posthog-js 1.396.2 → 1.396.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.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/src/entrypoints/web-vitals-with-attribution.d.ts +19 -0
- package/dist/src/entrypoints/web-vitals.d.ts +18 -0
- package/dist/surveys.js +1 -1
- package/dist/web-vitals-with-attribution.js +1 -1
- package/dist/web-vitals-with-attribution.js.map +1 -1
- package/dist/web-vitals.js +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/entrypoints/web-vitals-with-attribution.d.ts +19 -0
- package/lib/src/entrypoints/web-vitals-with-attribution.js +3 -0
- package/lib/src/entrypoints/web-vitals-with-attribution.js.map +1 -1
- package/lib/src/entrypoints/web-vitals.d.ts +18 -0
- package/lib/src/entrypoints/web-vitals.js +3 -0
- package/lib/src/entrypoints/web-vitals.js.map +1 -1
- package/lib/src/utils/array-at-polyfill.d.ts +0 -0
- package/lib/src/utils/array-at-polyfill.js +33 -0
- package/lib/src/utils/array-at-polyfill.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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))(_||{}),g={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},v={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},f={};function m(e){if(f[e])return f[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 g?g[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 v?v[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 f[e]=t.prototype,t.prototype;var a=document.createElement("iframe");try{document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var u=l[e].prototype;return u?f[e]=u:r}catch(e){return r}finally{a.parentNode&&document.body.removeChild(a)}}var y={};function b(e,t,r){var i,n=e+"."+String(r);if(y[n])return y[n].call(t);var s=m(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(y[n]=o,o.call(t)):t[r]}var S={};function w(e,t,r){var i=e+"."+String(r);if(S[i])return S[i].bind(t);var n=m(e)[r];return"function"!=typeof n?t[r]:(S[i]=n,n.bind(t))}function k(){return m("MutationObserver").constructor}function x(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n=r(i);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=n,()=>{e[t]=i}}catch(e){return()=>{}}}var C={childNodes:e=>b("Node",e,"childNodes"),parentNode:e=>b("Node",e,"parentNode"),parentElement:e=>b("Node",e,"parentElement"),textContent:e=>b("Node",e,"textContent"),contains:(e,t)=>w("Node",e,"contains")(t),getRootNode:e=>w("Node",e,"getRootNode")(),host:e=>e&&"host"in e?b("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?b("Element",e,"shadowRoot"):null,querySelector:(e,t)=>w("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>w("Element",e,"querySelectorAll")(t),mutationObserver:k,patch:x};function E(e){return e.nodeType===e.ELEMENT_NODE}function I(e){var t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return Boolean(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function T(e){return"[object ShadowRoot]"==={}.toString.call(e)}function M(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=>R(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 R(e,t){var r;if(function(e){return"styleSheet"in e}(e)){var i;try{i=M(e.styleSheet)||function(e){var{cssText:t}=e;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 H(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?H(n,t):n}class P{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=C.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{element:t,maskInputOptions:r,tagName:i,type:n,value:s,maskInputFn:o}=e,a=s||"",l=n&&F(n);return(r[i.toLowerCase()]||l&&r[l])&&(a=o?o(a,t):"*".repeat(a.length)),a}function F(e){return e.toLowerCase()}var O="__rrweb_original__";function A(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?F(t):null}var D=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,N=/^(?:[a-z+]+:)?\/\//i,B=/^www\..*/i,q=/^(data:)([^,]*),(.*)/i;function H(e,t){return(e||"").replace(D,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(N.test(l)||B.test(l))return"url("+u+l+u+")";if(q.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 U,z,W="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",V=4096,j=1,G=new RegExp("[^a-z0-9-_:]"),Q=-2;function Y(){return j++}var Z=/^[^ \t\n\r\u000c]+/,K=/^[, \t\n\r\u000c]+/,J=new WeakMap;function X(e,t){return t&&""!==t.trim()?ee(e,t):t}function ee(e,t){var r=J.get(e);if(r||(r=e.createElement("a"),J.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function te(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?W:e}(e,t.maxBase64ImageLength):e}function re(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=X(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>V||e.naturalHeight>V)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)),te(u,s)}if("image"===t)return te(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=X(e,i);return"image"===t&&c.startsWith("data:")?te(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(K),t.length>r;){var s=i(Z);if(","===s.slice(-1))s=X(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=X(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?H(i,ee(e)):"object"===t&&"data"===r?X(e,i):i:X(e,i)}function ie(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function ne(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&ne(C.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&ne(C.parentNode(e),t,r)}function se(e,t,r,i){var n;if(E(e)){if(!C.childNodes(n=e).length)return!1}else{if(null===C.parentElement(e))return!1;n=C.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(ne(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}var oe=new Map;function ae(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function le(e){return null==e?"":e.toLowerCase()}var ue=50,ce=!1,de=!1;function he(e,t){var{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g={},inlineImages:v=!1,recordCanvas:f=!1,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b=5e3,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:x=(()=>!1),newlyAddedElement:R=!1,depth:P=0,maxDepth:D=ue}=t,{needsMask:N}=t,{preserveWhiteSpace:B=!0}=t;if(P>=D)return de=!0,ce||(ce=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+D+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;N||(N=se(e,o,a,void 0===N));var q,W=function(e,t){var{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:d={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v=!1}=t,f=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,i);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:f};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s,{doc:o,blockClass:a,blockSelector:l,inlineStylesheet:u,maskInputOptions:c={},maskInputFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:v,newlyAddedElement:f=!1,rootId:m}=t,y=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,a,l),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=F(e.tagName);return G.test(t)?"div":t}(e),S={},w=e.attributes.length,k=0;w>k;k++){var x=e.attributes[k];ie(b,x.name)||(S[x.name]=re(o,b,F(x.name),x.value,e,h))}if("link"===b&&u){var E=e.sheet;if(!E){var I=function(e){return e.href}(e);I&&!(E=ae(o,I))&&I.includes(".css")&&(E=ae(o,window.location.origin+"/"+I.replace(window.location.href,"")))}var T=null;E&&(T=M(E)),T&&(delete S.rel,delete S.href,S._cssText=T)}if("style"===b&&e.sheet&&!(e.innerText||C.textContent(e)||"").trim().length){var R=M(e.sheet);R&&(S._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var P=e.value,D=e.checked;"radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&P?S.value=L({element:e,type:A(e),tagName:b,value:P,maskInputOptions:c,maskInputFn:d}):D&&(S.checked=D)}if("option"===b&&(e.selected&&!c.select?S.selected=!0:delete S.selected),"dialog"===b&&e.open)try{S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){S.rr_open_mode="modal",S.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&g)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)||(S.rr_dataURL=e.toDataURL(h.type,h.quality));else if(!("__context"in e)){var N=e.toDataURL(h.type,h.quality),B=o.createElement("canvas");B.width=e.width,B.height=e.height,N!==B.toDataURL(h.type,h.quality)&&(S.rr_dataURL=N)}if("img"===b&&p){U||(U=o.createElement("canvas"),z=U.getContext("2d"));var q=e,H=q.currentSrc||q.getAttribute("src")||"<unknown-src>",W=q.crossOrigin,V=()=>{q.removeEventListener("load",V);try{U.width=q.naturalWidth,U.height=q.naturalHeight,z.drawImage(q,0,0),S.rr_dataURL=U.toDataURL(h.type,h.quality)}catch(e){if("anonymous"!==q.crossOrigin)return q.crossOrigin="anonymous",void(q.complete&&0!==q.naturalWidth?V():q.addEventListener("load",V));console.warn("Cannot inline img src="+H+"! Error: "+e)}"anonymous"===q.crossOrigin&&(W?S.crossOrigin=W:q.removeAttribute("crossorigin"))};q.complete&&0!==q.naturalWidth?V():q.addEventListener("load",V)}if("audio"===b||"video"===b){var j=S;j.rr_mediaState=e.paused?"paused":"played",j.rr_mediaCurrentTime=e.currentTime,j.rr_mediaPlaybackRate=e.playbackRate,j.rr_mediaMuted=e.muted,j.rr_mediaLoop=e.loop,j.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),y){var{width:Q,height:Y,left:Z,top:K}=e.getBoundingClientRect(),J=null==(r=o.defaultView)?void 0:r.getComputedStyle(e);S={class:S.class,rr_width:Q+"px",rr_height:Y+"px",rr_left:Math.floor(Z+((null==(i=o.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(K+((null==(n=o.defaultView)?void 0:n.scrollY)||0))+"px"},J&&(S.rr_position=J.position||"static",J.transform&&"none"!==J.transform&&(S.rr_transform=J.transform),J.display&&J.display.startsWith("inline")&&(S.rr_display=J.display))}"iframe"!==b||v(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);try{customElements.get(b)&&(s=!0)}catch(e){}return{type:_.Element,tagName:b,attributes:S,childNodes:[],isSVG:(X=e,Boolean("svg"===X.tagName||X.ownerSVGElement)||void 0),needBlock:y,rootId:m,isCustom:s};var X}(e,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:h,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v,rootId:f});case e.TEXT_NODE:return function(e,t){var r,{needsMask:i,maskTextFn:n,rootId:s}=t,o=C.parentNode(e),a=o&&o.tagName,l=C.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=M(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=H(l,ee(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,C.parentElement(e)):l.replace(/[\S]/g,"*")),{type:_.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:o,maskTextFn:u,rootId:f});case e.CDATA_SECTION_NODE:return{type:_.CDATA,textContent:"",rootId:f};case e.COMMENT_NODE:return{type:_.Comment,textContent:C.textContent(e)||"",rootId:f};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,dataURLOptions:g,inlineImages:v,recordCanvas:f,keepIframeSrcFn:x,newlyAddedElement:R});if(!W)return console.warn(e,"not serialized"),null;q=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&&(le(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===le(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(le(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&le(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(le(e.attributes.property).match(/^(og|twitter|fb):/)||le(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===le(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(le(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(le(e.attributes.name))||le(e.attributes.property).match(/^article:/)||le(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(le(e.attributes.name)))return!0}}return!1}(W,p)||!B&&W.type===_.Text&&!W.isStyle&&!W.textContent.replace(/^\s+|\s+$/gm,"").length?Q:Y();var V=Object.assign(W,{id:q});if(i.add(e,V),q===Q)return null;m&&m(e);var j=!l;if(V.type===_.Element){j=j&&!V.needBlock,delete V.needBlock;var Z=C.shadowRoot(e);Z&&T(Z)&&(V.isShadowHost=!0)}if((V.type===_.Document||V.type===_.Element)&&j){p.headWhitespace&&V.type===_.Element&&"head"===V.tagName&&(B=!1);var K={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P+1,maxDepth:D};if(V.type===_.Element&&"textarea"===V.tagName&&void 0!==V.attributes.value);else for(var J of Array.from(C.childNodes(e))){var X=he(J,K);X&&V.childNodes.push(X)}var te=null;if(E(e)&&(te=C.shadowRoot(e)))for(var ne of Array.from(C.childNodes(te))){var pe=he(ne,K);pe&&(T(te)&&(pe.isShadow=!0),V.childNodes.push(pe))}}var _e=C.parentNode(e);if(_e&&I(_e)&&T(_e)&&(V.isShadow=!0),V.type===_.Element&&"iframe"===V.tagName){var ge=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),e.removeEventListener("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?e.removeEventListener("load",o):(a=!0,e.removeEventListener("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),e.removeEventListener("load",o)}}return e.addEventListener("load",o),()=>{e.removeEventListener("load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&y){var r=he(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P+1,maxDepth:D});r&&y(e,r)}}),b);null==S||S(e,ge)}return V.type===_.Element&&"link"===V.tagName&&"stylesheet"===V.attributes.rel&&function(t,l,_){if(!oe.has(t)){var S;try{S=t.sheet}catch(e){return}if(!S){var C=new AbortController,E=!1,I=()=>{if(!E){E=!0;try{(()=>{if(w){var t=he(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P,maxDepth:D});t&&w(e,t)}})()}finally{oe.delete(t),C.abort()}}},T=setTimeout(I,_);C.signal.addEventListener("abort",(()=>clearTimeout(T)),{once:!0}),t.addEventListener("load",I,{signal:C.signal,once:!0}),oe.set(t,C)}}}(e,0,k),V}function pe(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 _e{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 _e))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 ge(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function ve(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var fe="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.",me={map:{},getId(){return console.error(fe),-1},getNode(){return console.error(fe),null},removeNodeFromMap(){console.error(fe)},has(){return console.error(fe),!1},reset(){console.error(fe)}};function ye(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 be(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){setTimeout((()=>{r.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>be(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(me=new Proxy(me,{get(e,t,r){return"map"===t&&console.error(fe),Reflect.get(e,t,r)}}));var Se=Date.now;function we(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=C.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=C.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function ke(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function xe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ce(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function Ee(e,t,r,i){if(!e)return!1;var n=Ce(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(ne(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 Ie(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Q}function Te(e,t){if(I(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=C.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Te(i,t))}function Me(e){return Boolean(e.changedTouches)}function Re(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Pe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Le(e){return!!e&&(e instanceof _e&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(C.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Se=()=>(new Date).getTime());class Fe{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 Oe(e){var t,r=null;return"getRootNode"in e&&(null==(t=C.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function Ae(e){var t=e.ownerDocument;return!!t&&(C.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Oe(r);)r=t;return r}(e);return C.contains(t,r)}(e))}function De(e){return"__ln"in e}class Ne{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&&De(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&&De(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 Be,qe=(e,t)=>e+"@"+t;class He{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,"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 Ne,i=e=>{for(var t=e,r=Q;r===Q;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=C.parentNode(n);if(s&&Ae(n)&&"TEXTAREA"!==s.tagName){var o=I(s)?this.mirror.getId(Oe(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=he(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,inlineImages:this.inlineImages,onSerialize:e=>{Re(e,this.mirror)&&this.iframeManager.addIframe(e),Pe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Le(n)&&this.shadowDomManager.addShadowRoot(C.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)Ue(this.removesSubTreeCache,s)&&!this.movedSet.has(C.parentNode(s))||n(s);for(var o of this.addedSet)ze(this.droppedSet,o)||Ue(this.removesSubTreeCache,o)?ze(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(C.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(C.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var _=C.parentNode(h.value);if(_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=C.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=C.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{attributes:t}=e;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(C.childNodes(e),(e=>C.textContent(e)||"")).join("");t.attributes.value=L({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:A(e),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(e=>{if(!Ie(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=C.textContent(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:se(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ce(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=A(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Ee(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"),!ie(r.tagName,i))if(o.attributes[i]=re(this.doc,F(r.tagName),F(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(Ee(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=I(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||Ie(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?($e(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Te(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[qe(r,i)]?$e(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!I(e.target)||!T(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),C.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)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ie(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[qe(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ee(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach((e=>this.genAdds(e))),Le(e)&&C.childNodes(C.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),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.shadowDomManager.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 $e(e,t){e.delete(t),C.childNodes(t).forEach((t=>$e(e,t)))}function Ue(e,t,r){return 0!==e.size&&function(e,t,r){var i=C.parentNode(t);return!!i&&e.has(i)}(e,t)}function ze(e,t){return 0!==e.size&&We(e,t)}function We(e,t){var r=C.parentNode(t);return!!r&&(!!e.has(r)||We(e,r))}var Ve=e=>Be?function(){try{return e(...arguments)}catch(e){if(Be&&!0===Be(e))return;throw e}}:e,je=[];function Ge(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 Qe(e,t){var r=new He;je.push(r),r.init(e);var i=new(k())(Ve(r.processMutations.bind(r)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:i,buffer:r}}function Ye(e){var{scrollCb:t,doc:r,mirror:i,blockClass:n,blockSelector:s,sampling:o}=e,a=new Map,l=e=>{var o=Ge(e);if(o&&!Ee(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=we(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=[ge("scroll",Ve(ye(Ve((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(ge("scrollend",Ve(l),r)),()=>u.forEach((e=>e()))}function Ze(e,t){for(var r=je.length-1;r>=0;r--){var i=je[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),je.splice(r,1))}}}var Ke=["INPUT","TEXTAREA","SELECT"],Je=new WeakMap;function Xe(e){return function e(t,r){if(it("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||it("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||it("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||it("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 et(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}function tt(e,t){var r,i,n,s,{mirror:o,stylesheetManager:a}=e;s=o.getId("#document"===t.nodeName?t:C.host(t));var l="#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,u=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&l&&u?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null==(e=u.get)?void 0:e.call(this)},set(e){var t,r=null==(t=u.set)?void 0:t.call(this,e);if(null!==s&&-1!==s)try{a.adoptStyleSheets(e,s)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function rt(e,t){void 0===t&&(t={});var i,n,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var{mutationCb:r,mousemoveCb:i,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;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=Qe(e,e.doc);i=o.observer,n=o.buffer}var a=function(e){var{mousemoveCb:t,sampling:r,doc:i,mirror:n}=e;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=ye(Ve((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),d=Ve(ye(Ve((e=>{var t=Ge(e),{clientX:r,clientY:i}=Me(e)?e.changedTouches[0]:e;s||(s=Se()),l.push({x:r,y:i,id:n.getId(t),timeOffset:Se()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)})),o,{trailing:!1})),h=[ge("mousemove",d,i),ge("touchmove",d,i),ge("drag",d,i)];return Ve((()=>{h.forEach((e=>e()))}))}(e),l=function(e){var{mouseInteractionCb:t,doc:i,mirror:n,blockClass:s,blockSelector:o,sampling:a}=e;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=F(e),l=(e=>i=>{var a=Ge(i);if(!Ee(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 Me(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=Me(i)?i.changedTouches[0]:i;if(p){var _=n.getId(a),{clientX:g,clientY:v}=p;Ve(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(ge(a,l,i))})),Ve((()=>{u.forEach((e=>e()))}))}(e),h=Ye(e),_=function(e,t){var{viewportResizeCb:r}=e,{win:i}=t,n=-1,s=-1;return ge("resize",Ve(ye(Ve((()=>{var e=ke(),t=xe();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:s}),g=function(e){var{inputCb:t,doc:i,mirror:n,blockClass:s,blockSelector:o,ignoreClass:a,ignoreSelector:l,maskInputOptions:u,maskInputFn:c,sampling:d,userTriggeredOnInput:h}=e;function p(e){var t=Ge(e),r=e.isTrusted,n=t&&t.tagName;if(t&&"OPTION"===n&&(t=C.parentElement(t)),t&&n&&Ke.indexOf(n)>=0&&!Ee(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var d=t.value,p=!1,g=A(t)||"";"radio"===g||"checkbox"===g?p=t.checked:(u[n.toLowerCase()]||u[g])&&(d=L({element:t,maskInputOptions:u,tagName:n,type:g,value:d,maskInputFn:c})),_(t,h?{text:d,isChecked:p,userTriggered:r}:{text:d,isChecked:p});var v=t.name;"radio"===g&&v&&p&&i.querySelectorAll('input[type="radio"][name="'+v+'"]').forEach((e=>{if(e!==t){var r=e.value;_(e,h?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}function _(e,i){var s=Je.get(e);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Je.set(e,i);var o=n.getId(e);Ve(t)(r({},i,{id:o}))}}var g=("last"===d.input?["change"]:["input","change"]).map((e=>ge(e,Ve(p),i))),v=i.defaultView;if(!v)return()=>{g.forEach((e=>e()))};var f=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value");return f&&f.set&&g.push(...[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]].map((e=>be(e[0],e[1],{set(){Ve(p)({target:this,isTrusted:!1})}},!1,v)))),Ve((()=>{g.forEach((e=>e()))}))}(e),v=function(e){var{mediaInteractionCb:t,blockClass:r,blockSelector:i,mirror:n,sampling:s,doc:o}=e,a=Ve((e=>ye(Ve((s=>{var o=Ge(s);if(o&&!Ee(o,r,i,!0)){var{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=o;t({type:e,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),s.media||500))),l=[ge("play",a(p.Play),o),ge("pause",a(p.Pause),o),ge("seeked",a(p.Seeked),o),ge("volumechange",a(p.VolumeChange),o),ge("ratechange",a(p.RateChange),o)];return Ve((()=>{l.forEach((e=>e()))}))}(e),f=()=>{},m=()=>{},y=()=>{},b=()=>{};e.recordDOM&&(f=function(e,t){var{styleSheetRuleCb:r,mirror:i,stylesheetManager:n}=e,{win:s}=t;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var o=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((e,t,s)=>{var[o,a]=s,{id:l,styleId:u}=et(t,i,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,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:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,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:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,replace:o}),e.apply(t,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,replaceSync:o}),e.apply(t,s)}))}));var c={};nt("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(nt("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),nt("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),nt("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(c).forEach((e=>{var[t,s]=e;d[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Ve(((e,t,s)=>{var[o,a]=s,{id:l,styleId:u}=et(t.parentStyleSheet,i,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:o,index:[...Xe(t),a||0]}]}),e.apply(t,s)}))}),s.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t.parentStyleSheet,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,removes:[{index:[...Xe(t),o]}]}),e.apply(t,s)}))})})),Ve((()=>{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,r]=e;r.prototype.insertRule=d[t].insertRule,r.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:s}),m=tt(e,e.doc),y=function(e,t){var{styleDeclarationCb:r,mirror:i,ignoreCSSAttributes:n,stylesheetManager:s}=e,{win:o}=t,a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Ve(((e,t,o)=>{var l,[u,c,d]=o;if(n.has(u))return a.apply(t,[u,c,d]);var{id:h,styleId:p}=et(null==(l=t.parentRule)?void 0:l.parentStyleSheet,i,s.styleMirror);return(h&&-1!==h||p&&-1!==p)&&r({id:h,styleId:p,set:{property:u,value:c,priority:d},index:Xe(t.parentRule)}),e.apply(t,o)}))});var l=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ve(((e,t,o)=>{var a,[u]=o;if(n.has(u))return l.apply(t,[u]);var{id:c,styleId:d}=et(null==(a=t.parentRule)?void 0:a.parentStyleSheet,i,s.styleMirror);return(c&&-1!==c||d&&-1!==d)&&r({id:c,styleId:d,remove:{property:u},index:Xe(t.parentRule)}),e.apply(t,o)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:s}),e.collectFonts&&(b=function(e){var{fontCb:t,doc:r}=e,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=x(r.fonts,"add",(function(e){return function(r){return setTimeout(Ve((()=>{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),Ve((()=>{n.forEach((e=>e()))}))}(e)));var S=function(e){var{doc:t,mirror:r,blockClass:i,blockSelector:n,selectionCb:s}=e,o=!0,a=Ve((()=>{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),{startContainer:d,startOffset:h,endContainer:p,endOffset:_}=c;Ee(d,i,n,!0)||Ee(p,i,n,!0)||a.push({start:r.getId(d),startOffset:h,end:r.getId(p),endOffset:_})}s({ranges:a})}}));return a(),ge("selectionchange",a)}(e),w=function(e){var{doc:t,customElementCb:r}=e,i=t.defaultView;return i&&i.customElements?x(i.customElements,"define",(function(e){return function(t,i,n){try{r({define:{name:t}})}catch(e){console.warn("Custom element callback failed for "+t)}return e.apply(this,[t,i,n])}})):()=>{}}(e),k=[];for(var E of e.plugins)k.push(E.observer(E.callback,s,E.options));return Ve((()=>{if(n){n.destroy(),n.reset();var e=je.indexOf(n);-1!==e&&je.splice(e,1)}null==i||i.disconnect(),a(),l(),h(),_(),g(),v(),f(),m(),y(),b(),S(),w(),k.forEach((e=>e()))}))}function it(e){return void 0!==window[e]}function nt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class st{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 ot{constructor(e){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new st(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 st(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=>ve(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{var{win:t,handler:r}=e;ve((()=>t.removeEventListener("pagehide",r)))})),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);ve((()=>{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)}))}ve((()=>{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);if(n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(ve((()=>e.removeEventListener("message",t))),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)){var s=this.nestedIframeListeners.get(i);ve((()=>i.removeEventListener("message",s))),this.nestedIframeListeners.delete(i)}i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var o=this.attachedDocuments.get(r);o&&(o.forEach((e=>{ve((()=>this.mirror.removeNodeFromMap(e)))})),ve((()=>Ze(r,o))),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{content:r}=e;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&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{ve((()=>t.removeEventListener("message",e)))})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>{var{element:r}=t;return e.add(r)})),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 at{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){if(T(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var{observer:i,buffer:n}=Qe(r({},this.bypassOptions,{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>{i.disconnect(),n.destroy(),n.releaseCanvasManager();var e=je.indexOf(n);-1!==e&&je.splice(e,1)})),this.restoreHandlers.push(Ye(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(C.host(e))),this.restoreHandlers.push(tt({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(x(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=C.shadowRoot(this);return s&&Ae(this)&&r.addShadowRoot(s,t),n}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ut="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ct=0;64>ct;ct++)ut[lt.charCodeAt(ct)]=ct;var dt=new Map,ht=(e,t,r)=>{if(e&&(gt(e,t)||"object"==typeof e)){var i=function(e,t){var r=dt.get(e);return r||dt.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 pt(e,t,r,i){if(e instanceof Array)return e.map((e=>pt(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+=lt[r[t]>>2],n+=lt[(3&r[t])<<4|r[t+1]>>4],n+=lt[(15&r[t+1])<<2|r[t+2]>>6],n+=lt[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}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[pt(e.buffer,t,r,i),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){var o=e.constructor.name,{src:a}=e;return{rr_type:o,src:a}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[pt(e.data,t,r,i),e.width,e.height]}:gt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ht(e,t,r)}:e}var _t=(e,t,r,i)=>e.map((e=>pt(e,t,r,i))),gt=(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])))},vt=["webgl","webgl2"];function ft(e){return"nodeType"in e}function mt(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 x(n.prototype,"configure",(function(n){return function(s){var o=function(e){var{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!o||ft(o)&&Ee(o,t,i,!0))return n.call(this,s);ft(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=x(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(!Ee(this,t,i,!0)&&("__context"in this||(this.__context=s),n&&vt.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 yt(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=x(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(ht(d,s,this),"tagName"in this.canvas&&!Ee(this.canvas,i,n,!0)){var h=_t(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(i){var c=be(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 bt,St,wt,kt='(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 transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, displayWidth, displayHeight });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, displayWidth, displayHeight });\n lastFingerprintMap.set(id, fingerprint);\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//# sourceMappingURL=image-bitmap-data-url-worker-CSpkoNCs.js.map\n',xt="undefined"!=typeof self&&self.Blob&&new Blob([kt],{type:"text/javascript;charset=utf-8"});function Ct(e){var t;try{if(!(t=xt&&(self.URL||self.webkitURL).createObjectURL(xt)))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(kt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Et{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,"processMutation",((e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)}));var{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:s,dataURLOptions:o,resolutionScale:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,i,n,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:o,resolutionScale:l})}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="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=mt(r,i,n,!0),u=new Map,c=new Ct;c.onmessage=e=>{var{id:t}=e.data;if(u.set(t,!1),"base64"in e.data){var{base64:r,type:i,displayWidth:n,displayHeight:s}=e.data;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,n,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:i}]},0,0,n,s]}],displayWidth:n,displayHeight:s})}};var d,p=1e3/e,_=0,g=e=>{var l,h;_&&p>e-_||(_=e,(l=[],h=e=>{try{e.querySelectorAll("canvas").forEach((e=>{Ee(e,i,n,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&h(e.shadowRoot)}))}catch(e){}},h(r.document),l).forEach(function(){var e=t((function*(e){var t,r,i=o.mirror.getId(e);if(!u.get(i)&&0!==e.width&&0!==e.height){u.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 u.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var l=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(l*a)),p=Math.max(1,Math.round(d*a)),_=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});c.postMessage({id:i,bitmap:_,width:h,height:p,displayWidth:l,displayHeight:d,dataURLOptions:s.dataURLOptions},[_])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(g)};d=requestAnimationFrame(g),this.resetObservers=()=>{l(),cancelAnimationFrame(d)}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=mt(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=x(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 Ee(this.canvas,r,i,!0)||setTimeout((()=>{var r=_t(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=be(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(...yt(t.WebGLRenderingContext.prototype,h.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...yt(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))),{type:o}=r[0];this.mutationCb({id:t,type:o,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class It{constructor(e){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Fe),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:R(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,oe.forEach((e=>e.abort())),oe.clear()}trackStylesheetInLinkElement(e){}}class Tt{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 Mt=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Rt=document.createElement("iframe");document.body.appendChild(Rt),Array.from=(null==(n=Rt.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Rt)}}catch(e){console.debug("Unable to override Array.from",e)}var Pt=new P;function Lt(e){void 0===e&&(e={});var{emit:t,checkoutEveryNms:i,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:d="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,maskAllInputs:_,maskInputOptions:g,slimDOMOptions:v,maskInputFn:f,maskTextFn:m,hooks:y,packFn:b,sampling:S={},dataURLOptions:w={},canvasResolutionScale:k,mousemoveWait:x,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:T=!1,recordAfter:M=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:L=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:A=(()=>!1),ignoreCSSAttributes:D=new Set([]),errorHandler:N}=e;Be=N;var B=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},w),q=!T||window.parent===window,H=!1;if(!q)try{window.parent.document&&(H=!1)}catch(e){H=!0}if(q&&!t)throw new Error("emit function is required");if(!q&&!H)return()=>{};void 0!==x&&void 0===S.mousemove&&(S.mousemove=x),Pt.reset();var U,z=!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==g?g:{password:!0},W=pe(void 0!==v&&v);!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 V,j,G=0,Q=new Map,Y=e=>{for(var t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return b&&!H&&(e=b(e)),e};bt=(e,r)=>{var s,o=e;if(o.timestamp=Se(),!(null==(s=je[0])?void 0:s.isFrozen())||o.type===l.FullSnapshot||o.type===l.IncrementalSnapshot&&o.data.source===u.Mutation||je.forEach((e=>e.unfreeze())),q)null==t||t(Y(o),r);else if(H){var a={type:"rrweb",event:Y(o),origin:window.location.origin,isCheckout:r};window.parent.postMessage(a,"*")}if(o.type===l.FullSnapshot)U=o,G=0;else if(o.type===l.IncrementalSnapshot){if(o.data.source===u.Mutation&&o.data.isAttachIframe)return;G++,(n&&G>=n||i&&o.timestamp-U.timestamp>i)&&St(!0)}};var Z=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=Pt.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}e.removes.forEach((e=>{var{id:r}=e;if(!t||!t.has(r)){var n=ee.getIframeElementById(r);n&&i.has(n)?ee.forgetIframeId(r):(null==V||V(r),ee.removeIframeById(r))}})),null==j||j(),ee.cleanupDetachedIframes()}bt({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},K=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),J=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),X=new It({mutationCb:Z,adoptedStyleSheetCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),ee=new ot({mirror:Pt,mutationCb:Z,stylesheetManager:X,recordCrossOriginIframes:T,wrappedEmit:bt});for(var te of O||[])te.getMirror&&te.getMirror({nodeMirror:Pt,crossOriginIframeMirror:ee.crossOriginIframeMirror,crossOriginIframeStyleMirror:ee.crossOriginIframeStyleMirror});var re=new Tt;wt=new Et({recordCanvas:I,mutationCb:J,win:window,blockClass:s,blockSelector:o,mirror:Pt,sampling:S.canvas,dataURLOptions:B,resolutionScale:k});var ie=new at({mutationCb:Z,scrollCb:K,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:z,dataURLOptions:B,maskTextFn:m,maskInputFn:f,recordCanvas:I,inlineImages:F,sampling:S,slimDOMOptions:W,iframeManager:ee,stylesheetManager:X,canvasManager:wt,keepIframeSrcFn:A,processedNodeManager:re},mirror:Pt});St=function(e){if(void 0===e&&(e=!1),E){bt({type:l.Meta,data:{href:window.location.href,width:xe(),height:ke()}},e),X.reset(),ie.init(),je.forEach((e=>e.lock()));var t=function(e,t){var{mirror:r=new P,blockClass:i="rr-block",blockSelector:n=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:h,slimDOM:p=!1,dataURLOptions:_,preserveWhiteSpace:g,onSerialize:v,onIframeLoad:f,iframeLoadTimeout:m,onIframeListenerRegistered:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w=(()=>!1),maxDepth:k}=t||{};return he(e,{doc:e,mirror:r,blockClass:i,blockSelector:n,maskTextClass:s,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===c?{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===c?{password:!0}:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:pe(p),dataURLOptions:_,inlineImages:l,recordCanvas:u,preserveWhiteSpace:g,onSerialize:v,onIframeLoad:f,iframeLoadTimeout:m,onIframeListenerRegistered:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w,newlyAddedElement:!1,maxDepth:k})}(document,{mirror:Pt,blockClass:s,blockSelector:o,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:z,maskTextFn:m,maskInputFn:f,slimDOM:W,dataURLOptions:B,recordCanvas:I,inlineImages:F,onSerialize(e){Re(e,Pt)&&ee.addIframe(e),Pe(e,Pt)&&X.trackLinkElement(e),Le(e)&&ie.addShadowRoot(C.shadowRoot(e),document)},onIframeLoad(e,t){ee.attachIframe(e,t),ie.observeAttachShadow(e)},onIframeListenerRegistered(e,t){ee.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){X.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");bt({type:l.FullSnapshot,data:{node:t,initialOffset:we(window)}},e),je.forEach((e=>e.unlock())),T&&ee.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&X.adoptStyleSheets(document.adoptedStyleSheets,Pt.getId(document))}};try{var ne=[];V=e=>{var t=Q.get(e);t&&(t.forEach((e=>{ve(e);var t=ne.indexOf(e);-1!==t&&ne.splice(t,1)})),Q.delete(e))},j=()=>{for(var[e]of Q){var t=Pt.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==V||V(e)}catch(t){null==V||V(e)}else null==V||V(e)}};var se=e=>{var t;return Ve(rt)({mutationCb:Z,mousemoveCb:(e,t)=>bt({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:K,viewportResizeCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:J,fontCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:d,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:p,sampling:S,recordDOM:E,recordCanvas:I,inlineImages:F,userTriggeredOnInput:R,collectFonts:L,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:W,dataURLOptions:B,mirror:Pt,iframeManager:ee,stylesheetManager:X,shadowDomManager:ie,processedNodeManager:re,canvasManager:wt,ignoreCSSAttributes:D,plugins:(null==(t=null==O?void 0:O.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>bt({type:l.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},y)};ee.addLoadListener((e=>{try{var t=Pt.getId(e),r=se(e.contentDocument);if(ne.push(r),-1!==t){var i=Q.get(t);i||Q.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),ee.addPageHideListener((e=>{var t=Pt.getId(e);null==V||V(t),Ze(e)}));var oe=-1,ae=e=>bt({type:l.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),le=()=>{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?Pt.getId(s):-1;o!==oe&&(-1!==oe&&ae({id:oe,enter:!1}),oe=o,-1!==o&&ae({id:o,enter:!0}))},ue=()=>{St(),ne.push(se(document)),ne.push(ge("fullscreenchange",le)),ne.push(ge("webkitfullscreenchange",le)),ne.push(ge("mozfullscreenchange",le)),ne.push(ge("MSFullscreenChange",le)),Mt=!0};return["interactive","complete"].includes(document.readyState)?ue():(ne.push(ge("DOMContentLoaded",(()=>{bt({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===M&&ue()}))),ne.push(ge("load",(()=>{bt({type:l.Load,data:{}}),"load"===M&&ue()}),window))),()=>{ne.forEach((e=>ve(e))),re.destroy(),ee.removeLoadListener(),ee.destroy(),Q.clear(),Pt.reset(),Mt=!1,Be=void 0}}catch(e){console.warn(e)}}Lt.addCustomEvent=(e,t)=>{if(!Mt)throw new Error("please add custom event after start recording");bt({type:l.Custom,data:{tag:e,payload:t}})},Lt.freezePage=()=>{je.forEach((e=>e.freeze()))},Lt.takeFullSnapshot=e=>{if(!Mt)throw new Error("please take full snapshot after start recording");St(e)},Lt.mirror=Pt;var Ft=Object.defineProperty,Ot=(e,t,r)=>((e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class At{constructor(e){Ot(this,"fileName"),Ot(this,"functionName"),Ot(this,"lineNumber"),Ot(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 Dt=/(^|@)\S+:\d+/,Nt=/^\s*at .*(\S+:\d+|\(native\))/m,Bt=/^(eval@)?(\[native code])?$/,qt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Nt)?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(Nt)}),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 At({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Bt)}),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 At({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new At({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 At({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 At({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(Dt)&&!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 At({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Ht(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 $t(e){return Array.isArray(e)}function Ut(e){return"object"==typeof e&&null!==e&&!$t(e)}function zt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Ut(e[i])&&zt(e[i],t-1))return!0;return!1}function Wt(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(Ut(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Ut(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]=$t(u)?Ht(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 Vt={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({},Vt,r):Vt,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=qt.parse(t.error).map((e=>e.toString())),s=[Wt(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=[Wt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Wt("Uncaught (in promise)",n.stringifyOptions),Wt(t.reason,n.stringifyOptions)]);var s=qt.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=(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=qt.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Wt(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Wt("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})(u);return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u}})),t[s]=c,()=>{t[s]=u}}catch(e){return()=>{}}}(t,r):()=>{}}}var Gt=e=>({name:"rrweb/console@1",observer:jt,options:e}),Qt=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Yt(e){return"string"==typeof e||e}function Zt(e){return"string"==typeof e?e:void 0}var Kt,Jt=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.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}({}),Xt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),er=function(e){return e.MinLength="min_length",e.MaxLength="max_length",e}({}),tr=["$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"],rr=["token"],ir="NativeGzipValidationError",nr=e=>e.length>=2&&31===e[0]&&139===e[1],sr=(e,t)=>e===Xt.GZipJS||t===Xt.GZipJS||"gzip"===t,or=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ar=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return or(e)||t===ir},lr=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=ir,t},ur=function(){var e=t((function*(e,t){18>e.size&&lr("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());nr(r)&&8===r[2]||lr("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Kt)return Kt;Kt=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Kt[e]=t>>>0}return Kt})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&lr("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&lr("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function cr(e,t,r){return dr.apply(this,arguments)}function dr(){return dr=t((function*(e,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(e),s=new 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]);return yield ur(u,n),u}catch(e){if(null!=i&&i.rethrow)throw e;return r&&console.error("Failed to gzip compress data",e),null}})),dr.apply(this,arguments)}var hr=["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"],pr=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return hr.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function _r(e,t){return-1!==e.indexOf(t)}var gr=function(e){return e.trim()},vr=function(e){return e.replace(/^\$/,"")},fr=Object.prototype,mr=fr.hasOwnProperty,yr=fr.toString,br=Array.isArray||function(e){return"[object Array]"===yr.call(e)},Sr=e=>"function"==typeof e,wr=e=>e===Object(e)&&!br(e),kr=e=>{if(wr(e)){for(var t in e)if(mr.call(e,t))return!1;return!0}return!1},xr=e=>void 0===e,Cr=e=>"[object String]"==yr.call(e),Er=e=>Cr(e)&&0===e.trim().length,Ir=e=>null===e,Tr=e=>xr(e)||Ir(e),Mr=e=>"[object Number]"==yr.call(e)&&e==e,Rr=e=>Mr(e)&&e>0,Pr=e=>"[object Boolean]"===yr.call(e),Lr=e=>e instanceof FormData,Fr=e=>_r(rr,e);function Or(e){return null===e||"object"!=typeof e}function Ar(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Dr(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Nr=[!0,"true",1,"1","yes"],Br=e=>_r(Nr,e),qr=[!1,"false",0,"0","no"];function Hr(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),Mr(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),Hr(n||r,t,r,i))}class $r{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Hr(e.bucketSize,0,100,e._logger),this._refillRate=Hr(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Hr(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 Ur="Mobile",zr="iOS",Wr="Android",Vr="Tablet",jr=Wr+" "+Vr,Gr="iPad",Qr="Apple",Yr=Qr+" Watch",Zr="Safari",Kr="BlackBerry",Jr="Samsung",Xr=Jr+"Browser",ei=Jr+" Internet",ti="Chrome",ri=ti+" OS",ii=ti+" "+zr,ni="Internet Explorer",si=ni+" "+Ur,oi="Opera",ai=oi+" Mini",li="Edge",ui="Microsoft "+li,ci="Firefox",di=ci+" "+zr,hi="Nintendo",pi="PlayStation",_i="Xbox",gi=Wr+" "+Ur,vi=Ur+" "+Zr,fi="Windows",mi=fi+" Phone",yi="Nokia",bi="Ouya",Si="Generic",wi=Si+" "+Ur.toLowerCase(),ki=Si+" "+Vr.toLowerCase(),xi="Konqueror",Ci="Oculus Browser",Ei="Vivaldi",Ii="Yandex",Ti="Whale",Mi="DuckDuckGo",Ri="Pale Moon",Pi="Waterfox",Li="Brave",Fi="Google Search App",Oi="(\\d+(\\.\\d+)?)",Ai=new RegExp("Version/"+Oi),Di=new RegExp(_i,"i"),Ni=new RegExp(pi+" \\w+","i"),Bi=new RegExp(hi+" \\w+","i"),qi=new RegExp(Kr+"|PlayBook|BB10","i"),Hi={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},$i=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?Li:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&_r(e,"GSA/")?Fi:_r(e," OPR/")&&_r(e,"Mini")?ai:_r(e," OPR/")?oi:qi.test(e)?Kr:_r(e,"IE"+Ur)||_r(e,"WPDesktop")?si:_r(e,"OculusBrowser")?Ci:_r(e,Xr)?ei:_r(e,li)||_r(e,"Edg/")?ui:_r(e,Ei+"/")?Ei:_r(e,"YaBrowser/")?Ii:_r(e,Ti+"/")?Ti:_r(e,Mi+"/")||_r(e,"Ddg/")?Mi:_r(e,"FBIOS")?"Facebook "+Ur:_r(e,"UCWEB")||_r(e,"UCBrowser")?"UC Browser":_r(e,"CriOS")?ii:_r(e,"CrMo")||_r(e,ti)?ti:_r(e,Wr)&&_r(e,Zr)?gi:_r(e,"FxiOS")?di:_r(e.toLowerCase(),xi.toLowerCase())?xi:_r(e,Li+"/")?Li:((e,t)=>t&&_r(t,Qr)||function(e){return _r(e,Zr)&&!_r(e,ti)&&!_r(e,Wr)}(e))(e,t)?_r(e,Ur)?vi:Zr:_r(e,"PaleMoon/")?Ri:_r(e,Pi+"/")?Pi:_r(e,ci)?ci:_r(e,"MSIE")||_r(e,"Trident/")?ni:_r(e,"Gecko")?ci:"")},Ui={[si]:[new RegExp("rv:"+Oi)],[ui]:[new RegExp(li+"?\\/"+Oi)],[ti]:[new RegExp("("+ti+"|CrMo)\\/"+Oi)],[ii]:[new RegExp("CriOS\\/"+Oi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Oi)],[Zr]:[Ai],[vi]:[Ai],[oi]:[new RegExp("(Opera|OPR)\\/"+Oi)],[ci]:[new RegExp(ci+"\\/"+Oi)],[di]:[new RegExp("FxiOS\\/"+Oi)],[xi]:[new RegExp("Konqueror[:/]?"+Oi,"i")],[Kr]:[new RegExp(Kr+" "+Oi),Ai],[gi]:[new RegExp("android\\s"+Oi,"i")],[ei]:[new RegExp(Xr+"\\/"+Oi)],[Ci]:[new RegExp("OculusBrowser\\/"+Oi)],[Ei]:[new RegExp(Ei+"\\/"+Oi)],[Ii]:[new RegExp("YaBrowser\\/"+Oi)],[Ti]:[new RegExp(Ti+"\\/"+Oi)],[Li]:[new RegExp(Li+"\\/"+Oi)],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Oi)],[Ri]:[new RegExp("PaleMoon\\/"+Oi)],[Pi]:[new RegExp(Pi+"\\/"+Oi)],[Fi]:[new RegExp("GSA\\/"+Oi)],[ni]:[new RegExp("(rv:|MSIE )"+Oi)],Mozilla:[new RegExp("rv:"+Oi)]},zi=function(e,t,r,i){var n=$i(e,t,r,i),s=Ui[n];if(xr(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},Wi=[[new RegExp(_i+"; "+_i+" (.*?)[);]","i"),e=>[_i,e&&e[1]||""]],[new RegExp(hi,"i"),[hi,""]],[new RegExp(pi,"i"),[pi,""]],[qi,[Kr,""]],[new RegExp(fi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[mi,""];if(new RegExp(Ur).test(t)&&!/IEMobile\b/.test(t))return[fi+" "+Ur,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Hi[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[fi,i]}return[fi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[zr,[e[3],e[4],e[5]||"0"].join(".")]:[zr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=xr(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Wr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Wr+")","i"),e=>e&&e[2]?[Wr,[e[2],e[3],e[4]||"0"].join(".")]:[Wr,""]],[/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/,[ri,""]],[/Linux|debian/i,["Linux",""]]],Vi=function(e){return Bi.test(e)?hi:Ni.test(e)?pi:Di.test(e)?_i:new RegExp(bi,"i").test(e)?bi:new RegExp("("+mi+"|WPDesktop)","i").test(e)?mi:/iPad/.test(e)?Gr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Yr:qi.test(e)?Kr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(yi,"i").test(e)?yi:/(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(Ur).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Wr:jr:new RegExp("(pda|"+Ur+")","i").test(e)?wi:new RegExp(Vr,"i").test(e)&&!new RegExp(Vr+" pc","i").test(e)?ki:""},ji=function(e,t){var r,i,n,s,o=Vi(e);return o===Gr||o===jr||"Kobo"===o||"Kindle Fire"===o||o===ki?Vr:o===hi||o===_i||o===pi||o===bi?"Console":o===Yr?"Wearable":o?Ur:"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)?Ur:Vr:"Desktop"},Gi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qi(e,t){return"string"==typeof(r=e)&&Gi.test(r)?e:t();var r}function Yi(e){return e?e.split("#")[0]:e}function Zi(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}var Ki={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}},Ji=Ki.info;function Xi(e){if(Pr(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(br(e))return{arrayValue:{values:e.map((e=>Xi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function en(e){var t=[];for(var r in e){var i=e[r];Ir(i)||xr(i)||t.push({key:r,value:Xi(i)})}return t}function tn(e,t){var i=e.level||"info",{text:n,number:s}=Ki[i]||Ji,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),Tr(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),Tr(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:en(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),xr(e.trace_flags)||(u.flags=e.trace_flags),u}function rn(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 nn(e,t,r,i){return{resourceLogs:[{resource:{attributes:en(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let sn=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:tn(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=br(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(Jt.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=nn(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(Jt.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(Jt.LogsQueue))&&void 0!==t?t:[];r._instance.setPersistedProperty(Jt.LogsQueue,n.slice(i)),yield r._waitForStoragePersist()}))()}_buildResourceAttributes(){return rn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(Jt.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(Jt.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=Zi((()=>{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(Jt.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 Promise.race([t,new Promise((t=>Zi(t,e)))]):yield t}))()}flushWithTimeout(e){var r=this;return t((function*(){var t=!1,i=r.flush(),n=new Promise((r=>Zi((()=>{t=!0,r()}),e)));try{yield Promise.race([i,n])}finally{t&&i.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)}};function on(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var an,ln,un;function cn(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return un&&r.length===ln||(ln=r.length,un=r.reduce(((r,i)=>{an||(an={});var n=an[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,an[i]=[l,u];break}}return r}),{})),un}}class dn{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&&br(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:cn(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 hn="?";function pn(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?hn:r,in_app:!0};return xr(i)||(s.lineno=i),xr(n)||(s.colno=n),s}var _n=(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]:hn,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},gn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fn=/\((\S*)(?::(\d+))(?::(\d+))\)/,mn=(e,t)=>{var r=gn.exec(e);if(r){var[,i,n,s]=r;return pn(t,i,hn,+n,+s)}var o=vn.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=fn.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=_n(o[1]||hn,o[2]);return pn(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},yn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Sn=(e,t)=>{var r=yn.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=bn.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]||hn;return[s,n]=_n(s,n),pn(t,n,s,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},wn=/\(error: (.*)\)/,kn=50;class xn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Cr(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 Ar(e,"DOMException")}isDOMError(e){return Ar(e,"DOMError")}}class Cn{match(e){return e instanceof Error}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 En{constructor(){}match(e){return Ar(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 In=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Tn{match(e){return"string"==typeof e}coerce(e,t){var r,[i,n]=this.getInfos(e);return{type:null!=i?i:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(In);return i&&(t=i[1],r=i[2]),[t,r]}}var Mn=["fatal","error","warning","log","info","debug"];function Rn(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 Pn{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 Dr(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: "+Rn(e)}isSeverityLevel(e){return Cr(e)&&!Er(e)&&Mn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(r instanceof Error)return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Ln{match(e){return Dr(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Rn(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Fn{match(e){return Or(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 On{match(e){return Ar(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Dr(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 Or(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 An="$message",Dn="$timestamp",Nn=new Set([An,Dn]),Bn={enabled:!0,max_bytes:32768};function qn(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Bn.enabled,max_bytes:$n(e.max_bytes,Bn.max_bytes)}:r({},Bn)}class Hn{constructor(e){this._entries=[],this._totalBytes=0,this._config=qn(e)}setConfig(e){this._config=qn(e),this._trimToMaxBytes()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,r)=>{if("bigint"==typeof r)return r.toString();if("function"!=typeof r&&"symbol"!=typeof r){if(r instanceof Date)return r.toISOString();if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&"object"==typeof r){if(t.has(r))return"[Circular]";t.add(r)}return r}}))}catch(e){return}}(e);if(t)try{var r=JSON.parse(t);if(!wr(r))return;var i=r,n=i[An],s=i[Dn];if(!Cr(n)||0===n.trim().length)return;if(!Cr(s)&&!Mr(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 $n(e,t){if(!Mr(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var Un="undefined"!=typeof window?window:void 0,zn="undefined"!=typeof globalThis?globalThis:Un;"undefined"==typeof self&&(zn.self=zn),"undefined"==typeof File&&(zn.File=function(){});var Wn=null==zn?void 0:zn.navigator,Vn=null==zn?void 0:zn.document,jn=null==zn?void 0:zn.location,Gn=null==zn?void 0:zn.fetch,Qn=null!=zn&&zn.XMLHttpRequest&&"withCredentials"in new zn.XMLHttpRequest?zn.XMLHttpRequest:void 0,Yn=null==zn?void 0:zn.AbortController,Zn=null==zn?void 0:zn.CompressionStream,Kn=null==Wn?void 0:Wn.userAgent,Jn=null!=Un?Un:{},Xn=e=>e instanceof Document,es="1.396.2",ts={DEBUG:!1,LIB_VERSION:es,LIB_NAME:"web",JS_SDK_VERSION:es},rs=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,i={_log(t){if(Un&&(ts.DEBUG||Jn.POSTHOG_DEBUG||r)&&!xr(Un.console)&&Un.console){for(var i=("__rrweb_original__"in Un.console[t]?Un.console[t].__rrweb_original__:Un.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)=>rs(e+" "+t,r)};return i},is=rs("[PostHog.js]"),ns=is.createLogger;function ss(e,t){br(e)&&e.forEach(t)}function os(e,t){if(!Tr(e))if(br(e))e.forEach(t);else if(Lr(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)mr.call(e,r)&&t(e[r],r)}var as=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 ls(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 us=function(e){try{return e()}catch(e){return}},cs=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){is.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),is.critical(e)}}},ds=function(e){var t={};return os(e,(function(e,r){(Cr(e)&&e.length>0||Mr(e))&&(t[r]=e)})),t};var hs=["herokuapp.com","vercel.app","netlify.app"];function ps(e){var t=null==e?void 0:e.hostname;if(!Cr(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of hs)if(r===i)return!1;return!0}function _s(e,t,r,i){var{capture:n=!1,passive:s=!0}=null!=i?i:{};null==e||e.addEventListener(t,r,{capture:n,passive:s})}function gs(e){return"ph_toolbar_internal"===e.name}var vs=["localhost","127.0.0.1"],fs=e=>{var t=null==Vn?void 0:Vn.createElement("a");return xr(t)?null:(t.href=e,t)},ms=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return os(e,(function(e,t){xr(e)||xr(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},ys=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(!br(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){is.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},bs=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("=");br(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},Ss=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null};function ws(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n=r(i);return Sr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]===n&&(e[t]=i)}}catch(e){return()=>{}}}function ks(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 xs(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Sr(i))return t;try{var n=i(t);return Cr(n)&&n?n:t}catch(e){return is.error("Error in get_current_url, falling back to window.location.href",e),t}}function Cs(e){var t,r=null==Un||null==(t=Un.location)?void 0:t.href;return xr(r)?void 0:xs(e,r)}var Es="$people_distinct_id",Is="$device_id",Ts="$device_model",Ms="__alias",Rs="__timers",Ps="$autocapture_disabled_server_side",Ls="$heatmaps_enabled_server_side",Fs="$exception_capture_enabled_server_side",Os="$error_tracking_suppression_rules",As="$error_tracking_capture_extension_exceptions",Ds="$web_vitals_enabled_server_side",Ns="$dead_clicks_enabled_server_side",Bs="$product_tours_enabled_server_side",qs="$web_vitals_allowed_metrics",Hs="$session_recording_remote_config",$s="$replay_sample_rate",Us="$replay_override_sampling",zs="$replay_override_linked_flag",Ws="$replay_override_url_trigger",Vs="$replay_override_event_trigger",js="$sesid",Gs="$session_is_sampled",Qs="$session_past_minimum_duration",Ys="$session_recording_url_trigger_activated_session",Zs="$session_recording_event_trigger_activated_session",Ks="$posthog_sr_group_event_trigger_",Js="$posthog_sr_group_url_trigger_",Xs="$posthog_sr_group_sampling_",eo="$debug_first_full_snapshot_timestamp",to="$sess_rec_flush_size",ro="$enabled_feature_flags",io="$active_feature_flags",no="$early_access_features",so="$feature_flag_details",oo="$feature_flag_payloads",ao="$feature_flag_request_id",lo="$override_feature_flags",uo="$override_feature_flag_payloads",co="$stored_person_properties",ho="$stored_group_properties",po="$surveys",_o="$surveys_loaded_at",go="$surveys_activated",vo="ph_product_tours",fo="$flag_call_reported",mo="$flag_call_reported_session_id",yo="$feature_flag_errors",bo="$feature_flag_evaluated_at",So="$user_state",wo="$client_session_props",ko="$capture_rate_limit",xo="$initial_campaign_params",Co="$initial_referrer_info",Eo="$initial_person_info",Io="$epp",To="__POSTHOG_TOOLBAR__",Mo="$posthog_cookieless",Ro="$sdk_debug_extensions_init_method",Po="$sdk_debug_extensions_init_time_ms",Lo="$sdk_debug_recording_script_not_loaded",Fo="$sdk_debug_replay_event_trigger_status",Oo="$sdk_debug_replay_linked_flag_trigger_status",Ao="$sdk_debug_replay_matched_recording_trigger_groups",Do="$sdk_debug_replay_remote_trigger_matching_config",No="$sdk_debug_replay_trigger_groups_count",Bo="$sdk_debug_replay_url_trigger_status",qo="$session_recording_start_reason",Ho="PostHog loadExternalDependency extension not found.",$o="on_reject",Uo="always",zo="anonymous",Wo="identified",Vo="identified_only",jo="visibilitychange",Go="beforeunload",Qo="$pageview",Yo="$pageleave",Zo="$identify",Ko="$groupidentify",Jo=1,Xo=3,ea=11;function ta(e){return e instanceof Element&&(e.id===To||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function ra(e){return!!e&&e.nodeType===Jo}function ia(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function na(e){return!!e&&e.nodeType===Xo}function sa(e){return!!e&&e.nodeType===ea&&ra(e.host)}function oa(e){return e?gr(e).split(/\s+/):[]}function aa(e,t){var r=Cs(t);return!!(r&&e&&e.some((e=>r.match(e))))}function la(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 oa(t)}function ua(e){return Tr(e)?null:gr(e).split(/(\s+)/).filter((e=>Fa(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ca(e){var t="";return Ca(e)&&!Ea(e)&&e.childNodes&&e.childNodes.length&&os(e.childNodes,(function(e){var r;na(e)&&e.textContent&&(t+=null!==(r=ua(e.textContent))&&void 0!==r?r:"")})),gr(t)}function da(e){return xr(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var ha=["a","button","form","input","select","textarea","label"];function pa(e,t){if(xr(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 _a(e){var t=e.parentNode;return!(!t||!ra(t))&&t}var ga=[".ph-no-autocapture","[data-ph-no-autocapture]"],va=["next","previous","prev",">","<"],fa=[...va,"+","-","−","–"],ma=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ya=[".ph-no-deadclick",".ph-no-capture"],ba=[".ph-no-rageclick",".ph-no-capture"],Sa=["","text","search","email","password","url","tel","number"];function wa(e,t){if(!Un||ka(e))return!1;var r,i,n,s,o;if(Pr(t)?(r=!!t&&ba,i=void 0,n=!1):(r=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:ba,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||!ra(e))&&(!!ia(e,"textarea")||(ia(e,"input")?_r(Sa,(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{targetElementList:a}=xa(e,!1);return!function(e,t){if(!1===e||xr(e))return!1;var r;if(!0===e)r=va;else{if(!br(e))return!1;if(e.length>10)return is.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{safeText:t,ariaLabel:i}=e;return r.some((e=>ma(t,e)||ma(i,e)))}))}(i,a.map((e=>{var t;return{safeText:ca(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!pa(a,r)}var ka=e=>!e||ia(e,"html")||!ra(e),xa=(e,t)=>{if(!Un||ka(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],n=e;n.parentNode&&!ia(n,"body");)if(sa(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=_a(n);if(!s)break;if(t||ha.indexOf(s.tagName.toLowerCase())>-1)r=!0;else{var o=Un.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function Ca(e){for(var t=e;t.parentNode&&!ia(t,"body");t=t.parentNode){var r=la(t);if(_r(r,"ph-sensitive")||_r(r,"ph-no-capture"))return!1}if(_r(la(e),"ph-include"))return!0;var i=e.type||"";if(Cr(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";return!Cr(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Ea(e){return!!(ia(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ia(e,"select")||ia(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ia="(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})",Ta=new RegExp("^(?:"+Ia+")$"),Ma=new RegExp(Ia),Ra="\\d{3}-?\\d{2}-?\\d{4}",Pa=new RegExp("^("+Ra+")$"),La=new RegExp("("+Ra+")");function Fa(e,t){if(void 0===t&&(t=!0),Tr(e))return!1;if(Cr(e)){if(e=gr(e),(t?Ta:Ma).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Pa:La).test(e))return!1}return!0}function Oa(e){var t=ca(e);return Fa(t=(t+" "+Aa(e)).trim())?t:""}function Aa(e){var t="";return e&&e.childNodes&&e.childNodes.length&&os(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=ca(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Aa(e)).trim())}catch(e){is.error("[AutoCapture]",e)}})),t}function Da(e){return e.replace(/"|\\"/g,'\\"')}function Na(e){var t=e.attr__class;return t?br(t)?t:oa(t):void 0}var Ba="[SessionRecording]",qa="redacted",Ha=1e6;function $a(e){var t;return Math.min(Ha,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Ha)}var Ua={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:Ha,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},za=["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"],Wa=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Va=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ja=e=>{Tr(e)||os(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return za.includes(t)||Va.some((e=>t.includes(e)))})(t)&&(e[t]=qa)}))},Ga=["/s/","/e/","/i/"];function Qa(e,t,r,i){if(Tr(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Cr(n)&&(n=parseInt(n)),n>r?Ba+" "+i+" body too large to record ("+n+" bytes)":e}function Ya(e,t){if(Tr(e))return e;var r=e;return Fa(r,!1)||(r=Ba+" "+t+" body "+qa),os(Wa,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=Ba+" "+t+" body "+qa+" as might contain: "+e)})),r}var Za=ns("[Recorder]"),Ka=e=>"navigation"===e.entryType,Ja=e=>"resource"===e.entryType;function Xa(e,t){return!!t&&(Pr(t)||t[e])}function el(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 tl=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function rl(e){var{type:t,recordBody:r,headers:i,url:n}=e;function s(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:!!el(t)&&e(t.url)}catch(e){return!1}}(n))return!1;if(s(tl))return!1;if(Pr(r))return!0;if(br(r))return s(r);var o=r[t];return Pr(o)?o:s(o)}function il(e,t,r,i,n,s){return nl.apply(this,arguments)}function nl(){return nl=t((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Za.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(Ja(o=e[s])&&o.initiatorType===t&&(xr(i)||o.startTime>=i)&&(xr(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),il(e,t,r,i,n,s+1))})),nl.apply(this,arguments)}function sl(e){var{body:t,options:r,url:i}=e;if(Tr(t))return null;var{hostname:n,isHostDenied:s}=ks(i,r);if(s)return n+" is in deny list";if(Cr(t))return t;if(Xn(t))return t.textContent;if(Lr(t))return ms(t);if(wr(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 ol=e=>!Ir(e)&&("navigation"===e.entryType||"resource"===e.entryType);function al(e){var{entry:t,method:i,status:n,networkRequest:s,isInitial:o,start:a,end:l,url:u,initiatorType:c}=e;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:xr(a)?void 0:Math.round(a),endTime:xr(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(ol(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 ll=["video/","audio/"];function ul(e){return wr(e)&&Sr(e.getReader)&&Sr(e.tee)}var cl=500,dl="[SessionReplay] Timeout while trying to read body",hl="[SessionReplay] Failed to read body";function pl(e){return hl+": "+e}function _l(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function gl(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(dl)),cl);try{e.clone().text().then((e=>t(e)),(e=>t(pl(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(hl)}}))}(e);var r=$a(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(_l(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(dl)),cl);try{a=e.clone()}catch(e){return void o(hl)}var u=a.body;if(ul(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(hl)}var c=[],d=0;!function e(){i.read().then((r=>{var{done:i,value:a}=r;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(_l(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(pl(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(pl(e))))}catch(e){o(hl)}}))}(e,r)}function vl(){return vl=t((function*(e){var{r:t,options:r,url:i}=e,{hostname:n,isHostDenied:s}=ks(i,r);return s?Promise.resolve(n+" is in deny list"):gl(t,r)})),vl.apply(this,arguments)}function fl(){return fl=t((function*(e){var{r:t,options:r,url:i}=e,n=function(e){var t,{r:r,options:i,url:n}=e;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=ll.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var{hostname:a,isHostDenied:l}=ks(n,i);return l?a+" is in deny list":null}({r:t,options:r,url:i});return Ir(n)?gl(t,r):Promise.resolve(n)})),fl.apply(this,arguments)}var ml=null;function yl(e,i,n){if(!("performance"in i))return()=>{};if(ml)return Za.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Ua,n):Ua,o=t=>{var i=[];t.requests.forEach((e=>{var t=s.maskRequestFn(e);t&&i.push(t)})),i.length>0&&e(r({},t,{requests:i}))},a=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Ka(e)||Ja(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>al({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=>Ka(e)||Ja(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>al({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=Xa("request",r.recordHeaders),n=Xa("response",r.recordHeaders),s=ws(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d,h,p=this,_=new Request(a),g={},v={},f=p.setRequestHeader.bind(p);p.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=p.send.bind(p);p.send=e=>(rl({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=sl({body:e,options:r,url:a})),d=t.performance.now(),m(e));var y=()=>{p.removeEventListener("readystatechange",b),p.removeEventListener("error",y),p.removeEventListener("abort",y),p.removeEventListener("timeout",y)},b=()=>{if(p.readyState===p.DONE){y(),h=t.performance.now();var i={};p.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),rl({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=sl({body:p.response,options:r,url:a})),il(t,"xmlhttprequest",_.url,d,h).then((t=>{var r=al({entry:t,method:o,status:null==p?void 0:p.status,networkRequest:g,start:d,end:h,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};p.addEventListener("readystatechange",b),p.addEventListener("error",y),p.addEventListener("abort",y),p.addEventListener("timeout",y),s.call(p,o,a.toString(),l,u,c)}));return()=>{s()}}(o,i,s),u=function(e,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Xa("request",i.recordHeaders),s=Xa("response",i.recordHeaders),o=ws(r,"fetch",(o=>function(){var a=t((function*(t,a){var l,u,c,d=new Request(t,a),h={};try{var p={};d.headers.forEach(((e,t)=>{p[t]=e})),n&&(h.requestHeaders=p),!ul(null==a?void 0:a.body)&&rl({type:"request",headers:p,url:t,recordBody:i.recordBody})&&(h.requestBody=yield function(e){return vl.apply(this,arguments)}({r:d,options:i,url:t})),u=r.performance.now(),l=el(t)?yield o(d):yield o(t,a),c=r.performance.now();var _={};return l.headers.forEach(((e,t)=>{_[t]=e})),s&&(h.responseHeaders=_),rl({type:"response",headers:_,url:t,recordBody:i.recordBody})&&(h.responseBody=yield function(e){return fl.apply(this,arguments)}({r:l,options:i,url:t})),l}finally{il(r,"fetch",d.url,u,c).then((t=>{var r,i=al({entry:t,method:d.method,status:null==(r=l)?void 0:r.status,networkRequest:h,start:u,end:c,url:d.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return a.apply(this,arguments)}}()));return()=>{o()}}(o,i,s)),ml=()=>{a(),l(),u(),ml=null}}var bl=e=>({name:"rrweb/network@1",observer:yl,options:e});Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Gt,getRecordNetworkPlugin:bl},Jn.__PosthogExtensions__.rrweb={record:Lt,version:"v2",wasMaxDepthReached:()=>de,resetMaxDepthState(){de=!1,ce=!1}},Jn.rrweb={record:Lt,version:"v2"},Jn.rrwebConsoleRecord={getRecordConsolePlugin:Gt},Jn.getRecordNetworkPlugin=bl;var Sl,wl,kl,xl,Cl,El,Il,Tl,Ml,Rl,Pl,Ll,Fl,Ol,Al,Dl={},Nl=[],Bl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ql=Array.isArray;function Hl(e,t){for(var r in t)e[r]=t[r];return e}function $l(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ul(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?Sl.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 zl(e,o,i,n,null)}function zl(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?++kl:n,__i:-1,__u:0};return null==n&&null!=wl.vnode&&wl.vnode(s),s}function Wl(e){return e.children}function Vl(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 jl(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Hl({},t);s.__v=t.__v+1,wl.vnode&&wl.vnode(s),ru(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,nu(i,s,n),t.__e=t.__=null,s.__e!=r&&Gl(s)}}function Gl(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})),Gl(e)}function Ql(e){(!e.__d&&(e.__d=!0)&&xl.push(e)&&!Yl.__r++||Cl!=wl.debounceRendering)&&((Cl=wl.debounceRendering)||El)(Yl)}function Yl(){try{for(var e,t=1;xl.length;)xl.length>t&&xl.sort(Il),e=xl.shift(),t=xl.length,jl(e)}finally{xl.length=Yl.__r=0}}function Zl(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,_,g,v,f,m=i&&i.__k||Nl,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]=zl(null,o,null,null,null):ql(o)?o=e.__k[s]=zl(Wl,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=zl(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=Jl(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)),lu(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]||Dl,p.__i=d,v=ru(e,p,h,n,s,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&au(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=Kl(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 Kl(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=Kl(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 Jl(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 Xl(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Bl.test(t)?r:r+"px"}function eu(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||Xl(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Xl(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(Pl,"$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[Rl]=i[Rl]:(r[Rl]=Ll,e.addEventListener(t,s?Ol:Fl,s)):e.removeEventListener(t,s?Ol:Fl,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 tu(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ml])t[Ml]=Ll++;else if(r[Rl]>t[Ml])return;return r(wl.event?wl.event(t):t)}}}function ru(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=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=wl.__b)&&c(t);e:if("function"==typeof x)try{if(f=t.props,m=x.prototype&&x.prototype.render,y=(c=x.contextType)&&i[c.__c],$=c?y?y.props.value:c.__:i,r.__c?v=(d=t.__c=r.__c).__=d.__E:(m?t.__c=d=new x(f,$):(t.__c=d=new Vl(f,$),d.constructor=x,d.render=uu),y&&y.sub(d),d.state||(d.state={}),d.__n=i,h=d.__d=!0,d.__h=[],d._sb=[]),m&&null==d.__s&&(d.__s=d.state),m&&null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Hl({},d.__s)),Hl(d.__s,x.getDerivedStateFromProps(f,d.__s))),p=d.props,_=d.state,d.__v=t,h)m&&null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),m&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(m&&null==x.getDerivedStateFromProps&&f!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(f,$),t.__v==r.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,$)){t.__v!=r.__v&&(d.props=f,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),Nl.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,$),m&&null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,_,g)}))}if(d.context=$,d.props=f,d.__P=e,d.__e=!1,b=wl.__r,S=0,m)d.state=d.__s,d.__d=!1,b&&b(t),c=d.render(d.props,d.state,d.context),Nl.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,b&&b(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++S);d.state=d.__s,null!=d.getChildContext&&(i=Hl(Hl({},i),d.getChildContext())),m&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,_)),w=null!=c&&c.type===Wl&&null==c.key?su(c.props.children):c,a=Zl(e,ql(w)?w:[w],t,r,i,n,s,o,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(k=s.length;k--;)$l(s[k]);iu(t)}else t.__e=r.__e,t.__k=r.__k,e.then||iu(t);wl.__e(e,t,r)}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=ou(r.__e,t,r,i,n,s,o,l,u);return(c=wl.diffed)&&c(t),128&t.__u?void 0:a}function iu(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(iu))}function nu(e,t,r){for(var i=0;r.length>i;i++)au(r[i],r[++i],r[++i]);wl.__c&&wl.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){wl.__e(e,t.__v)}}))}function su(e){return"object"!=typeof e||null==e||e.__b>0?e:ql(e)?e.map(su):void 0!==e.constructor?null:Hl({},e)}function ou(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,_,g,v=r.props||Dl,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&&(wl.__m&&wl.__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&&Sl.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||eu(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||eu(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=""),Zl("template"==t.type?e.content:e,ql(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--;)$l(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&eu(e,u,_,v[u],n),u="checked",null!=g&&g!=e[u]&&eu(e,u,g,v[u],n))}return e}function au(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){wl.__e(e,r)}}function lu(e,t,r){var i,n;if(wl.unmount&&wl.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||au(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){wl.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&lu(i[n],t,r||"function"!=typeof e.type);r||$l(e.__e),e.__c=e.__=e.__e=void 0}function uu(e,t,r){return this.constructor(e,r)}function cu(e,t,r){var i,n,s;t==document&&(t=document.documentElement),wl.__&&wl.__(e,t),i=t.__k,n=[],s=[],ru(t,e=t.__k=Ul(Wl,null,[e]),i||Dl,Dl,t.namespaceURI,i?null:t.firstChild?Sl.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),nu(n,e,s)}Sl=Nl.slice,wl={__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}},kl=0,Vl.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Hl({},this.state),"function"==typeof e&&(e=e(Hl({},r),this.props)),e&&Hl(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ql(this))},Vl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ql(this))},Vl.prototype.render=Wl,xl=[],El="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Il=function(e,t){return e.__v.__b-t.__v.__b},Yl.__r=0,Tl=Math.random().toString(8),Ml="__d"+Tl,Rl="__a"+Tl,Pl=/(PointerCapture)$|Capture$/i,Ll=0,Fl=tu(!1),Ol=tu(!0),Al=0;var du,hu,pu,_u,gu=0,vu=[],fu=wl,mu=fu.__b,yu=fu.__r,bu=fu.diffed,Su=fu.__c,wu=fu.unmount,ku=fu.__;function xu(e,t){fu.__h&&fu.__h(hu,e,gu||t),gu=0;var r=hu.__H||(hu.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Cu(e){return gu=1,function(e,t,r){var i=xu(du++,2);if(i.t=e,!i.__c&&(i.__=[Du(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=hu,!hu.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=i.__c.__H.__.filter((function(e){return e.__c}));if(n.every((function(e){return!e.__N})))return!s||s.call(this,e,t,r);var o=i.__c.props!==e;return n.some((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s&&s.call(this,e,t,r)||o};hu.__f=!0;var s=hu.shouldComponentUpdate,o=hu.componentWillUpdate;hu.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)},hu.shouldComponentUpdate=n}return i.__N||i.__}(Du,e)}function Eu(e,t){var r=xu(du++,3);!fu.__s&&Au(r.__H,t)&&(r.__=e,r.u=t,hu.__H.__h.push(r))}function Iu(e){return gu=5,Tu((function(){return{current:e}}),[])}function Tu(e,t){var r=xu(du++,7);return Au(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Mu(e){var t=hu.context[e.__c],r=xu(du++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(hu)),t.props.value):e.__}function Ru(){for(var e;e=vu.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Fu),t.__h.some(Ou),t.__h=[]}catch(r){t.__h=[],fu.__e(r,e.__v)}}}fu.__b=function(e){hu=null,mu&&mu(e)},fu.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ku&&ku(e,t)},fu.__r=function(e){yu&&yu(e),du=0;var t=(hu=e.__c).__H;t&&(pu===hu?(t.__h=[],hu.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.some(Fu),t.__h.some(Ou),t.__h=[],du=0)),pu=hu},fu.diffed=function(e){bu&&bu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vu.push(t)&&_u===fu.requestAnimationFrame||((_u=fu.requestAnimationFrame)||Lu)(Ru)),t.__H.__.some((function(e){e.u&&(e.__H=e.u),e.u=void 0}))),pu=hu=null},fu.__c=function(e,t){t.some((function(e){try{e.__h.some(Fu),e.__h=e.__h.filter((function(e){return!e.__||Ou(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],fu.__e(r,e.__v)}})),Su&&Su(e,t)},fu.unmount=function(e){wu&&wu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Fu(e)}catch(e){t=e}})),r.__H=void 0,t&&fu.__e(t,r.__v))};var Pu="function"==typeof requestAnimationFrame;function Lu(e){var t,r=function(){clearTimeout(i),Pu&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Pu&&(t=requestAnimationFrame(r))}function Fu(e){var t=hu,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),hu=t}function Ou(e){var t=hu;e.__c=e.__(),hu=t}function Au(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Du(e,t){return"function"==typeof t?t(e):t}var Nu={Activation:"events",Cancellation:"cancelEvents"},Bu={Button:"button",Tab:"tab",Selector:"selector"},qu={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"},Hu={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},$u={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Uu={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},zu={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Wu={Once:"once",Recurring:"recurring",Always:"always"},Vu={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ju={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",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_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Gu={Popover:"popover",Inline:"inline"};function Qu(e){return"$survey_response_"+e}function Yu(e,t){if(!t)return null;var r=e[Qu(t)];return br(r)?[...r]:r}function Zu(e,t){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!xr(t.originalQuestionIndex)){var r,n=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,s=Yu(e,t.id);xr(s)||(i[n]=s)}})),r({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:Yu(e,t.id)})))},e,i)}function Ku(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 Ju(e){return"string"==typeof e&&e.trim()?e.trim():null}function Xu(e){return e.toLowerCase()}function ec(e,t,r){if(!e||!t)return null;var i=Xu(t),n=Object.keys(e).find((e=>Xu(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=>Xu(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}function tc(e,t,i){var n,s=ec(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),xr(u.name)||(o.name=u.name,a=!0),o.appearance?(o.appearance=r({},o.appearance),xr(u.thankYouMessageHeader)||(o.appearance.thankYouMessageHeader=u.thankYouMessageHeader,a=!0),xr(u.thankYouMessageDescription)||(o.appearance.thankYouMessageDescription=u.thankYouMessageDescription,a=!0),xr(u.thankYouMessageCloseButtonText)||(o.appearance.thankYouMessageCloseButtonText=u.thankYouMessageCloseButtonText,a=!0),xr(u.submitButtonText)||(o.appearance.submitButtonText=u.submitButtonText,a=!0),xr(u.backButtonText)||(o.appearance.backButtonText=u.backButtonText,a=!0)):function(e){return!(xr(e.thankYouMessageHeader)&&xr(e.thankYouMessageDescription)&&xr(e.thankYouMessageCloseButtonText)&&xr(e.submitButtonText)&&xr(e.backButtonText))}(u)&&(a=!0))}var c=e.questions.map((e=>function(e,t,i){var n,s=ec(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 xr(o.question)||(a.question=o.question,l=!0),xr(o.description)||(a.description=o.description,l=!0),xr(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!xr(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!xr(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!xr(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return br(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}}var rc=ns("[Surveys]");function ic(e){return!(!e.start_date||e.end_date)}function nc(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function sc(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var oc="seenSurvey_",ac="inProgressSurvey_",lc=(e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r},uc=e=>lc(oc,e),cc=e=>{try{var t=uc(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){rc.error("Failed to persist survey seen state",e)}},dc=[$u.Popover,$u.Widget,$u.API],hc={ignoreConditions:!1,ignoreDelay:!1,displayType:Gu.Popover};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Mr(e)&&isFinite(e)&&Math.floor(e)===e});class pc{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/Math.pow(2,8),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 pc(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 pc(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 _c{constructor(){this._timestamp=0,this._counter=0,this._random=new fc}generate(){var e=this.generateOrAbort();if(xr(e)){this._timestamp=0;var t=this.generateOrAbort();if(xr(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return pc.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var gc,vc=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};Un&&!xr(Un.crypto)&&crypto.getRandomValues&&(vc=e=>crypto.getRandomValues(e));class fc{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(vc(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var mc=()=>yc().toString(),yc=()=>(gc||(gc=new _c)).generate(),bc=["fatal","error","warning","log","info","debug"],Sc={GZipJS:"gzip-js",Base64:"base64"},wc=Uint8Array,kc=Uint16Array,xc=Uint32Array,Cc=new wc([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]),Ec=new wc([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]),Ic=new wc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tc=function(e,t){for(var r=new kc(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new xc(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]},Mc=Tc(Cc,2),Rc=Mc[1];Mc[0][28]=258,Rc[258]=28;for(var Pc=Tc(Ec,0)[1],Lc=new kc(32768),Fc=0;32768>Fc;++Fc){var Oc=(43690&Fc)>>>1|(21845&Fc)<<1;Lc[Fc]=((65280&(Oc=(61680&(Oc=(52428&Oc)>>>2|(13107&Oc)<<2))>>>4|(3855&Oc)<<4))>>>8|(255&Oc)<<8)>>>1}var Ac=function(e,t,r){for(var i=e.length,n=0,s=new kc(t);i>n;++n)++s[e[n]-1];var o,a=new kc(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new kc(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[Lc[d]>>>l]=u}else for(o=new kc(i),n=0;i>n;++n)o[n]=Lc[a[e[n]-1]++]>>>15-e[n];return o},Dc=new wc(288);for(Fc=0;144>Fc;++Fc)Dc[Fc]=8;for(Fc=144;256>Fc;++Fc)Dc[Fc]=9;for(Fc=256;280>Fc;++Fc)Dc[Fc]=7;for(Fc=280;288>Fc;++Fc)Dc[Fc]=8;var Nc=new wc(32);for(Fc=0;32>Fc;++Fc)Nc[Fc]=5;var Bc=Ac(Dc,9,0),qc=Ac(Nc,5,0),Hc=function(e){return(e/8>>0)+(7&e&&1)},$c=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof kc?kc:e instanceof xc?xc:wc)(r-t);return i.set(e.subarray(t,r)),i},Uc=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},zc=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},Wc=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 wc(0),0];if(1==n){var o=new wc(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 kc(h+1),_=Vc(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 wc(p),_]},Vc=function(e,t,r){return-1==e.s?Math.max(Vc(e.l,t,r+1),Vc(e.r,t,r+1)):t[e.s]=r},jc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new kc(++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]},Gc=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},Qc=function(e,t,r){var i=r.length,n=Hc(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)},Yc=function(e,t,r,i,n,s,o,a,l,u,c){Uc(t,c++,r),++n[256];for(var d=Wc(n,15),h=d[0],p=d[1],_=Wc(s,15),g=_[0],v=_[1],f=jc(h),m=f[0],y=f[1],b=jc(g),S=b[0],w=b[1],k=new kc(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=Wc(k,7),E=C[0],I=C[1],T=19;T>4&&!E[Ic[T-1]];--T);var M,R,P,L,F=u+5<<3,O=Gc(n,Dc)+Gc(s,Nc)+o,A=Gc(n,h)+Gc(s,g)+o+14+3*T+Gc(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(O>=F&&A>=F)return Qc(t,c,e.subarray(l,l+u));if(Uc(t,c,1+(O>A)),c+=2,O>A){M=Ac(h,p,0),R=h,P=Ac(g,v,0),L=g;var D=Ac(E,I,0);for(Uc(t,c,y-257),Uc(t,c+5,w-1),Uc(t,c+10,T-4),c+=14,x=0;T>x;++x)Uc(t,c+3*x,E[Ic[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)Uc(t,c,D[H=31&q[x]]),c+=E[H],H>15&&(Uc(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else M=Bc,R=Dc,P=qc,L=Nc;for(x=0;a>x;++x)if(i[x]>255){var H;zc(t,c,M[257+(H=i[x]>>>18&31)]),c+=R[H+257],H>7&&(Uc(t,c,i[x]>>>23&31),c+=Cc[H]);var U=31&i[x];zc(t,c,P[U]),c+=L[U],U>3&&(zc(t,c,i[x]>>>5&8191),c+=Ec[U])}else zc(t,c,M[i[x]]),c+=R[i[x]];return zc(t,c,M[256]),c+R[256]},Zc=new xc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kc=function(){for(var e=new xc(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Jc=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=Kc[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},Xc=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new wc(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=Qc(l,u,e.subarray(c,d)):(l[c]=true,u=Qc(l,u,e.subarray(c,o)))}else{for(var h=Zc[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new kc(32768),f=new kc(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 xc(25e3),w=new kc(288),k=new kc(32),x=0,C=0,E=(c=0,0),I=0,T=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(v[R]=P,f[M]=R,c>=I){var L=o-c;if((x>7e3||E>24576)&&L>423){u=Yc(e,l,0,S,w,k,C,E,T,c-T,u),E=x=C=0,T=c;for(var F=0;286>F;++F)w[F]=0;for(F=0;30>F;++F)k[F]=0}var O=2,A=0,D=_,N=R-P&32767;if(L>2&&M==b(c-N))for(var B=Math.min(p,L)-1,q=Math.min(32767,c),H=Math.min(258,L);q>=N&&--D&&R!=P;){if(e[c+O]==e[c+O-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>O){if(O=U,A=N,U>B)break;var z=Math.min(N,U-2),W=0;for(F=0;z>F;++F){var V=c-N+F+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,P=V)}}}N+=(R=P)-(P=v[R])+32768&32767}if(A){S[E++]=268435456|Rc[O]<<18|Pc[A];var G=31&Rc[O],Q=31&Pc[A];C+=Cc[G]+Ec[Q],++w[257+G],++k[Q],I=c+O,++x}else S[E++]=e[c],++w[e[c]]}}u=Yc(e,l,true,S,w,k,C,E,T,c-T,u)}return $c(a,0,i+Hc(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)},ed=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},td=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&&ed(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)}},rd=function(e){return 10+(e.filename&&e.filename.length+1||0)};function id(e,t){void 0===t&&(t={});var r=Jc(),i=e.length;r.p(e);var n=Xc(e,t,rd(t),8),s=n.length;return td(n,t),ed(n,s-8,r.d()),ed(n,s-4,i),n}function nd(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new wc(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 wc(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 $c(i,0,n)}function sd(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}var od=!!Qn||!!Gn,ad="text/plain",ld=!1,ud=(e,t)=>{var[r,i]=e.split("#"),[n,s]=r.split("?");if(!s)return e;var o=s.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},cd=function(e,t,i){var n;void 0===i&&(i=!0);var[s,o]=e.split("?"),a=r({},t),l=null!==(n=null==o?void 0:o.split("&").map((e=>{var t,[r,n]=e.split("="),s=i&&null!==(t=a[r])&&void 0!==t?t:n;return delete a[r],r+"="+s})))&&void 0!==n?n:[],u=ms(a);return u&&l.push(u),s+"?"+l.join("&")},dd=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),hd=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:r}=e;if(t){if(r===Sc.GZipJS){var i=id(nd(dd(t)),{mtime:0});return{contentType:ad,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===Sc.Base64){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(dd(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:dd(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=dd(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},pd=e=>{var t,i,n=()=>({url:ud(e.url,"compression"),encodedBody:hd(r({},e,{compression:void 0,_encodedBody:void 0}))});try{t=hd(e)}catch(t){if(sr(e.compression,ys(e.url,"compression")))return is.error("Failed to gzip request body, sending uncompressed payload",t),n();throw t}return t&&sr(e.compression,ys(e.url,"compression"))&&!((i=t.body)instanceof ArrayBuffer?nr(new Uint8Array(i)):ArrayBuffer.isView(i)&&nr(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(ld=!0,n()):{url:e.url,encodedBody:t}},_d=e=>{try{return pd(e)}catch(t){return is.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},gd=function(){var e=t((function*(e){var t=dd(e.data),i=yield cr(t,ts.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return r({},e,{_encodedBody:{contentType:ad,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),vd=(e,t)=>cd(e,{_:(new Date).getTime().toString(),ver:ts.JS_SDK_VERSION,compression:t}),fd=[];Gn&&fd.push({transport:"fetch",method(e){var t,i=_d(e);if(i){var{url:n,encodedBody:s}=i,{contentType:o,body:a,estimatedSize:l}=null!=s?s:{},u=new Headers;os(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var c=null,d=null;if(Yn){var h=new Yn;c={signal:h.signal,timeout:setTimeout((()=>{var t,r;t=e.timeout,(r=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",h.abort(d=r)}),e.timeout)}}Gn(n,r({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&52428.8>(l||0),body:a,signal:null==(t=c)?void 0:t.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){is.error(e)}null==e.callback||e.callback(i)})))).catch((t=>{t===d?is.warn(t):is.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>c?clearTimeout(c.timeout):null))}}}),Qn&&fd.push({transport:"XHR",method(e){var t=_d(e);if(t){var r=new Qn,{url:i,encodedBody:n}=t;r.open(e.method||"GET",i,!0);var{contentType:s,body:o}=null!=n?n:{};os(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!=Wn&&Wn.sendBeacon&&fd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:r}=pd(e),{contentType:i,body:n}=null!=r?r:{};if(!n)return;var s=n instanceof Blob?n:new Blob([n],{type:i});Wn.sendBeacon(t,s)}catch(e){}}});var md=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 yd(e,t,r){return dd({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var bd={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=>md(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!md(t,e))))),icontains:(e,t)=>t.map(Sd).some((t=>e.map(Sd).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Sd).every((t=>e.map(Sd).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)))}))},Sd=e=>e.toLowerCase(),wd=new Set(["is_not","not_icontains","not_regex"]);function kd(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(xr(n)||Ir(n))return wd.has(s);var o=bd[s];return!!o&&!xr(e.value)&&!Ir(e.value)&&o(br(e.value)?e.value.map(String):[String(e.value)],br(n)?n.map(String):[String(n)])}))}function xd(e,t){return!e||Object.entries(e).every((e=>{var[r,i]=e,n=null==t?void 0:t[r];if(xr(n)||Ir(n))return!1;var s=[String(n)],o=bd[i.operator];return!!o&&o(i.values,s)}))}var Cd="",Ed=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Id={_is_supported:()=>!!Vn,_error(e){is.error("cookieStore error: "+e)},_get(e){if(Vn){try{for(var t=e+"=",r=Vn.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}},_parse(e){var t;try{t=JSON.parse(Id._get(e))||{}}catch(e){}return t},_set(e,t,r,i,n){if(!Vn)return!1;try{var s="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=Vn),Cd)return Cd;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_"+mc();!Cd&&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",Cd=s)}return Cd}(e);if(!r){var i=(e=>{var t=e.match(Ed);return t?t[0]:""})(e);i!==r&&is.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(Vn.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&&is.warn("cookieStore warning: large cookie, len="+u.length),Vn.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=Vn&&Vn.cookie)try{Id._set(e,"",-1,t)}catch(e){return}}},Td=null,Md={_is_supported(){if(!Ir(Td))return Td;var e=!0;if(xr(Un))e=!1;else try{var t="__mplssupport__";Md._set(t,"xyz"),'"xyz"'!==Md._get(t)&&(e=!1),Md._remove(t)}catch(t){e=!1}return e||is.error("localStorage unsupported; falling back to cookie store"),Td=e,e},_error(e){is.error("localStorage error: "+e)},_get(e){try{return null==Un?void 0:Un.localStorage.getItem(e)}catch(e){Md._error(e)}return null},_parse(e){try{return JSON.parse(Md._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Un||Un.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Md._error(e)}return!1},_remove(e){try{null==Un||Un.localStorage.removeItem(e)}catch(e){Md._error(e)}}},Rd=[Is,"distinct_id",js,Gs,Io,Eo,So],Pd={},Ld={_is_supported:()=>!0,_error(e){is.error("memoryStorage error: "+e)},_get:e=>Pd[e]||null,_parse:e=>Pd[e]||null,_set:(e,t)=>(Pd[e]=t,!0),_remove(e){delete Pd[e]}},Fd=null,Od={_is_supported(){if(!Ir(Fd))return Fd;if(Fd=!0,xr(Un))Fd=!1;else try{var e="__support__";Od._set(e,"xyz"),'"xyz"'!==Od._get(e)&&(Fd=!1),Od._remove(e)}catch(e){Fd=!1}return Fd},_error(e){is.error("sessionStorage error: ",e)},_get(e){try{return null==Un?void 0:Un.sessionStorage.getItem(e)}catch(e){Od._error(e)}return null},_parse(e){try{return JSON.parse(Od._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Un||Un.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Od._error(e)}return!1},_remove(e){try{null==Un||Un.sessionStorage.removeItem(e)}catch(e){Od._error(e)}}},Ad=ns("[Stylesheet Loader]"),Dd=Un,Nd=Vn,Bd="#020617",qd={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:qu.Right,widgetType:Bu.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:Bd,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Hd=[qu.Center,qu.Left,qu.Right];function $d(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 Ud(e){var t;void 0===e&&(e=qd.backgroundColor),"#"===e[0]&&(t=$d(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=$d(r)),!t)return Bd;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?Bd:"white"}return Bd}var zd=(e,t,i)=>{var n=ah(e),s=Nd.querySelector("."+n);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=Nd.createElement("div");((e,t,i)=>{var n=r({},qd,i),s=e.style,o=!Hd.includes(n.position)||t===$u.Widget&&(null==i?void 0:i.widgetType)===Bu.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)||Ud(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",Ud(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Ud(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Ud(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)||Ud(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,n=Nd.createElement("style");return n.innerText=':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)}}',null!=r&&null!=(i=r.config)&&i.prepare_external_dependency_stylesheet&&(n=r.config.prepare_external_dependency_stylesheet(n)),n||(Ad.error("prepare_external_dependency_stylesheet returned null"),null)})(0,0,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 Nd.body.appendChild(o),{shadow:a,isNewlyCreated:!0}},Wd=e=>{var{responses:t,survey:i,surveySubmissionId:n,posthog:s,isSurveyCompleted:o,properties:a,surveyLanguage:l}=e;s?(cc(i),s.capture(Vu.SENT,r({[ju.SURVEY_NAME]:i.name,[ju.SURVEY_ID]:i.id,[ju.SURVEY_ITERATION]:i.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:i.current_iteration_start_date,[ju.SURVEY_SUBMISSION_ID]:n,[ju.SURVEY_COMPLETED]:o},l&&{[ju.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Zu(t,i),a,{$set:{[Ku(i,"responded")]:!0}})),o&&(Dd.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:i.id}})),oh(i))):rc.error("[survey sent] event not captured, PostHog instance not found.")},Vd=(e,t,i)=>{return r({[ju.SURVEY_NAME]:e.name,[ju.SURVEY_ID]:e.id,[ju.SURVEY_ITERATION]:e.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[ju.SURVEY_PARTIALLY_COMPLETED]:(n=null==t?void 0:t.responses,void 0===n&&(n={}),Object.values(n).some((e=>!Tr(e))))},(null==t?void 0:t.surveyLanguage)&&{[ju.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==i.get_session_replay_url?void 0:i.get_session_replay_url(),[ju.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Zu(null==t?void 0:t.responses,e));var n},jd=(e,t,i,n)=>{if(t){if(!i){var s=nh(e);t.capture(Vu.DISMISSED,r({},Vd(e,s,t),n&&{[ju.SURVEY_LANGUAGE]:n},{$set:{[Ku(e,"dismissed")]:!0}})),oh(e),cc(e),Dd.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else rc.error("[survey dismissed] event not captured, PostHog instance not found.")},Gd=(e,t)=>{if(t){var r=(e=>lc("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=nh(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Vu.ABANDONED,Vd(e,i,t),{transport:"sendBeacon"})}}else rc.error("[survey abandoned] event not captured, PostHog instance not found.")},Qd=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Yd=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Zd=e=>e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Yd(e.questions,Qd(e.questions)):e.questions,Kd=e=>{var t;return!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation||!(e=>{var t,r;return null!=(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)?void 0:t.length)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})(e))||e.schedule===Wu.Always||sh(e)},Jd=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,Ql(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"+Al++,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}),Xd=()=>Mu(Jd),eh=e=>{var{component:t,children:r,renderAsHtml:i,style:n}=e;return function(e,t,r){var i,n,s,o,a=Hl({},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?Sl.call(arguments,2):r),zl(e.type,a,i||e.key,n||e.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:r},style:n}:{children:r,style:n})};function th(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=Cs(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 bd[o](s,[n])}var rh=e=>{var t=""+ac+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+ac+e.id+"_"+e.current_iteration),t},ih=(e,t)=>{try{localStorage.setItem(rh(e),JSON.stringify(t))}catch(e){rc.error("Error setting in-progress survey state in localStorage",e)}},nh=e=>{try{var t=localStorage.getItem(rh(e));if(t)return JSON.parse(t)}catch(e){rc.error("Error getting in-progress survey state from localStorage",e)}return null},sh=e=>{var t=nh(e);return!Tr(null==t?void 0:t.surveySubmissionId)},oh=e=>{try{localStorage.removeItem(rh(e))}catch(e){rc.error("Error clearing in-progress survey state from localStorage",e)}};function ah(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function lh(e,t,r){if(void 0===t&&(t=qu.Right),e===$u.ExternalSurvey)return{};switch(t){case qu.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case qu.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case qu.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case qu.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case qu.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case qu.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case qu.Left:return{left:"30px"};case qu.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===$u.Widget&&r===Bu.Tab?"60px":"30px"}}}var uh=0;function ch(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:--uh,__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 wl.vnode&&wl.vnode(u),u}var dh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),hh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),ph=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),_h=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),gh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),vh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ch("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"})}),fh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ch("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"})}),mh=function(e){var{fill:t="currentColor"}=void 0===e?{}:e;return ch("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ch("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ch("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:t})]})},yh=ch("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ch("g",{"clip-path":"url(#clip0_2415_6911)",children:[ch("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ch("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ch("g",{mask:"url(#mask0_2415_6911)",children:[ch("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"}),ch("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"}),ch("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"}),ch("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"}),ch("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"}),ch("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"})]})]}),ch("defs",{children:ch("clipPath",{id:"clip0_2415_6911",children:ch("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function bh(e){var{urlParams:t}=e,r=t?Object.entries(t).map((e=>{var[t,r]=e;return encodeURIComponent(t)+"="+encodeURIComponent(r)})).join("&"):"";return ch("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",yh]})}function Sh(e){var{text:t,submitDisabled:r,appearance:i,onSubmit:n,link:s,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}=e,{isPreviewMode:c}=Mu(Jd),d=!!l&&!!u,h=!a&&ch("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){s&&(null==Un||Un.open(s)),c?null==o||o():n()},children:t});return ch("div",{className:"bottom-section",children:[d?ch("div",{className:"form-buttons form-buttons-with-back",children:[ch("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&ch(bh,{urlParams:{utm_source:"survey-footer"}})]})}function wh(e){var{question:t,forceDisableHtml:r,htmlFor:i}=e;return ch("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ch(t.type===Uu.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&eh({component:Ul("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function kh(e){var{onClick:t}=e,{isPreviewMode:r}=Mu(Jd);return ch("button",{className:"form-cancel",onClick:t,disabled:r,"aria-label":"Close survey",type:"button",children:mh({fill:"black"})})}ch("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ch("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 xh=Un;function Ch(e){var{header:t,description:r,contentType:i,forceDisableHtml:n,appearance:s,onClose:o}=e,{isPopup:a}=Mu(Jd);return Eu((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return _s(xh,"keydown",e),()=>{xh.removeEventListener("keydown",e)}}),[o]),ch("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&ch(kh,{onClick:()=>o()}),ch("h3",{className:"thank-you-message-header",children:t}),r&&eh({component:Ul("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&ch(Sh,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}var Eh=e=>br(e)&&e.every((e=>Cr(e)));function Ih(e){var{question:t,forceDisableHtml:r,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:o,initialValue:a,canGoBack:l,onBack:u}=e,{isPreviewMode:c}=Xd(),d=Iu(null),[h,p]=Cu((()=>Cr(a)?a:""));Eu((()=>{setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c]);var _="surveyQuestion"+o,g=Tu((()=>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 er.MinLength: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 er.MaxLength: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}(h,t.validation,t.optional)),[h,t.validation,t.optional]),v=on(t.validation,er.MinLength),f=on(t.validation,er.MaxLength),m=Tu((()=>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}(v,f)),[v,f]),y=()=>{g||n(h.trim())},b=()=>{g||s(h.trim())};return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:t,forceDisableHtml:r,htmlFor:_}),ch("textarea",{ref:d,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:v,maxLength:f,onInput(e){p(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:h}),m&&ch("div",{className:"validation-hint",children:m})]}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:l,onBack:u})]})}function Th(e){var{question:t,forceDisableHtml:r,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:o,onBack:a}=e;return ch(Wl,{children:[ch("div",{className:"question-container",children:ch(wh,{question:t,forceDisableHtml:r})}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:o,onBack:a})]})}function Mh(e){var t,{question:r,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d=r.scale,h=10===r.scale?0:1,[p,_]=Cu((()=>Mr(l)?l:br(l)&&l.length>0&&Mr(parseInt(l[0]))?parseInt(l[0]):Cr(l)&&Mr(parseInt(l))?parseInt(l):null)),g="emoji"===r.display&&2===r.scale,{isPreviewMode:v}=Xd(),f=e=>v?a(e):o(e);return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:r,forceDisableHtml:i}),ch("div",{className:"rating-section",children:[ch("div",{className:"rating-options",children:["emoji"===r.display&&ch("div",{className:"rating-options-emoji"+(g?" rating-options-emoji-2":""),children:null==(t=Ah[r.scale])?void 0:t.map(((e,t)=>ch("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===p?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;_(e),r.skipSubmitButton&&f(e)},children:e},t)))}),"number"===r.display&&ch("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:Dh(r.scale).map(((e,t)=>ch(Rh,{displayQuestionIndex:n,active:p===e,appearance:s,num:e,setActiveNumber(e){_(e),r.skipSubmitButton&&f(e)}},t)))})]}),!g&&ch("div",{className:"rating-text",children:[ch("div",{children:r.lowerBoundLabel}),ch("div",{children:r.upperBoundLabel})]})]})]}),ch(Sh,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Ir(p)&&!r.optional,appearance:s,onSubmit:()=>o(p),onPreviewSubmit:()=>a(p),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function Rh(e){var{num:t,active:r,displayQuestionIndex:i,setActiveNumber:n}=e;return ch("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+i+"-rating-"+t+" "+(r?"rating-active":""),type:"button",onClick(){n(t)},children:t})}function Ph(e){var{question:t,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d=Iu(null),h=Tu((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Yd(t,Qd(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),[p,_]=Cu((()=>((e,t)=>Cr(e)||Eh(e)?e:t===Uu.SingleChoice?null:[])(l,t.type))),[g,v]=Cu((()=>((e,t)=>{if(Cr(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Eh(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h))),{isPreviewMode:f}=Xd(),m=t.type===Uu.SingleChoice,y=t.type===Uu.MultipleChoice,b=t.skipSubmitButton&&m&&!t.hasOpenChoice,S=(e,t)=>{if(t){var i=!g.isSelected;return v((e=>r({},e,{isSelected:i,inputValue:i?e.inputValue:""}))),m&&_(""),void(i&&setTimeout((()=>{var e;return null==(e=d.current)?void 0:e.focus()}),75))}if(m)return _(e),v((e=>r({},e,{isSelected:!1,inputValue:""}))),void(b&&(o(e),f&&a(e)));y&&br(p)&&(p.includes(e)?_(p.filter((t=>t!==e))):_([...p,e]))},w=e=>{e.stopPropagation();var t=e.currentTarget.value;v((e=>r({},e,{inputValue:t}))),m&&_(t)},k=e=>{e.stopPropagation(),"Enter"!==e.key||x()||(e.preventDefault(),C()),"Escape"===e.key&&(e.preventDefault(),v((e=>r({},e,{isSelected:!1,inputValue:""}))),m&&_(null))},x=()=>!(t.optional||!Ir(p)&&(!br(p)||g.isSelected||0!==p.length)&&(!g.isSelected||""!==g.inputValue.trim())),C=()=>{g.isSelected&&y?br(p)&&(f?a([...p,g.inputValue]):o([...p,g.inputValue])):f?a(p):o(p)};return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:t,forceDisableHtml:i}),ch("fieldset",{className:"multiple-choice-options limit-height",children:[ch("legend",{className:"sr-only",children:y?" 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?g.isSelected:m?p===e:br(p)&&p.includes(e);return ch("label",{className:i?"choice-option-open":"",children:[ch("div",{className:"response-choice",children:[ch("input",{type:m?"radio":"checkbox",name:s,checked:a,onChange:()=>S(e,i),id:s,"aria-controls":o}),ch("span",{children:i?e+":":e})]}),i&&ch("input",{type:"text",ref:d,id:o,name:"question"+n+"Open",value:g.inputValue,onKeyDown:k,onInput:w,onClick(t){g.isSelected||S(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:x(),appearance:s,onSubmit:C,onPreviewSubmit:C,skipSubmitButton:b,canGoBack:u,onBack:c})]})}var Lh=[1,2,3,4,5],Fh=[1,2,3,4,5,6,7],Oh=[0,1,2,3,4,5,6,7,8,9,10],Ah={2:[vh,fh],3:[ph,hh,dh],5:[_h,ph,hh,dh,gh]};function Dh(e){switch(e){case 5:default:return Lh;case 7:return Fh;case 10:return Oh}}var Nh=ns("[Surveys]");function Bh(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?zu.End:s;if(n.branching.type===zu.End)return zu.End;if(n.branching.type===zu.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===zu.ResponseBased){if(n.type===Uu.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===zu.End?zu.End:s}}else if(n.type===Uu.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===zu.End?zu.End:s}}return s}return Nh.warn("Falling back to next question index due to unexpected branching type"),s}var qh="https?://(.*)",Hh=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$h=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Hh],Uh="<masked>",zh=["li_fat_id"];function Wh(e,t,r){if(!Vn)return{};var i,n=t?[...Hh,...r||[]]:[],s=Vh(bs(Vn.URL,n,Uh),e),o=(i={},os(zh,(function(e){var t=Id._get(e);i[e]=t||null})),i);return as(o,s)}function Vh(e,t){var r=$h.concat(t||[]),i={};return os(r,(function(t){var r=ys(e,t);i[t]=r||null})),i}function jh(e){var t=function(e){return e?0===e.search(qh+"google.([^/?]*)")?"google":0===e.search(qh+"bing.com")?"bing":0===e.search(qh+"yahoo.com")?"yahoo":0===e.search(qh+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Ir(t)){i.$search_engine=t;var n=Vn?ys(Vn.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function Gh(){return navigator.language||navigator.userLanguage}var Qh="$direct";function Yh(){return(null==Vn?void 0:Vn.referrer)||Qh}function Zh(e,t,r){void 0===r&&(r=!1);var i=e?[...Hh,...t||[]]:[],n=r?Yi(null==jn?void 0:jn.href):null==jn?void 0:jn.href,s=null==n?void 0:n.substring(0,1e3);return{r:Yh().substring(0,1e3),u:s?bs(s,i,Uh):void 0}}function Kh(e,t){var r;void 0===t&&(t=!1);var{r:i,u:n}=e,s=t?Yi(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==Qh?Qh:null==(r=fs(i))?void 0:r.host};if(s){o.$current_url=s;var a=fs(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Vh(s);as(o,l)}if(i){var u=jh(i);as(o,u)}return o}function Jh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Xh(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var ep=ns("[SurveyTranslations]");function tp(e,t){var r=function(e){return function(e,t){var{overrideLanguage:r,storedPersonProperties:i,locale:n}=e,s=Ju(r);if(s)return null==t||t.info("Using override display language: "+s),s;var o=function(e){return e&&"object"==typeof e&&"language"in e?Ju(e.language):null}(i);if(o)return null==t||t.info("Using person property language: "+o),o;var a=Ju(n);return a?(null==t||t.info("Using detected locale: "+a),a):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Sr(e.get_property)?e.get_property(co):void 0,locale:Gh()},ep)}(t);if(!r)return ep.info("No user language detected"),{survey:e,language:null};var i=tc(e,r,ep);return{survey:i.survey,language:i.matchedKey}}var rp=Un,ip=Vn,np="ph:show_survey_widget",sp="PHWidgetSurveyClickListener";function op(e,t){try{var r=e.getBoundingClientRect(),i=rp.innerHeight,n=rp.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:qd.zIndex}}catch(e){return rc.warn("Failed to calculate trigger position:",e),null}}class ap{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(po);if(e)for(var t of e)sh(t)&&Gd(t,this._posthog)},this.handlePopoverSurvey=(e,t)=>{var i,n,s,o,{survey:a,language:l}=this._translateSurveyForRendering(e),u=null!=t&&t.position||null!=t&&t.selector?r({},a,{appearance:r({},a.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):a;this._clearSurveyTimeout(u.id);var{properties:c,initialResponses:d}=null!=t?t:{},h=!(!d||0>=Object.keys(d).length)&&this._handleInitialResponses(u,d,c,l);if(!h||null!=(i=u.appearance)&&i.displayThankYouMessage){this._addSurveyToFocus(u);var p={};if((null==(n=u.appearance)?void 0:n.position)===qu.NextToTrigger&&null!=(s=u.appearance)&&s.widgetSelector){var _,g=ip.querySelector(u.appearance.widgetSelector);g&&(p=op(g,parseInt((null==(_=u.appearance)?void 0:_.maxWidth)||qd.maxWidth))||{})}var v=(null==(o=u.appearance)?void 0:o.surveyPopupDelaySeconds)||0,{shadow:f}=zd(u,this._posthog),m={posthog:this._posthog,survey:u,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:c,style:p,isSurveyCompleted:h,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:l};if(0>=v)return cu(ch(dp,r({},m)),f);var y=setTimeout((()=>{if(this._surveyTimeouts.delete(u.id),!this._shouldDisplaySurvey(u))return rc.info("Survey "+u.id+" no longer eligible when its display delay elapsed; not displaying"),this._removeSurveyFromFocus(u);cu(ch(dp,r({},m,{survey:r({},u,{appearance:r({},u.appearance,{surveyPopupDelaySeconds:0})})})),f)}),1e3*v);this._surveyTimeouts.set(u.id,y)}},this._handleWidget=e=>{var{survey:t,language:r}=this._translateSurveyForRendering(e),{shadow:i,isNewlyCreated:n}=zd(t,this._posthog);n&&cu(ch(pp,{posthog:this._posthog,survey:t,surveyLanguage:r},e.id),i)},this._removeWidgetSelectorListener=e=>{this._removeSurveyFromDom(e);var t=this._widgetSelectorListeners.get(e.id);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(sp),this._widgetSelectorListeners.delete(e.id),rc.info("Removed click listener for survey "+e.id))},this._manageWidgetSelectorListener=(e,t)=>{var r=ip.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;rc.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._removeWidgetSelectorListener(e)}if(!r.hasAttribute(sp)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===qu.NextToTrigger?op(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||qd.maxWidth)):{};rp.dispatchEvent(new CustomEvent(np,{detail:{surveyId:e.id,position:n}}))};_s(r,"click",n),r.setAttribute(sp,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),rc.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var{survey:t,language:r}=this._translateSurveyForRendering(e),{shadow:i}=zd(t,this._posthog);cu(ch(dp,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:r}),i)},this.renderSurvey=(e,t,r)=>{var i,{survey:n,language:s}=this._translateSurveyForRendering(e),o=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(o=this._handleUrlPrefill(n,s)),cu(ch(dp,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:o,surveyLanguage:s}),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===$u.Popover||e.type===$u.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===$u.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===Bu.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Bu.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}Ir(t._surveyInFocus)&&e.type===$u.Popover&&t.handlePopoverSurvey(e)})),t._widgetSelectorListeners.forEach((e=>{var{survey:r}=e;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{Ir(this._surveyInFocus)||rc.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&rc.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)&&(rc.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=sh(e),s=sh(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===Wu.Always,a=t.schedule===Wu.Always;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 tp(e,this._posthog)}_handleUrlPrefill(e,t){if(this._prefillHandledSurveys.has(e.id))return!1;var{params:r}=function(e){var t={},r=!1,i=rp.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var[o,a]=s.split("=");if(o&&!xr(a)){var l=decodeURIComponent(o),u=decodeURIComponent(a);if("auto_submit"!==l||"true"!==u){var c=l.match(/^q(\d+)$/);if(c){var d=parseInt(c[1],10);t[d]||(t[d]=[]),t[d].push(u)}}else r=!0}}return{params:t,autoSubmit:r}}();if(0===Object.keys(r).length)return!1;rc.info("[Survey Prefill] Detected URL prefill parameters");var i=this._processPrefillData(e,r,t);if(!i)return!1;var{responses:n,submissionId:s,isSurveyCompleted:o,skippedResponses:a}=i;return(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Wd({responses:o?n:a,survey:e,surveySubmissionId:s,posthog:this._posthog,isSurveyCompleted:o,surveyLanguage:t}),this._prefillHandledSurveys.add(e.id),o}_handleInitialResponses(e,t,r,i){var n={};for(var[s,o]of Object.entries(t))n[parseInt(s)]=br(o)?o.map(String):[String(o)];rc.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);if(!a)return!1;var{responses:l,submissionId:u,isSurveyCompleted:c}=a;return Wd({responses:l,survey:e,surveySubmissionId:u,posthog:this._posthog,isSurveyCompleted:c,properties:r,surveyLanguage:i}),c}_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=Qu(e.id);try{switch(e.type){case Uu.SingleChoice:if(!e.choices||0===e.choices.length)return void is.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 is.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case Uu.MultipleChoice:if(!e.choices||0===e.choices.length)return void is.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 is.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&is.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case Uu.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void is.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:is.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){is.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return rc.warn("[Survey Prefill] No valid responses after conversion"),null;var n=mc(),s=Object.keys(t).map((e=>parseInt(e,10))),{startQuestionIndex:o,skippedResponses:a}=function(e,t,r){for(var i=0,n={},s=e.questions.length+1;e.questions.length>i&&s>0&&t.includes(i);){var o=e.questions[i];if(!o||!("skipSubmitButton"in o)||!o.skipSubmitButton)break;if(o.id){var a=Qu(o.id);xr(r[a])||(n[a]=r[a])}var l=Bh(e,i,o.id?r[Qu(o.id)]:null);if(l===zu.End)return{startQuestionIndex:e.questions.length,skippedResponses:n};i=l}return{startQuestionIndex:i,skippedResponses:n}}(e,s,i),l=o>=e.questions.length;return ih(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:o,surveyLanguage:r}),rc.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:o,isSurveyCompleted:l,skippedResponses:a}}catch(e){return rc.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||th(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,n;if(!e||0===e.length)return!0;if(!Kn)return!1;var s=ji(Kn,{userAgentDataPlatform:null==Wn||null==(r=Wn.userAgentData)?void 0:r.platform,maxTouchPoints:null==Wn?void 0:Wn.maxTouchPoints,screenWidth:null==Un||null==(i=Un.screen)?void 0:i.width,screenHeight:null==Un||null==(n=Un.screen)?void 0:n.height,devicePixelRatio:null==Un?void 0:Un.devicePixelRatio});return bd[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==Nd||!Nd.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){return Kd(e)||this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)||sh(e)}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!ic(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!dc.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;return this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n)?this._isSurveyFeatureFlagEnabled(e.targeting_flag_key)?this._internalFlagCheckSatisfied(e)?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,Md._get("lastSeenSurveyDate"))?(e=>!!Md._get(uc(e))&&!Kd(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="Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i):(i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i):(i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i)}_hasActionOrEventTriggeredSurvey(e){var t;if(!nc(e)&&!sc(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{key:t,value:r}=e;return!t||!r||this._isSurveyFeatureFlagEnabled(r)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=ip.querySelector(ah(e,!0));null!=t&&t.shadowRoot&&cu(null,t.shadowRoot),null==t||t.remove()}catch(t){rc.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 lp(e,t){if(ip&&rp){var r,i=new ap(e);if(e.config.disable_surveys_automatic_display)return rc.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return rc.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{xr(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))};return n(),_s(ip,"visibilitychange",(()=>{ip.hidden?xr(r)||(clearInterval(r),r=void 0):(i.callSurveysAndEvaluateDisplayLogic(!1),n())})),i}}function up(e){var{survey:t,removeSurveyFromFocus:r=(()=>{}),setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}=e;Eu((()=>{var e;if(!n&&null!=(e=t.conditions)&&e.url){var o=()=>{var e,n=t.type===$u.Widget,o=th(t,s),a=(null==(e=t.appearance)?void 0:e.widgetType)===Bu.Tab&&n;if(!o)return rc.info("Hiding survey "+t.id+" because URL does not match"),i(!1),r(t);a&&(rc.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),i(!0))};_s(rp,"popstate",o),_s(rp,"hashchange",o);var a=rp.history.pushState,l=rp.history.replaceState;return rp.history.pushState=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];a.apply(this,t),o()},rp.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];l.apply(this,t),o()},()=>{rp.removeEventListener("popstate",o),rp.removeEventListener("hashchange",o),rp.history.pushState=a,rp.history.replaceState=l}}}),[n,t,r,i,s])}function cp(e){switch(void 0===e&&(e=Hu.Right),e){case Hu.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Hu.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Hu.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function dp(e){var t,i,n,s,o,a,{survey:l,forceDisableHtml:u,posthog:c,style:d={},previewPageIndex:h,removeSurveyFromFocus:p=(()=>{}),isPopup:_=!0,onPreviewSubmit:g=(()=>{}),onPreviewBack:v=(()=>{}),onPopupSurveyDismissed:f=(()=>{}),onCloseConfirmationMessage:m=(()=>{}),properties:y,isSurveyCompleted:b,skipShownEvent:S,surveyLanguage:w}=e,k=Iu(null),x=Number.isInteger(h),C=null!=(t=l.appearance)&&t.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,{isPopupVisible:E,isSurveySent:I,hidePopupWithViewTransition:T}=function(e,t,i,n,s,o,a,l,u){var[c,d]=Cu(n||0===i||e.type===$u.ExternalSurvey),[h,p]=Cu(!1),_=()=>{var t=()=>{o&&s(e),d(!1)};ip.startViewTransition?ip.startViewTransition((()=>{var e;null==a||null==(e=a.current)||e.remove()})).finished.then((()=>{setTimeout((()=>{t()}),100)})):t()},g=t=>{t.detail.surveyId===e.id&&_()};return Eu((()=>{if(t){if(!n){var s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return _();p(!0),null!=(i=e.appearance)&&i.autoDisappear&&setTimeout((()=>{_()}),5e3)}},o=()=>{if(th(e,t)){d(!0),rp.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(Vu.SHOWN,r({[ju.SURVEY_NAME]:e.name,[ju.SURVEY_ID]:e.id,[ju.SURVEY_ITERATION]:e.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[ju.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(_s(rp,"PHSurveyClosed",g),_s(rp,"PHSurveySent",s),i>0){var a=setTimeout(o,i);return()=>{clearTimeout(a),rp.removeEventListener("PHSurveyClosed",g),rp.removeEventListener("PHSurveySent",s)}}return o(),()=>{rp.removeEventListener("PHSurveyClosed",g),rp.removeEventListener("PHSurveySent",s)}}}else rc.error("usePopupVisibility hook called without a PostHog instance.")}),[]),up({survey:e,removeSurveyFromFocus:s,setSurveyVisible:d,isPreviewMode:n,posthog:t}),{isPopupVisible:c,isSurveySent:h,setIsPopupVisible:d,hidePopupWithViewTransition:_}}(l,c,C,x,p,_,k,S,w),M=I||h===l.questions.length||!0===b,R=Tu((()=>{var e=nh(l),t=(null==e?void 0:e.surveySubmissionId)||mc();return{isPreviewMode:x,previewPageIndex:h,onPopupSurveyDismissed(){w?jd(l,c,x,w):jd(l,c,x),f()},isPopup:_||!1,surveySubmissionId:t,onPreviewSubmit:g,onPreviewBack:v,posthog:c,properties:y,surveyLanguage:w}}),[x,h,_,c,l,f,g,v,y,w]);return E?ch(Jd.Provider,{value:R,children:ch("div",{className:"ph-survey",style:r({},lh(l.type,null==(i=l.appearance)?void 0:i.position,null==(n=l.appearance)?void 0:n.widgetType),d),ref:k,children:M?ch(Ch,{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||qd,onClose(){T(),m()}}):ch(hp,{survey:l,forceDisableHtml:!!u,posthog:c})})}):null}function hp(e){var t,i,{survey:n,forceDisableHtml:s,posthog:o}=e,[a,l]=Cu((()=>{var e=nh(n);return null!=e&&e.responses&&rc.info("Survey is already in progress, filling in initial responses"),(null==e?void 0:e.responses)||{}})),{previewPageIndex:u,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:h,onPreviewBack:p,surveySubmissionId:_,isPreviewMode:g,properties:v,surveyLanguage:f}=Mu(Jd),[m,y]=Cu((()=>{var e=nh(n);return u||(null==e?void 0:e.lastQuestionIndex)||0})),[b,S]=Cu((()=>{var e,t=nh(n);return null!==(e=null==t?void 0:t.visitedIndices)&&void 0!==e?e:[]})),w=Tu((()=>Zd(n)),[n]);Eu((()=>{g&&!xr(u)&&y(u)}),[u,g]);var k=!(null==(t=n.appearance)||!t.allowGoBack)&&(g?(null!=u?u:0)>0:b.length>0),x=w.at(m);return x?ch("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null==(i=n.appearance)?void 0:i.hideCancelButton)&&ch(kh,{onClick(){c()}}),ch("div",{className:"survey-box","data-question-index":m,children:_p({question:x,forceDisableHtml:s,displayQuestionIndex:m,appearance:n.appearance||qd,onSubmit:e=>(e=>{var{res:t,displayQuestionIndex:i,questionId:s}=e;if(o)if(s){var u=Qu(s),c=r({},a,{[u]:t});l(c);var d=Bh(n,i,t),h=d===zu.End,p=[...b,i];if(h||(S(p),y(d),ih(n,{surveySubmissionId:_,responses:c,lastQuestionIndex:d,visitedIndices:p,surveyLanguage:f})),n.enable_partial_responses||h){var g=new Set(p.map((e=>{var t;return null==(t=w[e])?void 0:t.id})).filter((e=>!!e)).map((e=>Qu(e)))),m=Object.fromEntries(Object.entries(c).filter((e=>{var[t]=e;return g.has(t)})));Wd({responses:m,survey:n,surveySubmissionId:_,isSurveyCompleted:h,posthog:o,properties:v,surveyLanguage:f})}}else rc.error("onNextButtonClick called without a questionId.");else rc.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:m,questionId:x.id}),onPreviewSubmit:h,initialValue:x.id?a[Qu(x.id)]:void 0,canGoBack:k,onBack(){if(g)p();else if(0!==b.length){var e=b[b.length-1],t=b.slice(0,-1);S(t),y(e),ih(n,{surveySubmissionId:_,responses:a,lastQuestionIndex:e,visitedIndices:t,surveyLanguage:f})}}})})]}):null}function pp(e){var t,r,i,n,s,o,a,{survey:l,forceDisableHtml:u,posthog:c,readOnly:d,surveyLanguage:h}=e,[p,_]=Cu(!0),[g,v]=Cu(!1),[f,m]=Cu({}),y=()=>{v(!g)};if(Eu((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(rc.info("Received show event for feedback button survey "+l.id),m(r.detail.position||{}),y())};return _s(rp,np,t),()=>{rp.removeEventListener(np,t)}}}else rc.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]),up({survey:l,setSurveyVisible:_,posthog:c}),!p)return null;var b=()=>{l.schedule!==Wu.Always&&_(!1),setTimeout((()=>{v(!1)}),200)};return ch(Wl,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&ch("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===Hu.Top?"widget-tab-top":""),onClick:y,disabled:d,style:cp(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),g&&ch(dp,{posthog:c,survey:l,forceDisableHtml:u,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:h})]})}var _p=e=>{var{question:t,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d={forceDisableHtml:i,appearance:s,onPreviewSubmit(e){a(e)},onSubmit(e){o(e)},initialValue:l,displayQuestionIndex:n,canGoBack:u,onBack:c};switch(t.type){case Uu.Open:return Ul(Ih,r({},d,{question:t,key:t.id}));case Uu.Link:return Ul(Th,r({},d,{question:t,key:t.id}));case Uu.Rating:return Ul(Mh,r({},d,{question:t,key:t.id}));case Uu.SingleChoice:case Uu.MultipleChoice:return Ul(Ph,r({},d,{question:t,key:t.id}));default:return rc.error("Unsupported question type: "+t.type),null}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.generateSurveys=lp,Jn.extendPostHogWithSurveys=lp;var gp=(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),vp=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return gp(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 gp(t,JSON.stringify(e.slice(0,n)),r)},fp=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,mp=(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}},yp=(e,t,r)=>{if(!r.truncated)if(wr(e)){if(r.seen.has(e))return void mp(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(yp(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else mp(t,e,r)},bp=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!fp(e))return!n||gp(t,"null",r);if(Ir(e)||(e=>{try{return Mr(e)||Pr(e)}catch(e){return!1}})(e))return gp(t,JSON.stringify(e),r);if("string"==typeof e)return vp(e,t,r);if(!wr(e)&&!br(e))return gp(t,JSON.stringify(e),r);if(i.has(e))return vp("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Sr(o))return bp(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return vp(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return gp(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 bp(l,t,r,i,n,s)}if(br(e)){if(!gp(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!gp(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!bp(d,t,r,i,!0))return!1}return gp(t,"]",r)}if(!gp(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{yp(_,p,s)}catch(e){}if(fp(_)){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(!gp(t,g,r))return!1;var y=t.length,b=bp(_,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 gp(t,"}",r)},Sp={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.logs={initializeLogs(e){var t={host:Jn.location.host},i=function(i){var n;Jn.console[i]=(n=Jn.console[i],function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];try{if(o.length>0&&e.is_capturing()){var l,{body:u,truncated:c,attributes:d}=((e,t)=>{for(var r=[],i={remaining:1e4,truncated:!1},n=wr(e[0])?{result:{},keysRemaining:50,sizeRemaining:1e4,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||gp(r," ",i))&&bp(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)||{}}})(o),h=r({},t,c?{body_truncated:"true"}:{});null==(l=e.logs)||l._captureConsoleLog({level:Sp[i],body:u,attributes:r({"log.source":"console."+i},h,d)})}}catch(e){}finally{n.apply(Jn.console,o)}})};for(var n of Object.keys(Sp))i(n)}};var wp=ns("[Error tracking]");function kp(){return new dn([new xn,new On,new En,new Cn,new Ln,new Pn,new Tn,new Fn],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=wn.test(l)?l.replace(wn,"$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>=kn)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,kn).map((e=>{return r({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||hn});var i}))}(s)}}("web:javascript",mn,Sn))}var xp=ns("[ExceptionAutocapture]"),Cp=kp(),Ep={wrapOnError(e){var t=Un;t||xp.info("window not available, cannot wrap onerror");var r=t.onerror;return t.onerror=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];var o=Cp.buildFromUnknown(n[4]||n[0],{mechanism:{handled:!1}});return e(o),null!==(t=null==r?void 0:r(...n))&&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=Un;t||xp.info("window not available, cannot wrap onUnhandledRejection");var r=t.onunhandledrejection;return t.onunhandledrejection=function(t){var i,n=Cp.buildFromUnknown(t,{mechanism:{handled:!1}});return e(n),null!==(i=null==r?void 0: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||xp.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=Cp.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});return e(a),null==r?void 0:r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.errorWrappingFunctions=Ep,Jn.posthogErrorWrappingFunctions=Ep;var Ip="X-POSTHOG-SESSION-ID",Tp="X-POSTHOG-WINDOW-ID",Mp="X-POSTHOG-DISTINCT-ID",Rp=[Ip,Tp,Mp],Pp=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Lp=(e,t)=>({}.hasOwnProperty.call(e,t)),Fp=e=>"object"==typeof e&&!Ir(e)||Sr(e),Op=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Ap=e=>{try{var t;return Op(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==Un||null==(t=Un.location)?void 0:t.href).toString()}catch(e){return}},Dp=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(br(e)&&!e.includes(s))return!1;var o=!1;if(r){var{sessionId:a,windowId:l}=r.checkAndGetSessionAndWindowId(!0);n.set(Ip,a),n.set(Tp,l),o=!0}var u=(e=>Sr(e)?e():e)(t);return u&&u!==Mo&&(n.set(Mp,u),o=!0),o};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{};var Np={_patchFetch:(e,t,i)=>ws(Un,"fetch",(n=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=Ap(s);if(u)if(Op(s)){var c=new Request(s,o);Dp(e,t,i,c.url,c.headers),l=[c]}else{var d=new Headers(Fp(o)?o.headers:void 0);if(Dp(e,t,i,u,d)){var h=((e,t)=>{if(xr(e)||Ir(e))return{headers:t};if(Fp(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)=>Lp(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>Lp(e,t)||t in i,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach((e=>t.add(e))),Pp.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&&Pp.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)=>ws(Un.XMLHttpRequest.prototype,"open",(i=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=Ap(s);d&&Dp(e,t,r,d,c);var h=i.call(u,n,s,o,a,l);return Rp.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};Jn.__PosthogExtensions__.tracingHeadersPatchFns=Np,Jn.postHogTracingHeadersPatchFns=Np;var Bp=-1,qp=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Bp=t.timeStamp,e(t))}),!0)},Hp=(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))}},$p=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},Up=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},zp=()=>{var e,t;return null!==(e=null==(t=Up())?void 0:t.activationStart)&&void 0!==e?e:0},Wp=function(e,t){void 0===t&&(t=-1);var r=Up(),i="navigate";return 0>Bp?r&&(document.prerendering||zp()>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}},Vp=new WeakMap;function jp(e,t){var r=Vp.get(t);return r||(r=new WeakMap,Vp.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Gp{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 Qp,Yp=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){}},Zp=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Kp=-1,Jp=new Set,Xp=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,e_=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Jp)t();isFinite(Kp)||(Kp="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",e_,!0))}},t_=()=>{if(0>Kp){var e,t=zp(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Kp=null!=r?r:Xp(),addEventListener("visibilitychange",e_,!0),addEventListener("prerenderingchange",e_,!0),qp((()=>{setTimeout((()=>{Kp=Xp()}))}))}return{get firstHiddenTime(){return Kp},onHidden(e){Jp.add(e)}}},r_=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},i_=[1800,3e3],n_=function(e,t){void 0===t&&(t={}),r_((()=>{var r,i=t_(),n=Wp("FCP"),s=Yp("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-zp(),0),n.entries.push(t),r(!0)))}));s&&(r=Hp(e,n,i_,t.reportAllChanges),qp((i=>{n=Wp("FCP"),r=Hp(e,n,i_,t.reportAllChanges),$p((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},s_=[.1,.25],o_=0,a_=1/0,l_=0,u_=e=>{for(var t of e)t.interactionId&&(a_=Math.min(a_,t.interactionId),l_=Math.max(l_,t.interactionId),o_=l_?(l_-a_)/7+1:0)},c_=()=>{var e;return Qp?o_:null!==(e=performance.interactionCount)&&void 0!==e?e:0},d_=0;class h_{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){d_=c_(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((c_()-d_)/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 p_=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Zp(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},__=[200,500];class g_{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var v_=[2500,4e3],f_={onLCP(e,t){void 0===t&&(t={}),r_((()=>{var r,i=t_(),n=Wp("LCP"),s=jp(t,g_),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-zp(),0),n.entries=[o],r())},a=Yp("largest-contentful-paint",o);if(a){r=Hp(e,n,v_,t.reportAllChanges);var l=Zp((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(p_(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});qp((i=>{n=Wp("LCP"),r=Hp(e,n,v_,t.reportAllChanges),$p((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},onCLS(e,t){void 0===t&&(t={});var r=t_();n_(Zp((()=>{var i,n=Wp("CLS",0),s=jp(t,Gp),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=Yp("layout-shift",o);a&&(i=Hp(e,n,s_,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),qp((()=>{s.i=0,n=Wp("CLS",0),i=Hp(e,n,s_,t.reportAllChanges),$p(i)})),setTimeout(i))})))},onFCP:n_,onINP(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=t_();r_((()=>{var i;"interactionCount"in performance||Qp||(Qp=Yp("event",u_,{durationThreshold:0}));var n,s=Wp("INP"),o=jp(t,h_),a=e=>{p_((()=>{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=Yp("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Hp(e,s,__,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),qp((()=>{o.v(),s=Wp("INP"),n=Hp(e,s,__,t.reportAllChanges)})))}))}}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.postHogWebVitalsCallbacks=f_,Jn.postHogWebVitalsCallbacks=f_,Jn.__PosthogExtensions__.loadWebVitalsCallbacks=()=>f_;class m_{constructor(e){this.disabled=!1===e;var t=wr(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 y_="$copy_autocapture",b_=ns("[AutoCapture]");function S_(e,t){return t.length>e?t.slice(0,e)+"...":t}function w_(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ra(t));return t}function k_(e,t){var i,n,{e:s,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:c}=t;if(!ra(e))return{props:{}};for(var d=[e],h=e;h.parentNode&&!ia(h,"body");)if(sa(h.parentNode))d.push(h.parentNode.host),h=h.parentNode.host;else{if(!ra(h.parentNode))break;d.push(h.parentNode),h=h.parentNode}var p,_,g=[],v={},f=!1,m=!1;if(os(d,(e=>{var t=Ca(e);if(ia(e,"a")){var r=e.getAttribute("href");f=!!(t&&r&&Fa(r))&&(c?Yi(r):r)}_r(la(e),"ph-no-capture")&&(m=!0),g.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};ha.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?S_(1024,Oa(e)):S_(1024,ca(e)));var a=la(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),os(e.attributes,(function(r){var s;if((!Ea(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Fa(r.value)&&(!Cr(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=oa(a).join(" ")),o["attr__"+r.name]=S_(1024,"href"===r.name&&n?Yi(a):a)}}));for(var l=1,u=1,c=e;c=w_(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(!Ca(e))return{};var t={};return os(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&&Fa(i)&&(t[r]=i)}})),t}(e);as(v,i)})),m)return{props:{},explicitNoCapture:m};if(a||(g[0].$el_text=ia(e,"a")||ia(e,"button")?Oa(e):ca(e)),f){var y,b;g[0].attr__href=f;var S=null==(y=fs(f))?void 0:y.host,w=null==Un||null==(b=Un.location)?void 0:b.host;S&&w&&S!==w&&(p=f)}return{props:as({$event_type:s.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,function(e){var t=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 ls(o).sort(((e,t)=>{var[r]=e,[i]=t;return r.localeCompare(i)})).forEach((e=>{var[t,r]=e;return a[Da(t.toString())]=Da(r.toString())})),(n+=":")+ls(a).map((e=>{var[t,r]=e;return t+'="'+r+'"'})).join("")}));return t.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:Na(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ls(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,r]=e;return i.attributes[t]=r})),i}))}(_)))},null!=(i=g[0])&&i.$el_text?{$el_text:null==(n=g[0])?void 0:n.$el_text}:{},p&&"click"===s.type?{$external_click_url:p}:{},v)}}var x_={};function C_(e){return function(e,t){var r=x_[e];if(r)return r;var i,n=t[e];if(Sr(i=n)&&-1!==i.toString().indexOf("[native code]")&&!Un.Zone)return x_[e]=n.bind(t);var s=t.document;if(s&&Sr(s.createElement))try{var o=s.createElement("iframe");o.hidden=!0,s.head.appendChild(o);var a=o.contentWindow;a&&a[e]&&(n=a[e]),s.head.removeChild(o)}catch(t){is.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}return n&&Sr(n)?x_[e]=n.bind(t):n}("MutationObserver",e)}function E_(e,t){return Mr(e)&&e>=t}class I_{_asRequiredConfig(e){var t,r,i,n,s,o=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:o.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:o.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:o.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:o.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:o.capture_clicks_with_modifier_keys,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:o.__onCapture}}constructor(e,t){this._clicks=[],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,__onCapture:e}),this._onClick=e=>{var t=function(e){var t=da(e);return t?{node:t,originalEvent:e,timestamp:Date.now()}:null}(e);Ir(t)||this._ignoreClick(t)||this._clicks.push(t),this._clicks.length&&xr(this._checkClickTimer)&&(this._checkClickTimer=Jn.setTimeout((()=>{this._checkClicks()}),1e3))},this._onScroll=()=>{var e=Date.now();e%50==0&&this._clicks.forEach((t=>{xr(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{"visible"===(null==Vn?void 0:Vn.visibilityState)&&(this._lastVisibilityChange=Date.now())},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)}_startMutationObserver(e){if(!this._mutationObserver){var t=C_(Jn);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,Jn.removeEventListener("click",this._onClick),Jn.removeEventListener("scroll",this._onScroll,{capture:!0}),Jn.removeEventListener("selectionchange",this._onSelectionChange),null==Vn||Vn.removeEventListener("visibilitychange",this._onVisibilityChange)}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){_s(Jn,"click",this._onClick)}_startScrollObserver(){_s(Jn,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){_s(Jn,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){_s(Vn,"visibilitychange",this._onVisibilityChange)}_ignoreClick(e){if(!e)return!0;if(!this._config.capture_clicks_with_modifier_keys&&((t=e.originalEvent).ctrlKey||t.metaKey||t.altKey||t.shiftKey))return!0;var t;if(ta(e.node))return!0;var r=this._clicks.some((t=>t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp)));return!(!r&&!ia(e.node,"html")&&ra(e.node)&&!function(e){if(!Un||ka(e))return!1;var{targetElementList:t}=xa(e,!1);return t.some((e=>ia(e,"a")))}(e.node)&&function(e,t){var r;if(!Un||ka(e))return!1;var i=Pr(t)?ya:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:ya,{targetElementList:n}=xa(e,!1);return!pa(n,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_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=E_(t.scrollDelayMs,this._config.scroll_threshold_ms),n=E_(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=E_(t.mutationDelayMs,this._config.mutation_threshold_ms),o=E_(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=Mr(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=Mr(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=Mr(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=Mr(t.visibilityChangedDelayMs)&&this._config.selection_change_threshold_ms>t.visibilityChangedDelayMs;if(!(a||l||u||c)){var d=E_(t.visibilityChangedDelayMs,this._config.selection_change_threshold_ms);i||s||o||n||d?this._onCapture(t,{$dead_click_last_mutation_timestamp:this._lastMutation,$dead_click_event_timestamp:t.timestamp,$dead_click_scroll_timeout:i,$dead_click_mutation_timeout:s,$dead_click_absolute_timeout:o,$dead_click_selection_changed_timeout:n,$dead_click_visibility_changed_timeout:d}):this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}}this._clicks.length&&xr(this._checkClickTimer)&&(this._checkClickTimer=Jn.setTimeout((()=>{this._checkClicks()}),1e3))}}_captureDeadClick(e,t){this.instance.capture("$dead_click",r({},t,k_(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,{$dead_click_scroll_delay_ms:e.scrollDelayMs,$dead_click_mutation_delay_ms:e.mutationDelayMs,$dead_click_absolute_delay_ms:e.absoluteDelayMs,$dead_click_selection_changed_delay_ms:e.selectionChangedDelayMs,$dead_click_visibility_changed_delay_ms:e.visibilityChangedDelayMs}),{timestamp:new Date(e.timestamp)})}}Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new I_(e,t);var T_={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},M_={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},R_="disabled",P_="sampled",L_="active",F_="buffering",O_="paused",A_="lazy_loading",D_="awaiting_config",N_="missing_config",B_="rrweb_error",q_="trigger",H_=q_+"_activated",$_=q_+"_pending",U_=q_+"_"+R_;function z_(e,t,r,i,n,s){return 0===t?U_:(null==e?void 0:e.get_property(r?i+r:n))===s?H_:$_}function W_(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 V_{constructor(e){this._matchers=e}triggerStatus(e){var t=this._matchers.map((t=>t.triggerStatus(e)));return t.includes(H_)?H_:t.includes($_)?$_:U_}stop(){this._matchers.forEach((e=>e.stop()))}}class j_{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(U_),t.size){case 0:return U_;case 1:return Array.from(t)[0];default:return $_}}stop(){this._matchers.forEach((e=>e.stop()))}}class G_{triggerStatus(){return H_}stop(){}}var Q_=e=>"sessionRecording"in e;class Y_{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=(Q_(e)?wr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Q_(e)?wr(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){is.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){is.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return z_(this._instance,this._urlTriggers.length,this._groupId,Js,Ys,e)}triggerStatus(e){var t=this._urlTriggerStatus(e),r=t===H_?H_:t===$_?$_:U_;return this._instance.register_for_session({[Bo]:r}),r}checkUrlBlocklist(e,t){var r=Cs(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=W_(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=Cs(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=W_(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===H_,l=W_(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class Z_{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=$_;return Tr(this.linkedFlag)&&(e=U_),this.linkedFlagSeen&&(e=H_),this._instance.register_for_session({[Oo]:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(Q_(e)?wr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Tr(this.linkedFlag)&&!this.linkedFlagSeen){var i=Cr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=Cr(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(wr(r)&&i in r){var o=r[i];s=Pr(o)?!0===o:n?o===n:!!o}this.linkedFlagSeen=s,s&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class K_{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(Q_(e)?wr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return z_(this._instance,this._eventTriggers.length,this._groupId,Ks,Zs,e)}triggerStatus(e){var t=this._eventTriggerStatus(e),r=t===H_?H_:t===$_?$_:U_;return this._instance.register_for_session({[Fo]:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===H_,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class J_{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Y_(e,t.id),this._eventTriggerMatching=new K_(e,t.id),this._linkedFlagMatching=new Z_(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 V_(s):new j_(s)}else this._combinedMatching=new G_}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?Js+this.group.id:Ks+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function X_(e){if(e.rrwebError)return B_;if(!e.receivedFlags)return F_;if(!e.isRecordingEnabled)return R_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=!0===e.isSampled,r=new V_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?P_:r===H_?L_:r===$_?F_:!1===e.isSampled?R_:L_}function eg(e){if(e.rrwebError)return B_;if(!e.receivedFlags)return F_;if(!e.isRecordingEnabled)return R_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=new j_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==U_,i=Pr(e.isSampled);return r&&t===$_?F_:r&&t===U_||i&&!e.isSampled?R_:!0===e.isSampled?P_:L_}function tg(e){var t,r;return(null==(t=JSON.stringify(e,(r=[],function(e,t){if(wr(t)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(t)?"[Circular]":(r.push(t),t)}return t})))?void 0:t.length)||0}function rg(e){if(Ir(e))return 4;if(xr(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(br(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=xr(i)||Ir(i)?4:rg(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];xr(l)||(o||(s+=1),o=!1,s+=a.length+3+rg(l))}return s;default:return 0}}function ig(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[ig({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),ig({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]}class ng{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)&&e})));var i=this._numberOfChanges(t);return 0!==i||r===i?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new $r({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:is})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}class sg{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(to,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(to);return wr(t=r)&&Cr(t.sessionId)&&Mr(t.size)&&r.sessionId===e?r.size:0}}function og(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<Hr(100*t,0,100,is)}var ag=ns("[SessionRecording]");function lg(e,t){return t?e:"!"+e}function ug(e,t){return e===t||e!=="!"+t&&null}class cg{constructor(e,t,r,i,n,s){this._sampleRate=null,this._recordingStatusFunction=eg,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s}onRemoteConfig(e){this._sampleRate=Mr(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new V_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=X_):(this._triggerStatusMatcher=new j_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=eg),this._instance.register_for_session({[Do]: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})}))}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 Mr(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&&Tr(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){ag.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!Mr(n))return null==(r=this._instance.persistence)||r.unregister(Gs),void(null==(i=this._instance.persistence)||i.unregister($s));var s=this._instance.get_property(Gs),o=this._instance.get_property($s),a=ug(s,e),l=Mr(o)&&o!==n,u=xr(o)&&s===e,c=l||u||!Pr(a),d=c?og(e,n):a;c&&(d?this._reportStarted("sampled"):ag.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[Gs]:lg(e,d),[$s]:Ir(o)&&s===e?null:n})}ensureSamplingDecision(e){if(Mr(this._sampleRate)){var t=this._instance.get_property(Gs);Pr(ug(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Zs),null==(t=this._instance.persistence)||t.unregister(Ys),null==(r=this._instance.persistence)||r.unregister(Gs),null==(i=this._instance.persistence)||i.unregister($s),null==(n=this._instance.persistence)||n.unregister(Qs)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===$_}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class dg{constructor(e,t,r,i){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Do]:"v2_trigger_groups",[No]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):ag.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return B_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return R_;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===H_){var a=s.group.id,l=r.get(a);xr(l)?is.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===$_&&(i=!0)}return n?P_:i?F_:R_}({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;Mr(i)&&(Ir(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))}),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 ag.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(co),a=s.some((t=>!t.properties||0===t.properties.length||kd(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t))}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){ag.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=Xs+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(wr(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,c=Mr(p)&&p!==s,l=h===e&&Mr(p)&&p===s&&Pr(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var g=u||c||d||!Pr(l),v=g?og(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(Gs),null==(t=this._instance.persistence)||t.unregister($s),null==(r=this._instance.persistence)||r.unregister(Qs),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister(Ks+a),null==(s=this._instance.persistence)||s.unregister(Js+a),null==(o=this._instance.persistence)||o.unregister(Xs+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({[Ao]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===$_)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||kd(r,t,this._instance.get_property(co))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new J_(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name})}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}function hg(e){return wr(e)?e.network_timing:e}var pg,_g,gg=36e5,vg="[SessionRecording]",fg=ns(vg),mg=[M_.MouseMove,M_.MouseInteraction,M_.Scroll,M_.ViewportResize,M_.Input,M_.TouchMove,M_.MediaInteraction,M_.Drag],yg=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function bg(){var e;return null==Jn||null==(e=Jn.__PosthogExtensions__)?void 0:e.rrweb}function Sg(){var e;return null==(e=bg())?void 0:e.record}function wg(e){return sd(id(nd(JSON.stringify(e))))}function kg(e){return xg.apply(this,arguments)}function xg(){return(xg=t((function*(e){var t=JSON.stringify(e),r=yield cr(t,ts.DEBUG,{rethrow:!0});return sd(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Cg="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Eg=!1;function Ig(e){return br(e)&&0===e.length?pg=null!=pg?pg:wg([]):wg(e)}function Tg(e){return Mg.apply(this,arguments)}function Mg(){return(Mg=t((function*(e){return br(e)&&0===e.length?pg||(_g=null!=_g?_g:kg([]).then((e=>(pg=e,e))).catch((e=>{throw pg=void 0,_g=void 0,e}))):kg(e)}))).apply(this,arguments)}function Rg(e){return Cg&&!Eg&&function(e){return e.type===T_.FullSnapshot||e.type===T_.IncrementalSnapshot&&(e.data.source===M_.Mutation||e.data.source===M_.StyleSheetRule)}(e)}function Pg(e){return{event:e,size:rg(e)}}function Lg(e,t){return r({},e,{data:t,cv:"2024-10"})}function Fg(e,t){return r({},e,{cv:"2024-10",data:r({},e.data,t)})}function Og(e){try{if(e.type===T_.FullSnapshot)return Pg(Lg(e,wg(e.data)));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.Mutation)return Pg(Fg(e,{texts:Ig(e.data.texts),attributes:Ig(e.data.attributes),removes:Ig(e.data.removes),adds:Ig(e.data.adds)}));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.StyleSheetRule)return Pg(Fg(e,{adds:e.data.adds?wg(e.data.adds):void 0,removes:e.data.removes?wg(e.data.removes):void 0}))}catch(e){fg.error("could not compress event - will use uncompressed event",e)}return{event:e,size:tg(e)}}function Ag(){return Ag=t((function*(e){try{if(e.type===T_.FullSnapshot)return Pg(Lg(e,yield kg(e.data)));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.Mutation){var[t,r,i,n]=yield Promise.all([Tg(e.data.texts),Tg(e.data.attributes),Tg(e.data.removes),Tg(e.data.adds)]);return Pg(Fg(e,{texts:t,attributes:r,removes:i,adds:n}))}if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.StyleSheetRule){var[s,o]=yield Promise.all([e.data.adds?kg(e.data.adds):void 0,e.data.removes?kg(e.data.removes):void 0]);return Pg(Fg(e,{adds:s,removes:o}))}}catch(t){return ar(t)&&(Eg=!0),fg.error("could not compress event asynchronously - trying synchronous compression",t),Og(e)}return{event:e,size:tg(e)}})),Ag.apply(this,arguments)}function Dg(e,t){return e.type===T_.Custom&&e.data.tag===t}function Ng(e){return Dg(e,"sessionIdle")}function Bg(e){return Dg(e,"$session_ending")}function qg(e){return Dg(e,"$session_starting")}class Hg{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(vg+" 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 ug(this._instance.get_property(Gs),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return Mr(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._fullSnapshotTimestamps=[],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(eo),this._maxDepthExceeded=!1,null==(n=bg())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!0!==this._isIdle&&this.isStarted||(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[Qs])===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 Mr(r)&&Mr(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!Mr(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 Mr(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!Ir(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Qs]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==F_?(this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=Vn&&Vn.visibilityState&&this._tryAddCustomEvent("window "+Vn.visibilityState,{})},this._instance=e;var{sessionId:t,windowId:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=t,this._windowId=r,this._linkedFlagMatching=new Z_(this._instance),this._urlTriggerMatching=new Y_(this._instance),this._eventTriggerMatching=new K_(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||fg.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 sg(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 xr(u)&&xr(c)&&xr(d)?void 0:{maskAllInputs:null==u||u,maskTextSelector:c,blockSelector:d}}get _canvasResolutionScale(){var e;return Hr(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,ns("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:Hr(c,0,12,ns("canvas recording fps"),4),quality:Hr(d,0,1,ns("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=hg(this._instance.config.capture_performance),l=hg(null==i?void 0:i.capturePerformance),u=!!(Pr(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,i=[],n=null==(e=Jn.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());var s,o,a,l,u,c,d,h,p,_,g=null==(t=Jn.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this._networkPayloadCapture&&Sr(g)&&(!vs.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(g((l={payloadSizeLimitBytes:Ua.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Ua.performanceEntryTypeToObserve],payloadHostDenyList:[...(o=this._networkPayloadCapture).payloadHostDenyList||[],...Ua.payloadHostDenyList]},u=!1!==(s=this._instance.config).session_recording.recordHeaders&&o.recordHeaders,c=!1!==s.session_recording.recordBody&&o.recordBody,d=!1!==s.capture_performance&&o.recordPerformance,a=$a(l),h=e=>(null!=e&&e.requestBody&&(e.requestBody=Qa(e.requestBody,e.requestHeaders,a,"Request")),null!=e&&e.responseBody&&(e.responseBody=Qa(e.responseBody,e.responseHeaders,a,"Response")),e),p=e=>{return h(((e,t)=>{var r,i=fs(e.name),n=0===t.indexOf("http")?null==(r=fs(t))?void 0:r.pathname:t;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Ga.some((e=>0===s.indexOf(e)))))return e})((ja((t=e).requestHeaders),ja(t.responseHeaders),t),s.api_host));var t},(_=Sr(s.session_recording.maskNetworkRequestFn))&&Sr(s.session_recording.maskCapturedNetworkRequestFn)&&is.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),_&&(s.session_recording.maskCapturedNetworkRequestFn=e=>{var t=s.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==t?void 0:t.url})}),l.maskRequestFn=Sr(s.session_recording.maskCapturedNetworkRequestFn)?e=>{var t,r=p(e);return r&&null!==(t=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==t?t:void 0}:e=>function(e){if(!xr(e))return e.requestBody=Ya(e.requestBody,"Request"),e.responseBody=Ya(e.responseBody,"Response"),e}(p(e)),r({},Ua,l,{recordHeaders:u,recordBody:c,recordPerformance:d,recordInitialRequests:d,streamNetworkBody:!0===s.session_recording.streamNetworkBody})))):fg.info("NetworkCapture not started because we are on localhost.")),i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Yi(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Yi(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Hh,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(bs(r,i,Uh))}_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}):fg.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(yg((()=>Sg().addCustomEvent(e,t))))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!Un)return;var e=new URL(Un.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(yg((()=>Sg().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;return null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4: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))}}_pauseRecording(){this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,clearInterval(this._fullSnapshotTimer),fg.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"}),fg.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?Ys:Zs]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),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(Hs);if(e){var t;try{t=wr(e)?e:JSON.parse(e)}catch(e){return void fg.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>gg)return fg.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(Hs))}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{sessionId:n,windowId:s}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=n,this._windowId=s,null==(t=this._instance.persistence)||t.unregister(eo),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 dg(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this)):new cg(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.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(Us,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Us)})),this._checkOverride(zs,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(zs)})),this._checkOverride(Vs,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Vs)})),this._checkOverride(Ws,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ws)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(_s(Un,"beforeunload",this._onBeforeUnload),_s(Un,"offline",this._onOffline),_s(Un,"online",this._onOnline),_s(Un,"visibilitychange",this._onVisibilityChange),this._onSessionIdListener||(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),this._onSessionIdleResetForcedListener||(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)}))}))),Tr(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){fg.error("Could not add $pageview to rrweb session",e)}}))),this.status===L_&&this._reportStarted(e||"recording_initialized"))}else fg.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,n,s;null==Un||Un.removeEventListener("beforeunload",this._onBeforeUnload),null==Un||Un.removeEventListener("offline",this._onOffline),null==Un||Un.removeEventListener("online",this._onOnline),null==Un||Un.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(),fg.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),fg.info("stopped")})),!0}stop(){this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),fg.info("stopped"))}discard(){this._clearBuffer(),this._teardown(),fg.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===T_.FullSnapshot&&null!=(s=bg())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this.status!==R_?this._captureSnapshotBuffered(o):this._clearBuffer()}_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{event:t,size:r}=e.compressionEnabled?Og(e.event):{event:e.event,size:tg(e.event)};this._captureQueuedCompressionEvent(e,t,r)}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{event:t,size:i}=r?Rg(e)?yield function(e){return Ag.apply(this,arguments)}(e):Og(e):{event:e,size:tg(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&&wr(e))){if(e.type===T_.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===T_.Custom&&"recording paused"===e.data.tag}(e)){var u,c;e.type===T_.FullSnapshot&&(this._scheduleFullSnapshot(),null==(u=this._mutationThrottler)||u.reset(),null==(c=this._instance.persistence)||c.register_once({[eo]:e.timestamp},void 0)),e.type===T_.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&&wr(t)&&6===t.type&&wr(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 Bg(e)?e.data.payload:null}(h),_=function(e){return qg(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===T_.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 Ng(e)||Bg(e)||qg(e)}(h)){if(Ng(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&&Rg(h))this._enqueueCompression(h,y,v,f);else{var{event:b,size:S}=y?Og(h):{event:h,size:tg(h)};this._captureProcessedEvent(h,b,S,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}):R_}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({[Gs]:this.sessionId,[$s]:null}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_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,r=this._isBelowMinimumDuration();return this.status===F_||this.status===O_||this.status===R_||r?(this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this._buffer):(this._buffer.data.length>0&&(ig(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:ts.LIB_NAME,$lib_version:ts.LIB_VERSION})})),null==(t=this._strategy)||t.onFlushComplete()),this._clearBuffer())}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id;this._isIdle||943718.4>=this._buffer.size+e.$snapshot_bytes+r&&this._buffer.sessionId===i||(this._buffer=this._flushBuffer(),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||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],{sessionStartTimestamp:i}=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i: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===T_.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({[qo]:e}),fg.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!==mg.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(!this._isIdle){var{windowId:n,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this._sessionId!==s,a=this._windowId!==n;this._windowId=n,this._sessionId=s,o||a?(this.stop(),this.start("session_id_changed")):r&&this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,{sessionStartTimestamp: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,$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},o=this._instance.config.session_recording;for(var[a,l]of Object.entries(o||{}))a in s&&("maskInputOptions"===a?s.maskInputOptions=r({password:!0},l):s[a]=l);this._canvasRecording&&this._canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this._canvasRecording.fps},s.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},s.canvasResolutionScale=this._canvasResolutionScale),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);var u=Sg();if(u){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new ng(u,{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";fg.info(r,{node:t}),this.log(vg+" "+r,"warn")}});var c=this._gatherRRWebPlugins();if(this._stopRrweb=u(r({emit:e=>{this.onRRwebEmit(e)},plugins:c},s)),!this._stopRrweb)return this._rrwebError=!0,void fg.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=Pr(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:c.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else fg.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.initSessionRecording=e=>new Hg(e);class $g{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===Uo||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===$o}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{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Br(e)?1:_r(qr,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Md:Id;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?Id:Md;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Br(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==Wn?void 0:Wn.doNotTrack,null==Wn?void 0:Wn.msDoNotTrack,Jn.doNotTrack].some((e=>Br(e)))}}var Ug=ns("[Dead Clicks]"),zg=()=>!0,Wg=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Ns)),i=e.instance.config.capture_dead_clicks;return Pr(i)?i:!!wr(i)||r};class Vg{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Ns]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Ug.error("failed to load script",t):e()}))}_start(){var e;if(Vn){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Jn.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=wr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Jn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(Vn),Ug.info("starting...")}}else Ug.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Ug.info("stopping..."))}}var jg=ns("[SegmentIntegration]");var Gg="posthog-js";function Qg(e,t){var{organization:i,projectId:n,prefix:s,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,h;if("*"!==o&&!o.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==(l=t.exception)?void 0:l.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==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.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 i&&n&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+t.event_id),a&&(null==(_=e.exceptions)||_.sendExceptionEvent(f)),t}}class Yg{constructor(e,t,r,i,n,s){this.name=Gg,this.setupOnce=function(o){o(Qg(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class Zg{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(is.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==Un?void 0:Un.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{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=n;if(!(xr(s)||xr(o)||xr(a)||xr(l)||xr(u)||xr(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?Hr(o/s,0,1,is):1,h=s>1?Hr(a/s,0,1,is):1,p=l>1?Hr(u/l,0,1,is):1,_=l>1?Hr(c/l,0,1,is):1;i=as(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 Kg=["flags","surveys"],Jg={[Es]:{exposure:"hidden"},[Ms]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Rs]:{exposure:"hidden"},[Ps]:{exposure:"event"},[Ls]:{exposure:"hidden"},[Fs]:{exposure:"event"},[Os]:{exposure:"hidden"},[As]:{exposure:"event"},[Ds]:{exposure:"event"},[Ns]:{exposure:"event"},[Bs]:{exposure:"hidden"},[qs]:{exposure:"event"},[Hs]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[js]:{exposure:"hidden"},[Gs]:{exposure:"event"},[$s]:{exposure:"event",shouldSkipFromEventProperties:e=>Ir(e)},[Qs]:{exposure:"event"},[Ys]:{exposure:"event"},[Zs]:{exposure:"event"},[eo]:{exposure:"event"},[to]:{exposure:"hidden"},[ro]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!wr(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[io]:{exposure:"event",storageGroup:"flags"},[no]:{exposure:"hidden"},[so]:{exposure:"hidden",storageGroup:"flags"},[oo]:{exposure:"event",storageGroup:"flags"},[ao]:{exposure:"event",storageGroup:"flags",volatile:!0},[lo]:{exposure:"event"},[uo]:{exposure:"hidden"},[co]:{exposure:"hidden"},[ho]:{exposure:"hidden"},[po]:{exposure:"hidden",storageGroup:"surveys"},[_o]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[go]:{exposure:"event"},[vo]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[fo]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[yo]:{exposure:"hidden"},[bo]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[So]:{exposure:"hidden"},[wo]:{exposure:"hidden"},[ko]:{exposure:"hidden"},[xo]:{exposure:"hidden"},[Co]:{exposure:"hidden"},[Eo]:{exposure:"hidden"},[Io]:{exposure:"hidden"},[Us]:{exposure:"event"},[zs]:{exposure:"event"},[Ws]:{exposure:"event"},[Vs]:{exposure:"event"},[Ro]:{exposure:"event"},[Po]:{exposure:"event"},[Lo]:{exposure:"event"},[Fo]:{exposure:"event"},[Oo]:{exposure:"event"},[Ao]:{exposure:"event"},[Do]:{exposure:"event"},[No]:{exposure:"event"},[Bo]:{exposure:"event"},[qo]:{exposure:"event"}},Xg=[[Ks,{exposure:"hidden"}],[Js,{exposure:"hidden"}],[Xs,{exposure:"hidden"}]],ev=e=>{var t=Jg[e];if(t)return t;for(var[r,i]of Xg)if(0===e.indexOf(r))return i},tv={flags:bo,surveys:_o},rv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],iv="main";class nv{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_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&is.info("Persistence loaded",e.persistence,r({},this.props)),this.update_config(e,e,t),this.save(),Un){var n=()=>this.flush();_s(Un,"beforeunload",n,{capture:!1}),_s(Un,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Mr(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===rv.indexOf(e.persistence.toLowerCase())&&(is.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=[...Rd,...e];return r({},Md,{_parse(e){try{var r={};try{r=Id._parse(e)||{}}catch(e){}var i,n=JSON.parse(Md._get(e)||"{}");if(t){var s={};for(var o in r){var a=r[o];Ir(a)||""===a||(s[o]=a)}i=as(n,s)}else i=as(r,n);return Md._set(e,i),i}catch(e){}return null},_set(e,t,r,n,s,o){var a=Md._set(e,t,void 0,void 0,o);try{var l={};i.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&Id._set(e,l,r,n,s,o)}catch(e){Md._error(e)}return a},_remove(e,t){try{null==Un||Un.localStorage.removeItem(e),Id._remove(e,t)}catch(e){Md._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return"localstorage"===s&&Md._is_supported()?(t=Md,n=!0):"localstorage+cookie"===s&&i._is_supported()?(t=i,n=!0):"sessionstorage"===s&&Od._is_supported()?t=Od:"memory"===s?t=Ld:"cookie"===s?t=Id:i._is_supported()?(t=i,n=!0):t=Id,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[bo];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return os(this.props,((t,r)=>{var i=ev(r);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,r===ro?()=>this._isFeatureFlagCacheStale():()=>!1))return;i.transformToEventProperties&&as(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=as({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Kg){var t=Md._parse(this._groupEntryName(e));if(t&&!kr(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||as(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=ev(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=tv[e];if(!r)return!1;var i=t[r],n=this.props[r];return Mr(i)&&Mr(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=ev(e))?void 0:t.storageGroup:void 0,i=r?Md._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?xr(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){xr(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,iv))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var r of(this._writeEntry(this._storage,this._name,e,iv),Kg)){var i,n=t[r];(!kr(n)||null!=(i=this._slotState[r])&&i.persisted)&&this._writeEntry(Md,this._groupEntryName(r),n,r)}}_partitionProps(){var e={},t={};for(var r of Kg)t[r]={};return os(this.props,((r,i)=>{var n,s=null==(n=ev(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===iv)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return os(e,((e,t)=>{var i;r[t]=null!=(i=ev(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n=this._slotWriteState(i);if(i===iv||n.dirty||xr(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!==iv&&(n.persisted=!0),xr(s)||(n.fingerprint=s)):this._config.debug&&is.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(xr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var r of Kg)Md._remove(this._groupEntryName(r));t?delete this._slotState[iv]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(wr(e)){xr(t)&&(t="None"),this._expire_days=xr(r)?this._default_expiry:r;var i=!1;if(os(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(wr(e)){this._expire_days=xr(t)?this._default_expiry:t;var r=!1;if(os(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(){if(!this._campaign_params_saved){var e=Wh(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);kr(ds(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==Vn?void 0:Vn.referrer)?jh(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Yh(),$referring_domain:null!=Vn&&Vn.referrer&&(null==(e=fs(Vn.referrer))?void 0:e.host)||Qh},void 0)}set_initial_person_info(){this.props[xo]||this.props[Co]||this.register_once({[Eo]:Zh(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={};os([Co,xo],(t=>{var r=this.props[t];r&&os(r,(function(t,r){e["$initial_"+vr(r)]=t}))}));var t=this.props[Eo];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Kh(e,t),i={};return os(r,(function(e,t){i["$initial_"+vr(t)]=e})),i}(t,this._config.disable_capture_url_hashes);as(e,r)}return e}safe_merge(e){return os(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[Rs]||{};r[e]=t,this._setProp(Rs,r),this.save()}remove_event_timer(e){var t=this.props[Rs]||{},r=t[e];return xr(r)||(delete t[e],this._setProp(Rs,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=ev(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=ev(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var sv={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ov={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},av={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},lv=ns("[RateLimiter]");class uv{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=>{lv.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void lv.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{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(ko))&&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(ko,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var cv=ns("[RemoteConfig]");class dv{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Jn._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=Jn.__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 cv.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void cv.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return cv.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){cv.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&Vn&&"hidden"!==Vn.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){var t;e||cv.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var hv=3e3;class pv{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Hr((null==t?void 0:t.flush_interval_ms)||hv,250,5e3,is.createLogger("flush interval"),hv),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&&br(r.data)&&os(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){is.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return os(this._queue,(t=>{var i,n=t,s=(n?n.batchKey:null)||n.url;xr(e[s])&&(e[s]=r({},n,{data:[]})),null==(i=e[s].data)||i.push(n.data)})),this._queue=[],e}}var _v=["retriesPerformedSoFar"];class gv{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!xr(Un)&&"onLine"in Un.navigator&&(this._areWeOnline=Un.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},_s(Un,"online",this._onlineListener),_s(Un,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=i(e,_v);Rr(t)&&(n.url=cd(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&&is.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)"),is.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{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,xr(Un)||(this._onlineListener&&(Un.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Un.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(r({},e,{transport:"sendBeacon"}))}catch(e){is.error(e)}this._queue=[]}}class vv{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(){_s(Un,"scroll",this._updateScrollData,{capture:!0}),_s(Un,"scrollend",this._updateScrollData,{capture:!0}),_s(Un,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==Un?void 0:Un.document.documentElement;var e=br(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var r=null==Un?void 0:Un.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 Un?"y"===e?Un.scrollY||Un.pageYOffset||Un.document.documentElement.scrollTop||0:Un.scrollX||Un.pageXOffset||Un.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var fv=e=>Zh(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 mv{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({[wo]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||fv,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[wo]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Kh(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 os(ds(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+vr(r)]=t})),e}}class yv{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}}var bv=ns("[SessionId]");class Sv{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 yv,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Rr(e)||!Rr(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Uo)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||mc,this._windowIdGenerator=r||mc;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Hr(this._config.session_idle_timeout_seconds||1800,60,36e3,bv.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=Od._parse(this._window_id_storage_key),o=Od._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:Od._remove(this._window_id_storage_key),Od._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){bv.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return xr(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&&Od._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Od._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Od._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ir(t)&&!Ir(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({[js]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Rr(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(js):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Ir(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,r]=this._getSessionId();t===this._sessionId&&r===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[js]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Rr(e)?e:0,r=Rr(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[js];return br(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&&Un&&(Un.removeEventListener(Go,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Od._remove(this._primary_window_exists_storage_key)},_s(Un,Go,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===Uo)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),[,i,n]=this._getSessionId(),s=this._freshestActivityTimestamp(),o=this._getWindowId(),a=Rr(n)&&Math.abs(r-n)>864e5,l=!1,u=!1,c=!i,d=i,h=!c&&!e&&this._sessionHasBeenIdleTooLong(r,s);h&&((h=this._isSessionIdleAfterCrossTabRefresh(r))||bv.info("cross-tab refresh kept the session alive",{sessionId:i}),[,i,n]=this._getSessionId()),c||h||a?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),bv.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a}}),n=r,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(u=i!==d)&&(bv.info("adopted cross-tab session id",{sessionId:i,windowId:o}),l=!0));var p=Rr(s)&&e&&!a?s:r,_=Rr(n)?n:(new Date).getTime();this._setWindowId(o),this._setSessionId(i,p,_),e||this._resetIdleTimer();var g={noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this._sessionIdChangedHandlers.forEach((e=>e(i,o,g))),{sessionId:i,windowId:o,sessionStartTimestamp:_,changeReason:l?g:void 0,lastActivityTimestamp:s}}_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 wv=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&pr(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>pr(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function kv(){return kv=t((function*(){var e=null==Wn?void 0:Wn.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),r=null==t?void 0:t.model;return Cr(r)&&r.length>0?r:void 0}catch(e){return void is.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),kv.apply(this,arguments)}var xv="custom",Cv="i.posthog.com",Ev=/^\/static\//;class Iv{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("."+Cv,".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":xv),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Ev.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===xv)return this.apiHost+t;var i=Cv+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Tv=ns("[PostHog ExternalIntegrations]"),Mv={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Rv{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return Tv.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var r,n,s;!i||null!=(r=Jn.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]||e._loadScript(Mv[t],(()=>{var r;null==(r=Jn.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[t])||r.start(e._instance)})),!i&&null!=(n=Jn.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]&&(null==(s=Jn.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[t])||s.stop())};for(var[r,i]of Object.entries(null!==(n=this._instance.config.integrations)&&void 0!==n?n:{})){var n;t(r)}}}var Pv,Lv={},Fv=0,Ov=()=>{},Av='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Dv="Surveys module not available",Nv="sanitize_properties is deprecated. Use before_send instead",Bv="Invalid value for property_denylist config: ",qv="posthog",Hv=!od&&-1===(null==Kn?void 0:Kn.indexOf("MSIE"))&&-1===(null==Kn?void 0:Kn.indexOf("Mozilla")),$v=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:ps(null==Vn?void 0:Vn.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ov,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:jn&&Cr(null==jn?void 0:jn.search)&&-1!==jn.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==Un||null==(t=Un.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){is.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:Vo,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:hv},error_tracking:{},_onCapture:Ov},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:fa,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))},Uv=[["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"]],zv=e=>{var t={};for(var[r,i]of Uv)xr(e[r])||(t[i]=e[r]);var n=as({},t,e),s=e.__preview_external_dependency_versioned_paths;return xr(s)||(xr(e.strict_script_versioning)&&(n.strict_script_versioning=!!s),Cr(s)&&xr(e.asset_host)&&(n.asset_host=s)),br(e.property_blacklist)&&(xr(e.property_denylist)?n.property_denylist=e.property_blacklist:br(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:is.error(Bv+e.property_denylist)),n};class Wv{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){is.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Vv{_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===Uo||this.config.cookieless_mode===$o&&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 Wv,this._personProcessingSetOncePropertiesSent=!1,this.version=ts.LIB_VERSION,this._internalEventEmitter=new yv,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$v(),this.SentryIntegration=Yg,this.sentryIntegration=e=>function(e,t){var r=Qg(e,t);return{name:Gg,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 vv(this),this.pageViewManager=new Zg(this),this.rateLimiter=new uv(this),this.requestRouter=new Iv(this),this.consent=new $g(this),this.externalIntegrations=new Rv(this);var t=null!==(e=Vv.__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.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=Cr(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Cr(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>is.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==qv){var i,n=null!==(i=Lv[r])&&void 0!==i?i:new Vv;return n._init(e,t,r),Lv[r]=n,Lv[qv][r]=n,n}return this._init(e,t,r)}_init(e,t,i){var n,s;void 0===t&&(t={});var o=Cr(e)?e.trim():"";if(!o)return is.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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},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 a=$v(t.defaults),l=zv(t),u=as({},a,l,{name:i,token:o});wr(a.rageclick)&&wr(l.rageclick)&&(u.rageclick=as({},a.rageclick,l.rageclick)),wr(a.session_recording)&&wr(l.session_recording)&&(u.session_recording=as({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&is.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Sc.GZipJS;var c=this._is_persistence_disabled();this.persistence=new nv(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nv(r({},this.config,{persistence:"sessionStorage"}),c,!1);var d=r({},this.persistence.props),h=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new pv((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new gv(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new Sv(this),this.sessionPropsManager=new mv(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(is.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(is.info("Initializing extensions synchronously"),this._initExtensions(p)),ts.DEBUG=ts.DEBUG||this.config.debug,ts.DEBUG&&is.info("Starting in debug mode",{this:this,config:t,thisC:r({},this.config),p:d,s:h}),!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 _=t.bootstrap.distinctID,g=this.get_distinct_id(),v=this.persistence.get_property(So);if(t.bootstrap.isIdentifiedID&&null!=g&&g!==_&&v===zo)this.identify(_);else if(t.bootstrap.isIdentifiedID&&null!=g&&g!==_&&v===Wo)is.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 f=this.config.get_device_id(mc()),m=t.bootstrap.isIdentifiedID?f:_;this.persistence.set_property(So,t.bootstrap.isIdentifiedID?Wo:zo),this.register({distinct_id:_,$device_id:m})}}if(p)this.register_once({distinct_id:Mo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(mc());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(So,zo)}return _s(Un,"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()||mc();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(So,Wo)),t()},n=r.user();"then"in n&&Sr(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||jg.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()||(jg.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(jg.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,Qo),identify:e=>t(e,Zo),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Sr(this.config._onCapture)&&this.config._onCapture!==Ov&&(is.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&is.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 kv.apply(this,arguments)}().then((e=>{e&&this.register({[Ts]:e})})).catch(Ov),this}_initExtensions(e){var t,i,n,s,o,a,l,u=performance.now(),c=r({},Vv.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(n=this.surveys)&&void 0!==n?n:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Wg)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_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){is.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[Ro]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Po]:i}),this.config.__preview_deferred_init_extensions&&is.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!Vn||!Vn.body)return is.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=_r(e.supportedCompression,Sc.GZipJS)?Sc.GZipJS:_r(e.supportedCompression,Sc.Base64)?Sc.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Vo}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){is.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=jn&&jn.hostname){var e=jn.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 dv(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;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Yo),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(r=this._requestQueue)||r.unload(),null==(i=this._retryQueue)||i.unload()):this._shouldCapturePageleave()&&this.capture(Yo,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Hv?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,(xr(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,s.url=vd(s.url,s.compression);var o=null!==(t=s.transport)&&void 0!==t?t:"fetch",a=fd.filter((e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport))),l=null!==(i=null==(n=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(a,(e=>e.transport===o)))?void 0:n.method)&&void 0!==i?i:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&s.data&&s.compression===Sc.GZipJS&&Zn&&"undefined"!=typeof Promise&&!ld?gd(s).then((e=>{l(e)})).catch((t=>{if(or(t))return ld=!0,void l(r({},s,{compression:void 0,url:vd(e.url,void 0)}));ar(t)&&(ld=!0),l(s)})):l(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){Fv++;try{var t,r=[],i=[],n=[];ss(e,(e=>{if(e)if(br(t=e[0]))n.push(e);else if(Sr(e))try{e.call(this)}catch(t){is.error("Error executing queued PostHog call",e,t)}else br(e)&&"alias"===t?r.push(e):br(e)&&-1!==t.indexOf("capture")&&Sr(this[t])?n.push(e):i.push(e)}));var s=function(e,t){ss(e,(function(e){try{if(br(e[0])){var r=t;os(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){is.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{Fv--}}push(e){if(Fv>0&&br(e)&&Cr(e[0])){var t=Vv.prototype[e[0]];Sr(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var n,s,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!xr(e)&&Cr(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Cr(null==t?void 0:t.$current_url)&&(is.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i._originatedFromCaptureException||is.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 d=new Date,h=(null==i?void 0:i.timestamp)||d,p=Qi(null==i?void 0:i.uuid,mc),_={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},h,p)};e===Qo&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==i?void 0:i.$set)&&(_.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(_.$unset=g);var v=this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==Ko,e===Zo);if(v&&(_.$set_once=v),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,o=_,a=e=>Cr(e)?e.slice(0,s):e,l=new Set,_=function e(t,r){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),br(t)?(i=[],ss(t,(t=>{i.push(e(t))}))):(i={},os(t,((t,r)=>{l.has(t)||(i[r]=e(t,r))}))),i);var i}(o)),_.timestamp=h,xr(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=d),e===Vu.DISMISSED||e===Vu.SENT){var f=null==t?void 0:t[ju.SURVEY_ID],m=null==t?void 0:t[ju.SURVEY_ITERATION];cc({id:f,current_iteration:m}),_.$set=r({},_.$set,{[Ku({id:f,current_iteration:m},e===Vu.SENT?"responded":"dismissed")]:!0})}else e===Vu.SHOWN&&(_.$set=r({},_.$set,{[ju.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===ov.SHOWN){var y=null==t?void 0:t[av.TOUR_TYPE];y&&(_.$set=r({},_.$set,{[av.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var b=r({},_.properties.$set,_.$set);if(kr(b)||this.setPersonPropertiesForFlags(b),!Tr(this.config.before_send)){var S=this._runBeforeSend(_);if(!S)return;(_=S).uuid=Qi(_.uuid,mc)}this._internalEventEmitter.emit("eventCaptured",_);var w={method:"POST",url:null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",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(w):this._requestQueue.enqueue(w),_}is.critical("This capture call is ignored due to client rate limiting.")}}else is.error("No event name provided to posthog.capture")}else is.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}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.$cookieless_mode=!0),"$snapshot"===e){var l=r({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Cr(a.distinct_id)&&!Mr(a.distinct_id)||Er(a.distinct_id))&&is.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),!Kn)return{};var l,u,c=e?[...Hh,...t||[]]:[],[d,h]=function(e){for(var t=0;Wi.length>t;t++){var[r,i]=Wi[t],n=r.exec(e),s=n&&(Sr(i)?i(n,e):i);if(s)return s}return["",""]}(Kn),p=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},_={detectGoogleSearchApp:r},g=as(ds({$os:d,$os_version:h,$browser:$i(Kn,navigator.vendor,p,_),$device:Vi(Kn),$device_type:ji(Kn,{userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==Un||null==(o=Un.screen)?void 0:o.width,screenHeight:null==Un||null==(a=Un.screen)?void 0:a.height,devicePixelRatio:null==Un?void 0:Un.devicePixelRatio}),$timezone:Jh(),$timezone_offset:Xh()}),{$current_url:bs(i?Yi(null==jn?void 0:jn.href):null==jn?void 0:jn.href,c,Uh),$host:null==jn?void 0:jn.host,$pathname:null==jn?void 0:jn.pathname,$raw_user_agent:Kn.length>1e3?Kn.substring(0,997)+"...":Kn,$browser_version:zi(Kn,navigator.vendor,p,_),$browser_language:Gh(),$browser_language_prefix:(u=Gh(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==Un?void 0:Un.screen.height,$screen_width:null==Un?void 0:Un.screen.width,$viewport_height:null==Un?void 0:Un.innerHeight,$viewport_width:null==Un?void 0:Un.innerWidth,$lib:ts.LIB_NAME,$lib_version:ts.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ts.SDK_DIST_CHANNEL&&(g.$sdk_dist_channel=ts.SDK_DIST_CHANNEL),g}(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{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&as(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&as(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===xv&&(a.$lib_custom_api_host=this.config.api_host),u=e!==Qo||s?e!==Yo||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=as(a,u),e===Qo&&Vn&&(a.title=Vn.title),!xr(o)){var _=i.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}Kn&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=as({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),br(this.config.property_denylist)?os(this.config.property_denylist,(function(e){delete a[e]})):is.error(Bv+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(is.error(Nv),a=g(a,e));var v=this._hasPersonProcessing();return a.$process_person_profile=v,v&&!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=as({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&(is.error(Nv),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),kr(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;return null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(e,t)}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:Dv}),()=>{})}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:Dv})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Dv})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=hc),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:Dv}}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:Dv})}_validateIdentifyId(e){return!e||Er(e)?(is.critical("Unique user id has not been set in posthog.identify"),!1):e===Mo?(is.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())||(is.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 is.uninitializedWarning("posthog.identify");if(Mr(e)&&(e=e.toString(),is.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(Is)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Ms)&&(this.unregister(Ms),this.register({distinct_id:e}));var n,s=(this.persistence.get_property(So)||zo)===zo;e!==i&&s?(this.persistence.set_property(So,Wo),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(Zo,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=yd(e,t,r),null==(n=this.featureFlags)||n.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(fo))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=yd(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):is.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(br(e)?e:[e]).filter((e=>Cr(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(Ko,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else is.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;if(is.info("reset"),!this.__loaded)return is.uninitializedWarning("posthog.reset");var c,d=this.get_property(Is),h=this.get_property(Ts),p=this.get_property(Hs);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),xr(p)||null==(c=this.persistence)||c.register({[Hs]:p}),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.persistence)||l.set_property(So,zo),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Uo)this.register_once({distinct_id:Mo,$device_id:null},"");else{var _=this.config.get_device_id(mc());this.register_once({distinct_id:_,$device_id:e?_:d},""),e||xr(h)||this.register({[Ts]:h})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}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{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);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(Es)?(is.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(xr(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Ms,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(is.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=r({},this.config);if(wr(e)){var i,n,s,o,a,l,u,c,d,h,p;as(this.config,zv(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 nv(r({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this._checkLocalStorageForDebug(this.config.debug);Pr(g)&&(this.config.debug=g),Pr(this.config.debug)&&(this.config.debug?(ts.DEBUG=!0,Md._is_supported()&&Md._set("ph_debug",!0),is.info("set_config",{config:e,oldConfig:t,newConfig:r({},this.config)})):(ts.DEBUG=!1,Md._is_supported()&&Md._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){ts.LIB_NAME=e,ts.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:Vv._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:qv;return t!==qv&&(t=qv+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(So))===Wo||(null==(t=this.sessionPersistence)?void 0:t.get_property(So))===Wo}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Vo&&!this._isIdentified()&&kr(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ms])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Io]))}_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?(is.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Io,!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!==$o)}_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!==Uo){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 Sv(this),this.pageViewManager=new Zg(this),this.persistence&&(this.sessionPropsManager=new mv(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=Vv.__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==$o&&(null==(u=this.surveys)||u.loadIfEnabled()),(xr(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 is.warn(Av)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Uo?(this.config.cookieless_mode===$o&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===$o&&(this.register({distinct_id:Mo,$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())):is.warn(Av)}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===Uo||(this.config.cookieless_mode===$o?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 Wn?wv(Wn,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Vn&&("visible"===Vn.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Qo,{title:Vn.title},{send_instantly:!0}),this._visibilityStateListener&&(Vn.removeEventListener(jo,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),_s(Vn,jo,this._visibilityStateListener)))}debug(e){!1===e?(null==Un||Un.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Un||Un.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,t,r,i,n,s,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(is.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):(r="advanced_disable_decide",!1,i=is,n=(t="advanced_disable_flags")in(e=o)&&!Tr(e[t]),s=r in e&&!Tr(e[r]),n?e[t]:!!s&&(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]))}_runBeforeSend(e){var t;if(Tr(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Fr),i=br(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i){if(n=s(n),Tr(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return _r(tr,e.event)?is.warn(o+". This can cause unexpected behavior."):is.info(o),null}n.properties&&!kr(n.properties)||is.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of r)if(n.properties&&Tr(n.properties[a]))return is.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=Pr(e)&&!e,r=Md._is_supported()&&"true"===Md._get("ph_debug");return!t&&(!!r||e)}}Vv.__defaultExtensionClasses={},Vv._noopLogger={trace:Pv=()=>{},debug:Pv,info:Pv,warn:Pv,error:Pv,fatal:Pv},function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=cs(e.prototype[t[r]])}(Vv,["identify"]);var jv=ns("[ExceptionAutocapture]"),Gv=ns("[TracingHeaders]"),Qv=ns("[Web Vitals]"),Yv=9e5,Zv="[SessionRecording]",Kv=ns(Zv),Jv=ns("[Heatmaps]");function Xv(e){return wr(e)&&"clientX"in e&&"clientY"in e&&Mr(e.clientX)&&Mr(e.clientY)}var ef=ns("[Product Tours]"),tf=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(Bs))},rf=["$set_once","$set"],nf=ns("[SiteApps]"),sf="Error while initializing PostHog app with config id ";function of(e,t,r){if(Tr(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 af{constructor(e){this._debugEventEmitter=new yv,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;xr(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(!xr(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(null==t?void 0: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(!of(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=>of(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&of((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=>of(e.text,t.text,t.text_matching||"exact")||of(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;!Tr(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=>of(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||xd(t.properties.reduce(((e,t)=>{var r=br(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 lf{constructor(e){this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&xd(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===Nu.Activation?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;xr(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 af(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,Nu.Activation),this._cancelEventToItems=this._buildEventToItemMap(e,Nu.Cancellation))}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,Nu.Cancellation);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,Nu.Activation);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])}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&this._setActivatedItems(i)}_getPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}reset(){this._pendingActivatedItems=[],this._getPersistedActivatedIds().length>0&&this._setActivatedItems([])}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class uf extends lf{constructor(e){super(e)}_getActivatedKey(){return go}_getShownEventName(){return Vu.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 rc}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[go]:e})}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;this._getItems((e=>{r=e.find((e=>e.id===t))}));var i=!r||function(e){var t,r,i,n=(null!==(t=null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)&&void 0!==t?t:0)>0;return e.schedule===Wu.Always||!(null==(i=e.conditions)||null==(i=i.events)||!i.repeatedActivation||!n)}(r);return i?e===Vu.SHOWN?"consume":"ignore":e===Vu.SHOWN?"persist":e===Vu.DISMISSED||e===Vu.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var cf="SDK is not enabled or survey functionality is not yet loaded",df="Disabled. Not loading surveys.",hf=null!=Un&&Un.location?Ss(Un.location.hash,"__posthog")||Ss(location.hash,"state"):null,pf="_postHogToolbarParams",_f=ns("[Toolbar]"),gf=ns("[FeatureFlags]"),vf=ns("[FeatureFlags]",{debugEnabled:!0}),ff="\" failed. Feature flags didn't load in time.",mf=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},yf=e=>{var t={};for(var[r,i]of ls(e||{}))i&&(t[r]=i);return t},bf="Refusing to render web experiment since the viewer is a likely bot",Sf={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>md(t,e),not_regex:(e,t)=>!md(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class wf{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{wf._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(wf._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);Cr(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];wf._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())wf._logInfo(bf);else if(!this._config.disable_web_experiments){if(Tr(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();wf._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=wf.getWindowLocation();if(null!=e&&e.search){var t=ys(null==e?void 0:e.search,"__experiment_id"),r=ys(null==e?void 0:e.search,"__experiment_variant");t&&r&&(wf._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",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&&(wf._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!Tr(e.conditions)&&wf._matchUrlConditions(e,t)&&wf._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(Tr(e.conditions)||Tr(null==(r=e.conditions)?void 0:r.url))return!0;var i=wf.getWindowLocation();if(i){var n,s,o,a=xs(t,i.href);return null==(n=e.conditions)||!n.url||Sf[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==Un?void 0:Un.location}static _matchUTMConditions(e){var t;if(Tr(e.conditions)||Tr(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Wh();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];is.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?wf._logInfo(bf):"control"!==t?r.forEach((r=>{if(r.selector){var i;wf._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)}))}})):wf._logInfo("Control variants leave the page unmodified.")}_is_bot(){return Wn&&this._instance?wv(Wn,this._config.custom_blocked_useragents):void 0}}var kf=ns("[Conversations]"),xf="Conversations not available yet.",Cf="console",Ef={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._instance=e,this.featureFlagEventHandlers=[]}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,gf.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||(gf.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||gf.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(!xr(e)){if(br(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||gf.error("Invalid flag key found:",e,"Expected non-empty string"),t}));gf.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:r}=this._instance,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(ro))&&void 0!==n?n:{},a=null!=i&&i.merge&&null!==(s=this._prop(oo))&&void 0!==s?s:{},l=r({},o,e),u=r({},a,t),c={};for(var[d,h]of Object.entries(l))c[d]={key:d,enabled:Yt(h),variant:Zt(h),reason:void 0,metadata:xr(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(so),t=this._prop(lo),i=this._prop(uo);if(!i&&!t)return e||{};var n=as({},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=xr(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,h=xr(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||(gf.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:Yt(i),variant:Zt(i),payload:Qt(t[r])}}))}getFlagVariants(){var e=this._prop(ro),t=this._prop(lo);if(!t)return e||{};for(var r=as({},e),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(gf.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(oo),t=this._prop(uo);if(!t)return e||{};for(var r=as({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(gf.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._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())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i=this._config.token,n=this._prop(Is),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(co)||{}),group_properties:this._prop(ho),timezone:Jh()};Ir(n)||xr(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();xr(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:Sc.Base64,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,n=!0;if(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({[yo]:o}),u)gf.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())}}})}}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 gf.warn('getFeatureFlag for key "'+e+ff)}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(ao)||void 0,l=this._prop(bo)||void 0,u=this._prop(fo)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this._prop(mo);d&&d!==h&&(u={},null==(c=this._persistence)||c.register({[fo]:u,[mo]: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;br(u[e])?u[e].push(o):u[e]=[o],null==(p=this._persistence)||p.register({[fo]:u});var k=this.getFeatureFlagDetails(e),x=[...null!==(_=this._prop(yo))&&void 0!==_?_:[]];xr(n)&&x.push("flag_missing");var C={$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};xr(null==k||null==(f=k.metadata)?void 0:f.version)||(C.$feature_flag_version=k.metadata.version);var E,I=null!==(m=null==k||null==(y=k.reason)?void 0:y.description)&&void 0!==m?m:null==k||null==(b=k.reason)?void 0:b.code;I&&(C.$feature_flag_reason=I),null!=k&&null!=(S=k.metadata)&&S.id&&(C.$feature_flag_id=k.metadata.id),xr(null==k?void 0:k.original_variant)&&xr(null==k?void 0:k.original_enabled)||(C.$feature_flag_original_response=xr(k.original_variant)?k.original_enabled:k.original_variant),null!=k&&null!=(w=k.metadata)&&w.original_payload&&(C.$feature_flag_original_payload=null==k||null==(E=k.metadata)?void 0:E.original_payload),x.length&&(C.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",C)}if(i)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Qt(s)}}}else gf.warn('getFeatureFlagResult for key "'+e+ff)}getRemoteConfigPayload(e,t){var r=this._config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this._shouldIncludeEvaluationEnvironments()&&(i.evaluation_contexts=this._getValidEvaluationEnvironments());var n=this._getValidFlagKeys();xr(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:Sc.Base64,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){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return xr(r)?void 0:!!r}gf.warn('isFeatureEnabled for key "'+e+ff)}}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&&gf.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(br(u)){gf.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({[io]:u,[ro]:p})}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=>{var[t]=e;return m.has(t)})))),v=r({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return m.has(t)})))),f=r({},s,Object.fromEntries(Object.entries(f||{}).filter((e=>{var[t]=e;return m.has(t)}))))}else g=r({},i,g),v=r({},n,v),f=r({},s,f);t&&t.register(r({[io]:Object.keys(yf(g)),[ro]:g||{},[oo]:v||{},[so]:f||{}},d?{[ao]:d}:{},h?{[bo]:h}:{}))}}}(e,this._persistence,n,s,o,i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),gf.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return gf.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(lo),this._persistence.unregister(uo),this._fireFeatureFlagsCallbacks(),vf.info("All overrides cleared");if(br(e)){var t=mf(e);return this._persistence.register({[lo]:t}),this._fireFeatureFlagsCallbacks(),vf.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(lo),vf.info("Flag overrides cleared");else if(i.flags){if(br(i.flags)){var n=mf(i.flags);this._persistence.register({[lo]:n})}else this._persistence.register({[lo]:i.flags});vf.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._persistence.unregister(uo),vf.info("Payload overrides cleared")):i.payloads&&(this._persistence.register({[uo]:i.payloads}),vf.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[lo]:e}),this._fireFeatureFlagsCallbacks(),vf.info("Flag overrides set",{flags:e});gf.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n,s=(this._prop(no)||[]).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({[io]:Object.keys(yf(l)),[ro]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(no),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",callback:t=>{var r,i;if(t.json){var n=t.json.earlyAccessFeatures;return null==(r=this._persistence)||r.unregister(no),null==(i=this._persistence)||i.register({[no]: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{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((i=>i(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(co)||{},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({[co]:r({},i,o,n)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=r({},this._prop(co)||{});e.forEach((e=>{delete i[e]})),this._instance.register({[co]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(co),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(ho)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=r({},i[t],e[t]),delete e[t]})),this._instance.register({[ho]:r({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(ho)||{};this._instance.register({[ho]:r({},t,{[e]:{}})})}else this._instance.unregister(ho)}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}}},If={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===D_||this._recordingStatus===N_?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=R_,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw Kv.error("started without valid sessionManager"),new Error(Zv+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===Uo)throw new Error(Zv+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(Hs))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return Un&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var r=!xr(Object.assign)&&!xr(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),Kv.info("starting")):(this._recordingStatus=R_,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==D_&&this._recordingStatus!==N_&&(this._recordingStatus=A_),null!=Jn&&null!=(t=Jn.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=Jn.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=Jn.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return Kv.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(Gs),null==(t=this._persistence)||t.unregister($s)}_validateSampleRate(e,t){if(Tr(e))return null;var r,i=Mr(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(Kv.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;Tr(a)&&this._resetSampling();var l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[Hs]: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:xr(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){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===D_&&(this._recordingStatus=N_,Kv.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):Kv.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(Hs);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,r=this._instance.get_property(Hs);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return Kv.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<=gg}_onScriptLoaded(e){var t,r;if(null==(t=Jn.__PosthogExtensions__)||!t.initSessionRecording)return Kv.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lo]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(r=Jn.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===N_||this._recordingStatus===D_)return;return this._recordingStatus=D_,Kv.info("persisted remote config is stale, requesting fresh config before starting"),void new dv(this._instance).load()}this._recordingStatus=A_,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({[zs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Us]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?Ws:Vs]:!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))}}},Tf={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new m_(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,r=wr(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(Un&&Vn){var e=e=>{e=e||(null==Un?void 0:Un.event);try{this._captureEvent(e)}catch(e){b_.error("Failed to capture event",e)}};if(_s(Vn,"submit",e,{capture:!0}),_s(Vn,"change",e,{capture:!0}),_s(Vn,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==Un?void 0:Un.event);try{this._captureEvent(e,y_)}catch(e){b_.error("Failed to capture copy/cut event",e)}};_s(Vn,"copy",t,{capture:!0}),_s(Vn,"cut",t,{capture:!0})}}}else b_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ps]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var i=null==Vn?void 0:Vn.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[Ps];if(Ir(this._isDisabledServerSide)&&!Pr(r)&&!this.instance._shouldDisableFlags())return!1;var i=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!this.instance.config.autocapture&&!i}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,i=da(e);na(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())&&wa(i,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===y_;if(i&&function(e,t,r,i,n,s){var o,a,l,u,c,d;if(void 0===r&&(r=void 0),!Un||ka(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!aa(r.url_allowlist,s))return!1;if(null!=(a=r)&&a.url_ignorelist&&aa(r.url_ignorelist,s))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:p,targetElementList:_}=xa(e,i);if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(xr(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}(_,r))return!1;if(!pa(_,null==(u=r)?void 0:u.css_selector_allowlist))return!1;if(pa(_,null!==(c=null==(d=r)?void 0:d.css_selector_ignorelist)&&void 0!==c?c:ga))return!1;var g=Un.getComputedStyle(e);if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){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 p?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(ha.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this._config,n,n?["copy","cut"]:void 0,this.instance)){var{props:s,explicitNoCapture:o}=k_(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});if(o)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(s.$element_selectors=a),t===y_){var l,u=ua(null==Un||null==(l=Un.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=c}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return Sr(null==Vn?void 0:Vn.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==Un||null==(t=Un.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(is.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,is.info("History API monitoring stopped")}monitorHistoryChanges(){Un&&Un.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(Un&&(null==(t=Un.history[e])||!t.__posthog_wrapped__)){var r=this;ws(Un.history,e,(t=>function(i,n,s){t.call(this,i,n,s),r._capturePageview(e)}))}}_capturePageview(e){try{var t,r=null==Un||null==(t=Un.location)?void 0:t.pathname;if(!r)return;r!==this._lastPathname&&this.isEnabled&&this._instance.capture(Qo,{navigation_type:e}),this._lastPathname=r}catch(t){is.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};_s(Un,"popstate",e),this._popstateListener=()=>{Un&&Un.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[Ls]),this.rageclicks=new m_(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return wr(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Tr(this._config.capture_heatmaps)?Tr(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Jv.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("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ls]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==Vn?void 0:Vn.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){Un&&Vn&&(this._flushHandler=this._flush.bind(this),_s(Un,Go,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==Un?void 0:Un.event)),_s(Vn,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==Un?void 0:Un.event)),_s(Vn,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Vg(this.instance,zg,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),_s(Vn,jo,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;Un&&Vn&&(this._flushHandler&&Un.removeEventListener(Go,this._flushHandler),this._onClickHandler&&Vn.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&Vn.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&Vn.removeEventListener(jo,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&&ra(i)&&!ia(i,"body");){if(i===r)return!1;if(_r(t,null==Un?void 0:Un.getComputedStyle(i).position))return!0;i=_a(i)}return!1}(da(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"),!ta(e.target)&&Xv(e)){var n=this._getProperties(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&wa(da(e),this.instance.config.rageclick)&&this._capture(r({},n,{type:"rageclick"})),this._capture(n)}}_onMouseMove(e){!ta(e.target)&&Xv(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(Un){var t=this._config.disable_capture_url_hashes?Yi(Un.location.href):Un.location.href,r=this._config.custom_personal_data_properties,i=this._config.mask_personal_data_properties?[...Hh,...r||[]]:[],n=bs(t,i,Uh);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(e)}}_flush(){this._buffer&&!kr(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Vg,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(!xr(i))if(Tr(null==e?void 0:e.name)||Tr(null==e?void 0:e.value))Qv.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)),xr(this._buffer.url)&&(this._buffer.url=i),this._buffer.firstMetricTimestamp=xr(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()});xr(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 Qv.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=Jn.__PosthogExtensions__;xr(n)||xr(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:r,onINP:i}=n.postHogWebVitalsCallbacks),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):Qv.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Ds]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=wr(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Tr(r)?(null==(t=this._instance.persistence)?void 0:t.props[qs])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(wr(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=wr(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=wr(this._perfConfig)&&Mr(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Yv;return e>0&&6e4>=e?Yv:e}get isEnabled(){var e=null==jn?void 0:jn.protocol;if("http:"!==e&&"https:"!==e)return Qv.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=wr(this._perfConfig)?this._perfConfig.web_vitals:Pr(this._perfConfig)?this._perfConfig:void 0;return Pr(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Qv.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=wr(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=wr(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ds]:t}),this._instance.persistence.register({[qs]:r})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Qv.error("failed to load script",t):e()}))}_currentURL(){var e=Un?this._instance.config.disable_capture_url_hashes?Yi(Un.location.href):Un.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Hh,...t||[]]:[];return bs(e,r,Uh)}Qv.error("Could not determine current URL")}}},Mf={exceptionObserver:class{constructor(e){var t,r,i;this._startCapturing=()=>{var e;if(Un&&this.isEnabled&&null!=(e=Jn.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Jn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=Jn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Jn.__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){jv.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Fs]),this._rateLimiter=new $r({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10,refillInterval:1e4,_logger:jv}),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 wr(e)?t=r({},t,e):(xr(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?(jv.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return jv.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){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Fs]: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)?jv.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=kp(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Os))&&void 0!==t?t:[],this._exceptionStepsConfig=qn(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Hn(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=qn(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if("errorTracking"in e){var n=null!==(t=null==(r=e.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],s=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[Os]:this._suppressionRules,[As]:s})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(As),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(!Cr(e)||0===e.trim().length)return void wp.warn("Ignoring exception step because message must be a non-empty string");var i=this._coerceExceptionStepProperties(t),{sanitizedProperties:n,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>Nn.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(i);s.length>0&&wp.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(r({[An]:e,[Dn]:(new Date).toISOString()},n))}catch(e){wp.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 wp.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 wp.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 wp.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Tr(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return i&&this._exceptionStepsBuffer.clear(),i}catch(e){return wp.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void wp.error("Failed to process exception event. Ignoring this exception.",e)}}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:r({},e,{$exception_steps:t})}catch(t){return wp.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[An]:e,[Dn]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return wr(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;var t=e.reduce(((e,t)=>{var{type:r,value:i}=t;return Cr(r)&&r.length>0&&e.$exception_types.push(r),Cr(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,i=bd[e.operator],n=br(e.value)?e.value:[e.value],s=null!==(r=t[e.key])&&void 0!==r?r:[];return n.length>0&&i(n,s)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}_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!Tr(e)&&br(e)}}},Rf=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("productTours"in e){var t,r;if(this._persistence&&this._persistence.register({[Bs]:!!e.productTours}),!tf(this._instance))return!this._productTourManager&&Tr(null==(t=this._persistence)?void 0:t.props[vo])||ef.info("product tours disabled; stopping and clearing cached tours"),null==(r=this._productTourManager)||r.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&tf(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?ef.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Jn.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Jn.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!br(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[vo];if(br(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",callback:t=>{if(tf(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return ef.error(n),void e([],{isLoaded:!1,error:n})}var s=br(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[vo]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Tr(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(vo)}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)}}},Ef),Pf={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=Jn._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))c[p]={id:d[p],type:p,properties:_};var{$set_once:g,$set:v}=e;return{event:r({},i(e,rf),{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)||(nf.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)||(nf.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==Vn?void 0:Vn.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=>!Ir(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&&(nf.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,nf.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var{processEvent:s}=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1);s&&(t.processEvent=s),i=!0}catch(t){nf.error(sf+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){nf.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){nf.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 nf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var s=function(e){var t;Jn["__$$ph_site_app_"+e]=n._instance,null==(t=Jn.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(n._instance,a,(t=>{if(t)return nf.error(sf+e,t)}))};for(var{id:o,url:a}of e.siteApps)s(o)}else nf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Lf={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?(xr(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Jn.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),xr(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Jn.__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=Jn.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Gv.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 br(e)?(br(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(br(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()}}},Ff=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._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Tr(t))return rc.warn("Flags not loaded yet. Not loading surveys.");var r=br(t);this._isSurveysEnabled=r?t.length>0:t,rc.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(oc)||null!=i&&i.startsWith(ac))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)rc.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)rc.info(df);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())rc.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Jn?void 0:Jn.__PosthogExtensions__;if(e){if(!xr(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(Ho);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 rc.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new uf(this._instance),rc.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){rc.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 rc.info(df),e([]);var r,i=this._instance.get_property(po);if(i&&!t)return e(i,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:r,context:i}=t;return e(r,i)})):("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",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;rc.error(s);var o={isLoaded:!1,error:s};return e([],o),void(null==r||r({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>ic(e)&&(nc(e)||sc(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(i=this._instance.persistence)||i.register({[po]:l,[_o]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){rc.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Tr(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);rc.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(Tr(this._surveyManager))return{eligible:!1,reason:cf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Tr(this._surveyManager))return rc.warn("init was not called"),{visible:!1,disabledReason:cf};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Tr(this._surveyManager)?(rc.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:cf})):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._checkSurveyEligibility(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(Tr(this._surveyManager))rc.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(dc.includes(n.type)){var s=null==Vn?void 0:Vn.querySelector(t);if(s)return null!=(i=n.appearance)&&i.surveyPopupDelaySeconds?(rc.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;rc.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),rc.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);rc.warn("Survey element not found")}else rc.warn("Surveys of type "+n.type+" cannot be rendered in the app");else rc.warn("Survey not found")}}displaySurvey(e,t){var i;if(Tr(this._surveyManager))rc.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!==Gu.Popover&&t.initialResponses&&rc.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(n);if(!o.visible)return void rc.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Gu.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else rc.warn("Survey not found")}}cancelPendingSurvey(e){Tr(this._surveyManager)?rc.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Ef),Of={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Jn.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Jn.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),gs(this.instance.config))return!1;if(!Un||!Vn)return!1;e=null!=e?e:Un.location,r=null!=r?r:Un.history;try{if(!t){try{Un.localStorage.setItem("test","test"),Un.localStorage.removeItem("test")}catch(e){return!1}t=null==Un?void 0:Un.localStorage}var i,n=hf||Ss(e.hash,"__posthog")||Ss(e.hash,"state"),s=n?us((()=>JSON.parse(atob(decodeURIComponent(n)))))||us((()=>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(pf)||"{}")).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=Jn.ph_load_toolbar||Jn.ph_load_editor;!Tr(t)&&Sr(t)?t(e,this.instance):_f.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==Vn||!Vn.getElementById(To));if(!Un||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(Un.localStorage.setItem(pf,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=Jn.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return _f.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),_s(Un,"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)}}},Af=r({experiments:wf},Ef),Df={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){var t=e.conversations;Tr(t)||(Pr(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||gs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Jn?void 0:Jn.__PosthogExtensions__;if(e&&!xr(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(Ho);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 kf.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),kf.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else kf.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){kf.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():kf.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ir(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):(kf.warn(xf),null)}))()}getMessages(e,r){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,r):(kf.warn(xf),null)}))()}markAsRead(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.markAsRead(e):(kf.warn(xf),null)}))()}getTickets(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getTickets(e):(kf.warn(xf),null)}))()}requestRestoreLink(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.requestRestoreLink(e):(kf.warn(xf),null)}))()}restoreFromToken(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.restoreFromToken(e):(kf.warn(xf),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kf.warn(xf),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()}}},Nf={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ns("[logs]"),this._queue=[],this._consoleQueue=[],this._onReconnect=()=>{var e,t;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),Un&&_s(Un,"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=xr(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 sn(this._createHost(e,t),s,this._logger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,[this._core,this._resolvedConfig]=this._buildCore((()=>this._queue),(e=>{this._queue=e}))),this._core}_getConsoleCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this._consoleCore&&this._consoleResolvedFrom===r||(null==(t=this._consoleCore)||t.reset(),this._consoleResolvedFrom=r,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Cf)),this._consoleCore}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Tr(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()}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==Jn?void 0:Jn.__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(Ho)}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===Jt.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===Jt.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>ts.LIB_NAME,getLibraryVersion:()=>ts.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{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(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)})}}})}))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,ts.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Cf,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=nn(s,rn(r,ts.LIB_NAME,ts.LIB_VERSION),i,ts.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{sessionId:r,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=i,Tr(n)||(t.sessionStartTimestamp=n),Tr(s)||(t.lastActivityTimestamp=s)}if(null!=Jn&&null!=(e=Jn.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Yi(Jn.location.href):Jn.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},Bf=r({},Ef,If,Tf,Mf,Rf,Pf,Ff,Lf,Of,Af,Df,Nf);Vv.__defaultExtensionClasses=r({},Bf);var qf=function(){ts.SDK_DIST_CHANNEL="npm";var e=Lv[qv]=new Vv;return function(){function e(){e.done||(e.done=!0,Hv=!1,os(Lv,(function(e){e._dom_loaded()})))}null!=Vn&&Vn.addEventListener?"complete"===Vn.readyState?e():_s(Vn,"DOMContentLoaded",e,{capture:!1}):Un&&is.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Sc as Compression,sv as DEFAULT_PRODUCT_TOUR_APPEARANCE,Gu as DisplaySurveyType,Vv as PostHog,ov as ProductTourEventName,av as ProductTourEventProperties,Vu as SurveyEventName,ju as SurveyEventProperties,Nu as SurveyEventType,qu as SurveyPosition,zu as SurveyQuestionBranchingType,Uu as SurveyQuestionType,Wu as SurveySchedule,Hu as SurveyTabPosition,$u as SurveyType,Bu as SurveyWidgetType,qf as default,qf as posthog,bc as severityLevels};
|
|
1
|
+
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))(_||{}),g={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},v={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},f={};function m(e){if(f[e])return f[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 g?g[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 v?v[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 f[e]=t.prototype,t.prototype;var a=document.createElement("iframe");try{document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var u=l[e].prototype;return u?f[e]=u:r}catch(e){return r}finally{a.parentNode&&document.body.removeChild(a)}}var y={};function b(e,t,r){var i,n=e+"."+String(r);if(y[n])return y[n].call(t);var s=m(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(y[n]=o,o.call(t)):t[r]}var S={};function w(e,t,r){var i=e+"."+String(r);if(S[i])return S[i].bind(t);var n=m(e)[r];return"function"!=typeof n?t[r]:(S[i]=n,n.bind(t))}function k(){return m("MutationObserver").constructor}function x(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n=r(i);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=n,()=>{e[t]=i}}catch(e){return()=>{}}}var C={childNodes:e=>b("Node",e,"childNodes"),parentNode:e=>b("Node",e,"parentNode"),parentElement:e=>b("Node",e,"parentElement"),textContent:e=>b("Node",e,"textContent"),contains:(e,t)=>w("Node",e,"contains")(t),getRootNode:e=>w("Node",e,"getRootNode")(),host:e=>e&&"host"in e?b("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?b("Element",e,"shadowRoot"):null,querySelector:(e,t)=>w("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>w("Element",e,"querySelectorAll")(t),mutationObserver:k,patch:x};function E(e){return e.nodeType===e.ELEMENT_NODE}function I(e){var t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return Boolean(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function T(e){return"[object ShadowRoot]"==={}.toString.call(e)}function M(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=>R(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 R(e,t){var r;if(function(e){return"styleSheet"in e}(e)){var i;try{i=M(e.styleSheet)||function(e){var{cssText:t}=e;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 H(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?H(n,t):n}class P{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=C.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{element:t,maskInputOptions:r,tagName:i,type:n,value:s,maskInputFn:o}=e,a=s||"",l=n&&F(n);return(r[i.toLowerCase()]||l&&r[l])&&(a=o?o(a,t):"*".repeat(a.length)),a}function F(e){return e.toLowerCase()}var O="__rrweb_original__";function A(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?F(t):null}var D=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,N=/^(?:[a-z+]+:)?\/\//i,B=/^www\..*/i,q=/^(data:)([^,]*),(.*)/i;function H(e,t){return(e||"").replace(D,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(N.test(l)||B.test(l))return"url("+u+l+u+")";if(q.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 U,z,W="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",V=4096,j=1,G=new RegExp("[^a-z0-9-_:]"),Q=-2;function Y(){return j++}var Z=/^[^ \t\n\r\u000c]+/,K=/^[, \t\n\r\u000c]+/,J=new WeakMap;function X(e,t){return t&&""!==t.trim()?ee(e,t):t}function ee(e,t){var r=J.get(e);if(r||(r=e.createElement("a"),J.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function te(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?W:e}(e,t.maxBase64ImageLength):e}function re(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=X(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>V||e.naturalHeight>V)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)),te(u,s)}if("image"===t)return te(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=X(e,i);return"image"===t&&c.startsWith("data:")?te(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(K),t.length>r;){var s=i(Z);if(","===s.slice(-1))s=X(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=X(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?H(i,ee(e)):"object"===t&&"data"===r?X(e,i):i:X(e,i)}function ie(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function ne(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&ne(C.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&ne(C.parentNode(e),t,r)}function se(e,t,r,i){var n;if(E(e)){if(!C.childNodes(n=e).length)return!1}else{if(null===C.parentElement(e))return!1;n=C.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(ne(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}var oe=new Map;function ae(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function le(e){return null==e?"":e.toLowerCase()}var ue=50,ce=!1,de=!1;function he(e,t){var{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g={},inlineImages:v=!1,recordCanvas:f=!1,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b=5e3,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:x=(()=>!1),newlyAddedElement:R=!1,depth:P=0,maxDepth:D=ue}=t,{needsMask:N}=t,{preserveWhiteSpace:B=!0}=t;if(P>=D)return de=!0,ce||(ce=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+D+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;N||(N=se(e,o,a,void 0===N));var q,W=function(e,t){var{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:d={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v=!1}=t,f=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,i);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:f};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s,{doc:o,blockClass:a,blockSelector:l,inlineStylesheet:u,maskInputOptions:c={},maskInputFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:v,newlyAddedElement:f=!1,rootId:m}=t,y=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,a,l),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=F(e.tagName);return G.test(t)?"div":t}(e),S={},w=e.attributes.length,k=0;w>k;k++){var x=e.attributes[k];ie(b,x.name)||(S[x.name]=re(o,b,F(x.name),x.value,e,h))}if("link"===b&&u){var E=e.sheet;if(!E){var I=function(e){return e.href}(e);I&&!(E=ae(o,I))&&I.includes(".css")&&(E=ae(o,window.location.origin+"/"+I.replace(window.location.href,"")))}var T=null;E&&(T=M(E)),T&&(delete S.rel,delete S.href,S._cssText=T)}if("style"===b&&e.sheet&&!(e.innerText||C.textContent(e)||"").trim().length){var R=M(e.sheet);R&&(S._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var P=e.value,D=e.checked;"radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&P?S.value=L({element:e,type:A(e),tagName:b,value:P,maskInputOptions:c,maskInputFn:d}):D&&(S.checked=D)}if("option"===b&&(e.selected&&!c.select?S.selected=!0:delete S.selected),"dialog"===b&&e.open)try{S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){S.rr_open_mode="modal",S.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&g)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)||(S.rr_dataURL=e.toDataURL(h.type,h.quality));else if(!("__context"in e)){var N=e.toDataURL(h.type,h.quality),B=o.createElement("canvas");B.width=e.width,B.height=e.height,N!==B.toDataURL(h.type,h.quality)&&(S.rr_dataURL=N)}if("img"===b&&p){U||(U=o.createElement("canvas"),z=U.getContext("2d"));var q=e,H=q.currentSrc||q.getAttribute("src")||"<unknown-src>",W=q.crossOrigin,V=()=>{q.removeEventListener("load",V);try{U.width=q.naturalWidth,U.height=q.naturalHeight,z.drawImage(q,0,0),S.rr_dataURL=U.toDataURL(h.type,h.quality)}catch(e){if("anonymous"!==q.crossOrigin)return q.crossOrigin="anonymous",void(q.complete&&0!==q.naturalWidth?V():q.addEventListener("load",V));console.warn("Cannot inline img src="+H+"! Error: "+e)}"anonymous"===q.crossOrigin&&(W?S.crossOrigin=W:q.removeAttribute("crossorigin"))};q.complete&&0!==q.naturalWidth?V():q.addEventListener("load",V)}if("audio"===b||"video"===b){var j=S;j.rr_mediaState=e.paused?"paused":"played",j.rr_mediaCurrentTime=e.currentTime,j.rr_mediaPlaybackRate=e.playbackRate,j.rr_mediaMuted=e.muted,j.rr_mediaLoop=e.loop,j.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),y){var{width:Q,height:Y,left:Z,top:K}=e.getBoundingClientRect(),J=null==(r=o.defaultView)?void 0:r.getComputedStyle(e);S={class:S.class,rr_width:Q+"px",rr_height:Y+"px",rr_left:Math.floor(Z+((null==(i=o.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(K+((null==(n=o.defaultView)?void 0:n.scrollY)||0))+"px"},J&&(S.rr_position=J.position||"static",J.transform&&"none"!==J.transform&&(S.rr_transform=J.transform),J.display&&J.display.startsWith("inline")&&(S.rr_display=J.display))}"iframe"!==b||v(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);try{customElements.get(b)&&(s=!0)}catch(e){}return{type:_.Element,tagName:b,attributes:S,childNodes:[],isSVG:(X=e,Boolean("svg"===X.tagName||X.ownerSVGElement)||void 0),needBlock:y,rootId:m,isCustom:s};var X}(e,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:h,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v,rootId:f});case e.TEXT_NODE:return function(e,t){var r,{needsMask:i,maskTextFn:n,rootId:s}=t,o=C.parentNode(e),a=o&&o.tagName,l=C.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=M(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=H(l,ee(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,C.parentElement(e)):l.replace(/[\S]/g,"*")),{type:_.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:o,maskTextFn:u,rootId:f});case e.CDATA_SECTION_NODE:return{type:_.CDATA,textContent:"",rootId:f};case e.COMMENT_NODE:return{type:_.Comment,textContent:C.textContent(e)||"",rootId:f};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,dataURLOptions:g,inlineImages:v,recordCanvas:f,keepIframeSrcFn:x,newlyAddedElement:R});if(!W)return console.warn(e,"not serialized"),null;q=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&&(le(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===le(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(le(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&le(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(le(e.attributes.property).match(/^(og|twitter|fb):/)||le(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===le(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(le(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(le(e.attributes.name))||le(e.attributes.property).match(/^article:/)||le(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(le(e.attributes.name)))return!0}}return!1}(W,p)||!B&&W.type===_.Text&&!W.isStyle&&!W.textContent.replace(/^\s+|\s+$/gm,"").length?Q:Y();var V=Object.assign(W,{id:q});if(i.add(e,V),q===Q)return null;m&&m(e);var j=!l;if(V.type===_.Element){j=j&&!V.needBlock,delete V.needBlock;var Z=C.shadowRoot(e);Z&&T(Z)&&(V.isShadowHost=!0)}if((V.type===_.Document||V.type===_.Element)&&j){p.headWhitespace&&V.type===_.Element&&"head"===V.tagName&&(B=!1);var K={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P+1,maxDepth:D};if(V.type===_.Element&&"textarea"===V.tagName&&void 0!==V.attributes.value);else for(var J of Array.from(C.childNodes(e))){var X=he(J,K);X&&V.childNodes.push(X)}var te=null;if(E(e)&&(te=C.shadowRoot(e)))for(var ne of Array.from(C.childNodes(te))){var pe=he(ne,K);pe&&(T(te)&&(pe.isShadow=!0),V.childNodes.push(pe))}}var _e=C.parentNode(e);if(_e&&I(_e)&&T(_e)&&(V.isShadow=!0),V.type===_.Element&&"iframe"===V.tagName){var ge=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),e.removeEventListener("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?e.removeEventListener("load",o):(a=!0,e.removeEventListener("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),e.removeEventListener("load",o)}}return e.addEventListener("load",o),()=>{e.removeEventListener("load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&y){var r=he(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onIframeListenerRegistered:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P+1,maxDepth:D});r&&y(e,r)}}),b);null==S||S(e,ge)}return V.type===_.Element&&"link"===V.tagName&&"stylesheet"===V.attributes.rel&&function(t,l,_){if(!oe.has(t)){var S;try{S=t.sheet}catch(e){return}if(!S){var C=new AbortController,E=!1,I=()=>{if(!E){E=!0;try{(()=>{if(w){var t=he(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:N,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,preserveWhiteSpace:B,onSerialize:m,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:x,depth:P,maxDepth:D});t&&w(e,t)}})()}finally{oe.delete(t),C.abort()}}},T=setTimeout(I,_);C.signal.addEventListener("abort",(()=>clearTimeout(T)),{once:!0}),t.addEventListener("load",I,{signal:C.signal,once:!0}),oe.set(t,C)}}}(e,0,k),V}function pe(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 _e{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 _e))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 ge(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function ve(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var fe="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.",me={map:{},getId(){return console.error(fe),-1},getNode(){return console.error(fe),null},removeNodeFromMap(){console.error(fe)},has(){return console.error(fe),!1},reset(){console.error(fe)}};function ye(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 be(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){setTimeout((()=>{r.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>be(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(me=new Proxy(me,{get(e,t,r){return"map"===t&&console.error(fe),Reflect.get(e,t,r)}}));var Se=Date.now;function we(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=C.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=C.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function ke(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function xe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ce(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function Ee(e,t,r,i){if(!e)return!1;var n=Ce(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(ne(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 Ie(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Q}function Te(e,t){if(I(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=C.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Te(i,t))}function Me(e){return Boolean(e.changedTouches)}function Re(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Pe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Le(e){return!!e&&(e instanceof _e&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(C.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Se=()=>(new Date).getTime());class Fe{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 Oe(e){var t,r=null;return"getRootNode"in e&&(null==(t=C.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function Ae(e){var t=e.ownerDocument;return!!t&&(C.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Oe(r);)r=t;return r}(e);return C.contains(t,r)}(e))}function De(e){return"__ln"in e}class Ne{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&&De(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&&De(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 Be,qe=(e,t)=>e+"@"+t;class He{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,"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 Ne,i=e=>{for(var t=e,r=Q;r===Q;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=C.parentNode(n);if(s&&Ae(n)&&"TEXTAREA"!==s.tagName){var o=I(s)?this.mirror.getId(Oe(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=he(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,inlineImages:this.inlineImages,onSerialize:e=>{Re(e,this.mirror)&&this.iframeManager.addIframe(e),Pe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Le(n)&&this.shadowDomManager.addShadowRoot(C.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)Ue(this.removesSubTreeCache,s)&&!this.movedSet.has(C.parentNode(s))||n(s);for(var o of this.addedSet)ze(this.droppedSet,o)||Ue(this.removesSubTreeCache,o)?ze(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(C.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(C.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var _=C.parentNode(h.value);if(_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=C.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=C.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{attributes:t}=e;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(C.childNodes(e),(e=>C.textContent(e)||"")).join("");t.attributes.value=L({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:A(e),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(e=>{if(!Ie(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=C.textContent(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:se(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ce(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=A(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Ee(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"),!ie(r.tagName,i))if(o.attributes[i]=re(this.doc,F(r.tagName),F(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(Ee(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=I(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||Ie(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?($e(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Te(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[qe(r,i)]?$e(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!I(e.target)||!T(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),C.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)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ie(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[qe(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ee(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach((e=>this.genAdds(e))),Le(e)&&C.childNodes(C.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),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.shadowDomManager.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 $e(e,t){e.delete(t),C.childNodes(t).forEach((t=>$e(e,t)))}function Ue(e,t,r){return 0!==e.size&&function(e,t,r){var i=C.parentNode(t);return!!i&&e.has(i)}(e,t)}function ze(e,t){return 0!==e.size&&We(e,t)}function We(e,t){var r=C.parentNode(t);return!!r&&(!!e.has(r)||We(e,r))}var Ve=e=>Be?function(){try{return e(...arguments)}catch(e){if(Be&&!0===Be(e))return;throw e}}:e,je=[];function Ge(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 Qe(e,t){var r=new He;je.push(r),r.init(e);var i=new(k())(Ve(r.processMutations.bind(r)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:i,buffer:r}}function Ye(e){var{scrollCb:t,doc:r,mirror:i,blockClass:n,blockSelector:s,sampling:o}=e,a=new Map,l=e=>{var o=Ge(e);if(o&&!Ee(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=we(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=[ge("scroll",Ve(ye(Ve((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(ge("scrollend",Ve(l),r)),()=>u.forEach((e=>e()))}function Ze(e,t){for(var r=je.length-1;r>=0;r--){var i=je[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),je.splice(r,1))}}}var Ke=["INPUT","TEXTAREA","SELECT"],Je=new WeakMap;function Xe(e){return function e(t,r){if(it("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||it("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||it("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||it("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 et(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}function tt(e,t){var r,i,n,s,{mirror:o,stylesheetManager:a}=e;s=o.getId("#document"===t.nodeName?t:C.host(t));var l="#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,u=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&l&&u?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null==(e=u.get)?void 0:e.call(this)},set(e){var t,r=null==(t=u.set)?void 0:t.call(this,e);if(null!==s&&-1!==s)try{a.adoptStyleSheets(e,s)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function rt(e,t){void 0===t&&(t={});var i,n,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var{mutationCb:r,mousemoveCb:i,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;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=Qe(e,e.doc);i=o.observer,n=o.buffer}var a=function(e){var{mousemoveCb:t,sampling:r,doc:i,mirror:n}=e;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=ye(Ve((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),d=Ve(ye(Ve((e=>{var t=Ge(e),{clientX:r,clientY:i}=Me(e)?e.changedTouches[0]:e;s||(s=Se()),l.push({x:r,y:i,id:n.getId(t),timeOffset:Se()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)})),o,{trailing:!1})),h=[ge("mousemove",d,i),ge("touchmove",d,i),ge("drag",d,i)];return Ve((()=>{h.forEach((e=>e()))}))}(e),l=function(e){var{mouseInteractionCb:t,doc:i,mirror:n,blockClass:s,blockSelector:o,sampling:a}=e;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=F(e),l=(e=>i=>{var a=Ge(i);if(!Ee(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 Me(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=Me(i)?i.changedTouches[0]:i;if(p){var _=n.getId(a),{clientX:g,clientY:v}=p;Ve(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(ge(a,l,i))})),Ve((()=>{u.forEach((e=>e()))}))}(e),h=Ye(e),_=function(e,t){var{viewportResizeCb:r}=e,{win:i}=t,n=-1,s=-1;return ge("resize",Ve(ye(Ve((()=>{var e=ke(),t=xe();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:s}),g=function(e){var{inputCb:t,doc:i,mirror:n,blockClass:s,blockSelector:o,ignoreClass:a,ignoreSelector:l,maskInputOptions:u,maskInputFn:c,sampling:d,userTriggeredOnInput:h}=e;function p(e){var t=Ge(e),r=e.isTrusted,n=t&&t.tagName;if(t&&"OPTION"===n&&(t=C.parentElement(t)),t&&n&&Ke.indexOf(n)>=0&&!Ee(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var d=t.value,p=!1,g=A(t)||"";"radio"===g||"checkbox"===g?p=t.checked:(u[n.toLowerCase()]||u[g])&&(d=L({element:t,maskInputOptions:u,tagName:n,type:g,value:d,maskInputFn:c})),_(t,h?{text:d,isChecked:p,userTriggered:r}:{text:d,isChecked:p});var v=t.name;"radio"===g&&v&&p&&i.querySelectorAll('input[type="radio"][name="'+v+'"]').forEach((e=>{if(e!==t){var r=e.value;_(e,h?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}function _(e,i){var s=Je.get(e);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Je.set(e,i);var o=n.getId(e);Ve(t)(r({},i,{id:o}))}}var g=("last"===d.input?["change"]:["input","change"]).map((e=>ge(e,Ve(p),i))),v=i.defaultView;if(!v)return()=>{g.forEach((e=>e()))};var f=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value");return f&&f.set&&g.push(...[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]].map((e=>be(e[0],e[1],{set(){Ve(p)({target:this,isTrusted:!1})}},!1,v)))),Ve((()=>{g.forEach((e=>e()))}))}(e),v=function(e){var{mediaInteractionCb:t,blockClass:r,blockSelector:i,mirror:n,sampling:s,doc:o}=e,a=Ve((e=>ye(Ve((s=>{var o=Ge(s);if(o&&!Ee(o,r,i,!0)){var{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=o;t({type:e,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),s.media||500))),l=[ge("play",a(p.Play),o),ge("pause",a(p.Pause),o),ge("seeked",a(p.Seeked),o),ge("volumechange",a(p.VolumeChange),o),ge("ratechange",a(p.RateChange),o)];return Ve((()=>{l.forEach((e=>e()))}))}(e),f=()=>{},m=()=>{},y=()=>{},b=()=>{};e.recordDOM&&(f=function(e,t){var{styleSheetRuleCb:r,mirror:i,stylesheetManager:n}=e,{win:s}=t;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var o=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((e,t,s)=>{var[o,a]=s,{id:l,styleId:u}=et(t,i,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,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:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,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:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,replace:o}),e.apply(t,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,replaceSync:o}),e.apply(t,s)}))}));var c={};nt("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(nt("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),nt("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),nt("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(c).forEach((e=>{var[t,s]=e;d[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Ve(((e,t,s)=>{var[o,a]=s,{id:l,styleId:u}=et(t.parentStyleSheet,i,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:o,index:[...Xe(t),a||0]}]}),e.apply(t,s)}))}),s.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Ve(((e,t,s)=>{var[o]=s,{id:a,styleId:l}=et(t.parentStyleSheet,i,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&r({id:a,styleId:l,removes:[{index:[...Xe(t),o]}]}),e.apply(t,s)}))})})),Ve((()=>{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,r]=e;r.prototype.insertRule=d[t].insertRule,r.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:s}),m=tt(e,e.doc),y=function(e,t){var{styleDeclarationCb:r,mirror:i,ignoreCSSAttributes:n,stylesheetManager:s}=e,{win:o}=t,a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Ve(((e,t,o)=>{var l,[u,c,d]=o;if(n.has(u))return a.apply(t,[u,c,d]);var{id:h,styleId:p}=et(null==(l=t.parentRule)?void 0:l.parentStyleSheet,i,s.styleMirror);return(h&&-1!==h||p&&-1!==p)&&r({id:h,styleId:p,set:{property:u,value:c,priority:d},index:Xe(t.parentRule)}),e.apply(t,o)}))});var l=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ve(((e,t,o)=>{var a,[u]=o;if(n.has(u))return l.apply(t,[u]);var{id:c,styleId:d}=et(null==(a=t.parentRule)?void 0:a.parentStyleSheet,i,s.styleMirror);return(c&&-1!==c||d&&-1!==d)&&r({id:c,styleId:d,remove:{property:u},index:Xe(t.parentRule)}),e.apply(t,o)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:s}),e.collectFonts&&(b=function(e){var{fontCb:t,doc:r}=e,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=x(r.fonts,"add",(function(e){return function(r){return setTimeout(Ve((()=>{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),Ve((()=>{n.forEach((e=>e()))}))}(e)));var S=function(e){var{doc:t,mirror:r,blockClass:i,blockSelector:n,selectionCb:s}=e,o=!0,a=Ve((()=>{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),{startContainer:d,startOffset:h,endContainer:p,endOffset:_}=c;Ee(d,i,n,!0)||Ee(p,i,n,!0)||a.push({start:r.getId(d),startOffset:h,end:r.getId(p),endOffset:_})}s({ranges:a})}}));return a(),ge("selectionchange",a)}(e),w=function(e){var{doc:t,customElementCb:r}=e,i=t.defaultView;return i&&i.customElements?x(i.customElements,"define",(function(e){return function(t,i,n){try{r({define:{name:t}})}catch(e){console.warn("Custom element callback failed for "+t)}return e.apply(this,[t,i,n])}})):()=>{}}(e),k=[];for(var E of e.plugins)k.push(E.observer(E.callback,s,E.options));return Ve((()=>{if(n){n.destroy(),n.reset();var e=je.indexOf(n);-1!==e&&je.splice(e,1)}null==i||i.disconnect(),a(),l(),h(),_(),g(),v(),f(),m(),y(),b(),S(),w(),k.forEach((e=>e()))}))}function it(e){return void 0!==window[e]}function nt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class st{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 ot{constructor(e){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new st(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 st(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=>ve(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{var{win:t,handler:r}=e;ve((()=>t.removeEventListener("pagehide",r)))})),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);ve((()=>{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)}))}ve((()=>{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);if(n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(ve((()=>e.removeEventListener("message",t))),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)){var s=this.nestedIframeListeners.get(i);ve((()=>i.removeEventListener("message",s))),this.nestedIframeListeners.delete(i)}i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var o=this.attachedDocuments.get(r);o&&(o.forEach((e=>{ve((()=>this.mirror.removeNodeFromMap(e)))})),ve((()=>Ze(r,o))),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{content:r}=e;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&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{ve((()=>t.removeEventListener("message",e)))})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>{var{element:r}=t;return e.add(r)})),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 at{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){if(T(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var{observer:i,buffer:n}=Qe(r({},this.bypassOptions,{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>{i.disconnect(),n.destroy(),n.releaseCanvasManager();var e=je.indexOf(n);-1!==e&&je.splice(e,1)})),this.restoreHandlers.push(Ye(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(C.host(e))),this.restoreHandlers.push(tt({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(x(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=C.shadowRoot(this);return s&&Ae(this)&&r.addShadowRoot(s,t),n}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ut="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ct=0;64>ct;ct++)ut[lt.charCodeAt(ct)]=ct;var dt=new Map,ht=(e,t,r)=>{if(e&&(gt(e,t)||"object"==typeof e)){var i=function(e,t){var r=dt.get(e);return r||dt.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 pt(e,t,r,i){if(e instanceof Array)return e.map((e=>pt(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+=lt[r[t]>>2],n+=lt[(3&r[t])<<4|r[t+1]>>4],n+=lt[(15&r[t+1])<<2|r[t+2]>>6],n+=lt[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}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[pt(e.buffer,t,r,i),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){var o=e.constructor.name,{src:a}=e;return{rr_type:o,src:a}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[pt(e.data,t,r,i),e.width,e.height]}:gt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ht(e,t,r)}:e}var _t=(e,t,r,i)=>e.map((e=>pt(e,t,r,i))),gt=(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])))},vt=["webgl","webgl2"];function ft(e){return"nodeType"in e}function mt(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 x(n.prototype,"configure",(function(n){return function(s){var o=function(e){var{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!o||ft(o)&&Ee(o,t,i,!0))return n.call(this,s);ft(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=x(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(!Ee(this,t,i,!0)&&("__context"in this||(this.__context=s),n&&vt.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 yt(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=x(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(ht(d,s,this),"tagName"in this.canvas&&!Ee(this.canvas,i,n,!0)){var h=_t(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(i){var c=be(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 bt,St,wt,kt='(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 transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, displayWidth, displayHeight });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, displayWidth, displayHeight });\n lastFingerprintMap.set(id, fingerprint);\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//# sourceMappingURL=image-bitmap-data-url-worker-CSpkoNCs.js.map\n',xt="undefined"!=typeof self&&self.Blob&&new Blob([kt],{type:"text/javascript;charset=utf-8"});function Ct(e){var t;try{if(!(t=xt&&(self.URL||self.webkitURL).createObjectURL(xt)))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(kt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Et{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,"processMutation",((e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)}));var{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:s,dataURLOptions:o,resolutionScale:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,i,n,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:o,resolutionScale:l})}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="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=mt(r,i,n,!0),u=new Map,c=new Ct;c.onmessage=e=>{var{id:t}=e.data;if(u.set(t,!1),"base64"in e.data){var{base64:r,type:i,displayWidth:n,displayHeight:s}=e.data;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,n,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:i}]},0,0,n,s]}],displayWidth:n,displayHeight:s})}};var d,p=1e3/e,_=0,g=e=>{var l,h;_&&p>e-_||(_=e,(l=[],h=e=>{try{e.querySelectorAll("canvas").forEach((e=>{Ee(e,i,n,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&h(e.shadowRoot)}))}catch(e){}},h(r.document),l).forEach(function(){var e=t((function*(e){var t,r,i=o.mirror.getId(e);if(!u.get(i)&&0!==e.width&&0!==e.height){u.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 u.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var l=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(l*a)),p=Math.max(1,Math.round(d*a)),_=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});c.postMessage({id:i,bitmap:_,width:h,height:p,displayWidth:l,displayHeight:d,dataURLOptions:s.dataURLOptions},[_])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(g)};d=requestAnimationFrame(g),this.resetObservers=()=>{l(),cancelAnimationFrame(d)}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=mt(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=x(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 Ee(this.canvas,r,i,!0)||setTimeout((()=>{var r=_t(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=be(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(...yt(t.WebGLRenderingContext.prototype,h.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...yt(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))),{type:o}=r[0];this.mutationCb({id:t,type:o,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class It{constructor(e){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Fe),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:R(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,oe.forEach((e=>e.abort())),oe.clear()}trackStylesheetInLinkElement(e){}}class Tt{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 Mt=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Rt=document.createElement("iframe");document.body.appendChild(Rt),Array.from=(null==(n=Rt.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Rt)}}catch(e){console.debug("Unable to override Array.from",e)}var Pt=new P;function Lt(e){void 0===e&&(e={});var{emit:t,checkoutEveryNms:i,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:d="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,maskAllInputs:_,maskInputOptions:g,slimDOMOptions:v,maskInputFn:f,maskTextFn:m,hooks:y,packFn:b,sampling:S={},dataURLOptions:w={},canvasResolutionScale:k,mousemoveWait:x,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:T=!1,recordAfter:M=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:L=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:A=(()=>!1),ignoreCSSAttributes:D=new Set([]),errorHandler:N}=e;Be=N;var B=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},w),q=!T||window.parent===window,H=!1;if(!q)try{window.parent.document&&(H=!1)}catch(e){H=!0}if(q&&!t)throw new Error("emit function is required");if(!q&&!H)return()=>{};void 0!==x&&void 0===S.mousemove&&(S.mousemove=x),Pt.reset();var U,z=!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==g?g:{password:!0},W=pe(void 0!==v&&v);!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 V,j,G=0,Q=new Map,Y=e=>{for(var t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return b&&!H&&(e=b(e)),e};bt=(e,r)=>{var s,o=e;if(o.timestamp=Se(),!(null==(s=je[0])?void 0:s.isFrozen())||o.type===l.FullSnapshot||o.type===l.IncrementalSnapshot&&o.data.source===u.Mutation||je.forEach((e=>e.unfreeze())),q)null==t||t(Y(o),r);else if(H){var a={type:"rrweb",event:Y(o),origin:window.location.origin,isCheckout:r};window.parent.postMessage(a,"*")}if(o.type===l.FullSnapshot)U=o,G=0;else if(o.type===l.IncrementalSnapshot){if(o.data.source===u.Mutation&&o.data.isAttachIframe)return;G++,(n&&G>=n||i&&o.timestamp-U.timestamp>i)&&St(!0)}};var Z=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=Pt.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}e.removes.forEach((e=>{var{id:r}=e;if(!t||!t.has(r)){var n=ee.getIframeElementById(r);n&&i.has(n)?ee.forgetIframeId(r):(null==V||V(r),ee.removeIframeById(r))}})),null==j||j(),ee.cleanupDetachedIframes()}bt({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},K=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),J=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),X=new It({mutationCb:Z,adoptedStyleSheetCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),ee=new ot({mirror:Pt,mutationCb:Z,stylesheetManager:X,recordCrossOriginIframes:T,wrappedEmit:bt});for(var te of O||[])te.getMirror&&te.getMirror({nodeMirror:Pt,crossOriginIframeMirror:ee.crossOriginIframeMirror,crossOriginIframeStyleMirror:ee.crossOriginIframeStyleMirror});var re=new Tt;wt=new Et({recordCanvas:I,mutationCb:J,win:window,blockClass:s,blockSelector:o,mirror:Pt,sampling:S.canvas,dataURLOptions:B,resolutionScale:k});var ie=new at({mutationCb:Z,scrollCb:K,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:z,dataURLOptions:B,maskTextFn:m,maskInputFn:f,recordCanvas:I,inlineImages:F,sampling:S,slimDOMOptions:W,iframeManager:ee,stylesheetManager:X,canvasManager:wt,keepIframeSrcFn:A,processedNodeManager:re},mirror:Pt});St=function(e){if(void 0===e&&(e=!1),E){bt({type:l.Meta,data:{href:window.location.href,width:xe(),height:ke()}},e),X.reset(),ie.init(),je.forEach((e=>e.lock()));var t=function(e,t){var{mirror:r=new P,blockClass:i="rr-block",blockSelector:n=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:h,slimDOM:p=!1,dataURLOptions:_,preserveWhiteSpace:g,onSerialize:v,onIframeLoad:f,iframeLoadTimeout:m,onIframeListenerRegistered:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w=(()=>!1),maxDepth:k}=t||{};return he(e,{doc:e,mirror:r,blockClass:i,blockSelector:n,maskTextClass:s,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===c?{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===c?{password:!0}:c,maskTextFn:d,maskInputFn:h,slimDOMOptions:pe(p),dataURLOptions:_,inlineImages:l,recordCanvas:u,preserveWhiteSpace:g,onSerialize:v,onIframeLoad:f,iframeLoadTimeout:m,onIframeListenerRegistered:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w,newlyAddedElement:!1,maxDepth:k})}(document,{mirror:Pt,blockClass:s,blockSelector:o,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:z,maskTextFn:m,maskInputFn:f,slimDOM:W,dataURLOptions:B,recordCanvas:I,inlineImages:F,onSerialize(e){Re(e,Pt)&&ee.addIframe(e),Pe(e,Pt)&&X.trackLinkElement(e),Le(e)&&ie.addShadowRoot(C.shadowRoot(e),document)},onIframeLoad(e,t){ee.attachIframe(e,t),ie.observeAttachShadow(e)},onIframeListenerRegistered(e,t){ee.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){X.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");bt({type:l.FullSnapshot,data:{node:t,initialOffset:we(window)}},e),je.forEach((e=>e.unlock())),T&&ee.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&X.adoptStyleSheets(document.adoptedStyleSheets,Pt.getId(document))}};try{var ne=[];V=e=>{var t=Q.get(e);t&&(t.forEach((e=>{ve(e);var t=ne.indexOf(e);-1!==t&&ne.splice(t,1)})),Q.delete(e))},j=()=>{for(var[e]of Q){var t=Pt.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==V||V(e)}catch(t){null==V||V(e)}else null==V||V(e)}};var se=e=>{var t;return Ve(rt)({mutationCb:Z,mousemoveCb:(e,t)=>bt({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:K,viewportResizeCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:J,fontCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:d,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:p,sampling:S,recordDOM:E,recordCanvas:I,inlineImages:F,userTriggeredOnInput:R,collectFonts:L,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:W,dataURLOptions:B,mirror:Pt,iframeManager:ee,stylesheetManager:X,shadowDomManager:ie,processedNodeManager:re,canvasManager:wt,ignoreCSSAttributes:D,plugins:(null==(t=null==O?void 0:O.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>bt({type:l.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},y)};ee.addLoadListener((e=>{try{var t=Pt.getId(e),r=se(e.contentDocument);if(ne.push(r),-1!==t){var i=Q.get(t);i||Q.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),ee.addPageHideListener((e=>{var t=Pt.getId(e);null==V||V(t),Ze(e)}));var oe=-1,ae=e=>bt({type:l.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),le=()=>{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?Pt.getId(s):-1;o!==oe&&(-1!==oe&&ae({id:oe,enter:!1}),oe=o,-1!==o&&ae({id:o,enter:!0}))},ue=()=>{St(),ne.push(se(document)),ne.push(ge("fullscreenchange",le)),ne.push(ge("webkitfullscreenchange",le)),ne.push(ge("mozfullscreenchange",le)),ne.push(ge("MSFullscreenChange",le)),Mt=!0};return["interactive","complete"].includes(document.readyState)?ue():(ne.push(ge("DOMContentLoaded",(()=>{bt({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===M&&ue()}))),ne.push(ge("load",(()=>{bt({type:l.Load,data:{}}),"load"===M&&ue()}),window))),()=>{ne.forEach((e=>ve(e))),re.destroy(),ee.removeLoadListener(),ee.destroy(),Q.clear(),Pt.reset(),Mt=!1,Be=void 0}}catch(e){console.warn(e)}}Lt.addCustomEvent=(e,t)=>{if(!Mt)throw new Error("please add custom event after start recording");bt({type:l.Custom,data:{tag:e,payload:t}})},Lt.freezePage=()=>{je.forEach((e=>e.freeze()))},Lt.takeFullSnapshot=e=>{if(!Mt)throw new Error("please take full snapshot after start recording");St(e)},Lt.mirror=Pt;var Ft=Object.defineProperty,Ot=(e,t,r)=>((e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class At{constructor(e){Ot(this,"fileName"),Ot(this,"functionName"),Ot(this,"lineNumber"),Ot(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 Dt=/(^|@)\S+:\d+/,Nt=/^\s*at .*(\S+:\d+|\(native\))/m,Bt=/^(eval@)?(\[native code])?$/,qt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Nt)?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(Nt)}),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 At({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Bt)}),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 At({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new At({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 At({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 At({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(Dt)&&!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 At({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Ht(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 $t(e){return Array.isArray(e)}function Ut(e){return"object"==typeof e&&null!==e&&!$t(e)}function zt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Ut(e[i])&&zt(e[i],t-1))return!0;return!1}function Wt(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(Ut(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Ut(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]=$t(u)?Ht(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 Vt={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({},Vt,r):Vt,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=qt.parse(t.error).map((e=>e.toString())),s=[Wt(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=[Wt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Wt("Uncaught (in promise)",n.stringifyOptions),Wt(t.reason,n.stringifyOptions)]);var s=qt.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=(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=qt.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Wt(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Wt("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})(u);return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u}})),t[s]=c,()=>{t[s]=u}}catch(e){return()=>{}}}(t,r):()=>{}}}var Gt=e=>({name:"rrweb/console@1",observer:jt,options:e}),Qt=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Yt(e){return"string"==typeof e||e}function Zt(e){return"string"==typeof e?e:void 0}var Kt,Jt=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.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}({}),Xt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),er=function(e){return e.MinLength="min_length",e.MaxLength="max_length",e}({}),tr=["$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"],rr=["token"],ir="NativeGzipValidationError",nr=e=>e.length>=2&&31===e[0]&&139===e[1],sr=(e,t)=>e===Xt.GZipJS||t===Xt.GZipJS||"gzip"===t,or=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ar=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return or(e)||t===ir},lr=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=ir,t},ur=function(){var e=t((function*(e,t){18>e.size&&lr("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());nr(r)&&8===r[2]||lr("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Kt)return Kt;Kt=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Kt[e]=t>>>0}return Kt})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&lr("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&lr("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function cr(e,t,r){return dr.apply(this,arguments)}function dr(){return dr=t((function*(e,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(e),s=new 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]);return yield ur(u,n),u}catch(e){if(null!=i&&i.rethrow)throw e;return r&&console.error("Failed to gzip compress data",e),null}})),dr.apply(this,arguments)}var hr=["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"],pr=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return hr.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function _r(e,t){return-1!==e.indexOf(t)}var gr=function(e){return e.trim()},vr=function(e){return e.replace(/^\$/,"")},fr=Object.prototype,mr=fr.hasOwnProperty,yr=fr.toString,br=Array.isArray||function(e){return"[object Array]"===yr.call(e)},Sr=e=>"function"==typeof e,wr=e=>e===Object(e)&&!br(e),kr=e=>{if(wr(e)){for(var t in e)if(mr.call(e,t))return!1;return!0}return!1},xr=e=>void 0===e,Cr=e=>"[object String]"==yr.call(e),Er=e=>Cr(e)&&0===e.trim().length,Ir=e=>null===e,Tr=e=>xr(e)||Ir(e),Mr=e=>"[object Number]"==yr.call(e)&&e==e,Rr=e=>Mr(e)&&e>0,Pr=e=>"[object Boolean]"===yr.call(e),Lr=e=>e instanceof FormData,Fr=e=>_r(rr,e);function Or(e){return null===e||"object"!=typeof e}function Ar(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Dr(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Nr=[!0,"true",1,"1","yes"],Br=e=>_r(Nr,e),qr=[!1,"false",0,"0","no"];function Hr(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),Mr(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),Hr(n||r,t,r,i))}class $r{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Hr(e.bucketSize,0,100,e._logger),this._refillRate=Hr(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Hr(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 Ur="Mobile",zr="iOS",Wr="Android",Vr="Tablet",jr=Wr+" "+Vr,Gr="iPad",Qr="Apple",Yr=Qr+" Watch",Zr="Safari",Kr="BlackBerry",Jr="Samsung",Xr=Jr+"Browser",ei=Jr+" Internet",ti="Chrome",ri=ti+" OS",ii=ti+" "+zr,ni="Internet Explorer",si=ni+" "+Ur,oi="Opera",ai=oi+" Mini",li="Edge",ui="Microsoft "+li,ci="Firefox",di=ci+" "+zr,hi="Nintendo",pi="PlayStation",_i="Xbox",gi=Wr+" "+Ur,vi=Ur+" "+Zr,fi="Windows",mi=fi+" Phone",yi="Nokia",bi="Ouya",Si="Generic",wi=Si+" "+Ur.toLowerCase(),ki=Si+" "+Vr.toLowerCase(),xi="Konqueror",Ci="Oculus Browser",Ei="Vivaldi",Ii="Yandex",Ti="Whale",Mi="DuckDuckGo",Ri="Pale Moon",Pi="Waterfox",Li="Brave",Fi="Google Search App",Oi="(\\d+(\\.\\d+)?)",Ai=new RegExp("Version/"+Oi),Di=new RegExp(_i,"i"),Ni=new RegExp(pi+" \\w+","i"),Bi=new RegExp(hi+" \\w+","i"),qi=new RegExp(Kr+"|PlayBook|BB10","i"),Hi={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},$i=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?Li:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&_r(e,"GSA/")?Fi:_r(e," OPR/")&&_r(e,"Mini")?ai:_r(e," OPR/")?oi:qi.test(e)?Kr:_r(e,"IE"+Ur)||_r(e,"WPDesktop")?si:_r(e,"OculusBrowser")?Ci:_r(e,Xr)?ei:_r(e,li)||_r(e,"Edg/")?ui:_r(e,Ei+"/")?Ei:_r(e,"YaBrowser/")?Ii:_r(e,Ti+"/")?Ti:_r(e,Mi+"/")||_r(e,"Ddg/")?Mi:_r(e,"FBIOS")?"Facebook "+Ur:_r(e,"UCWEB")||_r(e,"UCBrowser")?"UC Browser":_r(e,"CriOS")?ii:_r(e,"CrMo")||_r(e,ti)?ti:_r(e,Wr)&&_r(e,Zr)?gi:_r(e,"FxiOS")?di:_r(e.toLowerCase(),xi.toLowerCase())?xi:_r(e,Li+"/")?Li:((e,t)=>t&&_r(t,Qr)||function(e){return _r(e,Zr)&&!_r(e,ti)&&!_r(e,Wr)}(e))(e,t)?_r(e,Ur)?vi:Zr:_r(e,"PaleMoon/")?Ri:_r(e,Pi+"/")?Pi:_r(e,ci)?ci:_r(e,"MSIE")||_r(e,"Trident/")?ni:_r(e,"Gecko")?ci:"")},Ui={[si]:[new RegExp("rv:"+Oi)],[ui]:[new RegExp(li+"?\\/"+Oi)],[ti]:[new RegExp("("+ti+"|CrMo)\\/"+Oi)],[ii]:[new RegExp("CriOS\\/"+Oi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Oi)],[Zr]:[Ai],[vi]:[Ai],[oi]:[new RegExp("(Opera|OPR)\\/"+Oi)],[ci]:[new RegExp(ci+"\\/"+Oi)],[di]:[new RegExp("FxiOS\\/"+Oi)],[xi]:[new RegExp("Konqueror[:/]?"+Oi,"i")],[Kr]:[new RegExp(Kr+" "+Oi),Ai],[gi]:[new RegExp("android\\s"+Oi,"i")],[ei]:[new RegExp(Xr+"\\/"+Oi)],[Ci]:[new RegExp("OculusBrowser\\/"+Oi)],[Ei]:[new RegExp(Ei+"\\/"+Oi)],[Ii]:[new RegExp("YaBrowser\\/"+Oi)],[Ti]:[new RegExp(Ti+"\\/"+Oi)],[Li]:[new RegExp(Li+"\\/"+Oi)],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Oi)],[Ri]:[new RegExp("PaleMoon\\/"+Oi)],[Pi]:[new RegExp(Pi+"\\/"+Oi)],[Fi]:[new RegExp("GSA\\/"+Oi)],[ni]:[new RegExp("(rv:|MSIE )"+Oi)],Mozilla:[new RegExp("rv:"+Oi)]},zi=function(e,t,r,i){var n=$i(e,t,r,i),s=Ui[n];if(xr(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},Wi=[[new RegExp(_i+"; "+_i+" (.*?)[);]","i"),e=>[_i,e&&e[1]||""]],[new RegExp(hi,"i"),[hi,""]],[new RegExp(pi,"i"),[pi,""]],[qi,[Kr,""]],[new RegExp(fi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[mi,""];if(new RegExp(Ur).test(t)&&!/IEMobile\b/.test(t))return[fi+" "+Ur,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Hi[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[fi,i]}return[fi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[zr,[e[3],e[4],e[5]||"0"].join(".")]:[zr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=xr(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Wr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Wr+")","i"),e=>e&&e[2]?[Wr,[e[2],e[3],e[4]||"0"].join(".")]:[Wr,""]],[/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/,[ri,""]],[/Linux|debian/i,["Linux",""]]],Vi=function(e){return Bi.test(e)?hi:Ni.test(e)?pi:Di.test(e)?_i:new RegExp(bi,"i").test(e)?bi:new RegExp("("+mi+"|WPDesktop)","i").test(e)?mi:/iPad/.test(e)?Gr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Yr:qi.test(e)?Kr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(yi,"i").test(e)?yi:/(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(Ur).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Wr:jr:new RegExp("(pda|"+Ur+")","i").test(e)?wi:new RegExp(Vr,"i").test(e)&&!new RegExp(Vr+" pc","i").test(e)?ki:""},ji=function(e,t){var r,i,n,s,o=Vi(e);return o===Gr||o===jr||"Kobo"===o||"Kindle Fire"===o||o===ki?Vr:o===hi||o===_i||o===pi||o===bi?"Console":o===Yr?"Wearable":o?Ur:"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)?Ur:Vr:"Desktop"},Gi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qi(e,t){return"string"==typeof(r=e)&&Gi.test(r)?e:t();var r}function Yi(e){return e?e.split("#")[0]:e}function Zi(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}var Ki={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}},Ji=Ki.info;function Xi(e){if(Pr(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(br(e))return{arrayValue:{values:e.map((e=>Xi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function en(e){var t=[];for(var r in e){var i=e[r];Ir(i)||xr(i)||t.push({key:r,value:Xi(i)})}return t}function tn(e,t){var i=e.level||"info",{text:n,number:s}=Ki[i]||Ji,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),Tr(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),Tr(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:en(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),xr(e.trace_flags)||(u.flags=e.trace_flags),u}function rn(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 nn(e,t,r,i){return{resourceLogs:[{resource:{attributes:en(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let sn=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:tn(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=br(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(Jt.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=nn(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(Jt.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(Jt.LogsQueue))&&void 0!==t?t:[];r._instance.setPersistedProperty(Jt.LogsQueue,n.slice(i)),yield r._waitForStoragePersist()}))()}_buildResourceAttributes(){return rn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(Jt.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(Jt.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=Zi((()=>{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(Jt.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 Promise.race([t,new Promise((t=>Zi(t,e)))]):yield t}))()}flushWithTimeout(e){var r=this;return t((function*(){var t=!1,i=r.flush(),n=new Promise((r=>Zi((()=>{t=!0,r()}),e)));try{yield Promise.race([i,n])}finally{t&&i.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)}};function on(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var an,ln,un;function cn(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return un&&r.length===ln||(ln=r.length,un=r.reduce(((r,i)=>{an||(an={});var n=an[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,an[i]=[l,u];break}}return r}),{})),un}}class dn{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&&br(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:cn(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 hn="?";function pn(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?hn:r,in_app:!0};return xr(i)||(s.lineno=i),xr(n)||(s.colno=n),s}var _n=(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]:hn,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},gn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fn=/\((\S*)(?::(\d+))(?::(\d+))\)/,mn=(e,t)=>{var r=gn.exec(e);if(r){var[,i,n,s]=r;return pn(t,i,hn,+n,+s)}var o=vn.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=fn.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=_n(o[1]||hn,o[2]);return pn(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},yn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Sn=(e,t)=>{var r=yn.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=bn.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]||hn;return[s,n]=_n(s,n),pn(t,n,s,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},wn=/\(error: (.*)\)/,kn=50;class xn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Cr(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 Ar(e,"DOMException")}isDOMError(e){return Ar(e,"DOMError")}}class Cn{match(e){return e instanceof Error}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 En{constructor(){}match(e){return Ar(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 In=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Tn{match(e){return"string"==typeof e}coerce(e,t){var r,[i,n]=this.getInfos(e);return{type:null!=i?i:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(In);return i&&(t=i[1],r=i[2]),[t,r]}}var Mn=["fatal","error","warning","log","info","debug"];function Rn(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 Pn{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 Dr(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: "+Rn(e)}isSeverityLevel(e){return Cr(e)&&!Er(e)&&Mn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(r instanceof Error)return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Ln{match(e){return Dr(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Rn(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Fn{match(e){return Or(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 On{match(e){return Ar(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Dr(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 Or(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 An="$message",Dn="$timestamp",Nn=new Set([An,Dn]),Bn={enabled:!0,max_bytes:32768};function qn(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Bn.enabled,max_bytes:$n(e.max_bytes,Bn.max_bytes)}:r({},Bn)}class Hn{constructor(e){this._entries=[],this._totalBytes=0,this._config=qn(e)}setConfig(e){this._config=qn(e),this._trimToMaxBytes()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,r)=>{if("bigint"==typeof r)return r.toString();if("function"!=typeof r&&"symbol"!=typeof r){if(r instanceof Date)return r.toISOString();if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&"object"==typeof r){if(t.has(r))return"[Circular]";t.add(r)}return r}}))}catch(e){return}}(e);if(t)try{var r=JSON.parse(t);if(!wr(r))return;var i=r,n=i[An],s=i[Dn];if(!Cr(n)||0===n.trim().length)return;if(!Cr(s)&&!Mr(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 $n(e,t){if(!Mr(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var Un="undefined"!=typeof window?window:void 0,zn="undefined"!=typeof globalThis?globalThis:Un;"undefined"==typeof self&&(zn.self=zn),"undefined"==typeof File&&(zn.File=function(){});var Wn=null==zn?void 0:zn.navigator,Vn=null==zn?void 0:zn.document,jn=null==zn?void 0:zn.location,Gn=null==zn?void 0:zn.fetch,Qn=null!=zn&&zn.XMLHttpRequest&&"withCredentials"in new zn.XMLHttpRequest?zn.XMLHttpRequest:void 0,Yn=null==zn?void 0:zn.AbortController,Zn=null==zn?void 0:zn.CompressionStream,Kn=null==Wn?void 0:Wn.userAgent,Jn=null!=Un?Un:{},Xn=e=>e instanceof Document,es="1.396.3",ts={DEBUG:!1,LIB_VERSION:es,LIB_NAME:"web",JS_SDK_VERSION:es},rs=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,i={_log(t){if(Un&&(ts.DEBUG||Jn.POSTHOG_DEBUG||r)&&!xr(Un.console)&&Un.console){for(var i=("__rrweb_original__"in Un.console[t]?Un.console[t].__rrweb_original__:Un.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)=>rs(e+" "+t,r)};return i},is=rs("[PostHog.js]"),ns=is.createLogger;function ss(e,t){br(e)&&e.forEach(t)}function os(e,t){if(!Tr(e))if(br(e))e.forEach(t);else if(Lr(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)mr.call(e,r)&&t(e[r],r)}var as=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 ls(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 us=function(e){try{return e()}catch(e){return}},cs=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){is.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),is.critical(e)}}},ds=function(e){var t={};return os(e,(function(e,r){(Cr(e)&&e.length>0||Mr(e))&&(t[r]=e)})),t};var hs=["herokuapp.com","vercel.app","netlify.app"];function ps(e){var t=null==e?void 0:e.hostname;if(!Cr(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of hs)if(r===i)return!1;return!0}function _s(e,t,r,i){var{capture:n=!1,passive:s=!0}=null!=i?i:{};null==e||e.addEventListener(t,r,{capture:n,passive:s})}function gs(e){return"ph_toolbar_internal"===e.name}var vs=["localhost","127.0.0.1"],fs=e=>{var t=null==Vn?void 0:Vn.createElement("a");return xr(t)?null:(t.href=e,t)},ms=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return os(e,(function(e,t){xr(e)||xr(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},ys=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(!br(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){is.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},bs=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("=");br(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},Ss=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null};function ws(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n=r(i);return Sr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]===n&&(e[t]=i)}}catch(e){return()=>{}}}function ks(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 xs(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Sr(i))return t;try{var n=i(t);return Cr(n)&&n?n:t}catch(e){return is.error("Error in get_current_url, falling back to window.location.href",e),t}}function Cs(e){var t,r=null==Un||null==(t=Un.location)?void 0:t.href;return xr(r)?void 0:xs(e,r)}var Es="$people_distinct_id",Is="$device_id",Ts="$device_model",Ms="__alias",Rs="__timers",Ps="$autocapture_disabled_server_side",Ls="$heatmaps_enabled_server_side",Fs="$exception_capture_enabled_server_side",Os="$error_tracking_suppression_rules",As="$error_tracking_capture_extension_exceptions",Ds="$web_vitals_enabled_server_side",Ns="$dead_clicks_enabled_server_side",Bs="$product_tours_enabled_server_side",qs="$web_vitals_allowed_metrics",Hs="$session_recording_remote_config",$s="$replay_sample_rate",Us="$replay_override_sampling",zs="$replay_override_linked_flag",Ws="$replay_override_url_trigger",Vs="$replay_override_event_trigger",js="$sesid",Gs="$session_is_sampled",Qs="$session_past_minimum_duration",Ys="$session_recording_url_trigger_activated_session",Zs="$session_recording_event_trigger_activated_session",Ks="$posthog_sr_group_event_trigger_",Js="$posthog_sr_group_url_trigger_",Xs="$posthog_sr_group_sampling_",eo="$debug_first_full_snapshot_timestamp",to="$sess_rec_flush_size",ro="$enabled_feature_flags",io="$active_feature_flags",no="$early_access_features",so="$feature_flag_details",oo="$feature_flag_payloads",ao="$feature_flag_request_id",lo="$override_feature_flags",uo="$override_feature_flag_payloads",co="$stored_person_properties",ho="$stored_group_properties",po="$surveys",_o="$surveys_loaded_at",go="$surveys_activated",vo="ph_product_tours",fo="$flag_call_reported",mo="$flag_call_reported_session_id",yo="$feature_flag_errors",bo="$feature_flag_evaluated_at",So="$user_state",wo="$client_session_props",ko="$capture_rate_limit",xo="$initial_campaign_params",Co="$initial_referrer_info",Eo="$initial_person_info",Io="$epp",To="__POSTHOG_TOOLBAR__",Mo="$posthog_cookieless",Ro="$sdk_debug_extensions_init_method",Po="$sdk_debug_extensions_init_time_ms",Lo="$sdk_debug_recording_script_not_loaded",Fo="$sdk_debug_replay_event_trigger_status",Oo="$sdk_debug_replay_linked_flag_trigger_status",Ao="$sdk_debug_replay_matched_recording_trigger_groups",Do="$sdk_debug_replay_remote_trigger_matching_config",No="$sdk_debug_replay_trigger_groups_count",Bo="$sdk_debug_replay_url_trigger_status",qo="$session_recording_start_reason",Ho="PostHog loadExternalDependency extension not found.",$o="on_reject",Uo="always",zo="anonymous",Wo="identified",Vo="identified_only",jo="visibilitychange",Go="beforeunload",Qo="$pageview",Yo="$pageleave",Zo="$identify",Ko="$groupidentify",Jo=1,Xo=3,ea=11;function ta(e){return e instanceof Element&&(e.id===To||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function ra(e){return!!e&&e.nodeType===Jo}function ia(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function na(e){return!!e&&e.nodeType===Xo}function sa(e){return!!e&&e.nodeType===ea&&ra(e.host)}function oa(e){return e?gr(e).split(/\s+/):[]}function aa(e,t){var r=Cs(t);return!!(r&&e&&e.some((e=>r.match(e))))}function la(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 oa(t)}function ua(e){return Tr(e)?null:gr(e).split(/(\s+)/).filter((e=>Fa(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ca(e){var t="";return Ca(e)&&!Ea(e)&&e.childNodes&&e.childNodes.length&&os(e.childNodes,(function(e){var r;na(e)&&e.textContent&&(t+=null!==(r=ua(e.textContent))&&void 0!==r?r:"")})),gr(t)}function da(e){return xr(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var ha=["a","button","form","input","select","textarea","label"];function pa(e,t){if(xr(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 _a(e){var t=e.parentNode;return!(!t||!ra(t))&&t}var ga=[".ph-no-autocapture","[data-ph-no-autocapture]"],va=["next","previous","prev",">","<"],fa=[...va,"+","-","−","–"],ma=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ya=[".ph-no-deadclick",".ph-no-capture"],ba=[".ph-no-rageclick",".ph-no-capture"],Sa=["","text","search","email","password","url","tel","number"];function wa(e,t){if(!Un||ka(e))return!1;var r,i,n,s,o;if(Pr(t)?(r=!!t&&ba,i=void 0,n=!1):(r=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:ba,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||!ra(e))&&(!!ia(e,"textarea")||(ia(e,"input")?_r(Sa,(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{targetElementList:a}=xa(e,!1);return!function(e,t){if(!1===e||xr(e))return!1;var r;if(!0===e)r=va;else{if(!br(e))return!1;if(e.length>10)return is.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{safeText:t,ariaLabel:i}=e;return r.some((e=>ma(t,e)||ma(i,e)))}))}(i,a.map((e=>{var t;return{safeText:ca(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!pa(a,r)}var ka=e=>!e||ia(e,"html")||!ra(e),xa=(e,t)=>{if(!Un||ka(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],n=e;n.parentNode&&!ia(n,"body");)if(sa(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=_a(n);if(!s)break;if(t||ha.indexOf(s.tagName.toLowerCase())>-1)r=!0;else{var o=Un.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function Ca(e){for(var t=e;t.parentNode&&!ia(t,"body");t=t.parentNode){var r=la(t);if(_r(r,"ph-sensitive")||_r(r,"ph-no-capture"))return!1}if(_r(la(e),"ph-include"))return!0;var i=e.type||"";if(Cr(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";return!Cr(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Ea(e){return!!(ia(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ia(e,"select")||ia(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ia="(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})",Ta=new RegExp("^(?:"+Ia+")$"),Ma=new RegExp(Ia),Ra="\\d{3}-?\\d{2}-?\\d{4}",Pa=new RegExp("^("+Ra+")$"),La=new RegExp("("+Ra+")");function Fa(e,t){if(void 0===t&&(t=!0),Tr(e))return!1;if(Cr(e)){if(e=gr(e),(t?Ta:Ma).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Pa:La).test(e))return!1}return!0}function Oa(e){var t=ca(e);return Fa(t=(t+" "+Aa(e)).trim())?t:""}function Aa(e){var t="";return e&&e.childNodes&&e.childNodes.length&&os(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=ca(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Aa(e)).trim())}catch(e){is.error("[AutoCapture]",e)}})),t}function Da(e){return e.replace(/"|\\"/g,'\\"')}function Na(e){var t=e.attr__class;return t?br(t)?t:oa(t):void 0}var Ba="[SessionRecording]",qa="redacted",Ha=1e6;function $a(e){var t;return Math.min(Ha,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Ha)}var Ua={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:Ha,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},za=["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"],Wa=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Va=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ja=e=>{Tr(e)||os(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return za.includes(t)||Va.some((e=>t.includes(e)))})(t)&&(e[t]=qa)}))},Ga=["/s/","/e/","/i/"];function Qa(e,t,r,i){if(Tr(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Cr(n)&&(n=parseInt(n)),n>r?Ba+" "+i+" body too large to record ("+n+" bytes)":e}function Ya(e,t){if(Tr(e))return e;var r=e;return Fa(r,!1)||(r=Ba+" "+t+" body "+qa),os(Wa,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=Ba+" "+t+" body "+qa+" as might contain: "+e)})),r}var Za=ns("[Recorder]"),Ka=e=>"navigation"===e.entryType,Ja=e=>"resource"===e.entryType;function Xa(e,t){return!!t&&(Pr(t)||t[e])}function el(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 tl=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function rl(e){var{type:t,recordBody:r,headers:i,url:n}=e;function s(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:!!el(t)&&e(t.url)}catch(e){return!1}}(n))return!1;if(s(tl))return!1;if(Pr(r))return!0;if(br(r))return s(r);var o=r[t];return Pr(o)?o:s(o)}function il(e,t,r,i,n,s){return nl.apply(this,arguments)}function nl(){return nl=t((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Za.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(Ja(o=e[s])&&o.initiatorType===t&&(xr(i)||o.startTime>=i)&&(xr(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),il(e,t,r,i,n,s+1))})),nl.apply(this,arguments)}function sl(e){var{body:t,options:r,url:i}=e;if(Tr(t))return null;var{hostname:n,isHostDenied:s}=ks(i,r);if(s)return n+" is in deny list";if(Cr(t))return t;if(Xn(t))return t.textContent;if(Lr(t))return ms(t);if(wr(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 ol=e=>!Ir(e)&&("navigation"===e.entryType||"resource"===e.entryType);function al(e){var{entry:t,method:i,status:n,networkRequest:s,isInitial:o,start:a,end:l,url:u,initiatorType:c}=e;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:xr(a)?void 0:Math.round(a),endTime:xr(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(ol(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 ll=["video/","audio/"];function ul(e){return wr(e)&&Sr(e.getReader)&&Sr(e.tee)}var cl=500,dl="[SessionReplay] Timeout while trying to read body",hl="[SessionReplay] Failed to read body";function pl(e){return hl+": "+e}function _l(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function gl(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(dl)),cl);try{e.clone().text().then((e=>t(e)),(e=>t(pl(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(hl)}}))}(e);var r=$a(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(_l(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(dl)),cl);try{a=e.clone()}catch(e){return void o(hl)}var u=a.body;if(ul(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(hl)}var c=[],d=0;!function e(){i.read().then((r=>{var{done:i,value:a}=r;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(_l(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(pl(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(pl(e))))}catch(e){o(hl)}}))}(e,r)}function vl(){return vl=t((function*(e){var{r:t,options:r,url:i}=e,{hostname:n,isHostDenied:s}=ks(i,r);return s?Promise.resolve(n+" is in deny list"):gl(t,r)})),vl.apply(this,arguments)}function fl(){return fl=t((function*(e){var{r:t,options:r,url:i}=e,n=function(e){var t,{r:r,options:i,url:n}=e;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=ll.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var{hostname:a,isHostDenied:l}=ks(n,i);return l?a+" is in deny list":null}({r:t,options:r,url:i});return Ir(n)?gl(t,r):Promise.resolve(n)})),fl.apply(this,arguments)}var ml=null;function yl(e,i,n){if(!("performance"in i))return()=>{};if(ml)return Za.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Ua,n):Ua,o=t=>{var i=[];t.requests.forEach((e=>{var t=s.maskRequestFn(e);t&&i.push(t)})),i.length>0&&e(r({},t,{requests:i}))},a=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Ka(e)||Ja(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>al({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=>Ka(e)||Ja(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>al({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=Xa("request",r.recordHeaders),n=Xa("response",r.recordHeaders),s=ws(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d,h,p=this,_=new Request(a),g={},v={},f=p.setRequestHeader.bind(p);p.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=p.send.bind(p);p.send=e=>(rl({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=sl({body:e,options:r,url:a})),d=t.performance.now(),m(e));var y=()=>{p.removeEventListener("readystatechange",b),p.removeEventListener("error",y),p.removeEventListener("abort",y),p.removeEventListener("timeout",y)},b=()=>{if(p.readyState===p.DONE){y(),h=t.performance.now();var i={};p.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),rl({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=sl({body:p.response,options:r,url:a})),il(t,"xmlhttprequest",_.url,d,h).then((t=>{var r=al({entry:t,method:o,status:null==p?void 0:p.status,networkRequest:g,start:d,end:h,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};p.addEventListener("readystatechange",b),p.addEventListener("error",y),p.addEventListener("abort",y),p.addEventListener("timeout",y),s.call(p,o,a.toString(),l,u,c)}));return()=>{s()}}(o,i,s),u=function(e,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Xa("request",i.recordHeaders),s=Xa("response",i.recordHeaders),o=ws(r,"fetch",(o=>function(){var a=t((function*(t,a){var l,u,c,d=new Request(t,a),h={};try{var p={};d.headers.forEach(((e,t)=>{p[t]=e})),n&&(h.requestHeaders=p),!ul(null==a?void 0:a.body)&&rl({type:"request",headers:p,url:t,recordBody:i.recordBody})&&(h.requestBody=yield function(e){return vl.apply(this,arguments)}({r:d,options:i,url:t})),u=r.performance.now(),l=el(t)?yield o(d):yield o(t,a),c=r.performance.now();var _={};return l.headers.forEach(((e,t)=>{_[t]=e})),s&&(h.responseHeaders=_),rl({type:"response",headers:_,url:t,recordBody:i.recordBody})&&(h.responseBody=yield function(e){return fl.apply(this,arguments)}({r:l,options:i,url:t})),l}finally{il(r,"fetch",d.url,u,c).then((t=>{var r,i=al({entry:t,method:d.method,status:null==(r=l)?void 0:r.status,networkRequest:h,start:u,end:c,url:d.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return a.apply(this,arguments)}}()));return()=>{o()}}(o,i,s)),ml=()=>{a(),l(),u(),ml=null}}var bl=e=>({name:"rrweb/network@1",observer:yl,options:e});Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Gt,getRecordNetworkPlugin:bl},Jn.__PosthogExtensions__.rrweb={record:Lt,version:"v2",wasMaxDepthReached:()=>de,resetMaxDepthState(){de=!1,ce=!1}},Jn.rrweb={record:Lt,version:"v2"},Jn.rrwebConsoleRecord={getRecordConsolePlugin:Gt},Jn.getRecordNetworkPlugin=bl;var Sl,wl,kl,xl,Cl,El,Il,Tl,Ml,Rl,Pl,Ll,Fl,Ol,Al,Dl={},Nl=[],Bl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ql=Array.isArray;function Hl(e,t){for(var r in t)e[r]=t[r];return e}function $l(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ul(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?Sl.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 zl(e,o,i,n,null)}function zl(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?++kl:n,__i:-1,__u:0};return null==n&&null!=wl.vnode&&wl.vnode(s),s}function Wl(e){return e.children}function Vl(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 jl(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Hl({},t);s.__v=t.__v+1,wl.vnode&&wl.vnode(s),ru(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,nu(i,s,n),t.__e=t.__=null,s.__e!=r&&Gl(s)}}function Gl(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})),Gl(e)}function Ql(e){(!e.__d&&(e.__d=!0)&&xl.push(e)&&!Yl.__r++||Cl!=wl.debounceRendering)&&((Cl=wl.debounceRendering)||El)(Yl)}function Yl(){try{for(var e,t=1;xl.length;)xl.length>t&&xl.sort(Il),e=xl.shift(),t=xl.length,jl(e)}finally{xl.length=Yl.__r=0}}function Zl(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,_,g,v,f,m=i&&i.__k||Nl,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]=zl(null,o,null,null,null):ql(o)?o=e.__k[s]=zl(Wl,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=zl(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=Jl(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)),lu(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]||Dl,p.__i=d,v=ru(e,p,h,n,s,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&au(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=Kl(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 Kl(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=Kl(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 Jl(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 Xl(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Bl.test(t)?r:r+"px"}function eu(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||Xl(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Xl(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(Pl,"$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[Rl]=i[Rl]:(r[Rl]=Ll,e.addEventListener(t,s?Ol:Fl,s)):e.removeEventListener(t,s?Ol:Fl,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 tu(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ml])t[Ml]=Ll++;else if(r[Rl]>t[Ml])return;return r(wl.event?wl.event(t):t)}}}function ru(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=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=wl.__b)&&c(t);e:if("function"==typeof x)try{if(f=t.props,m=x.prototype&&x.prototype.render,y=(c=x.contextType)&&i[c.__c],$=c?y?y.props.value:c.__:i,r.__c?v=(d=t.__c=r.__c).__=d.__E:(m?t.__c=d=new x(f,$):(t.__c=d=new Vl(f,$),d.constructor=x,d.render=uu),y&&y.sub(d),d.state||(d.state={}),d.__n=i,h=d.__d=!0,d.__h=[],d._sb=[]),m&&null==d.__s&&(d.__s=d.state),m&&null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Hl({},d.__s)),Hl(d.__s,x.getDerivedStateFromProps(f,d.__s))),p=d.props,_=d.state,d.__v=t,h)m&&null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),m&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(m&&null==x.getDerivedStateFromProps&&f!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(f,$),t.__v==r.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,$)){t.__v!=r.__v&&(d.props=f,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),Nl.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,$),m&&null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,_,g)}))}if(d.context=$,d.props=f,d.__P=e,d.__e=!1,b=wl.__r,S=0,m)d.state=d.__s,d.__d=!1,b&&b(t),c=d.render(d.props,d.state,d.context),Nl.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,b&&b(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++S);d.state=d.__s,null!=d.getChildContext&&(i=Hl(Hl({},i),d.getChildContext())),m&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,_)),w=null!=c&&c.type===Wl&&null==c.key?su(c.props.children):c,a=Zl(e,ql(w)?w:[w],t,r,i,n,s,o,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(k=s.length;k--;)$l(s[k]);iu(t)}else t.__e=r.__e,t.__k=r.__k,e.then||iu(t);wl.__e(e,t,r)}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=ou(r.__e,t,r,i,n,s,o,l,u);return(c=wl.diffed)&&c(t),128&t.__u?void 0:a}function iu(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(iu))}function nu(e,t,r){for(var i=0;r.length>i;i++)au(r[i],r[++i],r[++i]);wl.__c&&wl.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){wl.__e(e,t.__v)}}))}function su(e){return"object"!=typeof e||null==e||e.__b>0?e:ql(e)?e.map(su):void 0!==e.constructor?null:Hl({},e)}function ou(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,_,g,v=r.props||Dl,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&&(wl.__m&&wl.__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&&Sl.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||eu(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||eu(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=""),Zl("template"==t.type?e.content:e,ql(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--;)$l(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&eu(e,u,_,v[u],n),u="checked",null!=g&&g!=e[u]&&eu(e,u,g,v[u],n))}return e}function au(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){wl.__e(e,r)}}function lu(e,t,r){var i,n;if(wl.unmount&&wl.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||au(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){wl.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&lu(i[n],t,r||"function"!=typeof e.type);r||$l(e.__e),e.__c=e.__=e.__e=void 0}function uu(e,t,r){return this.constructor(e,r)}function cu(e,t,r){var i,n,s;t==document&&(t=document.documentElement),wl.__&&wl.__(e,t),i=t.__k,n=[],s=[],ru(t,e=t.__k=Ul(Wl,null,[e]),i||Dl,Dl,t.namespaceURI,i?null:t.firstChild?Sl.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),nu(n,e,s)}Sl=Nl.slice,wl={__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}},kl=0,Vl.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Hl({},this.state),"function"==typeof e&&(e=e(Hl({},r),this.props)),e&&Hl(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ql(this))},Vl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ql(this))},Vl.prototype.render=Wl,xl=[],El="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Il=function(e,t){return e.__v.__b-t.__v.__b},Yl.__r=0,Tl=Math.random().toString(8),Ml="__d"+Tl,Rl="__a"+Tl,Pl=/(PointerCapture)$|Capture$/i,Ll=0,Fl=tu(!1),Ol=tu(!0),Al=0;var du,hu,pu,_u,gu=0,vu=[],fu=wl,mu=fu.__b,yu=fu.__r,bu=fu.diffed,Su=fu.__c,wu=fu.unmount,ku=fu.__;function xu(e,t){fu.__h&&fu.__h(hu,e,gu||t),gu=0;var r=hu.__H||(hu.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Cu(e){return gu=1,function(e,t,r){var i=xu(du++,2);if(i.t=e,!i.__c&&(i.__=[Du(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=hu,!hu.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=i.__c.__H.__.filter((function(e){return e.__c}));if(n.every((function(e){return!e.__N})))return!s||s.call(this,e,t,r);var o=i.__c.props!==e;return n.some((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s&&s.call(this,e,t,r)||o};hu.__f=!0;var s=hu.shouldComponentUpdate,o=hu.componentWillUpdate;hu.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)},hu.shouldComponentUpdate=n}return i.__N||i.__}(Du,e)}function Eu(e,t){var r=xu(du++,3);!fu.__s&&Au(r.__H,t)&&(r.__=e,r.u=t,hu.__H.__h.push(r))}function Iu(e){return gu=5,Tu((function(){return{current:e}}),[])}function Tu(e,t){var r=xu(du++,7);return Au(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Mu(e){var t=hu.context[e.__c],r=xu(du++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(hu)),t.props.value):e.__}function Ru(){for(var e;e=vu.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Fu),t.__h.some(Ou),t.__h=[]}catch(r){t.__h=[],fu.__e(r,e.__v)}}}fu.__b=function(e){hu=null,mu&&mu(e)},fu.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ku&&ku(e,t)},fu.__r=function(e){yu&&yu(e),du=0;var t=(hu=e.__c).__H;t&&(pu===hu?(t.__h=[],hu.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.some(Fu),t.__h.some(Ou),t.__h=[],du=0)),pu=hu},fu.diffed=function(e){bu&&bu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vu.push(t)&&_u===fu.requestAnimationFrame||((_u=fu.requestAnimationFrame)||Lu)(Ru)),t.__H.__.some((function(e){e.u&&(e.__H=e.u),e.u=void 0}))),pu=hu=null},fu.__c=function(e,t){t.some((function(e){try{e.__h.some(Fu),e.__h=e.__h.filter((function(e){return!e.__||Ou(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],fu.__e(r,e.__v)}})),Su&&Su(e,t)},fu.unmount=function(e){wu&&wu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Fu(e)}catch(e){t=e}})),r.__H=void 0,t&&fu.__e(t,r.__v))};var Pu="function"==typeof requestAnimationFrame;function Lu(e){var t,r=function(){clearTimeout(i),Pu&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Pu&&(t=requestAnimationFrame(r))}function Fu(e){var t=hu,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),hu=t}function Ou(e){var t=hu;e.__c=e.__(),hu=t}function Au(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Du(e,t){return"function"==typeof t?t(e):t}var Nu={Activation:"events",Cancellation:"cancelEvents"},Bu={Button:"button",Tab:"tab",Selector:"selector"},qu={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"},Hu={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},$u={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Uu={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},zu={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Wu={Once:"once",Recurring:"recurring",Always:"always"},Vu={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ju={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",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_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Gu={Popover:"popover",Inline:"inline"};function Qu(e){return"$survey_response_"+e}function Yu(e,t){if(!t)return null;var r=e[Qu(t)];return br(r)?[...r]:r}function Zu(e,t){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!xr(t.originalQuestionIndex)){var r,n=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,s=Yu(e,t.id);xr(s)||(i[n]=s)}})),r({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:Yu(e,t.id)})))},e,i)}function Ku(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 Ju(e){return"string"==typeof e&&e.trim()?e.trim():null}function Xu(e){return e.toLowerCase()}function ec(e,t,r){if(!e||!t)return null;var i=Xu(t),n=Object.keys(e).find((e=>Xu(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=>Xu(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}function tc(e,t,i){var n,s=ec(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),xr(u.name)||(o.name=u.name,a=!0),o.appearance?(o.appearance=r({},o.appearance),xr(u.thankYouMessageHeader)||(o.appearance.thankYouMessageHeader=u.thankYouMessageHeader,a=!0),xr(u.thankYouMessageDescription)||(o.appearance.thankYouMessageDescription=u.thankYouMessageDescription,a=!0),xr(u.thankYouMessageCloseButtonText)||(o.appearance.thankYouMessageCloseButtonText=u.thankYouMessageCloseButtonText,a=!0),xr(u.submitButtonText)||(o.appearance.submitButtonText=u.submitButtonText,a=!0),xr(u.backButtonText)||(o.appearance.backButtonText=u.backButtonText,a=!0)):function(e){return!(xr(e.thankYouMessageHeader)&&xr(e.thankYouMessageDescription)&&xr(e.thankYouMessageCloseButtonText)&&xr(e.submitButtonText)&&xr(e.backButtonText))}(u)&&(a=!0))}var c=e.questions.map((e=>function(e,t,i){var n,s=ec(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 xr(o.question)||(a.question=o.question,l=!0),xr(o.description)||(a.description=o.description,l=!0),xr(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!xr(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!xr(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!xr(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return br(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}}var rc=ns("[Surveys]");function ic(e){return!(!e.start_date||e.end_date)}function nc(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function sc(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var oc="seenSurvey_",ac="inProgressSurvey_",lc=(e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r},uc=e=>lc(oc,e),cc=e=>{try{var t=uc(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){rc.error("Failed to persist survey seen state",e)}},dc=[$u.Popover,$u.Widget,$u.API],hc={ignoreConditions:!1,ignoreDelay:!1,displayType:Gu.Popover};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Mr(e)&&isFinite(e)&&Math.floor(e)===e});class pc{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/Math.pow(2,8),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 pc(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 pc(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 _c{constructor(){this._timestamp=0,this._counter=0,this._random=new fc}generate(){var e=this.generateOrAbort();if(xr(e)){this._timestamp=0;var t=this.generateOrAbort();if(xr(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return pc.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var gc,vc=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};Un&&!xr(Un.crypto)&&crypto.getRandomValues&&(vc=e=>crypto.getRandomValues(e));class fc{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(vc(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var mc=()=>yc().toString(),yc=()=>(gc||(gc=new _c)).generate(),bc=["fatal","error","warning","log","info","debug"],Sc={GZipJS:"gzip-js",Base64:"base64"},wc=Uint8Array,kc=Uint16Array,xc=Uint32Array,Cc=new wc([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]),Ec=new wc([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]),Ic=new wc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tc=function(e,t){for(var r=new kc(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new xc(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]},Mc=Tc(Cc,2),Rc=Mc[1];Mc[0][28]=258,Rc[258]=28;for(var Pc=Tc(Ec,0)[1],Lc=new kc(32768),Fc=0;32768>Fc;++Fc){var Oc=(43690&Fc)>>>1|(21845&Fc)<<1;Lc[Fc]=((65280&(Oc=(61680&(Oc=(52428&Oc)>>>2|(13107&Oc)<<2))>>>4|(3855&Oc)<<4))>>>8|(255&Oc)<<8)>>>1}var Ac=function(e,t,r){for(var i=e.length,n=0,s=new kc(t);i>n;++n)++s[e[n]-1];var o,a=new kc(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new kc(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[Lc[d]>>>l]=u}else for(o=new kc(i),n=0;i>n;++n)o[n]=Lc[a[e[n]-1]++]>>>15-e[n];return o},Dc=new wc(288);for(Fc=0;144>Fc;++Fc)Dc[Fc]=8;for(Fc=144;256>Fc;++Fc)Dc[Fc]=9;for(Fc=256;280>Fc;++Fc)Dc[Fc]=7;for(Fc=280;288>Fc;++Fc)Dc[Fc]=8;var Nc=new wc(32);for(Fc=0;32>Fc;++Fc)Nc[Fc]=5;var Bc=Ac(Dc,9,0),qc=Ac(Nc,5,0),Hc=function(e){return(e/8>>0)+(7&e&&1)},$c=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof kc?kc:e instanceof xc?xc:wc)(r-t);return i.set(e.subarray(t,r)),i},Uc=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},zc=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},Wc=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 wc(0),0];if(1==n){var o=new wc(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 kc(h+1),_=Vc(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 wc(p),_]},Vc=function(e,t,r){return-1==e.s?Math.max(Vc(e.l,t,r+1),Vc(e.r,t,r+1)):t[e.s]=r},jc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new kc(++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]},Gc=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},Qc=function(e,t,r){var i=r.length,n=Hc(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)},Yc=function(e,t,r,i,n,s,o,a,l,u,c){Uc(t,c++,r),++n[256];for(var d=Wc(n,15),h=d[0],p=d[1],_=Wc(s,15),g=_[0],v=_[1],f=jc(h),m=f[0],y=f[1],b=jc(g),S=b[0],w=b[1],k=new kc(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=Wc(k,7),E=C[0],I=C[1],T=19;T>4&&!E[Ic[T-1]];--T);var M,R,P,L,F=u+5<<3,O=Gc(n,Dc)+Gc(s,Nc)+o,A=Gc(n,h)+Gc(s,g)+o+14+3*T+Gc(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(O>=F&&A>=F)return Qc(t,c,e.subarray(l,l+u));if(Uc(t,c,1+(O>A)),c+=2,O>A){M=Ac(h,p,0),R=h,P=Ac(g,v,0),L=g;var D=Ac(E,I,0);for(Uc(t,c,y-257),Uc(t,c+5,w-1),Uc(t,c+10,T-4),c+=14,x=0;T>x;++x)Uc(t,c+3*x,E[Ic[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)Uc(t,c,D[H=31&q[x]]),c+=E[H],H>15&&(Uc(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else M=Bc,R=Dc,P=qc,L=Nc;for(x=0;a>x;++x)if(i[x]>255){var H;zc(t,c,M[257+(H=i[x]>>>18&31)]),c+=R[H+257],H>7&&(Uc(t,c,i[x]>>>23&31),c+=Cc[H]);var U=31&i[x];zc(t,c,P[U]),c+=L[U],U>3&&(zc(t,c,i[x]>>>5&8191),c+=Ec[U])}else zc(t,c,M[i[x]]),c+=R[i[x]];return zc(t,c,M[256]),c+R[256]},Zc=new xc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kc=function(){for(var e=new xc(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Jc=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=Kc[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},Xc=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new wc(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=Qc(l,u,e.subarray(c,d)):(l[c]=true,u=Qc(l,u,e.subarray(c,o)))}else{for(var h=Zc[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new kc(32768),f=new kc(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 xc(25e3),w=new kc(288),k=new kc(32),x=0,C=0,E=(c=0,0),I=0,T=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(v[R]=P,f[M]=R,c>=I){var L=o-c;if((x>7e3||E>24576)&&L>423){u=Yc(e,l,0,S,w,k,C,E,T,c-T,u),E=x=C=0,T=c;for(var F=0;286>F;++F)w[F]=0;for(F=0;30>F;++F)k[F]=0}var O=2,A=0,D=_,N=R-P&32767;if(L>2&&M==b(c-N))for(var B=Math.min(p,L)-1,q=Math.min(32767,c),H=Math.min(258,L);q>=N&&--D&&R!=P;){if(e[c+O]==e[c+O-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>O){if(O=U,A=N,U>B)break;var z=Math.min(N,U-2),W=0;for(F=0;z>F;++F){var V=c-N+F+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,P=V)}}}N+=(R=P)-(P=v[R])+32768&32767}if(A){S[E++]=268435456|Rc[O]<<18|Pc[A];var G=31&Rc[O],Q=31&Pc[A];C+=Cc[G]+Ec[Q],++w[257+G],++k[Q],I=c+O,++x}else S[E++]=e[c],++w[e[c]]}}u=Yc(e,l,true,S,w,k,C,E,T,c-T,u)}return $c(a,0,i+Hc(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)},ed=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},td=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&&ed(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)}},rd=function(e){return 10+(e.filename&&e.filename.length+1||0)};function id(e,t){void 0===t&&(t={});var r=Jc(),i=e.length;r.p(e);var n=Xc(e,t,rd(t),8),s=n.length;return td(n,t),ed(n,s-8,r.d()),ed(n,s-4,i),n}function nd(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new wc(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 wc(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 $c(i,0,n)}function sd(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}var od=!!Qn||!!Gn,ad="text/plain",ld=!1,ud=(e,t)=>{var[r,i]=e.split("#"),[n,s]=r.split("?");if(!s)return e;var o=s.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},cd=function(e,t,i){var n;void 0===i&&(i=!0);var[s,o]=e.split("?"),a=r({},t),l=null!==(n=null==o?void 0:o.split("&").map((e=>{var t,[r,n]=e.split("="),s=i&&null!==(t=a[r])&&void 0!==t?t:n;return delete a[r],r+"="+s})))&&void 0!==n?n:[],u=ms(a);return u&&l.push(u),s+"?"+l.join("&")},dd=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),hd=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:r}=e;if(t){if(r===Sc.GZipJS){var i=id(nd(dd(t)),{mtime:0});return{contentType:ad,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===Sc.Base64){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(dd(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:dd(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=dd(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},pd=e=>{var t,i,n=()=>({url:ud(e.url,"compression"),encodedBody:hd(r({},e,{compression:void 0,_encodedBody:void 0}))});try{t=hd(e)}catch(t){if(sr(e.compression,ys(e.url,"compression")))return is.error("Failed to gzip request body, sending uncompressed payload",t),n();throw t}return t&&sr(e.compression,ys(e.url,"compression"))&&!((i=t.body)instanceof ArrayBuffer?nr(new Uint8Array(i)):ArrayBuffer.isView(i)&&nr(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(ld=!0,n()):{url:e.url,encodedBody:t}},_d=e=>{try{return pd(e)}catch(t){return is.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},gd=function(){var e=t((function*(e){var t=dd(e.data),i=yield cr(t,ts.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return r({},e,{_encodedBody:{contentType:ad,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),vd=(e,t)=>cd(e,{_:(new Date).getTime().toString(),ver:ts.JS_SDK_VERSION,compression:t}),fd=[];Gn&&fd.push({transport:"fetch",method(e){var t,i=_d(e);if(i){var{url:n,encodedBody:s}=i,{contentType:o,body:a,estimatedSize:l}=null!=s?s:{},u=new Headers;os(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var c=null,d=null;if(Yn){var h=new Yn;c={signal:h.signal,timeout:setTimeout((()=>{var t,r;t=e.timeout,(r=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",h.abort(d=r)}),e.timeout)}}Gn(n,r({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&52428.8>(l||0),body:a,signal:null==(t=c)?void 0:t.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){is.error(e)}null==e.callback||e.callback(i)})))).catch((t=>{t===d?is.warn(t):is.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>c?clearTimeout(c.timeout):null))}}}),Qn&&fd.push({transport:"XHR",method(e){var t=_d(e);if(t){var r=new Qn,{url:i,encodedBody:n}=t;r.open(e.method||"GET",i,!0);var{contentType:s,body:o}=null!=n?n:{};os(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!=Wn&&Wn.sendBeacon&&fd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:r}=pd(e),{contentType:i,body:n}=null!=r?r:{};if(!n)return;var s=n instanceof Blob?n:new Blob([n],{type:i});Wn.sendBeacon(t,s)}catch(e){}}});var md=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 yd(e,t,r){return dd({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var bd={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=>md(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!md(t,e))))),icontains:(e,t)=>t.map(Sd).some((t=>e.map(Sd).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Sd).every((t=>e.map(Sd).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)))}))},Sd=e=>e.toLowerCase(),wd=new Set(["is_not","not_icontains","not_regex"]);function kd(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(xr(n)||Ir(n))return wd.has(s);var o=bd[s];return!!o&&!xr(e.value)&&!Ir(e.value)&&o(br(e.value)?e.value.map(String):[String(e.value)],br(n)?n.map(String):[String(n)])}))}function xd(e,t){return!e||Object.entries(e).every((e=>{var[r,i]=e,n=null==t?void 0:t[r];if(xr(n)||Ir(n))return!1;var s=[String(n)],o=bd[i.operator];return!!o&&o(i.values,s)}))}var Cd="",Ed=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Id={_is_supported:()=>!!Vn,_error(e){is.error("cookieStore error: "+e)},_get(e){if(Vn){try{for(var t=e+"=",r=Vn.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}},_parse(e){var t;try{t=JSON.parse(Id._get(e))||{}}catch(e){}return t},_set(e,t,r,i,n){if(!Vn)return!1;try{var s="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=Vn),Cd)return Cd;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_"+mc();!Cd&&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",Cd=s)}return Cd}(e);if(!r){var i=(e=>{var t=e.match(Ed);return t?t[0]:""})(e);i!==r&&is.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(Vn.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&&is.warn("cookieStore warning: large cookie, len="+u.length),Vn.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=Vn&&Vn.cookie)try{Id._set(e,"",-1,t)}catch(e){return}}},Td=null,Md={_is_supported(){if(!Ir(Td))return Td;var e=!0;if(xr(Un))e=!1;else try{var t="__mplssupport__";Md._set(t,"xyz"),'"xyz"'!==Md._get(t)&&(e=!1),Md._remove(t)}catch(t){e=!1}return e||is.error("localStorage unsupported; falling back to cookie store"),Td=e,e},_error(e){is.error("localStorage error: "+e)},_get(e){try{return null==Un?void 0:Un.localStorage.getItem(e)}catch(e){Md._error(e)}return null},_parse(e){try{return JSON.parse(Md._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Un||Un.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Md._error(e)}return!1},_remove(e){try{null==Un||Un.localStorage.removeItem(e)}catch(e){Md._error(e)}}},Rd=[Is,"distinct_id",js,Gs,Io,Eo,So],Pd={},Ld={_is_supported:()=>!0,_error(e){is.error("memoryStorage error: "+e)},_get:e=>Pd[e]||null,_parse:e=>Pd[e]||null,_set:(e,t)=>(Pd[e]=t,!0),_remove(e){delete Pd[e]}},Fd=null,Od={_is_supported(){if(!Ir(Fd))return Fd;if(Fd=!0,xr(Un))Fd=!1;else try{var e="__support__";Od._set(e,"xyz"),'"xyz"'!==Od._get(e)&&(Fd=!1),Od._remove(e)}catch(e){Fd=!1}return Fd},_error(e){is.error("sessionStorage error: ",e)},_get(e){try{return null==Un?void 0:Un.sessionStorage.getItem(e)}catch(e){Od._error(e)}return null},_parse(e){try{return JSON.parse(Od._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Un||Un.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Od._error(e)}return!1},_remove(e){try{null==Un||Un.sessionStorage.removeItem(e)}catch(e){Od._error(e)}}},Ad=ns("[Stylesheet Loader]"),Dd=Un,Nd=Vn,Bd="#020617",qd={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:qu.Right,widgetType:Bu.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:Bd,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Hd=[qu.Center,qu.Left,qu.Right];function $d(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 Ud(e){var t;void 0===e&&(e=qd.backgroundColor),"#"===e[0]&&(t=$d(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=$d(r)),!t)return Bd;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?Bd:"white"}return Bd}var zd=(e,t,i)=>{var n=ah(e),s=Nd.querySelector("."+n);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=Nd.createElement("div");((e,t,i)=>{var n=r({},qd,i),s=e.style,o=!Hd.includes(n.position)||t===$u.Widget&&(null==i?void 0:i.widgetType)===Bu.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)||Ud(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",Ud(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Ud(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Ud(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)||Ud(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,n=Nd.createElement("style");return n.innerText=':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)}}',null!=r&&null!=(i=r.config)&&i.prepare_external_dependency_stylesheet&&(n=r.config.prepare_external_dependency_stylesheet(n)),n||(Ad.error("prepare_external_dependency_stylesheet returned null"),null)})(0,0,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 Nd.body.appendChild(o),{shadow:a,isNewlyCreated:!0}},Wd=e=>{var{responses:t,survey:i,surveySubmissionId:n,posthog:s,isSurveyCompleted:o,properties:a,surveyLanguage:l}=e;s?(cc(i),s.capture(Vu.SENT,r({[ju.SURVEY_NAME]:i.name,[ju.SURVEY_ID]:i.id,[ju.SURVEY_ITERATION]:i.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:i.current_iteration_start_date,[ju.SURVEY_SUBMISSION_ID]:n,[ju.SURVEY_COMPLETED]:o},l&&{[ju.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Zu(t,i),a,{$set:{[Ku(i,"responded")]:!0}})),o&&(Dd.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:i.id}})),oh(i))):rc.error("[survey sent] event not captured, PostHog instance not found.")},Vd=(e,t,i)=>{return r({[ju.SURVEY_NAME]:e.name,[ju.SURVEY_ID]:e.id,[ju.SURVEY_ITERATION]:e.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[ju.SURVEY_PARTIALLY_COMPLETED]:(n=null==t?void 0:t.responses,void 0===n&&(n={}),Object.values(n).some((e=>!Tr(e))))},(null==t?void 0:t.surveyLanguage)&&{[ju.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==i.get_session_replay_url?void 0:i.get_session_replay_url(),[ju.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Zu(null==t?void 0:t.responses,e));var n},jd=(e,t,i,n)=>{if(t){if(!i){var s=nh(e);t.capture(Vu.DISMISSED,r({},Vd(e,s,t),n&&{[ju.SURVEY_LANGUAGE]:n},{$set:{[Ku(e,"dismissed")]:!0}})),oh(e),cc(e),Dd.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else rc.error("[survey dismissed] event not captured, PostHog instance not found.")},Gd=(e,t)=>{if(t){var r=(e=>lc("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=nh(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Vu.ABANDONED,Vd(e,i,t),{transport:"sendBeacon"})}}else rc.error("[survey abandoned] event not captured, PostHog instance not found.")},Qd=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Yd=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Zd=e=>e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Yd(e.questions,Qd(e.questions)):e.questions,Kd=e=>{var t;return!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation||!(e=>{var t,r;return null!=(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)?void 0:t.length)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})(e))||e.schedule===Wu.Always||sh(e)},Jd=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,Ql(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"+Al++,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}),Xd=()=>Mu(Jd),eh=e=>{var{component:t,children:r,renderAsHtml:i,style:n}=e;return function(e,t,r){var i,n,s,o,a=Hl({},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?Sl.call(arguments,2):r),zl(e.type,a,i||e.key,n||e.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:r},style:n}:{children:r,style:n})};function th(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=Cs(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 bd[o](s,[n])}var rh=e=>{var t=""+ac+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+ac+e.id+"_"+e.current_iteration),t},ih=(e,t)=>{try{localStorage.setItem(rh(e),JSON.stringify(t))}catch(e){rc.error("Error setting in-progress survey state in localStorage",e)}},nh=e=>{try{var t=localStorage.getItem(rh(e));if(t)return JSON.parse(t)}catch(e){rc.error("Error getting in-progress survey state from localStorage",e)}return null},sh=e=>{var t=nh(e);return!Tr(null==t?void 0:t.surveySubmissionId)},oh=e=>{try{localStorage.removeItem(rh(e))}catch(e){rc.error("Error clearing in-progress survey state from localStorage",e)}};function ah(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function lh(e,t,r){if(void 0===t&&(t=qu.Right),e===$u.ExternalSurvey)return{};switch(t){case qu.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case qu.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case qu.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case qu.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case qu.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case qu.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case qu.Left:return{left:"30px"};case qu.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===$u.Widget&&r===Bu.Tab?"60px":"30px"}}}var uh=0;function ch(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:--uh,__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 wl.vnode&&wl.vnode(u),u}var dh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),hh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),ph=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),_h=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),gh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ch("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"})}),vh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ch("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"})}),fh=ch("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ch("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"})}),mh=function(e){var{fill:t="currentColor"}=void 0===e?{}:e;return ch("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ch("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ch("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:t})]})},yh=ch("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ch("g",{"clip-path":"url(#clip0_2415_6911)",children:[ch("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ch("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ch("g",{mask:"url(#mask0_2415_6911)",children:[ch("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"}),ch("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"}),ch("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"}),ch("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"}),ch("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"}),ch("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"})]})]}),ch("defs",{children:ch("clipPath",{id:"clip0_2415_6911",children:ch("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function bh(e){var{urlParams:t}=e,r=t?Object.entries(t).map((e=>{var[t,r]=e;return encodeURIComponent(t)+"="+encodeURIComponent(r)})).join("&"):"";return ch("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",yh]})}function Sh(e){var{text:t,submitDisabled:r,appearance:i,onSubmit:n,link:s,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}=e,{isPreviewMode:c}=Mu(Jd),d=!!l&&!!u,h=!a&&ch("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){s&&(null==Un||Un.open(s)),c?null==o||o():n()},children:t});return ch("div",{className:"bottom-section",children:[d?ch("div",{className:"form-buttons form-buttons-with-back",children:[ch("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&ch(bh,{urlParams:{utm_source:"survey-footer"}})]})}function wh(e){var{question:t,forceDisableHtml:r,htmlFor:i}=e;return ch("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ch(t.type===Uu.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&eh({component:Ul("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function kh(e){var{onClick:t}=e,{isPreviewMode:r}=Mu(Jd);return ch("button",{className:"form-cancel",onClick:t,disabled:r,"aria-label":"Close survey",type:"button",children:mh({fill:"black"})})}ch("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ch("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 xh=Un;function Ch(e){var{header:t,description:r,contentType:i,forceDisableHtml:n,appearance:s,onClose:o}=e,{isPopup:a}=Mu(Jd);return Eu((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return _s(xh,"keydown",e),()=>{xh.removeEventListener("keydown",e)}}),[o]),ch("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&ch(kh,{onClick:()=>o()}),ch("h3",{className:"thank-you-message-header",children:t}),r&&eh({component:Ul("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&ch(Sh,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}var Eh=e=>br(e)&&e.every((e=>Cr(e)));function Ih(e){var{question:t,forceDisableHtml:r,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:o,initialValue:a,canGoBack:l,onBack:u}=e,{isPreviewMode:c}=Xd(),d=Iu(null),[h,p]=Cu((()=>Cr(a)?a:""));Eu((()=>{setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c]);var _="surveyQuestion"+o,g=Tu((()=>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 er.MinLength: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 er.MaxLength: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}(h,t.validation,t.optional)),[h,t.validation,t.optional]),v=on(t.validation,er.MinLength),f=on(t.validation,er.MaxLength),m=Tu((()=>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}(v,f)),[v,f]),y=()=>{g||n(h.trim())},b=()=>{g||s(h.trim())};return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:t,forceDisableHtml:r,htmlFor:_}),ch("textarea",{ref:d,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:v,maxLength:f,onInput(e){p(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:h}),m&&ch("div",{className:"validation-hint",children:m})]}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:l,onBack:u})]})}function Th(e){var{question:t,forceDisableHtml:r,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:o,onBack:a}=e;return ch(Wl,{children:[ch("div",{className:"question-container",children:ch(wh,{question:t,forceDisableHtml:r})}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:o,onBack:a})]})}function Mh(e){var t,{question:r,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d=r.scale,h=10===r.scale?0:1,[p,_]=Cu((()=>Mr(l)?l:br(l)&&l.length>0&&Mr(parseInt(l[0]))?parseInt(l[0]):Cr(l)&&Mr(parseInt(l))?parseInt(l):null)),g="emoji"===r.display&&2===r.scale,{isPreviewMode:v}=Xd(),f=e=>v?a(e):o(e);return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:r,forceDisableHtml:i}),ch("div",{className:"rating-section",children:[ch("div",{className:"rating-options",children:["emoji"===r.display&&ch("div",{className:"rating-options-emoji"+(g?" rating-options-emoji-2":""),children:null==(t=Ah[r.scale])?void 0:t.map(((e,t)=>ch("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===p?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;_(e),r.skipSubmitButton&&f(e)},children:e},t)))}),"number"===r.display&&ch("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:Dh(r.scale).map(((e,t)=>ch(Rh,{displayQuestionIndex:n,active:p===e,appearance:s,num:e,setActiveNumber(e){_(e),r.skipSubmitButton&&f(e)}},t)))})]}),!g&&ch("div",{className:"rating-text",children:[ch("div",{children:r.lowerBoundLabel}),ch("div",{children:r.upperBoundLabel})]})]})]}),ch(Sh,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Ir(p)&&!r.optional,appearance:s,onSubmit:()=>o(p),onPreviewSubmit:()=>a(p),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function Rh(e){var{num:t,active:r,displayQuestionIndex:i,setActiveNumber:n}=e;return ch("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+i+"-rating-"+t+" "+(r?"rating-active":""),type:"button",onClick(){n(t)},children:t})}function Ph(e){var{question:t,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d=Iu(null),h=Tu((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Yd(t,Qd(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),[p,_]=Cu((()=>((e,t)=>Cr(e)||Eh(e)?e:t===Uu.SingleChoice?null:[])(l,t.type))),[g,v]=Cu((()=>((e,t)=>{if(Cr(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Eh(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h))),{isPreviewMode:f}=Xd(),m=t.type===Uu.SingleChoice,y=t.type===Uu.MultipleChoice,b=t.skipSubmitButton&&m&&!t.hasOpenChoice,S=(e,t)=>{if(t){var i=!g.isSelected;return v((e=>r({},e,{isSelected:i,inputValue:i?e.inputValue:""}))),m&&_(""),void(i&&setTimeout((()=>{var e;return null==(e=d.current)?void 0:e.focus()}),75))}if(m)return _(e),v((e=>r({},e,{isSelected:!1,inputValue:""}))),void(b&&(o(e),f&&a(e)));y&&br(p)&&(p.includes(e)?_(p.filter((t=>t!==e))):_([...p,e]))},w=e=>{e.stopPropagation();var t=e.currentTarget.value;v((e=>r({},e,{inputValue:t}))),m&&_(t)},k=e=>{e.stopPropagation(),"Enter"!==e.key||x()||(e.preventDefault(),C()),"Escape"===e.key&&(e.preventDefault(),v((e=>r({},e,{isSelected:!1,inputValue:""}))),m&&_(null))},x=()=>!(t.optional||!Ir(p)&&(!br(p)||g.isSelected||0!==p.length)&&(!g.isSelected||""!==g.inputValue.trim())),C=()=>{g.isSelected&&y?br(p)&&(f?a([...p,g.inputValue]):o([...p,g.inputValue])):f?a(p):o(p)};return ch(Wl,{children:[ch("div",{className:"question-container",children:[ch(wh,{question:t,forceDisableHtml:i}),ch("fieldset",{className:"multiple-choice-options limit-height",children:[ch("legend",{className:"sr-only",children:y?" 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?g.isSelected:m?p===e:br(p)&&p.includes(e);return ch("label",{className:i?"choice-option-open":"",children:[ch("div",{className:"response-choice",children:[ch("input",{type:m?"radio":"checkbox",name:s,checked:a,onChange:()=>S(e,i),id:s,"aria-controls":o}),ch("span",{children:i?e+":":e})]}),i&&ch("input",{type:"text",ref:d,id:o,name:"question"+n+"Open",value:g.inputValue,onKeyDown:k,onInput:w,onClick(t){g.isSelected||S(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),ch(Sh,{text:t.buttonText||"Submit",submitDisabled:x(),appearance:s,onSubmit:C,onPreviewSubmit:C,skipSubmitButton:b,canGoBack:u,onBack:c})]})}var Lh=[1,2,3,4,5],Fh=[1,2,3,4,5,6,7],Oh=[0,1,2,3,4,5,6,7,8,9,10],Ah={2:[vh,fh],3:[ph,hh,dh],5:[_h,ph,hh,dh,gh]};function Dh(e){switch(e){case 5:default:return Lh;case 7:return Fh;case 10:return Oh}}var Nh=ns("[Surveys]");function Bh(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?zu.End:s;if(n.branching.type===zu.End)return zu.End;if(n.branching.type===zu.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===zu.ResponseBased){if(n.type===Uu.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===zu.End?zu.End:s}}else if(n.type===Uu.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===zu.End?zu.End:s}}return s}return Nh.warn("Falling back to next question index due to unexpected branching type"),s}var qh="https?://(.*)",Hh=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$h=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Hh],Uh="<masked>",zh=["li_fat_id"];function Wh(e,t,r){if(!Vn)return{};var i,n=t?[...Hh,...r||[]]:[],s=Vh(bs(Vn.URL,n,Uh),e),o=(i={},os(zh,(function(e){var t=Id._get(e);i[e]=t||null})),i);return as(o,s)}function Vh(e,t){var r=$h.concat(t||[]),i={};return os(r,(function(t){var r=ys(e,t);i[t]=r||null})),i}function jh(e){var t=function(e){return e?0===e.search(qh+"google.([^/?]*)")?"google":0===e.search(qh+"bing.com")?"bing":0===e.search(qh+"yahoo.com")?"yahoo":0===e.search(qh+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Ir(t)){i.$search_engine=t;var n=Vn?ys(Vn.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function Gh(){return navigator.language||navigator.userLanguage}var Qh="$direct";function Yh(){return(null==Vn?void 0:Vn.referrer)||Qh}function Zh(e,t,r){void 0===r&&(r=!1);var i=e?[...Hh,...t||[]]:[],n=r?Yi(null==jn?void 0:jn.href):null==jn?void 0:jn.href,s=null==n?void 0:n.substring(0,1e3);return{r:Yh().substring(0,1e3),u:s?bs(s,i,Uh):void 0}}function Kh(e,t){var r;void 0===t&&(t=!1);var{r:i,u:n}=e,s=t?Yi(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==Qh?Qh:null==(r=fs(i))?void 0:r.host};if(s){o.$current_url=s;var a=fs(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Vh(s);as(o,l)}if(i){var u=jh(i);as(o,u)}return o}function Jh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Xh(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var ep=ns("[SurveyTranslations]");function tp(e,t){var r=function(e){return function(e,t){var{overrideLanguage:r,storedPersonProperties:i,locale:n}=e,s=Ju(r);if(s)return null==t||t.info("Using override display language: "+s),s;var o=function(e){return e&&"object"==typeof e&&"language"in e?Ju(e.language):null}(i);if(o)return null==t||t.info("Using person property language: "+o),o;var a=Ju(n);return a?(null==t||t.info("Using detected locale: "+a),a):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Sr(e.get_property)?e.get_property(co):void 0,locale:Gh()},ep)}(t);if(!r)return ep.info("No user language detected"),{survey:e,language:null};var i=tc(e,r,ep);return{survey:i.survey,language:i.matchedKey}}var rp=Un,ip=Vn,np="ph:show_survey_widget",sp="PHWidgetSurveyClickListener";function op(e,t){try{var r=e.getBoundingClientRect(),i=rp.innerHeight,n=rp.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:qd.zIndex}}catch(e){return rc.warn("Failed to calculate trigger position:",e),null}}class ap{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(po);if(e)for(var t of e)sh(t)&&Gd(t,this._posthog)},this.handlePopoverSurvey=(e,t)=>{var i,n,s,o,{survey:a,language:l}=this._translateSurveyForRendering(e),u=null!=t&&t.position||null!=t&&t.selector?r({},a,{appearance:r({},a.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):a;this._clearSurveyTimeout(u.id);var{properties:c,initialResponses:d}=null!=t?t:{},h=!(!d||0>=Object.keys(d).length)&&this._handleInitialResponses(u,d,c,l);if(!h||null!=(i=u.appearance)&&i.displayThankYouMessage){this._addSurveyToFocus(u);var p={};if((null==(n=u.appearance)?void 0:n.position)===qu.NextToTrigger&&null!=(s=u.appearance)&&s.widgetSelector){var _,g=ip.querySelector(u.appearance.widgetSelector);g&&(p=op(g,parseInt((null==(_=u.appearance)?void 0:_.maxWidth)||qd.maxWidth))||{})}var v=(null==(o=u.appearance)?void 0:o.surveyPopupDelaySeconds)||0,{shadow:f}=zd(u,this._posthog),m={posthog:this._posthog,survey:u,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:c,style:p,isSurveyCompleted:h,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:l};if(0>=v)return cu(ch(dp,r({},m)),f);var y=setTimeout((()=>{if(this._surveyTimeouts.delete(u.id),!this._shouldDisplaySurvey(u))return rc.info("Survey "+u.id+" no longer eligible when its display delay elapsed; not displaying"),this._removeSurveyFromFocus(u);cu(ch(dp,r({},m,{survey:r({},u,{appearance:r({},u.appearance,{surveyPopupDelaySeconds:0})})})),f)}),1e3*v);this._surveyTimeouts.set(u.id,y)}},this._handleWidget=e=>{var{survey:t,language:r}=this._translateSurveyForRendering(e),{shadow:i,isNewlyCreated:n}=zd(t,this._posthog);n&&cu(ch(pp,{posthog:this._posthog,survey:t,surveyLanguage:r},e.id),i)},this._removeWidgetSelectorListener=e=>{this._removeSurveyFromDom(e);var t=this._widgetSelectorListeners.get(e.id);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(sp),this._widgetSelectorListeners.delete(e.id),rc.info("Removed click listener for survey "+e.id))},this._manageWidgetSelectorListener=(e,t)=>{var r=ip.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;rc.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._removeWidgetSelectorListener(e)}if(!r.hasAttribute(sp)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===qu.NextToTrigger?op(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||qd.maxWidth)):{};rp.dispatchEvent(new CustomEvent(np,{detail:{surveyId:e.id,position:n}}))};_s(r,"click",n),r.setAttribute(sp,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),rc.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var{survey:t,language:r}=this._translateSurveyForRendering(e),{shadow:i}=zd(t,this._posthog);cu(ch(dp,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:r}),i)},this.renderSurvey=(e,t,r)=>{var i,{survey:n,language:s}=this._translateSurveyForRendering(e),o=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(o=this._handleUrlPrefill(n,s)),cu(ch(dp,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:o,surveyLanguage:s}),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===$u.Popover||e.type===$u.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===$u.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===Bu.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Bu.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}Ir(t._surveyInFocus)&&e.type===$u.Popover&&t.handlePopoverSurvey(e)})),t._widgetSelectorListeners.forEach((e=>{var{survey:r}=e;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{Ir(this._surveyInFocus)||rc.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&rc.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)&&(rc.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=sh(e),s=sh(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===Wu.Always,a=t.schedule===Wu.Always;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 tp(e,this._posthog)}_handleUrlPrefill(e,t){if(this._prefillHandledSurveys.has(e.id))return!1;var{params:r}=function(e){var t={},r=!1,i=rp.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var[o,a]=s.split("=");if(o&&!xr(a)){var l=decodeURIComponent(o),u=decodeURIComponent(a);if("auto_submit"!==l||"true"!==u){var c=l.match(/^q(\d+)$/);if(c){var d=parseInt(c[1],10);t[d]||(t[d]=[]),t[d].push(u)}}else r=!0}}return{params:t,autoSubmit:r}}();if(0===Object.keys(r).length)return!1;rc.info("[Survey Prefill] Detected URL prefill parameters");var i=this._processPrefillData(e,r,t);if(!i)return!1;var{responses:n,submissionId:s,isSurveyCompleted:o,skippedResponses:a}=i;return(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Wd({responses:o?n:a,survey:e,surveySubmissionId:s,posthog:this._posthog,isSurveyCompleted:o,surveyLanguage:t}),this._prefillHandledSurveys.add(e.id),o}_handleInitialResponses(e,t,r,i){var n={};for(var[s,o]of Object.entries(t))n[parseInt(s)]=br(o)?o.map(String):[String(o)];rc.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);if(!a)return!1;var{responses:l,submissionId:u,isSurveyCompleted:c}=a;return Wd({responses:l,survey:e,surveySubmissionId:u,posthog:this._posthog,isSurveyCompleted:c,properties:r,surveyLanguage:i}),c}_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=Qu(e.id);try{switch(e.type){case Uu.SingleChoice:if(!e.choices||0===e.choices.length)return void is.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 is.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case Uu.MultipleChoice:if(!e.choices||0===e.choices.length)return void is.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 is.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&is.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case Uu.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void is.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:is.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){is.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return rc.warn("[Survey Prefill] No valid responses after conversion"),null;var n=mc(),s=Object.keys(t).map((e=>parseInt(e,10))),{startQuestionIndex:o,skippedResponses:a}=function(e,t,r){for(var i=0,n={},s=e.questions.length+1;e.questions.length>i&&s>0&&t.includes(i);){var o=e.questions[i];if(!o||!("skipSubmitButton"in o)||!o.skipSubmitButton)break;if(o.id){var a=Qu(o.id);xr(r[a])||(n[a]=r[a])}var l=Bh(e,i,o.id?r[Qu(o.id)]:null);if(l===zu.End)return{startQuestionIndex:e.questions.length,skippedResponses:n};i=l}return{startQuestionIndex:i,skippedResponses:n}}(e,s,i),l=o>=e.questions.length;return ih(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:o,surveyLanguage:r}),rc.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:o,isSurveyCompleted:l,skippedResponses:a}}catch(e){return rc.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||th(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,n;if(!e||0===e.length)return!0;if(!Kn)return!1;var s=ji(Kn,{userAgentDataPlatform:null==Wn||null==(r=Wn.userAgentData)?void 0:r.platform,maxTouchPoints:null==Wn?void 0:Wn.maxTouchPoints,screenWidth:null==Un||null==(i=Un.screen)?void 0:i.width,screenHeight:null==Un||null==(n=Un.screen)?void 0:n.height,devicePixelRatio:null==Un?void 0:Un.devicePixelRatio});return bd[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==Nd||!Nd.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){return Kd(e)||this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)||sh(e)}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!ic(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!dc.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;return this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n)?this._isSurveyFeatureFlagEnabled(e.targeting_flag_key)?this._internalFlagCheckSatisfied(e)?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,Md._get("lastSeenSurveyDate"))?(e=>!!Md._get(uc(e))&&!Kd(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="Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i):(i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i):(i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i)}_hasActionOrEventTriggeredSurvey(e){var t;if(!nc(e)&&!sc(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{key:t,value:r}=e;return!t||!r||this._isSurveyFeatureFlagEnabled(r)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=ip.querySelector(ah(e,!0));null!=t&&t.shadowRoot&&cu(null,t.shadowRoot),null==t||t.remove()}catch(t){rc.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 lp(e,t){if(ip&&rp){var r,i=new ap(e);if(e.config.disable_surveys_automatic_display)return rc.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return rc.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{xr(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))};return n(),_s(ip,"visibilitychange",(()=>{ip.hidden?xr(r)||(clearInterval(r),r=void 0):(i.callSurveysAndEvaluateDisplayLogic(!1),n())})),i}}function up(e){var{survey:t,removeSurveyFromFocus:r=(()=>{}),setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}=e;Eu((()=>{var e;if(!n&&null!=(e=t.conditions)&&e.url){var o=()=>{var e,n=t.type===$u.Widget,o=th(t,s),a=(null==(e=t.appearance)?void 0:e.widgetType)===Bu.Tab&&n;if(!o)return rc.info("Hiding survey "+t.id+" because URL does not match"),i(!1),r(t);a&&(rc.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),i(!0))};_s(rp,"popstate",o),_s(rp,"hashchange",o);var a=rp.history.pushState,l=rp.history.replaceState;return rp.history.pushState=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];a.apply(this,t),o()},rp.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];l.apply(this,t),o()},()=>{rp.removeEventListener("popstate",o),rp.removeEventListener("hashchange",o),rp.history.pushState=a,rp.history.replaceState=l}}}),[n,t,r,i,s])}function cp(e){switch(void 0===e&&(e=Hu.Right),e){case Hu.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Hu.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Hu.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function dp(e){var t,i,n,s,o,a,{survey:l,forceDisableHtml:u,posthog:c,style:d={},previewPageIndex:h,removeSurveyFromFocus:p=(()=>{}),isPopup:_=!0,onPreviewSubmit:g=(()=>{}),onPreviewBack:v=(()=>{}),onPopupSurveyDismissed:f=(()=>{}),onCloseConfirmationMessage:m=(()=>{}),properties:y,isSurveyCompleted:b,skipShownEvent:S,surveyLanguage:w}=e,k=Iu(null),x=Number.isInteger(h),C=null!=(t=l.appearance)&&t.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,{isPopupVisible:E,isSurveySent:I,hidePopupWithViewTransition:T}=function(e,t,i,n,s,o,a,l,u){var[c,d]=Cu(n||0===i||e.type===$u.ExternalSurvey),[h,p]=Cu(!1),_=()=>{var t=()=>{o&&s(e),d(!1)};ip.startViewTransition?ip.startViewTransition((()=>{var e;null==a||null==(e=a.current)||e.remove()})).finished.then((()=>{setTimeout((()=>{t()}),100)})):t()},g=t=>{t.detail.surveyId===e.id&&_()};return Eu((()=>{if(t){if(!n){var s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return _();p(!0),null!=(i=e.appearance)&&i.autoDisappear&&setTimeout((()=>{_()}),5e3)}},o=()=>{if(th(e,t)){d(!0),rp.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(Vu.SHOWN,r({[ju.SURVEY_NAME]:e.name,[ju.SURVEY_ID]:e.id,[ju.SURVEY_ITERATION]:e.current_iteration,[ju.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[ju.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(_s(rp,"PHSurveyClosed",g),_s(rp,"PHSurveySent",s),i>0){var a=setTimeout(o,i);return()=>{clearTimeout(a),rp.removeEventListener("PHSurveyClosed",g),rp.removeEventListener("PHSurveySent",s)}}return o(),()=>{rp.removeEventListener("PHSurveyClosed",g),rp.removeEventListener("PHSurveySent",s)}}}else rc.error("usePopupVisibility hook called without a PostHog instance.")}),[]),up({survey:e,removeSurveyFromFocus:s,setSurveyVisible:d,isPreviewMode:n,posthog:t}),{isPopupVisible:c,isSurveySent:h,setIsPopupVisible:d,hidePopupWithViewTransition:_}}(l,c,C,x,p,_,k,S,w),M=I||h===l.questions.length||!0===b,R=Tu((()=>{var e=nh(l),t=(null==e?void 0:e.surveySubmissionId)||mc();return{isPreviewMode:x,previewPageIndex:h,onPopupSurveyDismissed(){w?jd(l,c,x,w):jd(l,c,x),f()},isPopup:_||!1,surveySubmissionId:t,onPreviewSubmit:g,onPreviewBack:v,posthog:c,properties:y,surveyLanguage:w}}),[x,h,_,c,l,f,g,v,y,w]);return E?ch(Jd.Provider,{value:R,children:ch("div",{className:"ph-survey",style:r({},lh(l.type,null==(i=l.appearance)?void 0:i.position,null==(n=l.appearance)?void 0:n.widgetType),d),ref:k,children:M?ch(Ch,{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||qd,onClose(){T(),m()}}):ch(hp,{survey:l,forceDisableHtml:!!u,posthog:c})})}):null}function hp(e){var t,i,{survey:n,forceDisableHtml:s,posthog:o}=e,[a,l]=Cu((()=>{var e=nh(n);return null!=e&&e.responses&&rc.info("Survey is already in progress, filling in initial responses"),(null==e?void 0:e.responses)||{}})),{previewPageIndex:u,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:h,onPreviewBack:p,surveySubmissionId:_,isPreviewMode:g,properties:v,surveyLanguage:f}=Mu(Jd),[m,y]=Cu((()=>{var e=nh(n);return u||(null==e?void 0:e.lastQuestionIndex)||0})),[b,S]=Cu((()=>{var e,t=nh(n);return null!==(e=null==t?void 0:t.visitedIndices)&&void 0!==e?e:[]})),w=Tu((()=>Zd(n)),[n]);Eu((()=>{g&&!xr(u)&&y(u)}),[u,g]);var k=!(null==(t=n.appearance)||!t.allowGoBack)&&(g?(null!=u?u:0)>0:b.length>0),x=w.at(m);return x?ch("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null==(i=n.appearance)?void 0:i.hideCancelButton)&&ch(kh,{onClick(){c()}}),ch("div",{className:"survey-box","data-question-index":m,children:_p({question:x,forceDisableHtml:s,displayQuestionIndex:m,appearance:n.appearance||qd,onSubmit:e=>(e=>{var{res:t,displayQuestionIndex:i,questionId:s}=e;if(o)if(s){var u=Qu(s),c=r({},a,{[u]:t});l(c);var d=Bh(n,i,t),h=d===zu.End,p=[...b,i];if(h||(S(p),y(d),ih(n,{surveySubmissionId:_,responses:c,lastQuestionIndex:d,visitedIndices:p,surveyLanguage:f})),n.enable_partial_responses||h){var g=new Set(p.map((e=>{var t;return null==(t=w[e])?void 0:t.id})).filter((e=>!!e)).map((e=>Qu(e)))),m=Object.fromEntries(Object.entries(c).filter((e=>{var[t]=e;return g.has(t)})));Wd({responses:m,survey:n,surveySubmissionId:_,isSurveyCompleted:h,posthog:o,properties:v,surveyLanguage:f})}}else rc.error("onNextButtonClick called without a questionId.");else rc.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:m,questionId:x.id}),onPreviewSubmit:h,initialValue:x.id?a[Qu(x.id)]:void 0,canGoBack:k,onBack(){if(g)p();else if(0!==b.length){var e=b[b.length-1],t=b.slice(0,-1);S(t),y(e),ih(n,{surveySubmissionId:_,responses:a,lastQuestionIndex:e,visitedIndices:t,surveyLanguage:f})}}})})]}):null}function pp(e){var t,r,i,n,s,o,a,{survey:l,forceDisableHtml:u,posthog:c,readOnly:d,surveyLanguage:h}=e,[p,_]=Cu(!0),[g,v]=Cu(!1),[f,m]=Cu({}),y=()=>{v(!g)};if(Eu((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(rc.info("Received show event for feedback button survey "+l.id),m(r.detail.position||{}),y())};return _s(rp,np,t),()=>{rp.removeEventListener(np,t)}}}else rc.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]),up({survey:l,setSurveyVisible:_,posthog:c}),!p)return null;var b=()=>{l.schedule!==Wu.Always&&_(!1),setTimeout((()=>{v(!1)}),200)};return ch(Wl,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&ch("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===Hu.Top?"widget-tab-top":""),onClick:y,disabled:d,style:cp(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),g&&ch(dp,{posthog:c,survey:l,forceDisableHtml:u,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:h})]})}var _p=e=>{var{question:t,forceDisableHtml:i,displayQuestionIndex:n,appearance:s,onSubmit:o,onPreviewSubmit:a,initialValue:l,canGoBack:u,onBack:c}=e,d={forceDisableHtml:i,appearance:s,onPreviewSubmit(e){a(e)},onSubmit(e){o(e)},initialValue:l,displayQuestionIndex:n,canGoBack:u,onBack:c};switch(t.type){case Uu.Open:return Ul(Ih,r({},d,{question:t,key:t.id}));case Uu.Link:return Ul(Th,r({},d,{question:t,key:t.id}));case Uu.Rating:return Ul(Mh,r({},d,{question:t,key:t.id}));case Uu.SingleChoice:case Uu.MultipleChoice:return Ul(Ph,r({},d,{question:t,key:t.id}));default:return rc.error("Unsupported question type: "+t.type),null}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.generateSurveys=lp,Jn.extendPostHogWithSurveys=lp;var gp=(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),vp=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return gp(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 gp(t,JSON.stringify(e.slice(0,n)),r)},fp=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,mp=(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}},yp=(e,t,r)=>{if(!r.truncated)if(wr(e)){if(r.seen.has(e))return void mp(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(yp(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else mp(t,e,r)},bp=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!fp(e))return!n||gp(t,"null",r);if(Ir(e)||(e=>{try{return Mr(e)||Pr(e)}catch(e){return!1}})(e))return gp(t,JSON.stringify(e),r);if("string"==typeof e)return vp(e,t,r);if(!wr(e)&&!br(e))return gp(t,JSON.stringify(e),r);if(i.has(e))return vp("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Sr(o))return bp(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return vp(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return gp(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 bp(l,t,r,i,n,s)}if(br(e)){if(!gp(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!gp(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!bp(d,t,r,i,!0))return!1}return gp(t,"]",r)}if(!gp(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{yp(_,p,s)}catch(e){}if(fp(_)){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(!gp(t,g,r))return!1;var y=t.length,b=bp(_,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 gp(t,"}",r)},Sp={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.logs={initializeLogs(e){var t={host:Jn.location.host},i=function(i){var n;Jn.console[i]=(n=Jn.console[i],function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];try{if(o.length>0&&e.is_capturing()){var l,{body:u,truncated:c,attributes:d}=((e,t)=>{for(var r=[],i={remaining:1e4,truncated:!1},n=wr(e[0])?{result:{},keysRemaining:50,sizeRemaining:1e4,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||gp(r," ",i))&&bp(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)||{}}})(o),h=r({},t,c?{body_truncated:"true"}:{});null==(l=e.logs)||l._captureConsoleLog({level:Sp[i],body:u,attributes:r({"log.source":"console."+i},h,d)})}}catch(e){}finally{n.apply(Jn.console,o)}})};for(var n of Object.keys(Sp))i(n)}};var wp=ns("[Error tracking]");function kp(){return new dn([new xn,new On,new En,new Cn,new Ln,new Pn,new Tn,new Fn],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=wn.test(l)?l.replace(wn,"$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>=kn)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,kn).map((e=>{return r({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||hn});var i}))}(s)}}("web:javascript",mn,Sn))}var xp=ns("[ExceptionAutocapture]"),Cp=kp(),Ep={wrapOnError(e){var t=Un;t||xp.info("window not available, cannot wrap onerror");var r=t.onerror;return t.onerror=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];var o=Cp.buildFromUnknown(n[4]||n[0],{mechanism:{handled:!1}});return e(o),null!==(t=null==r?void 0:r(...n))&&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=Un;t||xp.info("window not available, cannot wrap onUnhandledRejection");var r=t.onunhandledrejection;return t.onunhandledrejection=function(t){var i,n=Cp.buildFromUnknown(t,{mechanism:{handled:!1}});return e(n),null!==(i=null==r?void 0: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||xp.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=Cp.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});return e(a),null==r?void 0:r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.errorWrappingFunctions=Ep,Jn.posthogErrorWrappingFunctions=Ep;var Ip="X-POSTHOG-SESSION-ID",Tp="X-POSTHOG-WINDOW-ID",Mp="X-POSTHOG-DISTINCT-ID",Rp=[Ip,Tp,Mp],Pp=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Lp=(e,t)=>({}.hasOwnProperty.call(e,t)),Fp=e=>"object"==typeof e&&!Ir(e)||Sr(e),Op=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Ap=e=>{try{var t;return Op(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==Un||null==(t=Un.location)?void 0:t.href).toString()}catch(e){return}},Dp=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(br(e)&&!e.includes(s))return!1;var o=!1;if(r){var{sessionId:a,windowId:l}=r.checkAndGetSessionAndWindowId(!0);n.set(Ip,a),n.set(Tp,l),o=!0}var u=(e=>Sr(e)?e():e)(t);return u&&u!==Mo&&(n.set(Mp,u),o=!0),o};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{};var Np={_patchFetch:(e,t,i)=>ws(Un,"fetch",(n=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=Ap(s);if(u)if(Op(s)){var c=new Request(s,o);Dp(e,t,i,c.url,c.headers),l=[c]}else{var d=new Headers(Fp(o)?o.headers:void 0);if(Dp(e,t,i,u,d)){var h=((e,t)=>{if(xr(e)||Ir(e))return{headers:t};if(Fp(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)=>Lp(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>Lp(e,t)||t in i,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach((e=>t.add(e))),Pp.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&&Pp.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)=>ws(Un.XMLHttpRequest.prototype,"open",(i=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=Ap(s);d&&Dp(e,t,r,d,c);var h=i.call(u,n,s,o,a,l);return Rp.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};Jn.__PosthogExtensions__.tracingHeadersPatchFns=Np,Jn.postHogTracingHeadersPatchFns=Np,"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 Bp=-1,qp=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Bp=t.timeStamp,e(t))}),!0)},Hp=(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))}},$p=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},Up=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},zp=()=>{var e,t;return null!==(e=null==(t=Up())?void 0:t.activationStart)&&void 0!==e?e:0},Wp=function(e,t){void 0===t&&(t=-1);var r=Up(),i="navigate";return 0>Bp?r&&(document.prerendering||zp()>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}},Vp=new WeakMap;function jp(e,t){var r=Vp.get(t);return r||(r=new WeakMap,Vp.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Gp{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 Qp,Yp=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){}},Zp=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Kp=-1,Jp=new Set,Xp=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,e_=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Jp)t();isFinite(Kp)||(Kp="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",e_,!0))}},t_=()=>{if(0>Kp){var e,t=zp(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Kp=null!=r?r:Xp(),addEventListener("visibilitychange",e_,!0),addEventListener("prerenderingchange",e_,!0),qp((()=>{setTimeout((()=>{Kp=Xp()}))}))}return{get firstHiddenTime(){return Kp},onHidden(e){Jp.add(e)}}},r_=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},i_=[1800,3e3],n_=function(e,t){void 0===t&&(t={}),r_((()=>{var r,i=t_(),n=Wp("FCP"),s=Yp("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-zp(),0),n.entries.push(t),r(!0)))}));s&&(r=Hp(e,n,i_,t.reportAllChanges),qp((i=>{n=Wp("FCP"),r=Hp(e,n,i_,t.reportAllChanges),$p((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},s_=[.1,.25],o_=0,a_=1/0,l_=0,u_=e=>{for(var t of e)t.interactionId&&(a_=Math.min(a_,t.interactionId),l_=Math.max(l_,t.interactionId),o_=l_?(l_-a_)/7+1:0)},c_=()=>{var e;return Qp?o_:null!==(e=performance.interactionCount)&&void 0!==e?e:0},d_=0;class h_{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){d_=c_(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((c_()-d_)/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 p_=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Zp(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},__=[200,500];class g_{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var v_=[2500,4e3],f_={onLCP(e,t){void 0===t&&(t={}),r_((()=>{var r,i=t_(),n=Wp("LCP"),s=jp(t,g_),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-zp(),0),n.entries=[o],r())},a=Yp("largest-contentful-paint",o);if(a){r=Hp(e,n,v_,t.reportAllChanges);var l=Zp((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(p_(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});qp((i=>{n=Wp("LCP"),r=Hp(e,n,v_,t.reportAllChanges),$p((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},onCLS(e,t){void 0===t&&(t={});var r=t_();n_(Zp((()=>{var i,n=Wp("CLS",0),s=jp(t,Gp),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=Yp("layout-shift",o);a&&(i=Hp(e,n,s_,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),qp((()=>{s.i=0,n=Wp("CLS",0),i=Hp(e,n,s_,t.reportAllChanges),$p(i)})),setTimeout(i))})))},onFCP:n_,onINP(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=t_();r_((()=>{var i;"interactionCount"in performance||Qp||(Qp=Yp("event",u_,{durationThreshold:0}));var n,s=Wp("INP"),o=jp(t,h_),a=e=>{p_((()=>{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=Yp("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Hp(e,s,__,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),qp((()=>{o.v(),s=Wp("INP"),n=Hp(e,s,__,t.reportAllChanges)})))}))}}};Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.postHogWebVitalsCallbacks=f_,Jn.postHogWebVitalsCallbacks=f_,Jn.__PosthogExtensions__.loadWebVitalsCallbacks=()=>f_;class m_{constructor(e){this.disabled=!1===e;var t=wr(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 y_="$copy_autocapture",b_=ns("[AutoCapture]");function S_(e,t){return t.length>e?t.slice(0,e)+"...":t}function w_(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ra(t));return t}function k_(e,t){var i,n,{e:s,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:c}=t;if(!ra(e))return{props:{}};for(var d=[e],h=e;h.parentNode&&!ia(h,"body");)if(sa(h.parentNode))d.push(h.parentNode.host),h=h.parentNode.host;else{if(!ra(h.parentNode))break;d.push(h.parentNode),h=h.parentNode}var p,_,g=[],v={},f=!1,m=!1;if(os(d,(e=>{var t=Ca(e);if(ia(e,"a")){var r=e.getAttribute("href");f=!!(t&&r&&Fa(r))&&(c?Yi(r):r)}_r(la(e),"ph-no-capture")&&(m=!0),g.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};ha.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?S_(1024,Oa(e)):S_(1024,ca(e)));var a=la(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),os(e.attributes,(function(r){var s;if((!Ea(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Fa(r.value)&&(!Cr(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=oa(a).join(" ")),o["attr__"+r.name]=S_(1024,"href"===r.name&&n?Yi(a):a)}}));for(var l=1,u=1,c=e;c=w_(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(!Ca(e))return{};var t={};return os(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&&Fa(i)&&(t[r]=i)}})),t}(e);as(v,i)})),m)return{props:{},explicitNoCapture:m};if(a||(g[0].$el_text=ia(e,"a")||ia(e,"button")?Oa(e):ca(e)),f){var y,b;g[0].attr__href=f;var S=null==(y=fs(f))?void 0:y.host,w=null==Un||null==(b=Un.location)?void 0:b.host;S&&w&&S!==w&&(p=f)}return{props:as({$event_type:s.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,function(e){var t=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 ls(o).sort(((e,t)=>{var[r]=e,[i]=t;return r.localeCompare(i)})).forEach((e=>{var[t,r]=e;return a[Da(t.toString())]=Da(r.toString())})),(n+=":")+ls(a).map((e=>{var[t,r]=e;return t+'="'+r+'"'})).join("")}));return t.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:Na(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ls(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,r]=e;return i.attributes[t]=r})),i}))}(_)))},null!=(i=g[0])&&i.$el_text?{$el_text:null==(n=g[0])?void 0:n.$el_text}:{},p&&"click"===s.type?{$external_click_url:p}:{},v)}}var x_={};function C_(e){return function(e,t){var r=x_[e];if(r)return r;var i,n=t[e];if(Sr(i=n)&&-1!==i.toString().indexOf("[native code]")&&!Un.Zone)return x_[e]=n.bind(t);var s=t.document;if(s&&Sr(s.createElement))try{var o=s.createElement("iframe");o.hidden=!0,s.head.appendChild(o);var a=o.contentWindow;a&&a[e]&&(n=a[e]),s.head.removeChild(o)}catch(t){is.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}return n&&Sr(n)?x_[e]=n.bind(t):n}("MutationObserver",e)}function E_(e,t){return Mr(e)&&e>=t}class I_{_asRequiredConfig(e){var t,r,i,n,s,o=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:o.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:o.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:o.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:o.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:o.capture_clicks_with_modifier_keys,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:o.__onCapture}}constructor(e,t){this._clicks=[],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,__onCapture:e}),this._onClick=e=>{var t=function(e){var t=da(e);return t?{node:t,originalEvent:e,timestamp:Date.now()}:null}(e);Ir(t)||this._ignoreClick(t)||this._clicks.push(t),this._clicks.length&&xr(this._checkClickTimer)&&(this._checkClickTimer=Jn.setTimeout((()=>{this._checkClicks()}),1e3))},this._onScroll=()=>{var e=Date.now();e%50==0&&this._clicks.forEach((t=>{xr(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{"visible"===(null==Vn?void 0:Vn.visibilityState)&&(this._lastVisibilityChange=Date.now())},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)}_startMutationObserver(e){if(!this._mutationObserver){var t=C_(Jn);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,Jn.removeEventListener("click",this._onClick),Jn.removeEventListener("scroll",this._onScroll,{capture:!0}),Jn.removeEventListener("selectionchange",this._onSelectionChange),null==Vn||Vn.removeEventListener("visibilitychange",this._onVisibilityChange)}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){_s(Jn,"click",this._onClick)}_startScrollObserver(){_s(Jn,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){_s(Jn,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){_s(Vn,"visibilitychange",this._onVisibilityChange)}_ignoreClick(e){if(!e)return!0;if(!this._config.capture_clicks_with_modifier_keys&&((t=e.originalEvent).ctrlKey||t.metaKey||t.altKey||t.shiftKey))return!0;var t;if(ta(e.node))return!0;var r=this._clicks.some((t=>t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp)));return!(!r&&!ia(e.node,"html")&&ra(e.node)&&!function(e){if(!Un||ka(e))return!1;var{targetElementList:t}=xa(e,!1);return t.some((e=>ia(e,"a")))}(e.node)&&function(e,t){var r;if(!Un||ka(e))return!1;var i=Pr(t)?ya:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:ya,{targetElementList:n}=xa(e,!1);return!pa(n,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_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=E_(t.scrollDelayMs,this._config.scroll_threshold_ms),n=E_(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=E_(t.mutationDelayMs,this._config.mutation_threshold_ms),o=E_(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=Mr(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=Mr(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=Mr(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=Mr(t.visibilityChangedDelayMs)&&this._config.selection_change_threshold_ms>t.visibilityChangedDelayMs;if(!(a||l||u||c)){var d=E_(t.visibilityChangedDelayMs,this._config.selection_change_threshold_ms);i||s||o||n||d?this._onCapture(t,{$dead_click_last_mutation_timestamp:this._lastMutation,$dead_click_event_timestamp:t.timestamp,$dead_click_scroll_timeout:i,$dead_click_mutation_timeout:s,$dead_click_absolute_timeout:o,$dead_click_selection_changed_timeout:n,$dead_click_visibility_changed_timeout:d}):this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}}this._clicks.length&&xr(this._checkClickTimer)&&(this._checkClickTimer=Jn.setTimeout((()=>{this._checkClicks()}),1e3))}}_captureDeadClick(e,t){this.instance.capture("$dead_click",r({},t,k_(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,{$dead_click_scroll_delay_ms:e.scrollDelayMs,$dead_click_mutation_delay_ms:e.mutationDelayMs,$dead_click_absolute_delay_ms:e.absoluteDelayMs,$dead_click_selection_changed_delay_ms:e.selectionChangedDelayMs,$dead_click_visibility_changed_delay_ms:e.visibilityChangedDelayMs}),{timestamp:new Date(e.timestamp)})}}Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new I_(e,t);var T_={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},M_={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},R_="disabled",P_="sampled",L_="active",F_="buffering",O_="paused",A_="lazy_loading",D_="awaiting_config",N_="missing_config",B_="rrweb_error",q_="trigger",H_=q_+"_activated",$_=q_+"_pending",U_=q_+"_"+R_;function z_(e,t,r,i,n,s){return 0===t?U_:(null==e?void 0:e.get_property(r?i+r:n))===s?H_:$_}function W_(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 V_{constructor(e){this._matchers=e}triggerStatus(e){var t=this._matchers.map((t=>t.triggerStatus(e)));return t.includes(H_)?H_:t.includes($_)?$_:U_}stop(){this._matchers.forEach((e=>e.stop()))}}class j_{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(U_),t.size){case 0:return U_;case 1:return Array.from(t)[0];default:return $_}}stop(){this._matchers.forEach((e=>e.stop()))}}class G_{triggerStatus(){return H_}stop(){}}var Q_=e=>"sessionRecording"in e;class Y_{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=(Q_(e)?wr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Q_(e)?wr(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){is.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){is.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return z_(this._instance,this._urlTriggers.length,this._groupId,Js,Ys,e)}triggerStatus(e){var t=this._urlTriggerStatus(e),r=t===H_?H_:t===$_?$_:U_;return this._instance.register_for_session({[Bo]:r}),r}checkUrlBlocklist(e,t){var r=Cs(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=W_(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=Cs(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=W_(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===H_,l=W_(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class Z_{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=$_;return Tr(this.linkedFlag)&&(e=U_),this.linkedFlagSeen&&(e=H_),this._instance.register_for_session({[Oo]:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(Q_(e)?wr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Tr(this.linkedFlag)&&!this.linkedFlagSeen){var i=Cr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=Cr(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(wr(r)&&i in r){var o=r[i];s=Pr(o)?!0===o:n?o===n:!!o}this.linkedFlagSeen=s,s&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class K_{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(Q_(e)?wr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return z_(this._instance,this._eventTriggers.length,this._groupId,Ks,Zs,e)}triggerStatus(e){var t=this._eventTriggerStatus(e),r=t===H_?H_:t===$_?$_:U_;return this._instance.register_for_session({[Fo]:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===H_,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class J_{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Y_(e,t.id),this._eventTriggerMatching=new K_(e,t.id),this._linkedFlagMatching=new Z_(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 V_(s):new j_(s)}else this._combinedMatching=new G_}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?Js+this.group.id:Ks+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function X_(e){if(e.rrwebError)return B_;if(!e.receivedFlags)return F_;if(!e.isRecordingEnabled)return R_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=!0===e.isSampled,r=new V_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?P_:r===H_?L_:r===$_?F_:!1===e.isSampled?R_:L_}function eg(e){if(e.rrwebError)return B_;if(!e.receivedFlags)return F_;if(!e.isRecordingEnabled)return R_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=new j_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==U_,i=Pr(e.isSampled);return r&&t===$_?F_:r&&t===U_||i&&!e.isSampled?R_:!0===e.isSampled?P_:L_}function tg(e){var t,r;return(null==(t=JSON.stringify(e,(r=[],function(e,t){if(wr(t)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(t)?"[Circular]":(r.push(t),t)}return t})))?void 0:t.length)||0}function rg(e){if(Ir(e))return 4;if(xr(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(br(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=xr(i)||Ir(i)?4:rg(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];xr(l)||(o||(s+=1),o=!1,s+=a.length+3+rg(l))}return s;default:return 0}}function ig(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[ig({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),ig({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]}class ng{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)&&e})));var i=this._numberOfChanges(t);return 0!==i||r===i?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new $r({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:is})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}class sg{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(to,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(to);return wr(t=r)&&Cr(t.sessionId)&&Mr(t.size)&&r.sessionId===e?r.size:0}}function og(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<Hr(100*t,0,100,is)}var ag=ns("[SessionRecording]");function lg(e,t){return t?e:"!"+e}function ug(e,t){return e===t||e!=="!"+t&&null}class cg{constructor(e,t,r,i,n,s){this._sampleRate=null,this._recordingStatusFunction=eg,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s}onRemoteConfig(e){this._sampleRate=Mr(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new V_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=X_):(this._triggerStatusMatcher=new j_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=eg),this._instance.register_for_session({[Do]: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})}))}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 Mr(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&&Tr(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){ag.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!Mr(n))return null==(r=this._instance.persistence)||r.unregister(Gs),void(null==(i=this._instance.persistence)||i.unregister($s));var s=this._instance.get_property(Gs),o=this._instance.get_property($s),a=ug(s,e),l=Mr(o)&&o!==n,u=xr(o)&&s===e,c=l||u||!Pr(a),d=c?og(e,n):a;c&&(d?this._reportStarted("sampled"):ag.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[Gs]:lg(e,d),[$s]:Ir(o)&&s===e?null:n})}ensureSamplingDecision(e){if(Mr(this._sampleRate)){var t=this._instance.get_property(Gs);Pr(ug(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Zs),null==(t=this._instance.persistence)||t.unregister(Ys),null==(r=this._instance.persistence)||r.unregister(Gs),null==(i=this._instance.persistence)||i.unregister($s),null==(n=this._instance.persistence)||n.unregister(Qs)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===$_}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class dg{constructor(e,t,r,i){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Do]:"v2_trigger_groups",[No]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):ag.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return B_;if(e.urlTriggerMatching.urlBlocked)return O_;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return R_;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===H_){var a=s.group.id,l=r.get(a);xr(l)?is.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===$_&&(i=!0)}return n?P_:i?F_:R_}({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;Mr(i)&&(Ir(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))}),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 ag.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(co),a=s.some((t=>!t.properties||0===t.properties.length||kd(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t))}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){ag.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=Xs+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(wr(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,c=Mr(p)&&p!==s,l=h===e&&Mr(p)&&p===s&&Pr(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var g=u||c||d||!Pr(l),v=g?og(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(Gs),null==(t=this._instance.persistence)||t.unregister($s),null==(r=this._instance.persistence)||r.unregister(Qs),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister(Ks+a),null==(s=this._instance.persistence)||s.unregister(Js+a),null==(o=this._instance.persistence)||o.unregister(Xs+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({[Ao]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===$_)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||kd(r,t,this._instance.get_property(co))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new J_(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name})}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}function hg(e){return wr(e)?e.network_timing:e}var pg,_g,gg=36e5,vg="[SessionRecording]",fg=ns(vg),mg=[M_.MouseMove,M_.MouseInteraction,M_.Scroll,M_.ViewportResize,M_.Input,M_.TouchMove,M_.MediaInteraction,M_.Drag],yg=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function bg(){var e;return null==Jn||null==(e=Jn.__PosthogExtensions__)?void 0:e.rrweb}function Sg(){var e;return null==(e=bg())?void 0:e.record}function wg(e){return sd(id(nd(JSON.stringify(e))))}function kg(e){return xg.apply(this,arguments)}function xg(){return(xg=t((function*(e){var t=JSON.stringify(e),r=yield cr(t,ts.DEBUG,{rethrow:!0});return sd(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Cg="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Eg=!1;function Ig(e){return br(e)&&0===e.length?pg=null!=pg?pg:wg([]):wg(e)}function Tg(e){return Mg.apply(this,arguments)}function Mg(){return(Mg=t((function*(e){return br(e)&&0===e.length?pg||(_g=null!=_g?_g:kg([]).then((e=>(pg=e,e))).catch((e=>{throw pg=void 0,_g=void 0,e}))):kg(e)}))).apply(this,arguments)}function Rg(e){return Cg&&!Eg&&function(e){return e.type===T_.FullSnapshot||e.type===T_.IncrementalSnapshot&&(e.data.source===M_.Mutation||e.data.source===M_.StyleSheetRule)}(e)}function Pg(e){return{event:e,size:rg(e)}}function Lg(e,t){return r({},e,{data:t,cv:"2024-10"})}function Fg(e,t){return r({},e,{cv:"2024-10",data:r({},e.data,t)})}function Og(e){try{if(e.type===T_.FullSnapshot)return Pg(Lg(e,wg(e.data)));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.Mutation)return Pg(Fg(e,{texts:Ig(e.data.texts),attributes:Ig(e.data.attributes),removes:Ig(e.data.removes),adds:Ig(e.data.adds)}));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.StyleSheetRule)return Pg(Fg(e,{adds:e.data.adds?wg(e.data.adds):void 0,removes:e.data.removes?wg(e.data.removes):void 0}))}catch(e){fg.error("could not compress event - will use uncompressed event",e)}return{event:e,size:tg(e)}}function Ag(){return Ag=t((function*(e){try{if(e.type===T_.FullSnapshot)return Pg(Lg(e,yield kg(e.data)));if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.Mutation){var[t,r,i,n]=yield Promise.all([Tg(e.data.texts),Tg(e.data.attributes),Tg(e.data.removes),Tg(e.data.adds)]);return Pg(Fg(e,{texts:t,attributes:r,removes:i,adds:n}))}if(e.type===T_.IncrementalSnapshot&&e.data.source===M_.StyleSheetRule){var[s,o]=yield Promise.all([e.data.adds?kg(e.data.adds):void 0,e.data.removes?kg(e.data.removes):void 0]);return Pg(Fg(e,{adds:s,removes:o}))}}catch(t){return ar(t)&&(Eg=!0),fg.error("could not compress event asynchronously - trying synchronous compression",t),Og(e)}return{event:e,size:tg(e)}})),Ag.apply(this,arguments)}function Dg(e,t){return e.type===T_.Custom&&e.data.tag===t}function Ng(e){return Dg(e,"sessionIdle")}function Bg(e){return Dg(e,"$session_ending")}function qg(e){return Dg(e,"$session_starting")}class Hg{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(vg+" 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 ug(this._instance.get_property(Gs),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return Mr(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._fullSnapshotTimestamps=[],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(eo),this._maxDepthExceeded=!1,null==(n=bg())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!0!==this._isIdle&&this.isStarted||(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[Qs])===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 Mr(r)&&Mr(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!Mr(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 Mr(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!Ir(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Qs]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==F_?(this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=Vn&&Vn.visibilityState&&this._tryAddCustomEvent("window "+Vn.visibilityState,{})},this._instance=e;var{sessionId:t,windowId:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=t,this._windowId=r,this._linkedFlagMatching=new Z_(this._instance),this._urlTriggerMatching=new Y_(this._instance),this._eventTriggerMatching=new K_(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||fg.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 sg(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 xr(u)&&xr(c)&&xr(d)?void 0:{maskAllInputs:null==u||u,maskTextSelector:c,blockSelector:d}}get _canvasResolutionScale(){var e;return Hr(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,ns("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:Hr(c,0,12,ns("canvas recording fps"),4),quality:Hr(d,0,1,ns("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=hg(this._instance.config.capture_performance),l=hg(null==i?void 0:i.capturePerformance),u=!!(Pr(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,i=[],n=null==(e=Jn.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());var s,o,a,l,u,c,d,h,p,_,g=null==(t=Jn.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this._networkPayloadCapture&&Sr(g)&&(!vs.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(g((l={payloadSizeLimitBytes:Ua.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Ua.performanceEntryTypeToObserve],payloadHostDenyList:[...(o=this._networkPayloadCapture).payloadHostDenyList||[],...Ua.payloadHostDenyList]},u=!1!==(s=this._instance.config).session_recording.recordHeaders&&o.recordHeaders,c=!1!==s.session_recording.recordBody&&o.recordBody,d=!1!==s.capture_performance&&o.recordPerformance,a=$a(l),h=e=>(null!=e&&e.requestBody&&(e.requestBody=Qa(e.requestBody,e.requestHeaders,a,"Request")),null!=e&&e.responseBody&&(e.responseBody=Qa(e.responseBody,e.responseHeaders,a,"Response")),e),p=e=>{return h(((e,t)=>{var r,i=fs(e.name),n=0===t.indexOf("http")?null==(r=fs(t))?void 0:r.pathname:t;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Ga.some((e=>0===s.indexOf(e)))))return e})((ja((t=e).requestHeaders),ja(t.responseHeaders),t),s.api_host));var t},(_=Sr(s.session_recording.maskNetworkRequestFn))&&Sr(s.session_recording.maskCapturedNetworkRequestFn)&&is.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),_&&(s.session_recording.maskCapturedNetworkRequestFn=e=>{var t=s.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==t?void 0:t.url})}),l.maskRequestFn=Sr(s.session_recording.maskCapturedNetworkRequestFn)?e=>{var t,r=p(e);return r&&null!==(t=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==t?t:void 0}:e=>function(e){if(!xr(e))return e.requestBody=Ya(e.requestBody,"Request"),e.responseBody=Ya(e.responseBody,"Response"),e}(p(e)),r({},Ua,l,{recordHeaders:u,recordBody:c,recordPerformance:d,recordInitialRequests:d,streamNetworkBody:!0===s.session_recording.streamNetworkBody})))):fg.info("NetworkCapture not started because we are on localhost.")),i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Yi(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Yi(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Hh,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(bs(r,i,Uh))}_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}):fg.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(yg((()=>Sg().addCustomEvent(e,t))))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!Un)return;var e=new URL(Un.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(yg((()=>Sg().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;return null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4: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))}}_pauseRecording(){this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,clearInterval(this._fullSnapshotTimer),fg.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"}),fg.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?Ys:Zs]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),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(Hs);if(e){var t;try{t=wr(e)?e:JSON.parse(e)}catch(e){return void fg.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>gg)return fg.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(Hs))}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{sessionId:n,windowId:s}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=n,this._windowId=s,null==(t=this._instance.persistence)||t.unregister(eo),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 dg(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this)):new cg(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.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(Us,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Us)})),this._checkOverride(zs,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(zs)})),this._checkOverride(Vs,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Vs)})),this._checkOverride(Ws,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ws)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(_s(Un,"beforeunload",this._onBeforeUnload),_s(Un,"offline",this._onOffline),_s(Un,"online",this._onOnline),_s(Un,"visibilitychange",this._onVisibilityChange),this._onSessionIdListener||(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),this._onSessionIdleResetForcedListener||(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)}))}))),Tr(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){fg.error("Could not add $pageview to rrweb session",e)}}))),this.status===L_&&this._reportStarted(e||"recording_initialized"))}else fg.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,n,s;null==Un||Un.removeEventListener("beforeunload",this._onBeforeUnload),null==Un||Un.removeEventListener("offline",this._onOffline),null==Un||Un.removeEventListener("online",this._onOnline),null==Un||Un.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(),fg.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),fg.info("stopped")})),!0}stop(){this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),fg.info("stopped"))}discard(){this._clearBuffer(),this._teardown(),fg.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===T_.FullSnapshot&&null!=(s=bg())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this.status!==R_?this._captureSnapshotBuffered(o):this._clearBuffer()}_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{event:t,size:r}=e.compressionEnabled?Og(e.event):{event:e.event,size:tg(e.event)};this._captureQueuedCompressionEvent(e,t,r)}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{event:t,size:i}=r?Rg(e)?yield function(e){return Ag.apply(this,arguments)}(e):Og(e):{event:e,size:tg(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&&wr(e))){if(e.type===T_.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===T_.Custom&&"recording paused"===e.data.tag}(e)){var u,c;e.type===T_.FullSnapshot&&(this._scheduleFullSnapshot(),null==(u=this._mutationThrottler)||u.reset(),null==(c=this._instance.persistence)||c.register_once({[eo]:e.timestamp},void 0)),e.type===T_.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&&wr(t)&&6===t.type&&wr(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 Bg(e)?e.data.payload:null}(h),_=function(e){return qg(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===T_.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 Ng(e)||Bg(e)||qg(e)}(h)){if(Ng(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&&Rg(h))this._enqueueCompression(h,y,v,f);else{var{event:b,size:S}=y?Og(h):{event:h,size:tg(h)};this._captureProcessedEvent(h,b,S,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}):R_}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({[Gs]:this.sessionId,[$s]:null}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_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,r=this._isBelowMinimumDuration();return this.status===F_||this.status===O_||this.status===R_||r?(this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this._buffer):(this._buffer.data.length>0&&(ig(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:ts.LIB_NAME,$lib_version:ts.LIB_VERSION})})),null==(t=this._strategy)||t.onFlushComplete()),this._clearBuffer())}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id;this._isIdle||943718.4>=this._buffer.size+e.$snapshot_bytes+r&&this._buffer.sessionId===i||(this._buffer=this._flushBuffer(),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||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],{sessionStartTimestamp:i}=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i: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===T_.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({[qo]:e}),fg.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!==mg.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(!this._isIdle){var{windowId:n,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this._sessionId!==s,a=this._windowId!==n;this._windowId=n,this._sessionId=s,o||a?(this.stop(),this.start("session_id_changed")):r&&this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,{sessionStartTimestamp: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,$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},o=this._instance.config.session_recording;for(var[a,l]of Object.entries(o||{}))a in s&&("maskInputOptions"===a?s.maskInputOptions=r({password:!0},l):s[a]=l);this._canvasRecording&&this._canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this._canvasRecording.fps},s.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},s.canvasResolutionScale=this._canvasResolutionScale),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);var u=Sg();if(u){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new ng(u,{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";fg.info(r,{node:t}),this.log(vg+" "+r,"warn")}});var c=this._gatherRRWebPlugins();if(this._stopRrweb=u(r({emit:e=>{this.onRRwebEmit(e)},plugins:c},s)),!this._stopRrweb)return this._rrwebError=!0,void fg.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=Pr(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:c.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else fg.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}Jn.__PosthogExtensions__=Jn.__PosthogExtensions__||{},Jn.__PosthogExtensions__.initSessionRecording=e=>new Hg(e);class $g{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===Uo||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===$o}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{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Br(e)?1:_r(qr,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Md:Id;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?Id:Md;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Br(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==Wn?void 0:Wn.doNotTrack,null==Wn?void 0:Wn.msDoNotTrack,Jn.doNotTrack].some((e=>Br(e)))}}var Ug=ns("[Dead Clicks]"),zg=()=>!0,Wg=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Ns)),i=e.instance.config.capture_dead_clicks;return Pr(i)?i:!!wr(i)||r};class Vg{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Ns]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Ug.error("failed to load script",t):e()}))}_start(){var e;if(Vn){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Jn.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=wr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Jn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(Vn),Ug.info("starting...")}}else Ug.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Ug.info("stopping..."))}}var jg=ns("[SegmentIntegration]");var Gg="posthog-js";function Qg(e,t){var{organization:i,projectId:n,prefix:s,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,h;if("*"!==o&&!o.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==(l=t.exception)?void 0:l.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==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.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 i&&n&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+t.event_id),a&&(null==(_=e.exceptions)||_.sendExceptionEvent(f)),t}}class Yg{constructor(e,t,r,i,n,s){this.name=Gg,this.setupOnce=function(o){o(Qg(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class Zg{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(is.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==Un?void 0:Un.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{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=n;if(!(xr(s)||xr(o)||xr(a)||xr(l)||xr(u)||xr(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?Hr(o/s,0,1,is):1,h=s>1?Hr(a/s,0,1,is):1,p=l>1?Hr(u/l,0,1,is):1,_=l>1?Hr(c/l,0,1,is):1;i=as(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 Kg=["flags","surveys"],Jg={[Es]:{exposure:"hidden"},[Ms]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Rs]:{exposure:"hidden"},[Ps]:{exposure:"event"},[Ls]:{exposure:"hidden"},[Fs]:{exposure:"event"},[Os]:{exposure:"hidden"},[As]:{exposure:"event"},[Ds]:{exposure:"event"},[Ns]:{exposure:"event"},[Bs]:{exposure:"hidden"},[qs]:{exposure:"event"},[Hs]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[js]:{exposure:"hidden"},[Gs]:{exposure:"event"},[$s]:{exposure:"event",shouldSkipFromEventProperties:e=>Ir(e)},[Qs]:{exposure:"event"},[Ys]:{exposure:"event"},[Zs]:{exposure:"event"},[eo]:{exposure:"event"},[to]:{exposure:"hidden"},[ro]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!wr(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[io]:{exposure:"event",storageGroup:"flags"},[no]:{exposure:"hidden"},[so]:{exposure:"hidden",storageGroup:"flags"},[oo]:{exposure:"event",storageGroup:"flags"},[ao]:{exposure:"event",storageGroup:"flags",volatile:!0},[lo]:{exposure:"event"},[uo]:{exposure:"hidden"},[co]:{exposure:"hidden"},[ho]:{exposure:"hidden"},[po]:{exposure:"hidden",storageGroup:"surveys"},[_o]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[go]:{exposure:"event"},[vo]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[fo]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[yo]:{exposure:"hidden"},[bo]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[So]:{exposure:"hidden"},[wo]:{exposure:"hidden"},[ko]:{exposure:"hidden"},[xo]:{exposure:"hidden"},[Co]:{exposure:"hidden"},[Eo]:{exposure:"hidden"},[Io]:{exposure:"hidden"},[Us]:{exposure:"event"},[zs]:{exposure:"event"},[Ws]:{exposure:"event"},[Vs]:{exposure:"event"},[Ro]:{exposure:"event"},[Po]:{exposure:"event"},[Lo]:{exposure:"event"},[Fo]:{exposure:"event"},[Oo]:{exposure:"event"},[Ao]:{exposure:"event"},[Do]:{exposure:"event"},[No]:{exposure:"event"},[Bo]:{exposure:"event"},[qo]:{exposure:"event"}},Xg=[[Ks,{exposure:"hidden"}],[Js,{exposure:"hidden"}],[Xs,{exposure:"hidden"}]],ev=e=>{var t=Jg[e];if(t)return t;for(var[r,i]of Xg)if(0===e.indexOf(r))return i},tv={flags:bo,surveys:_o},rv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],iv="main";class nv{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_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&is.info("Persistence loaded",e.persistence,r({},this.props)),this.update_config(e,e,t),this.save(),Un){var n=()=>this.flush();_s(Un,"beforeunload",n,{capture:!1}),_s(Un,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Mr(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===rv.indexOf(e.persistence.toLowerCase())&&(is.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=[...Rd,...e];return r({},Md,{_parse(e){try{var r={};try{r=Id._parse(e)||{}}catch(e){}var i,n=JSON.parse(Md._get(e)||"{}");if(t){var s={};for(var o in r){var a=r[o];Ir(a)||""===a||(s[o]=a)}i=as(n,s)}else i=as(r,n);return Md._set(e,i),i}catch(e){}return null},_set(e,t,r,n,s,o){var a=Md._set(e,t,void 0,void 0,o);try{var l={};i.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&Id._set(e,l,r,n,s,o)}catch(e){Md._error(e)}return a},_remove(e,t){try{null==Un||Un.localStorage.removeItem(e),Id._remove(e,t)}catch(e){Md._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return"localstorage"===s&&Md._is_supported()?(t=Md,n=!0):"localstorage+cookie"===s&&i._is_supported()?(t=i,n=!0):"sessionstorage"===s&&Od._is_supported()?t=Od:"memory"===s?t=Ld:"cookie"===s?t=Id:i._is_supported()?(t=i,n=!0):t=Id,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[bo];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return os(this.props,((t,r)=>{var i=ev(r);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,r===ro?()=>this._isFeatureFlagCacheStale():()=>!1))return;i.transformToEventProperties&&as(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=as({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Kg){var t=Md._parse(this._groupEntryName(e));if(t&&!kr(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||as(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=ev(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=tv[e];if(!r)return!1;var i=t[r],n=this.props[r];return Mr(i)&&Mr(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=ev(e))?void 0:t.storageGroup:void 0,i=r?Md._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?xr(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){xr(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,iv))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var r of(this._writeEntry(this._storage,this._name,e,iv),Kg)){var i,n=t[r];(!kr(n)||null!=(i=this._slotState[r])&&i.persisted)&&this._writeEntry(Md,this._groupEntryName(r),n,r)}}_partitionProps(){var e={},t={};for(var r of Kg)t[r]={};return os(this.props,((r,i)=>{var n,s=null==(n=ev(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===iv)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return os(e,((e,t)=>{var i;r[t]=null!=(i=ev(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n=this._slotWriteState(i);if(i===iv||n.dirty||xr(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!==iv&&(n.persisted=!0),xr(s)||(n.fingerprint=s)):this._config.debug&&is.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(xr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var r of Kg)Md._remove(this._groupEntryName(r));t?delete this._slotState[iv]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(wr(e)){xr(t)&&(t="None"),this._expire_days=xr(r)?this._default_expiry:r;var i=!1;if(os(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(wr(e)){this._expire_days=xr(t)?this._default_expiry:t;var r=!1;if(os(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(){if(!this._campaign_params_saved){var e=Wh(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);kr(ds(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==Vn?void 0:Vn.referrer)?jh(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Yh(),$referring_domain:null!=Vn&&Vn.referrer&&(null==(e=fs(Vn.referrer))?void 0:e.host)||Qh},void 0)}set_initial_person_info(){this.props[xo]||this.props[Co]||this.register_once({[Eo]:Zh(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={};os([Co,xo],(t=>{var r=this.props[t];r&&os(r,(function(t,r){e["$initial_"+vr(r)]=t}))}));var t=this.props[Eo];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Kh(e,t),i={};return os(r,(function(e,t){i["$initial_"+vr(t)]=e})),i}(t,this._config.disable_capture_url_hashes);as(e,r)}return e}safe_merge(e){return os(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[Rs]||{};r[e]=t,this._setProp(Rs,r),this.save()}remove_event_timer(e){var t=this.props[Rs]||{},r=t[e];return xr(r)||(delete t[e],this._setProp(Rs,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=ev(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=ev(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var sv={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ov={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},av={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},lv=ns("[RateLimiter]");class uv{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=>{lv.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void lv.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{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(ko))&&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(ko,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var cv=ns("[RemoteConfig]");class dv{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Jn._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=Jn.__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 cv.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void cv.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return cv.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){cv.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&Vn&&"hidden"!==Vn.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){var t;e||cv.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var hv=3e3;class pv{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Hr((null==t?void 0:t.flush_interval_ms)||hv,250,5e3,is.createLogger("flush interval"),hv),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&&br(r.data)&&os(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){is.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return os(this._queue,(t=>{var i,n=t,s=(n?n.batchKey:null)||n.url;xr(e[s])&&(e[s]=r({},n,{data:[]})),null==(i=e[s].data)||i.push(n.data)})),this._queue=[],e}}var _v=["retriesPerformedSoFar"];class gv{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!xr(Un)&&"onLine"in Un.navigator&&(this._areWeOnline=Un.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},_s(Un,"online",this._onlineListener),_s(Un,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=i(e,_v);Rr(t)&&(n.url=cd(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&&is.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)"),is.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{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,xr(Un)||(this._onlineListener&&(Un.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Un.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(r({},e,{transport:"sendBeacon"}))}catch(e){is.error(e)}this._queue=[]}}class vv{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(){_s(Un,"scroll",this._updateScrollData,{capture:!0}),_s(Un,"scrollend",this._updateScrollData,{capture:!0}),_s(Un,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==Un?void 0:Un.document.documentElement;var e=br(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var r=null==Un?void 0:Un.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 Un?"y"===e?Un.scrollY||Un.pageYOffset||Un.document.documentElement.scrollTop||0:Un.scrollX||Un.pageXOffset||Un.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var fv=e=>Zh(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 mv{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({[wo]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||fv,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[wo]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Kh(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 os(ds(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+vr(r)]=t})),e}}class yv{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}}var bv=ns("[SessionId]");class Sv{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 yv,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Rr(e)||!Rr(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Uo)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||mc,this._windowIdGenerator=r||mc;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Hr(this._config.session_idle_timeout_seconds||1800,60,36e3,bv.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=Od._parse(this._window_id_storage_key),o=Od._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:Od._remove(this._window_id_storage_key),Od._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){bv.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return xr(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&&Od._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Od._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Od._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ir(t)&&!Ir(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({[js]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Rr(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(js):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Ir(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,r]=this._getSessionId();t===this._sessionId&&r===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[js]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Rr(e)?e:0,r=Rr(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[js];return br(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&&Un&&(Un.removeEventListener(Go,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Od._remove(this._primary_window_exists_storage_key)},_s(Un,Go,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===Uo)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),[,i,n]=this._getSessionId(),s=this._freshestActivityTimestamp(),o=this._getWindowId(),a=Rr(n)&&Math.abs(r-n)>864e5,l=!1,u=!1,c=!i,d=i,h=!c&&!e&&this._sessionHasBeenIdleTooLong(r,s);h&&((h=this._isSessionIdleAfterCrossTabRefresh(r))||bv.info("cross-tab refresh kept the session alive",{sessionId:i}),[,i,n]=this._getSessionId()),c||h||a?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),bv.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a}}),n=r,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(u=i!==d)&&(bv.info("adopted cross-tab session id",{sessionId:i,windowId:o}),l=!0));var p=Rr(s)&&e&&!a?s:r,_=Rr(n)?n:(new Date).getTime();this._setWindowId(o),this._setSessionId(i,p,_),e||this._resetIdleTimer();var g={noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this._sessionIdChangedHandlers.forEach((e=>e(i,o,g))),{sessionId:i,windowId:o,sessionStartTimestamp:_,changeReason:l?g:void 0,lastActivityTimestamp:s}}_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 wv=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&pr(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>pr(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function kv(){return kv=t((function*(){var e=null==Wn?void 0:Wn.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),r=null==t?void 0:t.model;return Cr(r)&&r.length>0?r:void 0}catch(e){return void is.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),kv.apply(this,arguments)}var xv="custom",Cv="i.posthog.com",Ev=/^\/static\//;class Iv{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("."+Cv,".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":xv),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Ev.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===xv)return this.apiHost+t;var i=Cv+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Tv=ns("[PostHog ExternalIntegrations]"),Mv={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Rv{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return Tv.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var r,n,s;!i||null!=(r=Jn.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]||e._loadScript(Mv[t],(()=>{var r;null==(r=Jn.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[t])||r.start(e._instance)})),!i&&null!=(n=Jn.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]&&(null==(s=Jn.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[t])||s.stop())};for(var[r,i]of Object.entries(null!==(n=this._instance.config.integrations)&&void 0!==n?n:{})){var n;t(r)}}}var Pv,Lv={},Fv=0,Ov=()=>{},Av='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Dv="Surveys module not available",Nv="sanitize_properties is deprecated. Use before_send instead",Bv="Invalid value for property_denylist config: ",qv="posthog",Hv=!od&&-1===(null==Kn?void 0:Kn.indexOf("MSIE"))&&-1===(null==Kn?void 0:Kn.indexOf("Mozilla")),$v=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:ps(null==Vn?void 0:Vn.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ov,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:jn&&Cr(null==jn?void 0:jn.search)&&-1!==jn.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==Un||null==(t=Un.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){is.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:Vo,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:hv},error_tracking:{},_onCapture:Ov},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:fa,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))},Uv=[["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"]],zv=e=>{var t={};for(var[r,i]of Uv)xr(e[r])||(t[i]=e[r]);var n=as({},t,e),s=e.__preview_external_dependency_versioned_paths;return xr(s)||(xr(e.strict_script_versioning)&&(n.strict_script_versioning=!!s),Cr(s)&&xr(e.asset_host)&&(n.asset_host=s)),br(e.property_blacklist)&&(xr(e.property_denylist)?n.property_denylist=e.property_blacklist:br(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:is.error(Bv+e.property_denylist)),n};class Wv{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){is.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Vv{_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===Uo||this.config.cookieless_mode===$o&&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 Wv,this._personProcessingSetOncePropertiesSent=!1,this.version=ts.LIB_VERSION,this._internalEventEmitter=new yv,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$v(),this.SentryIntegration=Yg,this.sentryIntegration=e=>function(e,t){var r=Qg(e,t);return{name:Gg,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 vv(this),this.pageViewManager=new Zg(this),this.rateLimiter=new uv(this),this.requestRouter=new Iv(this),this.consent=new $g(this),this.externalIntegrations=new Rv(this);var t=null!==(e=Vv.__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.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=Cr(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Cr(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>is.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==qv){var i,n=null!==(i=Lv[r])&&void 0!==i?i:new Vv;return n._init(e,t,r),Lv[r]=n,Lv[qv][r]=n,n}return this._init(e,t,r)}_init(e,t,i){var n,s;void 0===t&&(t={});var o=Cr(e)?e.trim():"";if(!o)return is.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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},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 a=$v(t.defaults),l=zv(t),u=as({},a,l,{name:i,token:o});wr(a.rageclick)&&wr(l.rageclick)&&(u.rageclick=as({},a.rageclick,l.rageclick)),wr(a.session_recording)&&wr(l.session_recording)&&(u.session_recording=as({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&is.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Sc.GZipJS;var c=this._is_persistence_disabled();this.persistence=new nv(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nv(r({},this.config,{persistence:"sessionStorage"}),c,!1);var d=r({},this.persistence.props),h=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new pv((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new gv(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new Sv(this),this.sessionPropsManager=new mv(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(is.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(is.info("Initializing extensions synchronously"),this._initExtensions(p)),ts.DEBUG=ts.DEBUG||this.config.debug,ts.DEBUG&&is.info("Starting in debug mode",{this:this,config:t,thisC:r({},this.config),p:d,s:h}),!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 _=t.bootstrap.distinctID,g=this.get_distinct_id(),v=this.persistence.get_property(So);if(t.bootstrap.isIdentifiedID&&null!=g&&g!==_&&v===zo)this.identify(_);else if(t.bootstrap.isIdentifiedID&&null!=g&&g!==_&&v===Wo)is.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 f=this.config.get_device_id(mc()),m=t.bootstrap.isIdentifiedID?f:_;this.persistence.set_property(So,t.bootstrap.isIdentifiedID?Wo:zo),this.register({distinct_id:_,$device_id:m})}}if(p)this.register_once({distinct_id:Mo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(mc());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(So,zo)}return _s(Un,"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()||mc();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(So,Wo)),t()},n=r.user();"then"in n&&Sr(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||jg.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()||(jg.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(jg.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,Qo),identify:e=>t(e,Zo),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Sr(this.config._onCapture)&&this.config._onCapture!==Ov&&(is.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&is.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 kv.apply(this,arguments)}().then((e=>{e&&this.register({[Ts]:e})})).catch(Ov),this}_initExtensions(e){var t,i,n,s,o,a,l,u=performance.now(),c=r({},Vv.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(n=this.surveys)&&void 0!==n?n:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Wg)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_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){is.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[Ro]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Po]:i}),this.config.__preview_deferred_init_extensions&&is.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!Vn||!Vn.body)return is.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=_r(e.supportedCompression,Sc.GZipJS)?Sc.GZipJS:_r(e.supportedCompression,Sc.Base64)?Sc.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Vo}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){is.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=jn&&jn.hostname){var e=jn.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 dv(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;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Yo),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(r=this._requestQueue)||r.unload(),null==(i=this._retryQueue)||i.unload()):this._shouldCapturePageleave()&&this.capture(Yo,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Hv?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,(xr(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,s.url=vd(s.url,s.compression);var o=null!==(t=s.transport)&&void 0!==t?t:"fetch",a=fd.filter((e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport))),l=null!==(i=null==(n=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(a,(e=>e.transport===o)))?void 0:n.method)&&void 0!==i?i:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&s.data&&s.compression===Sc.GZipJS&&Zn&&"undefined"!=typeof Promise&&!ld?gd(s).then((e=>{l(e)})).catch((t=>{if(or(t))return ld=!0,void l(r({},s,{compression:void 0,url:vd(e.url,void 0)}));ar(t)&&(ld=!0),l(s)})):l(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){Fv++;try{var t,r=[],i=[],n=[];ss(e,(e=>{if(e)if(br(t=e[0]))n.push(e);else if(Sr(e))try{e.call(this)}catch(t){is.error("Error executing queued PostHog call",e,t)}else br(e)&&"alias"===t?r.push(e):br(e)&&-1!==t.indexOf("capture")&&Sr(this[t])?n.push(e):i.push(e)}));var s=function(e,t){ss(e,(function(e){try{if(br(e[0])){var r=t;os(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){is.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{Fv--}}push(e){if(Fv>0&&br(e)&&Cr(e[0])){var t=Vv.prototype[e[0]];Sr(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var n,s,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!xr(e)&&Cr(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Cr(null==t?void 0:t.$current_url)&&(is.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i._originatedFromCaptureException||is.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 d=new Date,h=(null==i?void 0:i.timestamp)||d,p=Qi(null==i?void 0:i.uuid,mc),_={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},h,p)};e===Qo&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==i?void 0:i.$set)&&(_.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(_.$unset=g);var v=this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==Ko,e===Zo);if(v&&(_.$set_once=v),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,o=_,a=e=>Cr(e)?e.slice(0,s):e,l=new Set,_=function e(t,r){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),br(t)?(i=[],ss(t,(t=>{i.push(e(t))}))):(i={},os(t,((t,r)=>{l.has(t)||(i[r]=e(t,r))}))),i);var i}(o)),_.timestamp=h,xr(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=d),e===Vu.DISMISSED||e===Vu.SENT){var f=null==t?void 0:t[ju.SURVEY_ID],m=null==t?void 0:t[ju.SURVEY_ITERATION];cc({id:f,current_iteration:m}),_.$set=r({},_.$set,{[Ku({id:f,current_iteration:m},e===Vu.SENT?"responded":"dismissed")]:!0})}else e===Vu.SHOWN&&(_.$set=r({},_.$set,{[ju.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===ov.SHOWN){var y=null==t?void 0:t[av.TOUR_TYPE];y&&(_.$set=r({},_.$set,{[av.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var b=r({},_.properties.$set,_.$set);if(kr(b)||this.setPersonPropertiesForFlags(b),!Tr(this.config.before_send)){var S=this._runBeforeSend(_);if(!S)return;(_=S).uuid=Qi(_.uuid,mc)}this._internalEventEmitter.emit("eventCaptured",_);var w={method:"POST",url:null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",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(w):this._requestQueue.enqueue(w),_}is.critical("This capture call is ignored due to client rate limiting.")}}else is.error("No event name provided to posthog.capture")}else is.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}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.$cookieless_mode=!0),"$snapshot"===e){var l=r({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Cr(a.distinct_id)&&!Mr(a.distinct_id)||Er(a.distinct_id))&&is.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),!Kn)return{};var l,u,c=e?[...Hh,...t||[]]:[],[d,h]=function(e){for(var t=0;Wi.length>t;t++){var[r,i]=Wi[t],n=r.exec(e),s=n&&(Sr(i)?i(n,e):i);if(s)return s}return["",""]}(Kn),p=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},_={detectGoogleSearchApp:r},g=as(ds({$os:d,$os_version:h,$browser:$i(Kn,navigator.vendor,p,_),$device:Vi(Kn),$device_type:ji(Kn,{userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==Un||null==(o=Un.screen)?void 0:o.width,screenHeight:null==Un||null==(a=Un.screen)?void 0:a.height,devicePixelRatio:null==Un?void 0:Un.devicePixelRatio}),$timezone:Jh(),$timezone_offset:Xh()}),{$current_url:bs(i?Yi(null==jn?void 0:jn.href):null==jn?void 0:jn.href,c,Uh),$host:null==jn?void 0:jn.host,$pathname:null==jn?void 0:jn.pathname,$raw_user_agent:Kn.length>1e3?Kn.substring(0,997)+"...":Kn,$browser_version:zi(Kn,navigator.vendor,p,_),$browser_language:Gh(),$browser_language_prefix:(u=Gh(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==Un?void 0:Un.screen.height,$screen_width:null==Un?void 0:Un.screen.width,$viewport_height:null==Un?void 0:Un.innerHeight,$viewport_width:null==Un?void 0:Un.innerWidth,$lib:ts.LIB_NAME,$lib_version:ts.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ts.SDK_DIST_CHANNEL&&(g.$sdk_dist_channel=ts.SDK_DIST_CHANNEL),g}(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{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&as(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&as(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===xv&&(a.$lib_custom_api_host=this.config.api_host),u=e!==Qo||s?e!==Yo||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=as(a,u),e===Qo&&Vn&&(a.title=Vn.title),!xr(o)){var _=i.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}Kn&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=as({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),br(this.config.property_denylist)?os(this.config.property_denylist,(function(e){delete a[e]})):is.error(Bv+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(is.error(Nv),a=g(a,e));var v=this._hasPersonProcessing();return a.$process_person_profile=v,v&&!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=as({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&(is.error(Nv),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),kr(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;return null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(e,t)}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:Dv}),()=>{})}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:Dv})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Dv})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=hc),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:Dv}}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:Dv})}_validateIdentifyId(e){return!e||Er(e)?(is.critical("Unique user id has not been set in posthog.identify"),!1):e===Mo?(is.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())||(is.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 is.uninitializedWarning("posthog.identify");if(Mr(e)&&(e=e.toString(),is.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(Is)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Ms)&&(this.unregister(Ms),this.register({distinct_id:e}));var n,s=(this.persistence.get_property(So)||zo)===zo;e!==i&&s?(this.persistence.set_property(So,Wo),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(Zo,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=yd(e,t,r),null==(n=this.featureFlags)||n.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(fo))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=yd(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):is.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(br(e)?e:[e]).filter((e=>Cr(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(Ko,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else is.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;if(is.info("reset"),!this.__loaded)return is.uninitializedWarning("posthog.reset");var c,d=this.get_property(Is),h=this.get_property(Ts),p=this.get_property(Hs);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),xr(p)||null==(c=this.persistence)||c.register({[Hs]:p}),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.persistence)||l.set_property(So,zo),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Uo)this.register_once({distinct_id:Mo,$device_id:null},"");else{var _=this.config.get_device_id(mc());this.register_once({distinct_id:_,$device_id:e?_:d},""),e||xr(h)||this.register({[Ts]:h})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}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{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);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(Es)?(is.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(xr(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Ms,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(is.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=r({},this.config);if(wr(e)){var i,n,s,o,a,l,u,c,d,h,p;as(this.config,zv(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 nv(r({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this._checkLocalStorageForDebug(this.config.debug);Pr(g)&&(this.config.debug=g),Pr(this.config.debug)&&(this.config.debug?(ts.DEBUG=!0,Md._is_supported()&&Md._set("ph_debug",!0),is.info("set_config",{config:e,oldConfig:t,newConfig:r({},this.config)})):(ts.DEBUG=!1,Md._is_supported()&&Md._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){ts.LIB_NAME=e,ts.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:Vv._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:qv;return t!==qv&&(t=qv+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(So))===Wo||(null==(t=this.sessionPersistence)?void 0:t.get_property(So))===Wo}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Vo&&!this._isIdentified()&&kr(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ms])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Io]))}_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?(is.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Io,!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!==$o)}_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!==Uo){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 Sv(this),this.pageViewManager=new Zg(this),this.persistence&&(this.sessionPropsManager=new mv(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=Vv.__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==$o&&(null==(u=this.surveys)||u.loadIfEnabled()),(xr(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 is.warn(Av)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Uo?(this.config.cookieless_mode===$o&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===$o&&(this.register({distinct_id:Mo,$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())):is.warn(Av)}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===Uo||(this.config.cookieless_mode===$o?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 Wn?wv(Wn,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Vn&&("visible"===Vn.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Qo,{title:Vn.title},{send_instantly:!0}),this._visibilityStateListener&&(Vn.removeEventListener(jo,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),_s(Vn,jo,this._visibilityStateListener)))}debug(e){!1===e?(null==Un||Un.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Un||Un.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,t,r,i,n,s,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(is.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):(r="advanced_disable_decide",!1,i=is,n=(t="advanced_disable_flags")in(e=o)&&!Tr(e[t]),s=r in e&&!Tr(e[r]),n?e[t]:!!s&&(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]))}_runBeforeSend(e){var t;if(Tr(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Fr),i=br(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i){if(n=s(n),Tr(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return _r(tr,e.event)?is.warn(o+". This can cause unexpected behavior."):is.info(o),null}n.properties&&!kr(n.properties)||is.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of r)if(n.properties&&Tr(n.properties[a]))return is.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=Pr(e)&&!e,r=Md._is_supported()&&"true"===Md._get("ph_debug");return!t&&(!!r||e)}}Vv.__defaultExtensionClasses={},Vv._noopLogger={trace:Pv=()=>{},debug:Pv,info:Pv,warn:Pv,error:Pv,fatal:Pv},function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=cs(e.prototype[t[r]])}(Vv,["identify"]);var jv=ns("[ExceptionAutocapture]"),Gv=ns("[TracingHeaders]"),Qv=ns("[Web Vitals]"),Yv=9e5,Zv="[SessionRecording]",Kv=ns(Zv),Jv=ns("[Heatmaps]");function Xv(e){return wr(e)&&"clientX"in e&&"clientY"in e&&Mr(e.clientX)&&Mr(e.clientY)}var ef=ns("[Product Tours]"),tf=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(Bs))},rf=["$set_once","$set"],nf=ns("[SiteApps]"),sf="Error while initializing PostHog app with config id ";function of(e,t,r){if(Tr(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 af{constructor(e){this._debugEventEmitter=new yv,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;xr(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(!xr(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(null==t?void 0: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(!of(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=>of(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&of((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=>of(e.text,t.text,t.text_matching||"exact")||of(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;!Tr(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=>of(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||xd(t.properties.reduce(((e,t)=>{var r=br(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 lf{constructor(e){this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&xd(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===Nu.Activation?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;xr(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 af(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,Nu.Activation),this._cancelEventToItems=this._buildEventToItemMap(e,Nu.Cancellation))}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,Nu.Cancellation);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,Nu.Activation);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])}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&this._setActivatedItems(i)}_getPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}reset(){this._pendingActivatedItems=[],this._getPersistedActivatedIds().length>0&&this._setActivatedItems([])}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class uf extends lf{constructor(e){super(e)}_getActivatedKey(){return go}_getShownEventName(){return Vu.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 rc}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[go]:e})}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;this._getItems((e=>{r=e.find((e=>e.id===t))}));var i=!r||function(e){var t,r,i,n=(null!==(t=null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)&&void 0!==t?t:0)>0;return e.schedule===Wu.Always||!(null==(i=e.conditions)||null==(i=i.events)||!i.repeatedActivation||!n)}(r);return i?e===Vu.SHOWN?"consume":"ignore":e===Vu.SHOWN?"persist":e===Vu.DISMISSED||e===Vu.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var cf="SDK is not enabled or survey functionality is not yet loaded",df="Disabled. Not loading surveys.",hf=null!=Un&&Un.location?Ss(Un.location.hash,"__posthog")||Ss(location.hash,"state"):null,pf="_postHogToolbarParams",_f=ns("[Toolbar]"),gf=ns("[FeatureFlags]"),vf=ns("[FeatureFlags]",{debugEnabled:!0}),ff="\" failed. Feature flags didn't load in time.",mf=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},yf=e=>{var t={};for(var[r,i]of ls(e||{}))i&&(t[r]=i);return t},bf="Refusing to render web experiment since the viewer is a likely bot",Sf={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>md(t,e),not_regex:(e,t)=>!md(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class wf{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{wf._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(wf._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);Cr(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];wf._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())wf._logInfo(bf);else if(!this._config.disable_web_experiments){if(Tr(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();wf._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=wf.getWindowLocation();if(null!=e&&e.search){var t=ys(null==e?void 0:e.search,"__experiment_id"),r=ys(null==e?void 0:e.search,"__experiment_variant");t&&r&&(wf._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",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&&(wf._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!Tr(e.conditions)&&wf._matchUrlConditions(e,t)&&wf._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(Tr(e.conditions)||Tr(null==(r=e.conditions)?void 0:r.url))return!0;var i=wf.getWindowLocation();if(i){var n,s,o,a=xs(t,i.href);return null==(n=e.conditions)||!n.url||Sf[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==Un?void 0:Un.location}static _matchUTMConditions(e){var t;if(Tr(e.conditions)||Tr(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Wh();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];is.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?wf._logInfo(bf):"control"!==t?r.forEach((r=>{if(r.selector){var i;wf._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)}))}})):wf._logInfo("Control variants leave the page unmodified.")}_is_bot(){return Wn&&this._instance?wv(Wn,this._config.custom_blocked_useragents):void 0}}var kf=ns("[Conversations]"),xf="Conversations not available yet.",Cf="console",Ef={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._instance=e,this.featureFlagEventHandlers=[]}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,gf.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||(gf.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||gf.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(!xr(e)){if(br(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||gf.error("Invalid flag key found:",e,"Expected non-empty string"),t}));gf.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:r}=this._instance,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(ro))&&void 0!==n?n:{},a=null!=i&&i.merge&&null!==(s=this._prop(oo))&&void 0!==s?s:{},l=r({},o,e),u=r({},a,t),c={};for(var[d,h]of Object.entries(l))c[d]={key:d,enabled:Yt(h),variant:Zt(h),reason:void 0,metadata:xr(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(so),t=this._prop(lo),i=this._prop(uo);if(!i&&!t)return e||{};var n=as({},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=xr(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,h=xr(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||(gf.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:Yt(i),variant:Zt(i),payload:Qt(t[r])}}))}getFlagVariants(){var e=this._prop(ro),t=this._prop(lo);if(!t)return e||{};for(var r=as({},e),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(gf.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(oo),t=this._prop(uo);if(!t)return e||{};for(var r=as({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(gf.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._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())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i=this._config.token,n=this._prop(Is),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(co)||{}),group_properties:this._prop(ho),timezone:Jh()};Ir(n)||xr(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();xr(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:Sc.Base64,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,n=!0;if(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({[yo]:o}),u)gf.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())}}})}}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 gf.warn('getFeatureFlag for key "'+e+ff)}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(ao)||void 0,l=this._prop(bo)||void 0,u=this._prop(fo)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this._prop(mo);d&&d!==h&&(u={},null==(c=this._persistence)||c.register({[fo]:u,[mo]: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;br(u[e])?u[e].push(o):u[e]=[o],null==(p=this._persistence)||p.register({[fo]:u});var k=this.getFeatureFlagDetails(e),x=[...null!==(_=this._prop(yo))&&void 0!==_?_:[]];xr(n)&&x.push("flag_missing");var C={$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};xr(null==k||null==(f=k.metadata)?void 0:f.version)||(C.$feature_flag_version=k.metadata.version);var E,I=null!==(m=null==k||null==(y=k.reason)?void 0:y.description)&&void 0!==m?m:null==k||null==(b=k.reason)?void 0:b.code;I&&(C.$feature_flag_reason=I),null!=k&&null!=(S=k.metadata)&&S.id&&(C.$feature_flag_id=k.metadata.id),xr(null==k?void 0:k.original_variant)&&xr(null==k?void 0:k.original_enabled)||(C.$feature_flag_original_response=xr(k.original_variant)?k.original_enabled:k.original_variant),null!=k&&null!=(w=k.metadata)&&w.original_payload&&(C.$feature_flag_original_payload=null==k||null==(E=k.metadata)?void 0:E.original_payload),x.length&&(C.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",C)}if(i)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Qt(s)}}}else gf.warn('getFeatureFlagResult for key "'+e+ff)}getRemoteConfigPayload(e,t){var r=this._config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this._shouldIncludeEvaluationEnvironments()&&(i.evaluation_contexts=this._getValidEvaluationEnvironments());var n=this._getValidFlagKeys();xr(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:Sc.Base64,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){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return xr(r)?void 0:!!r}gf.warn('isFeatureEnabled for key "'+e+ff)}}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&&gf.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(br(u)){gf.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({[io]:u,[ro]:p})}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=>{var[t]=e;return m.has(t)})))),v=r({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return m.has(t)})))),f=r({},s,Object.fromEntries(Object.entries(f||{}).filter((e=>{var[t]=e;return m.has(t)}))))}else g=r({},i,g),v=r({},n,v),f=r({},s,f);t&&t.register(r({[io]:Object.keys(yf(g)),[ro]:g||{},[oo]:v||{},[so]:f||{}},d?{[ao]:d}:{},h?{[bo]:h}:{}))}}}(e,this._persistence,n,s,o,i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),gf.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return gf.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(lo),this._persistence.unregister(uo),this._fireFeatureFlagsCallbacks(),vf.info("All overrides cleared");if(br(e)){var t=mf(e);return this._persistence.register({[lo]:t}),this._fireFeatureFlagsCallbacks(),vf.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(lo),vf.info("Flag overrides cleared");else if(i.flags){if(br(i.flags)){var n=mf(i.flags);this._persistence.register({[lo]:n})}else this._persistence.register({[lo]:i.flags});vf.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._persistence.unregister(uo),vf.info("Payload overrides cleared")):i.payloads&&(this._persistence.register({[uo]:i.payloads}),vf.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[lo]:e}),this._fireFeatureFlagsCallbacks(),vf.info("Flag overrides set",{flags:e});gf.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n,s=(this._prop(no)||[]).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({[io]:Object.keys(yf(l)),[ro]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(no),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",callback:t=>{var r,i;if(t.json){var n=t.json.earlyAccessFeatures;return null==(r=this._persistence)||r.unregister(no),null==(i=this._persistence)||i.register({[no]: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{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((i=>i(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(co)||{},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({[co]:r({},i,o,n)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=r({},this._prop(co)||{});e.forEach((e=>{delete i[e]})),this._instance.register({[co]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(co),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(ho)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=r({},i[t],e[t]),delete e[t]})),this._instance.register({[ho]:r({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(ho)||{};this._instance.register({[ho]:r({},t,{[e]:{}})})}else this._instance.unregister(ho)}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}}},If={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===D_||this._recordingStatus===N_?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=R_,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw Kv.error("started without valid sessionManager"),new Error(Zv+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===Uo)throw new Error(Zv+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(Hs))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return Un&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var r=!xr(Object.assign)&&!xr(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),Kv.info("starting")):(this._recordingStatus=R_,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==D_&&this._recordingStatus!==N_&&(this._recordingStatus=A_),null!=Jn&&null!=(t=Jn.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=Jn.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=Jn.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return Kv.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(Gs),null==(t=this._persistence)||t.unregister($s)}_validateSampleRate(e,t){if(Tr(e))return null;var r,i=Mr(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(Kv.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;Tr(a)&&this._resetSampling();var l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[Hs]: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:xr(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){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===D_&&(this._recordingStatus=N_,Kv.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):Kv.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(Hs);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,r=this._instance.get_property(Hs);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return Kv.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<=gg}_onScriptLoaded(e){var t,r;if(null==(t=Jn.__PosthogExtensions__)||!t.initSessionRecording)return Kv.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lo]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(r=Jn.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===N_||this._recordingStatus===D_)return;return this._recordingStatus=D_,Kv.info("persisted remote config is stale, requesting fresh config before starting"),void new dv(this._instance).load()}this._recordingStatus=A_,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({[zs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Us]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?Ws:Vs]:!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))}}},Tf={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new m_(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,r=wr(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(Un&&Vn){var e=e=>{e=e||(null==Un?void 0:Un.event);try{this._captureEvent(e)}catch(e){b_.error("Failed to capture event",e)}};if(_s(Vn,"submit",e,{capture:!0}),_s(Vn,"change",e,{capture:!0}),_s(Vn,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==Un?void 0:Un.event);try{this._captureEvent(e,y_)}catch(e){b_.error("Failed to capture copy/cut event",e)}};_s(Vn,"copy",t,{capture:!0}),_s(Vn,"cut",t,{capture:!0})}}}else b_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ps]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var i=null==Vn?void 0:Vn.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[Ps];if(Ir(this._isDisabledServerSide)&&!Pr(r)&&!this.instance._shouldDisableFlags())return!1;var i=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!this.instance.config.autocapture&&!i}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,i=da(e);na(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())&&wa(i,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===y_;if(i&&function(e,t,r,i,n,s){var o,a,l,u,c,d;if(void 0===r&&(r=void 0),!Un||ka(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!aa(r.url_allowlist,s))return!1;if(null!=(a=r)&&a.url_ignorelist&&aa(r.url_ignorelist,s))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:p,targetElementList:_}=xa(e,i);if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(xr(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}(_,r))return!1;if(!pa(_,null==(u=r)?void 0:u.css_selector_allowlist))return!1;if(pa(_,null!==(c=null==(d=r)?void 0:d.css_selector_ignorelist)&&void 0!==c?c:ga))return!1;var g=Un.getComputedStyle(e);if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){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 p?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(ha.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this._config,n,n?["copy","cut"]:void 0,this.instance)){var{props:s,explicitNoCapture:o}=k_(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});if(o)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(s.$element_selectors=a),t===y_){var l,u=ua(null==Un||null==(l=Un.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=c}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return Sr(null==Vn?void 0:Vn.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==Un||null==(t=Un.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(is.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,is.info("History API monitoring stopped")}monitorHistoryChanges(){Un&&Un.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(Un&&(null==(t=Un.history[e])||!t.__posthog_wrapped__)){var r=this;ws(Un.history,e,(t=>function(i,n,s){t.call(this,i,n,s),r._capturePageview(e)}))}}_capturePageview(e){try{var t,r=null==Un||null==(t=Un.location)?void 0:t.pathname;if(!r)return;r!==this._lastPathname&&this.isEnabled&&this._instance.capture(Qo,{navigation_type:e}),this._lastPathname=r}catch(t){is.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};_s(Un,"popstate",e),this._popstateListener=()=>{Un&&Un.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[Ls]),this.rageclicks=new m_(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return wr(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Tr(this._config.capture_heatmaps)?Tr(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Jv.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("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ls]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==Vn?void 0:Vn.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){Un&&Vn&&(this._flushHandler=this._flush.bind(this),_s(Un,Go,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==Un?void 0:Un.event)),_s(Vn,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==Un?void 0:Un.event)),_s(Vn,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Vg(this.instance,zg,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),_s(Vn,jo,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;Un&&Vn&&(this._flushHandler&&Un.removeEventListener(Go,this._flushHandler),this._onClickHandler&&Vn.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&Vn.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&Vn.removeEventListener(jo,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&&ra(i)&&!ia(i,"body");){if(i===r)return!1;if(_r(t,null==Un?void 0:Un.getComputedStyle(i).position))return!0;i=_a(i)}return!1}(da(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"),!ta(e.target)&&Xv(e)){var n=this._getProperties(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&wa(da(e),this.instance.config.rageclick)&&this._capture(r({},n,{type:"rageclick"})),this._capture(n)}}_onMouseMove(e){!ta(e.target)&&Xv(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(Un){var t=this._config.disable_capture_url_hashes?Yi(Un.location.href):Un.location.href,r=this._config.custom_personal_data_properties,i=this._config.mask_personal_data_properties?[...Hh,...r||[]]:[],n=bs(t,i,Uh);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(e)}}_flush(){this._buffer&&!kr(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Vg,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(!xr(i))if(Tr(null==e?void 0:e.name)||Tr(null==e?void 0:e.value))Qv.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)),xr(this._buffer.url)&&(this._buffer.url=i),this._buffer.firstMetricTimestamp=xr(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()});xr(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 Qv.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=Jn.__PosthogExtensions__;xr(n)||xr(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:r,onINP:i}=n.postHogWebVitalsCallbacks),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):Qv.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Ds]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=wr(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Tr(r)?(null==(t=this._instance.persistence)?void 0:t.props[qs])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(wr(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=wr(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=wr(this._perfConfig)&&Mr(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Yv;return e>0&&6e4>=e?Yv:e}get isEnabled(){var e=null==jn?void 0:jn.protocol;if("http:"!==e&&"https:"!==e)return Qv.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=wr(this._perfConfig)?this._perfConfig.web_vitals:Pr(this._perfConfig)?this._perfConfig:void 0;return Pr(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Qv.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=wr(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=wr(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ds]:t}),this._instance.persistence.register({[qs]:r})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Qv.error("failed to load script",t):e()}))}_currentURL(){var e=Un?this._instance.config.disable_capture_url_hashes?Yi(Un.location.href):Un.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Hh,...t||[]]:[];return bs(e,r,Uh)}Qv.error("Could not determine current URL")}}},Mf={exceptionObserver:class{constructor(e){var t,r,i;this._startCapturing=()=>{var e;if(Un&&this.isEnabled&&null!=(e=Jn.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Jn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=Jn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Jn.__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){jv.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Fs]),this._rateLimiter=new $r({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10,refillInterval:1e4,_logger:jv}),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 wr(e)?t=r({},t,e):(xr(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?(jv.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return jv.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){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Fs]: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)?jv.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=kp(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Os))&&void 0!==t?t:[],this._exceptionStepsConfig=qn(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Hn(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=qn(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if("errorTracking"in e){var n=null!==(t=null==(r=e.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],s=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[Os]:this._suppressionRules,[As]:s})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(As),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(!Cr(e)||0===e.trim().length)return void wp.warn("Ignoring exception step because message must be a non-empty string");var i=this._coerceExceptionStepProperties(t),{sanitizedProperties:n,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>Nn.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(i);s.length>0&&wp.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(r({[An]:e,[Dn]:(new Date).toISOString()},n))}catch(e){wp.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 wp.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 wp.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 wp.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Tr(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return i&&this._exceptionStepsBuffer.clear(),i}catch(e){return wp.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void wp.error("Failed to process exception event. Ignoring this exception.",e)}}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:r({},e,{$exception_steps:t})}catch(t){return wp.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[An]:e,[Dn]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return wr(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;var t=e.reduce(((e,t)=>{var{type:r,value:i}=t;return Cr(r)&&r.length>0&&e.$exception_types.push(r),Cr(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,i=bd[e.operator],n=br(e.value)?e.value:[e.value],s=null!==(r=t[e.key])&&void 0!==r?r:[];return n.length>0&&i(n,s)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}_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!Tr(e)&&br(e)}}},Rf=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("productTours"in e){var t,r;if(this._persistence&&this._persistence.register({[Bs]:!!e.productTours}),!tf(this._instance))return!this._productTourManager&&Tr(null==(t=this._persistence)?void 0:t.props[vo])||ef.info("product tours disabled; stopping and clearing cached tours"),null==(r=this._productTourManager)||r.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&tf(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=Jn.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?ef.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Jn.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Jn.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!br(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[vo];if(br(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",callback:t=>{if(tf(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return ef.error(n),void e([],{isLoaded:!1,error:n})}var s=br(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[vo]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Tr(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(vo)}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)}}},Ef),Pf={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=Jn._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))c[p]={id:d[p],type:p,properties:_};var{$set_once:g,$set:v}=e;return{event:r({},i(e,rf),{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)||(nf.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)||(nf.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==Vn?void 0:Vn.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=>!Ir(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&&(nf.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,nf.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var{processEvent:s}=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1);s&&(t.processEvent=s),i=!0}catch(t){nf.error(sf+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){nf.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){nf.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 nf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var s=function(e){var t;Jn["__$$ph_site_app_"+e]=n._instance,null==(t=Jn.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(n._instance,a,(t=>{if(t)return nf.error(sf+e,t)}))};for(var{id:o,url:a}of e.siteApps)s(o)}else nf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Lf={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?(xr(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Jn.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),xr(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Jn.__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=Jn.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=Jn.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Gv.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 br(e)?(br(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(br(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()}}},Ff=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._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Tr(t))return rc.warn("Flags not loaded yet. Not loading surveys.");var r=br(t);this._isSurveysEnabled=r?t.length>0:t,rc.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(oc)||null!=i&&i.startsWith(ac))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)rc.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)rc.info(df);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())rc.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Jn?void 0:Jn.__PosthogExtensions__;if(e){if(!xr(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(Ho);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 rc.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new uf(this._instance),rc.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){rc.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 rc.info(df),e([]);var r,i=this._instance.get_property(po);if(i&&!t)return e(i,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:r,context:i}=t;return e(r,i)})):("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",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;rc.error(s);var o={isLoaded:!1,error:s};return e([],o),void(null==r||r({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>ic(e)&&(nc(e)||sc(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(i=this._instance.persistence)||i.register({[po]:l,[_o]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){rc.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Tr(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);rc.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(Tr(this._surveyManager))return{eligible:!1,reason:cf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Tr(this._surveyManager))return rc.warn("init was not called"),{visible:!1,disabledReason:cf};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Tr(this._surveyManager)?(rc.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:cf})):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._checkSurveyEligibility(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(Tr(this._surveyManager))rc.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(dc.includes(n.type)){var s=null==Vn?void 0:Vn.querySelector(t);if(s)return null!=(i=n.appearance)&&i.surveyPopupDelaySeconds?(rc.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;rc.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),rc.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);rc.warn("Survey element not found")}else rc.warn("Surveys of type "+n.type+" cannot be rendered in the app");else rc.warn("Survey not found")}}displaySurvey(e,t){var i;if(Tr(this._surveyManager))rc.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!==Gu.Popover&&t.initialResponses&&rc.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(n);if(!o.visible)return void rc.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Gu.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else rc.warn("Survey not found")}}cancelPendingSurvey(e){Tr(this._surveyManager)?rc.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Ef),Of={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Jn.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Jn.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),gs(this.instance.config))return!1;if(!Un||!Vn)return!1;e=null!=e?e:Un.location,r=null!=r?r:Un.history;try{if(!t){try{Un.localStorage.setItem("test","test"),Un.localStorage.removeItem("test")}catch(e){return!1}t=null==Un?void 0:Un.localStorage}var i,n=hf||Ss(e.hash,"__posthog")||Ss(e.hash,"state"),s=n?us((()=>JSON.parse(atob(decodeURIComponent(n)))))||us((()=>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(pf)||"{}")).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=Jn.ph_load_toolbar||Jn.ph_load_editor;!Tr(t)&&Sr(t)?t(e,this.instance):_f.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==Vn||!Vn.getElementById(To));if(!Un||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(Un.localStorage.setItem(pf,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=Jn.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return _f.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),_s(Un,"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)}}},Af=r({experiments:wf},Ef),Df={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){var t=e.conversations;Tr(t)||(Pr(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||gs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Jn?void 0:Jn.__PosthogExtensions__;if(e&&!xr(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(Ho);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 kf.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),kf.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else kf.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){kf.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():kf.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ir(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):(kf.warn(xf),null)}))()}getMessages(e,r){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,r):(kf.warn(xf),null)}))()}markAsRead(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.markAsRead(e):(kf.warn(xf),null)}))()}getTickets(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getTickets(e):(kf.warn(xf),null)}))()}requestRestoreLink(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.requestRestoreLink(e):(kf.warn(xf),null)}))()}restoreFromToken(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.restoreFromToken(e):(kf.warn(xf),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kf.warn(xf),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()}}},Nf={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ns("[logs]"),this._queue=[],this._consoleQueue=[],this._onReconnect=()=>{var e,t;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),Un&&_s(Un,"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=xr(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 sn(this._createHost(e,t),s,this._logger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,[this._core,this._resolvedConfig]=this._buildCore((()=>this._queue),(e=>{this._queue=e}))),this._core}_getConsoleCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this._consoleCore&&this._consoleResolvedFrom===r||(null==(t=this._consoleCore)||t.reset(),this._consoleResolvedFrom=r,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Cf)),this._consoleCore}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Tr(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()}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==Jn?void 0:Jn.__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(Ho)}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===Jt.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===Jt.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>ts.LIB_NAME,getLibraryVersion:()=>ts.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{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(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)})}}})}))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,ts.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Cf,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=nn(s,rn(r,ts.LIB_NAME,ts.LIB_VERSION),i,ts.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{sessionId:r,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=i,Tr(n)||(t.sessionStartTimestamp=n),Tr(s)||(t.lastActivityTimestamp=s)}if(null!=Jn&&null!=(e=Jn.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Yi(Jn.location.href):Jn.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},Bf=r({},Ef,If,Tf,Mf,Rf,Pf,Ff,Lf,Of,Af,Df,Nf);Vv.__defaultExtensionClasses=r({},Bf);var qf=function(){ts.SDK_DIST_CHANNEL="npm";var e=Lv[qv]=new Vv;return function(){function e(){e.done||(e.done=!0,Hv=!1,os(Lv,(function(e){e._dom_loaded()})))}null!=Vn&&Vn.addEventListener?"complete"===Vn.readyState?e():_s(Vn,"DOMContentLoaded",e,{capture:!1}):Un&&is.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Sc as Compression,sv as DEFAULT_PRODUCT_TOUR_APPEARANCE,Gu as DisplaySurveyType,Vv as PostHog,ov as ProductTourEventName,av as ProductTourEventProperties,Vu as SurveyEventName,ju as SurveyEventProperties,Nu as SurveyEventType,qu as SurveyPosition,zu as SurveyQuestionBranchingType,Uu as SurveyQuestionType,Wu as SurveySchedule,Hu as SurveyTabPosition,$u as SurveyType,Bu as SurveyWidgetType,qf as default,qf as posthog,bc as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.full.no-external.js.map
|