From cee1a536cb77385de4a4f5e8a1c4c5abbbe49ef1 Mon Sep 17 00:00:00 2001 From: Kevin Etchells Date: Wed, 17 Jul 2024 10:44:14 +0100 Subject: [PATCH] Adjust Posthog for new Parcel setup tidy-up gitignore --- .gitignore | 1 - django_app/frontend/package.json | 1 + django_app/frontend/posthog_source/index.html | 1 - django_app/frontend/posthog_source/index.js | 13 ---------- django_app/frontend/posthog_source/readme.md | 9 ------- django_app/frontend/src/js/posthog.js | 24 +++++++++---------- django_app/redbox_app/templates/base.html | 2 -- 7 files changed, 12 insertions(+), 39 deletions(-) delete mode 100644 django_app/frontend/posthog_source/index.html delete mode 100644 django_app/frontend/posthog_source/index.js delete mode 100644 django_app/frontend/posthog_source/readme.md diff --git a/.gitignore b/.gitignore index 613e41e8d..8551929a7 100644 --- a/.gitignore +++ b/.gitignore @@ -198,7 +198,6 @@ django_app/frontend/govuk-assets django_app/frontend/.parcel-cache # Django app tests staticfiles django_app/tests/staticfiles -django_app/frontend/.parcel-cache # Other diff --git a/django_app/frontend/package.json b/django_app/frontend/package.json index b47de3e8e..2ff0e7ace 100644 --- a/django_app/frontend/package.json +++ b/django_app/frontend/package.json @@ -7,6 +7,7 @@ "src/js/documents.js", "src/js/trusted-types.js", "src/js/autosubmit.js", + "src/js/posthog.js", "src/js/chats/feedback.js", "src/js/chats/markdown.js", "src/js/chats/message-input.js", diff --git a/django_app/frontend/posthog_source/index.html b/django_app/frontend/posthog_source/index.html deleted file mode 100644 index 955263041..000000000 --- a/django_app/frontend/posthog_source/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/django_app/frontend/posthog_source/index.js b/django_app/frontend/posthog_source/index.js deleted file mode 100644 index be2eaf4da..000000000 --- a/django_app/frontend/posthog_source/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import "../node_modules/posthog-js/dist/recorder.js"; -import "../node_modules/posthog-js/dist/surveys.js"; -//import "../node_modules/posthog-js/dist/exception-autocapture.js"; -//import "../node_modules/posthog-js/dist/tracing-headers.js"; -import "../node_modules/posthog-js/dist/web-vitals.js"; -import posthog from "posthog-js"; - -posthog.init("phc_3r2LNsBz7zJFRSpcMmE4PwXEq2m4CwfxJC9H1OeeMJg", { - api_host: "https://eu.i.posthog.com", - disable_external_dependency_loading: true, -}); - -export const _frontmatter = {}; diff --git a/django_app/frontend/posthog_source/readme.md b/django_app/frontend/posthog_source/readme.md deleted file mode 100644 index c179eeb22..000000000 --- a/django_app/frontend/posthog_source/readme.md +++ /dev/null @@ -1,9 +0,0 @@ -# Posthog setup - -These instructions are based on the docs at https://posthog.com/docs/libraries/js#advanced-option---bundle-all-required-extensions - -After making changes to index.js, run from this folder: - -`npx parcel build index.html` - -That will create a `JS` file in the `/frontend/dist/` folder. Copy this file to `/frontend/js/posthog.js`. You can then delete the contents of the `/frontend/dist/` folder. diff --git a/django_app/frontend/src/js/posthog.js b/django_app/frontend/src/js/posthog.js index 1171175e0..51b31b9a7 100644 --- a/django_app/frontend/src/js/posthog.js +++ b/django_app/frontend/src/js/posthog.js @@ -1,15 +1,13 @@ -function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}!function(e){function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function s(e){o(a,r,i,s,l,"next",e)}function l(e){o(a,r,i,s,l,"throw",e)}s(void 0)})}}function s(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function v(e){var t=null==e?void 0:e.host;return(null==t?void 0:t.shadowRoot)===e}function g(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function m(e){try{var t,n=e.rules||e.cssRules;return n?((t=Array.from(n,_).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}}function _(e){var t,n,r;if("styleSheet"in e)try{t=m(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if("selectorText"in e&&e.selectorText.includes(":"))return n=e.cssText,r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,n.replace(r,"$1\\$2");return t||e.cssText}(S=x||(x={}))[S.Document=0]="Document",S[S.DocumentType=1]="DocumentType",S[S.Element=2]="Element",S[S.Text=3]="Text",S[S.CDATA=4]="CDATA",S[S.Comment=5]="Comment";var y=function(){function e(){s(this,e),this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return u(e,[{key:"getId",value:function(e){if(!e)return -1;var t,n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}},{key:"getNode",value:function(e){return this.idNodeMap.get(e)||null}},{key:"getIds",value:function(){return Array.from(this.idNodeMap.keys())}},{key:"getMeta",value:function(e){return this.nodeMetaMap.get(e)||null}},{key:"removeNodeFromMap",value:function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})}},{key:"has",value:function(e){return this.idNodeMap.has(e)}},{key:"hasNode",value:function(e){return this.nodeMetaMap.has(e)}},{key:"add",value:function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}},{key:"replace",value:function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)}},{key:"reset",value:function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}]),e}();function b(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,s=o||"",l=i&&k(i);return(n[r.toLowerCase()]||l&&n[l])&&(s=a?a(s,t):"*".repeat(s.length)),s}function k(e){return e.toLowerCase()}var C="__rrweb_original__";function w(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?k(t):null}function I(e,t){try{r=new URL(e,null!=t?t:window.location.href)}catch(e){return null}var n,r,i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==i?void 0:i[1])&&void 0!==n?n:null}var S,x,E,A,T=1,M=RegExp("[^a-z0-9-_:]");function O(){return T++}var R=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,F=/^(?:[a-z+]+:)?\/\//i,N=/^www\..*/i,L=/^(data:)([^,]*),(.*)/i;function P(e,t){return(e||"").replace(R,function(e,n,r,i,o,a){var s=r||o||a,l=n||i||"";if(!s)return e;if(F.test(s)||N.test(s)||L.test(s))return"url(".concat(l).concat(s).concat(l,")");if("/"===s[0])return"url(".concat(l).concat((t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0]).split("?")[0]+s).concat(l,")");var u=t.split("/"),c=s.split("/");u.pop();var d,f=h(c);try{for(f.s();!(d=f.n()).done;){var p=d.value;"."!==p&&(".."===p?u.pop():u.push(p))}}catch(e){f.e(e)}finally{f.f()}return"url(".concat(l).concat(u.join("/")).concat(l,")")})}var D=/^[^ \t\n\r\u000c]+/,q=/^[, \t\n\r\u000c]+/;function H(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function B(){var e=document.createElement("a");return e.href="",e.href}function j(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?H(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}for(var i=[];r(q),!(n>=t.length);){var o=r(D);if(","===o.slice(-1))o=H(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=H(e,o);for(var s=!1;;){var l=t.charAt(n);if(""===l){i.push((o+a).trim());break}if(s)")"===l&&(s=!1);else{if(","===l){n+=1,i.push((o+a).trim());break}"("===l&&(s=!0)}a+=l,n+=1}}}return i.join(", ")}(e,r):"style"===n?P(r,B()):"object"===t&&"data"===n?H(e,r):r:H(e,r):r}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&W(e.parentNode,t,n);for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return!!n&&W(e.parentNode,t,n)}function $(e,t,n,r){try{var i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===i)return!1;if("string"==typeof t){if(r){if(i.closest(".".concat(t)))return!0}else if(i.classList.contains(t))return!0}else if(W(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch(e){}return!1}function V(e){return null==e?"":e.toLowerCase()}function G(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,c=t.inlineStylesheet,d=void 0===c||c,f=t.maskInputOptions,p=void 0===f?{}:f,h=t.maskTextFn,_=t.maskInputFn,y=t.slimDOMOptions,S=t.dataURLOptions,T=void 0===S?{}:S,R=t.inlineImages,F=void 0!==R&&R,N=t.recordCanvas,L=void 0!==N&&N,D=t.onSerialize,q=t.onIframeLoad,H=t.iframeLoadTimeout,W=void 0===H?5e3:H,Z=t.onStylesheetLoad,z=t.stylesheetLoadTimeout,Q=void 0===z?5e3:z,K=t.keepIframeSrcFn,Y=void 0===K?function(){return!1}:K,J=t.newlyAddedElement,X=t.needsMask,ee=t.preserveWhiteSpace,et=void 0===ee||ee;!X&&e.childNodes&&(X=$(e,a,s,void 0===X));var en,er=function(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.needsMask,s=t.inlineStylesheet,l=t.maskInputOptions,u=t.maskTextFn,c=t.maskInputFn,d=t.dataURLOptions,f=t.inlineImages,p=t.recordCanvas,h=t.keepIframeSrcFn,v=t.newlyAddedElement,g=function(e,t){if(t.hasNode(e)){var n=t.getId(e);return 1===n?void 0:n}}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:x.Document,childNodes:[],compatMode:e.compatMode}:{type:x.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:g};case e.ELEMENT_NODE:return function(e,t){for(var n,r=t.doc,i=t.blockClass,o=t.blockSelector,a=t.inlineStylesheet,s=t.maskInputOptions,l=void 0===s?{}:s,u=t.maskInputFn,c=t.dataURLOptions,d=void 0===c?{}:c,f=t.inlineImages,p=t.recordCanvas,h=t.keepIframeSrcFn,v=t.newlyAddedElement,g=t.rootId,_=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,i,o),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=k(e.tagName);return M.test(t)?"div":t}(e),I={},S=e.attributes.length,T=0;T2&&void 0!==arguments[2]?arguments[2]:document,r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var z="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",Q={map:{},getId:function(){return console.error(z),-1},getNode:function(){return console.error(z),null},removeNodeFromMap:function(){console.error(z)},has:function(){return console.error(z),!1},reset:function(){console.error(z)}};function K(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,i=0;return function(){for(var o=arguments.length,a=Array(o),s=0;st?(r&&(clearTimeout(r),r=null),i=l,e.apply(c,a)):r||!1===n.trailing||(r=setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(c,a)},u))}}function Y(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window,o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),o&&o.set&&o.set.call(this,e)}}),function(){return Y(e,t,o||{},!0)}}function J(e,t,n){try{if(!(t in e))return function(){};var r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,function(){e[t]=r}}catch(e){return function(){}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Q=new Proxy(Q,{get:function(e,t,n){return"map"===t&&console.error(z),Reflect.get(e,t,n)}}));var X=Date.now;function ee(e){var t,n,r,i,o,a,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==s?void 0:s.documentElement.scrollLeft)||(null===(n=null===(t=null==s?void 0:s.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==s?void 0:s.body)||void 0===r?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===(o=null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.scrollTop)||0}}function et(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function en(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function er(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function ei(e,t,n,r){if(!e)return!1;var i=er(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t)||r&&null!==i.closest("."+t))return!0}else if(W(i,t,r))return!0}catch(e){}return!!(n&&(i.matches(n)||r&&null!==i.closest(n)))}function eo(e,t){return -2===t.getId(e)}function ea(e){return!!e.changedTouches}function es(e,t){return!!("IFRAME"===e.nodeName&&t.getMeta(e))}function el(e,t){return!!("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function eu(e){return!!(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(X=function(){return(new Date).getTime()});var ec=function(){function e(){s(this,e),this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}return u(e,[{key:"getId",value:function(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}},{key:"has",value:function(e){return this.styleIDMap.has(e)}},{key:"add",value:function(e,t){var n;return this.has(e)?this.getId(e):(n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n)}},{key:"getStyle",value:function(e){return this.idStyleMap.get(e)||null}},{key:"reset",value:function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}},{key:"generateId",value:function(){return this.id++}}]),e}();function ed(e){var t,n,r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ef(e){var t=e.ownerDocument;return!!t&&(t.contains(e)||function(e){var t=e.ownerDocument;if(!t)return!1;var n=function(e){for(var t,n=e;t=ed(n);)n=t;return n}(e);return t.contains(n)}(e))}var ep,eh,ev,eg,em,e_,ey=((ep=ey||{})[ep.DomContentLoaded=0]="DomContentLoaded",ep[ep.Load=1]="Load",ep[ep.FullSnapshot=2]="FullSnapshot",ep[ep.IncrementalSnapshot=3]="IncrementalSnapshot",ep[ep.Meta=4]="Meta",ep[ep.Custom=5]="Custom",ep[ep.Plugin=6]="Plugin",ep),eb=((eh=eb||{})[eh.Mutation=0]="Mutation",eh[eh.MouseMove=1]="MouseMove",eh[eh.MouseInteraction=2]="MouseInteraction",eh[eh.Scroll=3]="Scroll",eh[eh.ViewportResize=4]="ViewportResize",eh[eh.Input=5]="Input",eh[eh.TouchMove=6]="TouchMove",eh[eh.MediaInteraction=7]="MediaInteraction",eh[eh.StyleSheetRule=8]="StyleSheetRule",eh[eh.CanvasMutation=9]="CanvasMutation",eh[eh.Font=10]="Font",eh[eh.Log=11]="Log",eh[eh.Drag=12]="Drag",eh[eh.StyleDeclaration=13]="StyleDeclaration",eh[eh.Selection=14]="Selection",eh[eh.AdoptedStyleSheet=15]="AdoptedStyleSheet",eh[eh.CustomElement=16]="CustomElement",eh),ek=((ev=ek||{})[ev.MouseUp=0]="MouseUp",ev[ev.MouseDown=1]="MouseDown",ev[ev.Click=2]="Click",ev[ev.ContextMenu=3]="ContextMenu",ev[ev.DblClick=4]="DblClick",ev[ev.Focus=5]="Focus",ev[ev.Blur=6]="Blur",ev[ev.TouchStart=7]="TouchStart",ev[ev.TouchMove_Departed=8]="TouchMove_Departed",ev[ev.TouchEnd=9]="TouchEnd",ev[ev.TouchCancel=10]="TouchCancel",ev),eC=((eg=eC||{})[eg.Mouse=0]="Mouse",eg[eg.Pen=1]="Pen",eg[eg.Touch=2]="Touch",eg),ew=((em=ew||{})[em["2D"]=0]="2D",em[em.WebGL=1]="WebGL",em[em.WebGL2=2]="WebGL2",em),eI=function(){function e(){s(this,e),this.length=0,this.head=null,this.tail=null}return u(e,[{key:"get",value:function(e){if(e>=this.length)throw Error("Position outside of list range");for(var t=this.head,n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=e.doc.defaultView;if(!r)return function(){};m=e.mutationCb,_=e.mousemoveCb,y=e.mouseInteractionCb,C=e.scrollCb,I=e.viewportResizeCb,S=e.inputCb,x=e.mediaInteractionCb,E=e.styleSheetRuleCb,A=e.styleDeclarationCb,T=e.canvasMutationCb,M=e.fontCb,O=e.selectionCb,R=e.customElementCb,e.mutationCb=function(){n.mutation&&n.mutation.apply(n,arguments),m.apply(void 0,arguments)},e.mousemoveCb=function(){n.mousemove&&n.mousemove.apply(n,arguments),_.apply(void 0,arguments)},e.mouseInteractionCb=function(){n.mouseInteraction&&n.mouseInteraction.apply(n,arguments),y.apply(void 0,arguments)},e.scrollCb=function(){n.scroll&&n.scroll.apply(n,arguments),C.apply(void 0,arguments)},e.viewportResizeCb=function(){n.viewportResize&&n.viewportResize.apply(n,arguments),I.apply(void 0,arguments)},e.inputCb=function(){n.input&&n.input.apply(n,arguments),S.apply(void 0,arguments)},e.mediaInteractionCb=function(){n.mediaInteaction&&n.mediaInteaction.apply(n,arguments),x.apply(void 0,arguments)},e.styleSheetRuleCb=function(){n.styleSheetRule&&n.styleSheetRule.apply(n,arguments),E.apply(void 0,arguments)},e.styleDeclarationCb=function(){n.styleDeclaration&&n.styleDeclaration.apply(n,arguments),A.apply(void 0,arguments)},e.canvasMutationCb=function(){n.canvasMutation&&n.canvasMutation.apply(n,arguments),T.apply(void 0,arguments)},e.fontCb=function(){n.font&&n.font.apply(n,arguments),M.apply(void 0,arguments)},e.selectionCb=function(){n.selection&&n.selection.apply(n,arguments),O.apply(void 0,arguments)},e.customElementCb=function(){n.customElement&&n.customElement.apply(n,arguments),R.apply(void 0,arguments)},e.recordDOM&&(t=eF(e,e.doc));var i=function(e){var t=e.mousemoveCb,n=e.sampling,r=e.doc,i=e.mirror;if(!1===n.mousemove)return function(){};var o,a="number"==typeof n.mousemove?n.mousemove:50,s="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500,l=[],u=K(eM(function(e){var n=Date.now()-o;t(l.map(function(e){return e.timeOffset-=n,e}),e),l=[],o=null}),s),c=eM(K(eM(function(e){var t=eR(e),n=ea(e)?e.changedTouches[0]:e,r=n.clientX,a=n.clientY;o||(o=X()),l.push({x:r,y:a,id:i.getId(t),timeOffset:X()-o}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?eb.Drag:e instanceof MouseEvent?eb.MouseMove:eb.TouchMove)}),a,{trailing:!1})),d=[Z("mousemove",c,r),Z("touchmove",c,r),Z("drag",c,r)];return eM(function(){d.forEach(function(e){return e()})})}(e),o=function(e){var t=e.mouseInteractionCb,n=e.doc,r=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.sampling;if(!1===a.mouseInteraction)return function(){};var s=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[],u=null;return Object.keys(ek).filter(function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]}).forEach(function(e){var a=k(e);if(window.PointerEvent)switch(ek[e]){case ek.MouseDown:case ek.MouseUp:a=a.replace("mouse","pointer");break;case ek.TouchStart:case ek.TouchEnd:return}l.push(Z(a,function(n){var a=eR(n);if(!ei(a,i,o,!0)){var s=null,l=e;if("pointerType"in n){switch(n.pointerType){case"mouse":s=eC.Mouse;break;case"touch":s=eC.Touch;break;case"pen":s=eC.Pen}s===eC.Touch?ek[e]===ek.MouseDown?l="TouchStart":ek[e]===ek.MouseUp&&(l="TouchEnd"):eC.Pen}else ea(n)&&(s=eC.Touch);null!==s?(u=s,(l.startsWith("Touch")&&s===eC.Touch||l.startsWith("Mouse")&&s===eC.Mouse)&&(s=null)):ek[e]===ek.Click&&(s=u,u=null);var c=ea(n)?n.changedTouches[0]:n;if(c){var d=r.getId(a),f=c.clientX,p=c.clientY;eM(t)(Object.assign({type:ek[l],id:d,x:f,y:p},null!==s&&{pointerType:s}))}}},n))}),eM(function(){l.forEach(function(e){return e()})})}(e),a=eN(e),s=(F={win:r},N=e.viewportResizeCb,L=F.win,P=-1,D=-1,Z("resize",eM(K(eM(function(){var e=et(),t=en();P===e&&D===t||(N({width:Number(t),height:Number(e)}),P=e,D=t)}),200)),L)),l=function(e){var t=e.inputCb,n=e.doc,r=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.ignoreClass,s=e.ignoreSelector,l=e.maskInputOptions,u=e.maskInputFn,c=e.sampling,f=e.userTriggeredOnInput;function p(e){var t=eR(e),r=e.isTrusted,c=t&&t.tagName;if(t&&"OPTION"===c&&(t=t.parentElement),t&&c&&!(0>eL.indexOf(c))&&!ei(t,i,o,!0)&&!(t.classList.contains(a)||s&&t.matches(s))){var d=t.value,p=!1,v=w(t)||"";"radio"===v||"checkbox"===v?p=t.checked:(l[c.toLowerCase()]||l[v])&&(d=b({element:t,maskInputOptions:l,tagName:c,type:v,value:d,maskInputFn:u})),h(t,f?{text:d,isChecked:p,userTriggered:r}:{text:d,isChecked:p});var g=t.name;"radio"===v&&g&&p&&n.querySelectorAll('input[type="radio"][name="'.concat(g,'"]')).forEach(function(e){if(e!==t){var n=e.value;h(e,f?{text:n,isChecked:!p,userTriggered:!1}:{text:n,isChecked:!p})}})}}function h(e,n){var i=eP.get(e);if(!i||i.text!==n.text||i.isChecked!==n.isChecked){eP.set(e,n);var o=r.getId(e);eM(t)(Object.assign(Object.assign({},n),{id:o}))}}var v=("last"===c.input?["change"]:["input","change"]).map(function(e){return Z(e,eM(p),n)}),g=n.defaultView;if(!g)return function(){v.forEach(function(e){return e()})};var m=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),_=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&v.push.apply(v,d(_.map(function(e){return Y(e[0],e[1],{set:function(){eM(p)({target:this,isTrusted:!1})}},!1,g)}))),eM(function(){v.forEach(function(e){return e()})})}(e),u=(q=e.mediaInteractionCb,H=e.blockClass,B=e.blockSelector,j=e.mirror,U=e.sampling,W=e.doc,V=[Z("play",($=eM(function(e){return K(eM(function(t){var n=eR(t);if(n&&!ei(n,H,B,!0)){var r=n.currentTime,i=n.volume,o=n.muted,a=n.playbackRate,s=n.loop;q({type:e,id:j.getId(n),currentTime:r,volume:i,muted:o,playbackRate:a,loop:s})}}),U.media||500)}))(0),W),Z("pause",$(1),W),Z("seeked",$(2),W),Z("volumechange",$(3),W),Z("ratechange",$(4),W)],eM(function(){V.forEach(function(e){return e()})})),f=function(){},p=function(){},v=function(){},g=function(){};e.recordDOM&&(f=function(e,t){var n=e.styleSheetRuleCb,r=e.mirror,i=e.stylesheetManager,o=t.win;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return function(){};var a=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:eM(function(e,t,o){var a=c(o,2),s=a[0],l=a[1],u=eq(t,r,i.styleMirror),d=u.id,f=u.styleId;return(d&&-1!==d||f&&-1!==f)&&n({id:d,styleId:f,adds:[{rule:s,index:l}]}),e.apply(t,o)})});var s,l,u=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:eM(function(e,t,o){var a=c(o,1)[0],s=eq(t,r,i.styleMirror),l=s.id,u=s.styleId;return(l&&-1!==l||u&&-1!==u)&&n({id:l,styleId:u,removes:[{index:a}]}),e.apply(t,o)})}),o.CSSStyleSheet.prototype.replace&&(s=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:eM(function(e,t,o){var a=c(o,1)[0],s=eq(t,r,i.styleMirror),l=s.id,u=s.styleId;return(l&&-1!==l||u&&-1!==u)&&n({id:l,styleId:u,replace:a}),e.apply(t,o)})})),o.CSSStyleSheet.prototype.replaceSync&&(l=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:eM(function(e,t,o){var a=c(o,1)[0],s=eq(t,r,i.styleMirror),l=s.id,u=s.styleId;return(l&&-1!==l||u&&-1!==u)&&n({id:l,styleId:u,replaceSync:a}),e.apply(t,o)})}));var f={};eU("CSSGroupingRule")?f.CSSGroupingRule=o.CSSGroupingRule:(eU("CSSMediaRule")&&(f.CSSMediaRule=o.CSSMediaRule),eU("CSSConditionRule")&&(f.CSSConditionRule=o.CSSConditionRule),eU("CSSSupportsRule")&&(f.CSSSupportsRule=o.CSSSupportsRule));var p={};return Object.entries(f).forEach(function(e){var t=c(e,2),o=t[0],a=t[1];p[o]={insertRule:a.prototype.insertRule,deleteRule:a.prototype.deleteRule},a.prototype.insertRule=new Proxy(p[o].insertRule,{apply:eM(function(e,t,o){var a=c(o,2),s=a[0],l=a[1],u=eq(t.parentStyleSheet,r,i.styleMirror),f=u.id,p=u.styleId;return(f&&-1!==f||p&&-1!==p)&&n({id:f,styleId:p,adds:[{rule:s,index:[].concat(d(eD(t)),[l||0])}]}),e.apply(t,o)})}),a.prototype.deleteRule=new Proxy(p[o].deleteRule,{apply:eM(function(e,t,o){var a=c(o,1)[0],s=eq(t.parentStyleSheet,r,i.styleMirror),l=s.id,u=s.styleId;return(l&&-1!==l||u&&-1!==u)&&n({id:l,styleId:u,removes:[{index:[].concat(d(eD(t)),[a])}]}),e.apply(t,o)})})}),eM(function(){o.CSSStyleSheet.prototype.insertRule=a,o.CSSStyleSheet.prototype.deleteRule=u,s&&(o.CSSStyleSheet.prototype.replace=s),l&&(o.CSSStyleSheet.prototype.replaceSync=l),Object.entries(f).forEach(function(e){var t=c(e,2),n=t[0],r=t[1];r.prototype.insertRule=p[n].insertRule,r.prototype.deleteRule=p[n].deleteRule})})}(e,{win:r}),p=eH(e,e.doc),G={win:r},z=e.styleDeclarationCb,Q=e.mirror,ee=e.ignoreCSSAttributes,er=e.stylesheetManager,es=(eo=G.win).CSSStyleDeclaration.prototype.setProperty,eo.CSSStyleDeclaration.prototype.setProperty=new Proxy(es,{apply:eM(function(e,t,n){var r,i=c(n,3),o=i[0],a=i[1],s=i[2];if(ee.has(o))return es.apply(t,[o,a,s]);var l=eq(null===(r=t.parentRule)||void 0===r?void 0:r.parentStyleSheet,Q,er.styleMirror),u=l.id,d=l.styleId;return(u&&-1!==u||d&&-1!==d)&&z({id:u,styleId:d,set:{property:o,value:a,priority:s},index:eD(t.parentRule)}),e.apply(t,n)})}),el=eo.CSSStyleDeclaration.prototype.removeProperty,eo.CSSStyleDeclaration.prototype.removeProperty=new Proxy(el,{apply:eM(function(e,t,n){var r,i=c(n,1)[0];if(ee.has(i))return el.apply(t,[i]);var o=eq(null===(r=t.parentRule)||void 0===r?void 0:r.parentStyleSheet,Q,er.styleMirror),a=o.id,s=o.styleId;return(a&&-1!==a||s&&-1!==s)&&z({id:a,styleId:s,remove:{property:i},index:eD(t.parentRule)}),e.apply(t,n)})}),v=eM(function(){eo.CSSStyleDeclaration.prototype.setProperty=es,eo.CSSStyleDeclaration.prototype.removeProperty=el}),e.collectFonts&&(g=function(e){var t=e.fontCb,n=e.doc,r=n.defaultView;if(!r)return function(){};var i=[],o=new WeakMap,a=r.FontFace;r.FontFace=function(e,t,n){var r=new a(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};var s=J(n.fonts,"add",function(e){return function(n){return setTimeout(eM(function(){var e=o.get(n);e&&(t(e),o.delete(n))}),0),e.apply(this,[n])}});return i.push(function(){r.FontFace=a}),i.push(s),eM(function(){i.forEach(function(e){return e()})})}(e)));var m,_,y,C,I,S,x,E,A,T,M,O,R,F,N,L,P,D,q,H,B,j,U,W,$,V,G,z,Q,ee,er,eo,es,el,eu,ec,ed,ef,ep,eh,ev,eg,em,e_,ey,ew=(eu=e.doc,ec=e.mirror,ed=e.blockClass,ef=e.blockSelector,ep=e.selectionCb,eh=!0,(ev=eM(function(){var e=eu.getSelection();if(!(!e||eh&&(null==e?void 0:e.isCollapsed))){eh=e.isCollapsed||!1;for(var t=[],n=e.rangeCount||0,r=0;r0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}},{key:"handleMessage",value:function(e){if("rrweb"===e.data.type&&e.origin===e.data.origin&&e.source){var t=this.crossOriginIframeMap.get(e.source);if(t){var n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}}},{key:"transformCrossOriginEvent",value:function(e,t){var n,r=this;switch(t.type){case ey.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),{timestamp:t.timestamp,type:ey.IncrementalSnapshot,data:{source:eb.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case ey.Meta:case ey.Load:case ey.DomContentLoaded:break;case ey.Plugin:return t;case ey.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ey.IncrementalSnapshot:switch(t.data.source){case eb.Mutation:return t.data.adds.forEach(function(t){r.replaceIds(t,e,["parentId","nextId","previousId"]),r.replaceIdOnNode(t.node,e);var n=r.crossOriginIframeRootIdMap.get(e);n&&r.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(function(t){r.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(function(t){r.replaceIds(t,e,["id"])}),t.data.texts.forEach(function(t){r.replaceIds(t,e,["id"])}),t;case eb.Drag:case eb.TouchMove:case eb.MouseMove:return t.data.positions.forEach(function(t){r.replaceIds(t,e,["id"])}),t;case eb.ViewportResize:return!1;case eb.MediaInteraction:case eb.MouseInteraction:case eb.Scroll:case eb.CanvasMutation:case eb.Input:return this.replaceIds(t.data,e,["id"]),t;case eb.StyleSheetRule:case eb.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case eb.Font:return t;case eb.Selection:return t.data.ranges.forEach(function(t){r.replaceIds(t,e,["start","end"])}),t;case eb.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(function(t){r.replaceStyleIds(t,e,["styleId"])}),t}}return!1}},{key:"replace",value:function(e,t,n,r){var i,o=h(r);try{for(o.s();!(i=o.n()).done;){var a=i.value;(Array.isArray(t[a])||"number"==typeof t[a])&&(Array.isArray(t[a])?t[a]=e.getIds(n,t[a]):t[a]=e.getId(n,t[a]))}}catch(e){o.e(e)}finally{o.f()}return t}},{key:"replaceIds",value:function(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}},{key:"replaceStyleIds",value:function(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}},{key:"replaceIdOnNode",value:function(e,t){var n=this;this.replaceIds(e,t,["id","rootId"]),("childNodes"in e)&&e.childNodes.forEach(function(e){n.replaceIdOnNode(e,t)})}},{key:"patchRootIdOnNode",value:function(e,t){var n=this;e.type===x.Document||e.rootId||(e.rootId=t),("childNodes"in e)&&e.childNodes.forEach(function(e){n.patchRootIdOnNode(e,t)})}}]),e}(),eV=function(){function e(t){s(this,e),this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}return u(e,[{key:"init",value:function(){this.reset(),this.patchAttachShadow(Element,document)}},{key:"addShadowRoot",value:function(e,t){var n=this;if(g(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var r=eF(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(function(){return r.disconnect()}),this.restoreHandlers.push(eN(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(function(){e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&n.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,n.mirror.getId(e.host)),n.restoreHandlers.push(eH({mirror:n.mirror,stylesheetManager:n.bypassOptions.stylesheetManager},e))},0)}}},{key:"observeAttachShadow",value:function(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}},{key:"patchAttachShadow",value:function(e,t){var n=this;this.restoreHandlers.push(J(e.prototype,"attachShadow",function(e){return function(r){var i=e.call(this,r);return this.shadowRoot&&ef(this)&&n.addShadowRoot(this.shadowRoot,t),i}}))}},{key:"reset",value:function(){this.restoreHandlers.forEach(function(e){try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}]),e}(),eG="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eZ="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ez=0;ez<64;ez++)eZ[eG.charCodeAt(ez)]=ez;var eQ=new Map,eK=function(e,t,n){if(e&&(eJ(e,t)||"object"===i(e))){var r,o,a=(r=e.constructor.name,(o=eQ.get(n))||(o=new Map,eQ.set(n,o)),o.has(r)||o.set(r,[]),o.get(r)),s=a.indexOf(e);return -1===s&&(s=a.length,a.push(e)),s}},eY=function(e,t,n){return e.map(function(e){return function e(t,n,r){return t instanceof Array?t.map(function(t){return e(t,n,r)}):null===t?t:t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray?{rr_type:t.constructor.name,args:[Object.values(t)]}:t instanceof ArrayBuffer?{rr_type:t.constructor.name,base64:function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t>2]+eG[(3&n[t])<<4|n[t+1]>>4]+eG[(15&n[t+1])<<2|n[t+2]>>6]+eG[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(t)}:t instanceof DataView?{rr_type:t.constructor.name,args:[e(t.buffer,n,r),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL()}:t instanceof ImageData?{rr_type:t.constructor.name,args:[e(t.data,n,r),t.width,t.height]}:eJ(t,n)||"object"===i(t)?{rr_type:t.constructor.name,index:eK(t,n,r)}:t}(e,t,n)})},eJ=function(e,t){return!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(function(e){return"function"==typeof t[e]}).find(function(n){return e instanceof t[n]})};function eX(e,t,n,r){var o=[];try{var a=J(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o){for(var a=arguments.length,s=Array(a>1?a-1:0),l=1;lt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]))}),i=n[0].type;this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}}}]),e}(),e7=function(){function e(t){s(this,e),this.trackedLinkElements=new WeakSet,this.styleMirror=new ec,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}return u(e,[{key:"attachLinkElement",value:function(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}},{key:"trackLinkElement",value:function(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}},{key:"adoptStyleSheets",value:function(e,t){if(0!==e.length){var n,r={id:t,styleIds:[]},i=[],o=h(e);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=void 0;this.styleMirror.has(a)?s=this.styleMirror.getId(a):(s=this.styleMirror.add(a),i.push({styleId:s,rules:Array.from(a.rules||CSSRule,function(e,t){return{rule:_(e),index:t}})})),r.styleIds.push(s)}}catch(e){o.e(e)}finally{o.f()}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}}},{key:"reset",value:function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}},{key:"trackStylesheetInLinkElement",value:function(e){}}]),e}(),e9=function(){function e(){s(this,e),this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}return u(e,[{key:"periodicallyClear",value:function(){var e=this;requestAnimationFrame(function(){e.clear(),e.loop&&e.periodicallyClear()})}},{key:"inOtherBuffer",value:function(e,t){var n=this.nodeMap.get(e);return n&&Array.from(n).some(function(e){return e!==t})}},{key:"add",value:function(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}},{key:"clear",value:function(){this.nodeMap=new WeakMap}},{key:"destroy",value:function(){this.loop=!1}}]),e}();function te(e){return Object.assign(Object.assign({},e),{timestamp:X()})}var tt=!1,tn=new y;function tr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.emit,n=e.checkoutEveryNms,r=e.checkoutEveryNth,i=e.blockClass,o=void 0===i?"rr-block":i,a=e.blockSelector,s=void 0===a?null:a,l=e.ignoreClass,u=void 0===l?"rr-ignore":l,c=e.ignoreSelector,d=void 0===c?null:c,f=e.maskTextClass,p=void 0===f?"rr-mask":f,v=e.maskTextSelector,g=void 0===v?null:v,m=e.inlineStylesheet,_=void 0===m||m,b=e.maskAllInputs,k=e.maskInputOptions,C=e.slimDOMOptions,w=e.maskInputFn,I=e.maskTextFn,S=e.hooks,x=e.packFn,E=e.sampling,A=void 0===E?{}:E,T=e.dataURLOptions,M=void 0===T?{}:T,O=e.mousemoveWait,R=e.recordDOM,F=void 0===R||R,N=e.recordCanvas,L=void 0!==N&&N,P=e.recordCrossOriginIframes,D=void 0!==P&&P,q=e.recordAfter,H=void 0===q?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":q,B=e.userTriggeredOnInput,j=void 0!==B&&B,U=e.collectFonts,W=void 0!==U&&U,$=e.inlineImages,V=void 0!==$&&$,z=e.plugins,Q=e.keepIframeSrcFn,K=void 0===Q?function(){return!1}:Q,Y=e.ignoreCSSAttributes,J=void 0===Y?new Set([]):Y;e_=e.errorHandler;var X=!D||window.parent===window,er=!1;if(!X)try{window.parent.document&&(er=!1)}catch(e){er=!0}if(X&&!t)throw Error("emit function is required");void 0!==O&&void 0===A.mousemove&&(A.mousemove=O),tn.reset();var ei,eo=!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==k?k:{password:!0},ea=!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===C,headMetaDescKeywords:"all"===C}:C||{};!function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(){for(var t=arguments.length,n=Array(t),r=0;r=r,l=n&&e.timestamp-ei.timestamp>n;(s||l)&&e3(!0)}};var ef,ep=function(e){e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.Mutation},e)}))},eh=function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.Scroll},e)}))},ev=function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.CanvasMutation},e)}))},eg=new e7({mutationCb:ep,adoptedStyleSheetCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.AdoptedStyleSheet},e)}))}}),em=new e$({mirror:tn,mutationCb:ep,stylesheetManager:eg,recordCrossOriginIframes:D,wrappedEmit:e5}),ek=h(z||[]);try{for(ek.s();!(ef=ek.n()).done;){var eC=ef.value;eC.getMirror&&eC.getMirror({nodeMirror:tn,crossOriginIframeMirror:em.crossOriginIframeMirror,crossOriginIframeStyleMirror:em.crossOriginIframeStyleMirror})}}catch(e){ek.e(e)}finally{ek.f()}var ew=new e9;e4=new e6({recordCanvas:L,mutationCb:ev,win:window,blockClass:o,blockSelector:s,mirror:tn,sampling:A.canvas,dataURLOptions:M});var eI=new eV({mutationCb:ep,scrollCb:eh,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:p,maskTextSelector:g,inlineStylesheet:_,maskInputOptions:eo,dataURLOptions:M,maskTextFn:I,maskInputFn:w,recordCanvas:L,inlineImages:V,sampling:A,slimDOMOptions:ea,iframeManager:em,stylesheetManager:eg,canvasManager:e4,keepIframeSrcFn:K,processedNodeManager:ew},mirror:tn});e3=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(F){e5(te({type:ey.Meta,data:{href:window.location.href,width:en(),height:et()}}),e),eg.reset(),eI.init(),eO.forEach(function(e){return e.lock()});var t,n,r,i,a,l,u,c,d,f,h,v,m,b,k,C,w,S,x,E,A,T,O,R=(t=document,i=void 0===(r=(n={mirror:tn,blockClass:o,blockSelector:s,maskTextClass:p,maskTextSelector:g,inlineStylesheet:_,maskAllInputs:eo,maskTextFn:I,slimDOM:ea,dataURLOptions:M,recordCanvas:L,inlineImages:V,onSerialize:function(e){es(e,tn)&&em.addIframe(e),el(e,tn)&&eg.trackLinkElement(e),eu(e)&&eI.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){em.attachIframe(e,t),eI.observeAttachShadow(e)},onStylesheetLoad:function(e,t){eg.attachLinkElement(e,t)},keepIframeSrcFn:K}).mirror)?new y:r,a=n.blockClass,l=n.blockSelector,u=n.maskTextClass,c=n.maskTextSelector,d=n.inlineStylesheet,f=n.inlineImages,h=n.recordCanvas,m=void 0!==(v=n.maskAllInputs)&&v,b=n.maskTextFn,k=n.maskInputFn,w=void 0!==(C=n.slimDOM)&&C,S=n.dataURLOptions,x=n.preserveWhiteSpace,E=n.onSerialize,A=n.onIframeLoad,T=n.iframeLoadTimeout,G(t,{doc:t,mirror:i,blockClass:void 0===a?"rr-block":a,blockSelector:void 0===l?null:l,maskTextClass:void 0===u?"rr-mask":u,maskTextSelector:void 0===c?null:c,skipChild:!1,inlineStylesheet:void 0===d||d,maskInputOptions:!0===m?{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===m?{password:!0}:m,maskTextFn:b,maskInputFn:k,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:S,inlineImages:void 0!==f&&f,recordCanvas:void 0!==h&&h,preserveWhiteSpace:x,onSerialize:E,onIframeLoad:A,iframeLoadTimeout:T,onStylesheetLoad:n.onStylesheetLoad,stylesheetLoadTimeout:n.stylesheetLoadTimeout,keepIframeSrcFn:void 0===(O=n.keepIframeSrcFn)?function(){return!1}:O,newlyAddedElement:!1}));if(!R)return console.warn("Failed to snapshot the document");e5(te({type:ey.FullSnapshot,data:{node:R,initialOffset:ee(window)}}),e),eO.forEach(function(e){return e.unlock()}),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&eg.adoptStyleSheets(document.adoptedStyleSheets,tn.getId(document))}};try{var eS=[],ex=function(e){var t;return eM(eB)({mutationCb:ep,mousemoveCb:function(e,t){return e5(te({type:ey.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.MouseInteraction},e)}))},scrollCb:eh,viewportResizeCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.ViewportResize},e)}))},inputCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.Input},e)}))},mediaInteractionCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.StyleDeclaration},e)}))},canvasMutationCb:ev,fontCb:function(e){return e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.Font},e)}))},selectionCb:function(e){e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.Selection},e)}))},customElementCb:function(e){e5(te({type:ey.IncrementalSnapshot,data:Object.assign({source:eb.CustomElement},e)}))},blockClass:o,ignoreClass:u,ignoreSelector:d,maskTextClass:p,maskTextSelector:g,maskInputOptions:eo,inlineStylesheet:_,sampling:A,recordDOM:F,recordCanvas:L,inlineImages:V,userTriggeredOnInput:j,collectFonts:W,doc:e,maskInputFn:w,maskTextFn:I,keepIframeSrcFn:K,blockSelector:s,slimDOMOptions:ea,dataURLOptions:M,mirror:tn,iframeManager:em,stylesheetManager:eg,shadowDomManager:eI,processedNodeManager:ew,canvasManager:e4,ignoreCSSAttributes:J,plugins:(null===(t=null==z?void 0:z.filter(function(e){return e.observer}))||void 0===t?void 0:t.map(function(e){return{observer:e.observer,options:e.options,callback:function(t){return e5(te({type:ey.Plugin,data:{plugin:e.name,payload:t}}))}}}))||[]},S)};em.addLoadListener(function(e){try{eS.push(ex(e.contentDocument))}catch(e){console.warn(e)}});var eE=function(){e3(),eS.push(ex(document)),tt=!0};return"interactive"===document.readyState||"complete"===document.readyState?eE():(eS.push(Z("DOMContentLoaded",function(){e5(te({type:ey.DomContentLoaded,data:{}})),"DOMContentLoaded"===H&&eE()})),eS.push(Z("load",function(){e5(te({type:ey.Load,data:{}})),"load"===H&&eE()},window))),function(){eS.forEach(function(e){return e()}),ew.destroy(),tt=!1,e_=void 0}}catch(e){console.warn(e)}}tr.addCustomEvent=function(e,t){if(!tt)throw Error("please add custom event after start recording");e5(te({type:ey.Custom,data:{tag:e,payload:t}}))},tr.freezePage=function(){eO.forEach(function(e){return e.freeze()})},tr.takeFullSnapshot=function(e){if(!tt)throw Error("please take full snapshot after start recording");e3(e)},tr.mirror=tn;var ti=function(){function e(t){s(this,e),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}return u(e,[{key:"toString",value:function(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?"".concat(this.functionName," (").concat(this.fileName,":").concat(e,":").concat(t,")"):"".concat(this.fileName,":").concat(e,":").concat(t)}}]),e}(),to=/(^|@)\S+:\d+/,ta=/^\s*at .*(\S+:\d+|\(native\))/m,ts=/^(eval@)?(\[native code])?$/,tl={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(ta)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw Error("Cannot parse given url: ".concat(e));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(ta)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),r=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop());return new ti({functionName:r.join(" ")||void 0,fileName:["eval",""].indexOf(i[0])>-1?void 0:i[0],lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(ts)},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 ti({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new ti({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],i=2,o=n.length;i/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function tu(e){return"[object Object]"===Object.prototype.toString.call(e)}function tc(e,t){var n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);var r=[],i=[];return JSON.stringify(e,function(e,t){if(r.length>0){var o,a,s=r.indexOf(this);~s?r.splice(s+1):r.push(this),~s?i.splice(s,1/0,e):i.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(tu(o=t)&&Object.keys(o).length>n.numOfKeysLimit||"function"==typeof o||tu(o)&&function e(t,n){if(0===n)return!0;for(var r=0,i=Object.keys(t);rn.stringLengthLimit&&(a="".concat(a.slice(0,n.stringLengthLimit),"...")),a;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var l={};for(var u in t){var c=t[u];Array.isArray(c)?l[u]=function(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var r=e.parentElement,i=[];if(r.children&&r.children.length>0)for(var o=0;o1&&(n+=":eq(".concat(i.indexOf(e),")")),t=n+(t?">"+t:""),e=r}return t}(c.length?c[0]:null):l[u]=c}return l}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 td={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 tf(e,t,n){var r,i=n?Object.assign({},td,n):td,o=i.logger;if(!o)return function(){};r="string"==typeof o?t[o]:o;var a=0,s=!1,l=[];if(i.level.includes("error")){var u=function(t){var n=t.message,r=t.error;e({level:"error",trace:tl.parse(r).map(function(e){return e.toString()}),payload:[tc(n,i.stringifyOptions)]})};t.addEventListener("error",u),l.push(function(){t.removeEventListener("error",u)});var c=function(t){var n,r;t.reason instanceof Error?(n=t.reason,r=[tc("Uncaught (in promise) ".concat(n.name,": ").concat(n.message),i.stringifyOptions)]):(n=Error(),r=[tc("Uncaught (in promise)",i.stringifyOptions),tc(t.reason,i.stringifyOptions)]),e({level:"error",trace:tl.parse(n).map(function(e){return e.toString()}),payload:r})};t.addEventListener("unhandledrejection",c),l.push(function(){t.removeEventListener("unhandledrejection",c)})}var d,f=h(i.level);try{for(f.s();!(d=f.n()).done;){var p=d.value;l.push(function(t,n){var r=this;return t[n]?J(t,n,function(t){return function(){for(var o=arguments.length,l=Array(o),u=0;u1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return function(e,t,n){if(!tb(e)){if(tm(e))return function(e,t,n){if(tm(e)){if(tS&&e.forEach===tS)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r=0;n-=1)if(t(e[n]))return e[n]}function tD(e,t){return!!t&&(tk(t)||t[e])}function tq(e,t,n){function r(e){var t=Object.keys(n).find(function(e){return"content-type"===e.toLowerCase()}),r=t&&n[t];return e.some(function(e){return null==r?void 0:r.includes(e)})}if(!t)return!1;if(tk(t))return!0;if(tm(t))return r(t);var i=t[e];return tk(i)?i:r(i)}function tH(e,t,n,r,i){return tB.apply(this,arguments)}function tB(){return(tB=a(r().mark(function e(t,n,i,o,a){var s,l,u=arguments;return r().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!((s=u.length>5&&void 0!==u[5]?u[5]:0)>10)){e.next=4;break}return tT.warn("Failed to get performance entry for request",{url:i,initiatorType:n}),e.abrupt("return",null);case 4:if(l=tP(t.performance.getEntriesByName(i),function(e){return tL(e)&&e.initiatorType===n&&(!o||e.startTime>=o)&&(!a||e.startTime<=a)})){e.next=10;break}return e.next=9,new Promise(function(e){return setTimeout(e,50*s)});case 9:return e.abrupt("return",tH(t,n,i,o,a,s+1));case 10:return e.abrupt("return",l);case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function tj(e){if(tb(e))return null;if("[object String]"==tg.call(e))return e;if(e instanceof Document)return e.textContent;if(tC(e))return tO(e);if(e===Object(e)&&!tm(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}function tU(e,t,r,i,o){var a=Math.floor(Date.now()-performance.now()),s=Math.floor(a+e.startTime),l=[n(n({},e.toJSON()),{},{startTime:Math.round(e.startTime),endTime:Math.round(e.responseEnd),timeOrigin:a,timestamp:s,method:t,initiatorType:e.initiatorType,status:r,requestHeaders:i.requestHeaders,requestBody:i.requestBody,responseHeaders:i.responseHeaders,responseBody:i.responseBody,isInitial:o})];if("navigation"===e.entryType||"resource"===e.entryType){var u,c=h(e.serverTiming||[]);try{for(c.s();!(u=c.n()).done;){var d=u.value;l.push({timeOrigin:a,timestamp:s,startTime:Math.round(e.startTime),name:d.name,duration:d.duration,entryType:"serverTiming"})}}catch(e){c.e(e)}finally{c.f()}}return l}var tW=["video/","audio/"];function t$(e){return new Promise(function(t,n){var r=setTimeout(function(){return t("[SessionReplay] Timeout while trying to read body")},500);e.clone().text().then(function(e){return t(e)},function(e){return n(e)}).finally(function(){return clearTimeout(r)})})}function tV(){return(tV=a(r().mark(function e(t){var n;return r().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ty(n=function(e){if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var t,n=null===(t=e.headers.get("Content-Type"))||void 0===t?void 0:t.toLowerCase(),r=tW.some(function(e){return null==n?void 0:n.startsWith(e)});return n&&r?"Content-Type ".concat(n," is not supported"):null}(t))){e.next=3;break}return e.abrupt("return",Promise.resolve(n));case 3:return e.abrupt("return",t$(t));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}var tG=null;function tZ(e,t,i){if(!("performance"in t))return function(){};if(tG)return tT.warn("Network observer already initialised, doing nothing"),function(){};var o,s,l=i?Object.assign({},tR,i):tR,u=function(t){var r=[];t.requests.forEach(function(e){var t=l.maskRequestFn(e);t&&r.push(t)}),r.length>0&&e(n(n({},t),{},{requests:r}))},c=(l.recordInitialRequests&&u({requests:t.performance.getEntries().filter(function(e){return tN(e)||tL(e)&&l.initiatorTypes.includes(e.initiatorType)}).flatMap(function(e){return tU(e,void 0,void 0,{},!0)}),isInitial:!0}),o=new t.PerformanceObserver(function(e){u({requests:e.getEntries().filter(function(e){return tN(e)||tL(e)&&l.initiatorTypes.includes(e.initiatorType)&&(!l.recordBody&&!l.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)}).flatMap(function(e){return tU(e,void 0,void 0,{})})})}),s=PerformanceObserver.supportedEntryTypes.filter(function(e){return l.performanceEntryTypeToObserve.includes(e)}),o.observe({entryTypes:s}),function(){o.disconnect()}),d=function(){},f=function(){};return(l.recordHeaders||l.recordBody)&&(d=function(e,t,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return function(){};var r=tD("request",n.recordHeaders),i=tD("response",n.recordHeaders),o=tF(t.XMLHttpRequest.prototype,"open",function(o){return function(a,s){var l,u,c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],d=arguments.length>3?arguments[3]:void 0,f=arguments.length>4?arguments[4]:void 0,p=this,h=new Request(s),v={},g={},m=p.setRequestHeader.bind(p);p.setRequestHeader=function(e,t){return g[e]=t,m(e,t)},r&&(v.requestHeaders=g);var _=p.send.bind(p);p.send=function(e){return tq("request",n.recordBody,g)&&(t_(e)||ty(e)?v.requestBody=null:v.requestBody=tj(e)),l=t.performance.now(),_(e)},p.addEventListener("readystatechange",function(){if(p.readyState===p.DONE){u=t.performance.now();var r={};p.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(function(e){var t=e.split(": "),n=t.shift(),i=t.join(": ");n&&(r[n]=i)}),i&&(v.responseHeaders=r),tq("response",n.recordBody,r)&&(tb(p.response)?v.responseBody=null:v.responseBody=tj(p.response)),tH(t,"xmlhttprequest",h.url,l,u).then(function(t){ty(t)||e({requests:tU(t,h.method,null==p?void 0:p.status,v)})}).catch(function(){})}}),o.call(p,a,s,c,d,f)}});return function(){o()}}(u,t,l),f=function(e,t,n){if(!n.initiatorTypes.includes("fetch"))return function(){};var i=tD("request",n.recordHeaders),o=tD("response",n.recordHeaders),s=tF(t,"fetch",function(s){var l;return l=a(r().mark(function a(l,u){var c,d,f,p,h,v,g;return r().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(c=new Request(l,u),f={},r.prev=2,v={},c.headers.forEach(function(e,t){v[t]=e}),i&&(f.requestHeaders=v),!tq("request",n.recordBody,v)){r.next=10;break}return r.next=9,t$(c);case 9:f.requestBody=r.sent;case 10:return p=t.performance.now(),r.next=13,s(c);case 13:if(d=r.sent,h=t.performance.now(),g={},d.headers.forEach(function(e,t){g[t]=e}),o&&(f.responseHeaders=g),!tq("response",n.recordBody,g)){r.next=22;break}return r.next=21,function(e){return tV.apply(this,arguments)}(d);case 21:f.responseBody=r.sent;case 22:return r.abrupt("return",d);case 23:return r.prev=23,tH(t,"fetch",c.url,p,h).then(function(t){var n;ty(t)||e({requests:tU(t,c.method,null===(n=d)||void 0===n?void 0:n.status,f)})}).catch(function(){}),r.finish(23);case 26:case"end":return r.stop()}},a,null,[[2,,23,26]])})),function(e,t){return l.apply(this,arguments)}});return function(){s()}}(u,t,l)),tG=function(){c(),d(),f()}}var tz="rrweb/network@1",tQ=function(e){return{name:tz,observer:tZ,options:e}};tw&&(tw.rrweb={record:tr,version:"v2",rrwebVersion:"2.0.0-alpha.13"},tw.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:tf,options:e}}},tw.getRecordNetworkPlugin=tQ),e.NETWORK_PLUGIN_NAME=tz,e.default=tr,e.findLast=tP,e.getRecordNetworkPlugin=tQ,Object.defineProperty(e,"__esModule",{value:!0})}({}),function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&(a.children=arguments.length>3?_.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return N(e,a,r,i,null)}function N(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++b:i,__i:-1,__u:0};return null==i&&null!=y.vnode&&y.vnode(o),o}function L(e){return e.children}function P(e,t){this.props=e,this.context=t}function D(e,t){if(null==t)return e.__?D(e.__,e.__i+1):null;for(var n;tt&&k.sort(I));H.__r=0}function B(e,t,n,r,i,o,a,s,l,u,c){var d,f,p,h,v,g=r&&r.__k||A,m=t.length;for(n.__d=l,function(e,t,n){var r,i,o,a,s,l=t.length,u=n.length,c=u,d=0;for(e.__k=[],r=0;r0?N(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,s=function(e,t,n,r){var i=e.key,o=e.type,a=n-1,s=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null!=l&&0==(131072&l.__u)?1:0))for(;a>=0||s=0){if((l=t[a])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return a;a--}if(sa?c>l-a?d+=s-a:d--:d=s .ratings-number {\n border-right: 1px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .emoji-svg {\n fill: ").concat((null==e?void 0:e.ratingButtonColor)||"#c9c6c6",";\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message {\n position: fixed;\n bottom: 0px;\n z-index: ").concat(parseInt((null==e?void 0:e.zIndex)||"99999"),';\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n padding: 20px 25px 10px;\n background: ').concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n text-align: center;\n max-width: ").concat(parseInt((null==e?void 0:e.maxWidth)||"300"),"px;\n min-width: 150px;\n width: 100%;\n ").concat(t[(null==e?void 0:e.position)||"right"]||"right: 30px;","\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ")};function J(e){if("#"===e[0]){var t=e.replace(/^#/,"");return"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")"}return"rgb(255, 255, 255)"}function X(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:el;"#"===t[0]&&(e=J(t)),t.startsWith("rgb")&&(e=t);var n={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"}[t.toLowerCase()];if(n&&(e=J(n)),!e)return"black";var r=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(r){var i=parseInt(r[1]),o=parseInt(r[2]),a=parseInt(r[3]);return Math.sqrt(i*i*.299+o*o*.587+a*a*.114)>127.5?"black":"white"}return"black"}var ee,et,en,er,ei,eo,ea,es={backgroundColor:"#eeeded",submitButtonColor:"black",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},el="#eeeded",eu=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0;o&&(localStorage.setItem(ep(i),"true"),o.capture("survey sent",t(t({$survey_name:i.name,$survey_id:i.id,$survey_iteration:i.current_iteration,$survey_iteration_start_date:i.current_iteration_start_date,$survey_questions:i.questions.map(function(e){return e.question}),sessionRecordingUrl:null===(e=o.get_session_replay_url)||void 0===e?void 0:e.call(o)},n),{},{$set:r({},eh(i,"responded"),!0)})),l.dispatchEvent(new Event("PHSurveySent")))},ec=function(e,t,n){var i;!n&&t&&(t.capture("survey dismissed",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t),$set:r({},eh(e,"dismissed"),!0)}),localStorage.setItem(ep(e),"true"),l.dispatchEvent(new Event("PHSurveyClosed")))},ed=function(e){return e.map(function(e){return{sort:Math.floor(10*Math.random()),value:e}}).sort(function(e,t){return e.sort-t.sort}).map(function(e){return e.value})},ef=function(e,t){return e.length===t.length&&e.every(function(e,n){return e===t[n]})?t.reverse():t},ep=function(e){var t="seenSurvey_".concat(e.id);return e.current_iteration&&e.current_iteration>0&&(t="seenSurvey_".concat(e.id,"_").concat(e.current_iteration)),t},eh=function(e,t){var n="$survey_".concat(t,"/").concat(e.id);return e.current_iteration&&e.current_iteration>0&&(n="$survey_".concat(t,"/").concat(e.id,"/").concat(e.current_iteration)),n},ev=(ee={isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:function(){}},(en={__c:et="__cC"+S++,__:ee,Consumer:function(e,t){return e.children(t)},Provider:function(e){var t,n;return this.getChildContext||(t=[],(n={})[et]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&t.some(function(e){e.__e=!0,q(e)})},this.sub=function(e){t.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t.splice(t.indexOf(e),1),n&&n.call(e)}}),e.children}}).Provider.__=en.Consumer.contextType=en),eg=function(e){var t=e.component,n=e.children,r=e.renderAsHtml,i=e.style;return function(e,t,n){var r,i,o,a,s=O({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=void 0===t[o]&&void 0!==a?a[o]:t[o];return arguments.length>2&&(s.children=arguments.length>3?_.call(arguments,2):n),N(e.type,s,r||e.key,i||e.ref,null)}(t,r?{dangerouslySetInnerHTML:{__html:n},style:i}:{children:n,style:i})},em=0,e_=[],ey=[],eb=y.__b,ek=y.__r,eC=y.diffed,ew=y.__c,eI=y.unmount;function eS(e,t){y.__h&&y.__h(ei,e,em||t),em=0;var n=ei.__H||(ei.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:ey}),n.__[e]}function ex(e){return em=1,function(e,t,n){var r=eS(er++,2);if(r.t=e,!r.__c&&(r.__=[eP(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=ei,!ei.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!o||o.call(this,e,t,n);var a=!1;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),!(!a&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};ei.u=!0;var o=ei.shouldComponentUpdate,a=ei.componentWillUpdate;ei.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}a&&a.call(this,e,t,n)},ei.shouldComponentUpdate=i}return r.__N||r.__}(eP,e)}function eE(e,t){var n=eS(er++,3);!y.__s&&eL(n.__H,t)&&(n.__=e,n.i=t,ei.__H.__h.push(n))}function eA(e){return em=5,eT(function(){return{current:e}},[])}function eT(e,t){var n=eS(er++,7);return eL(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function eM(e){var t=ei.context[e.__c],n=eS(er++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(ei)),t.props.value):e.__}function eO(){for(var e;e=e_.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(eF),e.__H.__h.forEach(eN),e.__H.__h=[]}catch(t){e.__H.__h=[],y.__e(t,e.__v)}}y.__b=function(e){ei=null,eb&&eb(e)},y.__r=function(e){ek&&ek(e),er=0;var t=(ei=e.__c).__H;t&&(eo===ei?(t.__h=[],ei.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=ey,e.__N=e.i=void 0})):(t.__h.forEach(eF),t.__h.forEach(eN),t.__h=[],er=0)),eo=ei},y.diffed=function(e){eC&&eC(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==e_.push(t)&&ea===y.requestAnimationFrame||((ea=y.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),eR&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);eR&&(t=requestAnimationFrame(n))})(eO)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==ey&&(e.__=e.__V),e.i=void 0,e.__V=ey})),eo=ei=null},y.__c=function(e,t){t.some(function(e){try{e.__h.forEach(eF),e.__h=e.__h.filter(function(e){return!e.__||eN(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],y.__e(n,e.__v)}}),ew&&ew(e,t)},y.unmount=function(e){eI&&eI(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{eF(e)}catch(e){t=e}}),n.__H=void 0,t&&y.__e(t,n.__v))};var eR="function"==typeof requestAnimationFrame;function eF(e){var t=ei,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),ei=t}function eN(e){var t=ei;e.__c=e.__(),ei=t}function eL(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function eP(e,t){return"function"==typeof t?t(e):t}var eD=Array.isArray,eq=Object.prototype.toString,eH=eD||function(e){return"[object Array]"===eq.call(e)},eB=function(e){return null===e},ej=0;function eU(e,t,n,r,i,o){var a,s,l={};for(s in t)"ref"==s?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--ej,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return y.vnode&&y.vnode(u),u}var eW=eU("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:eU("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"})}),e$=eU("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:eU("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"})}),eV=eU("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:eU("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"})}),eG=eU("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:eU("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"})}),eZ=eU("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:eU("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"})}),ez=eU("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:eU("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:"black"})}),eQ=eU("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[eU("g",{"clip-path":"url(#clip0_2415_6911)",children:[eU("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:eU("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),eU("g",{mask:"url(#mask0_2415_6911)",children:[eU("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"}),eU("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"}),eU("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"}),eU("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"}),eU("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"}),eU("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"})]})]}),eU("defs",{children:eU("clipPath",{id:"clip0_2415_6911",children:eU("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),eK=eU("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:eU("path",{d:"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z",fill:"currentColor"})});function eY(e){var t=e.backgroundColor;return eU("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",style:{backgroundColor:t,color:X(t)},className:"footer-branding",children:["Survey by ",eQ]})}function eJ(e){var t=e.text,n=e.submitDisabled,r=e.appearance,i=e.onSubmit,o=e.link,a=eM(ev).isPreviewMode;return eU("div",{className:"bottom-section",children:[eU("div",{className:"buttons",children:eU("button",{className:"form-submit",disabled:n&&!a,type:"button",style:{color:X(r.submitButtonColor||es.submitButtonColor)},onClick:function(){a||(o&&(null==l||l.open(o)),i())},children:t})}),!r.whiteLabel&&eU(eY,{backgroundColor:r.backgroundColor||el})]})}function eX(e){var t=e.question,n=e.description,r=e.descriptionContentType,i=e.backgroundColor,o=e.forceDisableHtml;return eU("div",{style:{backgroundColor:i||es.backgroundColor},children:[eU("div",{className:"survey-question",children:t}),n&&eg({component:F("div",{className:"description"}),children:n,renderAsHtml:!o&&"text"!==r})]})}function e0(e){return eU("div",{className:"cancel-btn-wrapper",children:eU("button",{className:"form-cancel",onClick:e.onClick,disabled:eM(ev).isPreviewMode,children:ez})})}function e1(e){var n=e.header,r=e.description,i=e.contentType,o=e.forceDisableHtml,a=e.appearance,s=e.onClose,l=e.styleOverrides,u=X(a.backgroundColor||es.backgroundColor);return eU(L,{children:eU("div",{className:"thank-you-message",style:t({},l),children:eU("div",{className:"thank-you-message-container",children:[eU(e0,{onClick:function(){return s()}}),eU("h3",{className:"thank-you-message-header",style:{color:u},children:n}),r&&eg({component:F("div",{className:"thank-you-message-body"}),children:r,renderAsHtml:!o&&"text"!==i,style:{color:u}}),eU(eJ,{text:"Close",submitDisabled:!1,appearance:a,onSubmit:function(){return s()}})]})})})}function e2(e){var t=e.question,n=e.forceDisableHtml,r=e.appearance,o=e.onSubmit,a=eA(null),s=i(ex(""),2),l=s[0],u=s[1],c=eM(ev).handleCloseSurveyPopup;return eU("div",{className:"survey-box",style:{backgroundColor:r.backgroundColor||es.backgroundColor},ref:a,children:[eU(e0,{onClick:function(){return c()}}),eU(eX,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,backgroundColor:r.backgroundColor,forceDisableHtml:n}),eU("textarea",{rows:4,placeholder:null==r?void 0:r.placeholder,onInput:function(e){return u(e.currentTarget.value)}}),eU(eJ,{text:t.buttonText||"Submit",submitDisabled:!l&&!t.optional,appearance:r,onSubmit:function(){return o(l)}})]})}function e5(e){var t=e.question,n=e.forceDisableHtml,r=e.appearance,i=e.onSubmit,o=eM(ev).handleCloseSurveyPopup;return eU("div",{className:"survey-box",children:[eU(e0,{onClick:function(){return o()}}),eU(eX,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n}),eU(eJ,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:function(){return i("link clicked")}})]})}function e3(e){var t=e.question,n=e.forceDisableHtml,r=e.displayQuestionIndex,o=e.appearance,a=e.onSubmit,s=t.scale,l=10===t.scale?0:1,u=i(ex(null),2),c=u[0],d=u[1],f=eM(ev).handleCloseSurveyPopup;return eU("div",{className:"survey-box",children:[eU(e0,{onClick:function(){return f()}}),eU(eX,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:o.backgroundColor}),eU("div",{className:"rating-section",children:[eU("div",{className:"rating-options",children:["emoji"===t.display&&eU("div",{className:"rating-options-emoji",children:(3===t.scale?e6:e7).map(function(e,t){var n=t+1===c;return eU("button",{className:"ratings-emoji question-".concat(r,"-rating-").concat(t," ").concat(n?"rating-active":null),value:t+1,type:"button",onClick:function(){d(t+1)},children:e},t)})}),"number"===t.display&&eU("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat(".concat(s-l+1,", minmax(0, 1fr))")},children:(5===t.scale?e9:te).map(function(e,t){return eU(e4,{displayQuestionIndex:r,active:c===e,appearance:o,num:e,setActiveNumber:function(e){d(e)}},t)})})]}),eU("div",{className:"rating-text",children:[eU("div",{children:t.lowerBoundLabel}),eU("div",{children:t.upperBoundLabel})]})]}),eU(eJ,{text:t.buttonText||(null==o?void 0:o.submitButtonText)||"Submit",submitDisabled:eB(c)&&!t.optional,appearance:o,onSubmit:function(){return a(c)}})]})}function e4(e){var t,n,r,o,a,s,u=e.num,c=e.active,d=e.displayQuestionIndex,f=e.appearance,p=e.setActiveNumber,h=(t={appearance:f,defaultTextColor:"black",forceUpdate:c},r=eA(null),a=(o=i(ex(null!==(n=t.defaultTextColor)&&void 0!==n?n:"black"),2))[0],s=o[1],eE(function(){r.current&&s(function(e){var t=l.getComputedStyle(e).backgroundColor;if("rgba(0, 0, 0, 0)"===t)return"black";var n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(!n)return"black";var r=parseInt(n[1]),i=parseInt(n[2]),o=parseInt(n[3]);return Math.sqrt(r*r*.299+i*i*.587+o*o*.114)>127.5?"black":"white"}(r.current))},[t.appearance,t.forceUpdate]),{ref:r,textColor:a}),v=h.textColor;return eU("button",{ref:h.ref,className:"ratings-number question-".concat(d,"-rating-").concat(u," ").concat(c?"rating-active":null),type:"button",onClick:function(){p(u)},style:{color:v,backgroundColor:c?f.ratingButtonActiveColor:f.ratingButtonColor,borderColor:f.borderColor},children:u})}function e8(e){var t=e.question,n=e.forceDisableHtml,r=e.displayQuestionIndex,a=e.appearance,s=e.onSubmit,l=eA(null),u=eT(function(){return function(e){if(!e.shuffleOptions)return e.choices;var t=e.choices,n="";e.hasOpenChoice&&(n=t.pop());var r=ef(t,ed(t));return e.hasOpenChoice&&(e.choices.push(n),r.push(n)),r}(t)},[t]),c=i(ex(t.type===g.MultipleChoice?[]:null),2),d=c[0],f=c[1],p=i(ex(!1),2),h=p[0],v=p[1],m=i(ex(""),2),_=m[0],y=m[1],b=eM(ev).handleCloseSurveyPopup,k=t.type===g.SingleChoice?"radio":"checkbox";return eU("div",{className:"survey-box",style:{backgroundColor:a.backgroundColor||es.backgroundColor},ref:l,children:[eU(e0,{onClick:function(){return b()}}),eU(eX,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:a.backgroundColor}),eU("div",{className:"multiple-choice-options",children:u.map(function(e,n){var i="choice-option";return t.hasOpenChoice&&n===t.choices.length-1&&(i+=" choice-option-open"),eU("div",{className:i,children:[eU("input",{type:k,id:"surveyQuestion".concat(r,"Choice").concat(n),name:"question".concat(r),value:e,disabled:!e,onInput:function(){return t.hasOpenChoice&&n===t.choices.length-1?v(!h):t.type===g.SingleChoice?f(e):t.type===g.MultipleChoice&&eH(d)?d.includes(e)?f(d.filter(function(t){return t!==e})):f([].concat(o(d),[e])):void 0}}),eU("label",{htmlFor:"surveyQuestion".concat(r,"Choice").concat(n),style:{color:"black"},children:t.hasOpenChoice&&n===t.choices.length-1?eU(L,{children:[eU("span",{children:[e,":"]}),eU("input",{type:"text",id:"surveyQuestion".concat(r,"Choice").concat(n,"Open"),name:"question".concat(r),onInput:function(e){var n=e.currentTarget.value;return t.type===g.SingleChoice?f(n):t.type===g.MultipleChoice&&eH(d)?y(n):void 0}})]}):e}),eU("span",{className:"choice-check",style:{color:"black"},children:eK})]})})}),eU(eJ,{text:t.buttonText||"Submit",submitDisabled:(eB(d)||eH(d)&&!h&&0===d.length||eH(d)&&h&&!_&&0===d.length&&!t.optional)&&!t.optional,appearance:a,onSubmit:function(){h&&t.type===g.MultipleChoice?eH(d)&&s([].concat(o(d),[_])):s(d)}})]})}var e6=[eV,e$,eW],e7=[eG,eV,e$,eW,eZ],e9=[1,2,3,4,5],te=[0,1,2,3,4,5,6,7,8,9,10],tt="[PostHog.js]",tn={_log:function(e){if(l&&x.POSTHOG_DEBUG&&void 0!==l.console&&l.console){for(var t=("__rrweb_original__"in l.console[e])?l.console[e].__rrweb_original__:l.console[e],n=arguments.length,r=Array(n>1?n-1:0),i=1;i0)||1===(null===(e=t[t.length-1].shadowRoot)||void 0===e?void 0:e.childElementCount)}),r(this,"handlePopoverSurvey",function(e){var n,r,i,o,a,s,l,u,c,f=null===(c=e.conditions)||void 0===c?void 0:c.seenSurveyWaitPeriodInDays,p=localStorage.getItem("lastSeenSurveyDate");if(!(f&&p&&Math.ceil(Math.abs((new Date).getTime()-new Date(p).getTime())/864e5)0)){t.addSurveyToFocus(e.id);var h=function(e,t){var n=d.createElement("div");n.className="PostHogSurvey".concat(t);var r=n.attachShadow({mode:"open"});if(e){var i=Object.assign(d.createElement("style"),{innerText:e});r.appendChild(i)}return d.body.appendChild(n),r}(Y(null==e?void 0:e.appearance),e.id);K(eU(ti,{posthog:t.posthog,survey:e,removeSurveyFromFocus:t.removeSurveyFromFocus},"popover-survey"),h)}}),r(this,"handleWidget",function(e){var n,r,i,o,a,s=((r=d.createElement("div")).className="PostHogWidget".concat(e.id),o=r.attachShadow({mode:"open"}),i=null===(n=e.appearance)||void 0===n?void 0:n.widgetColor,a="\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ".concat(i||"#e0a045",";\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: 9999999;\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n "),o.append(Object.assign(d.createElement("style"),{innerText:a})),d.body.appendChild(r),o),l=Y(e.appearance);s.appendChild(Object.assign(d.createElement("style"),{innerText:l})),K(eU(ta,{posthog:t.posthog,survey:e,removeSurveyFromFocus:t.removeSurveyFromFocus},"feedback-survey"),s)}),r(this,"handleWidgetSelector",function(e){var n,r=(null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector)&&d.querySelector(e.appearance.widgetSelector);if(r){if(0===d.querySelectorAll(".PostHogWidget".concat(e.id)).length)t.handleWidget(e);else if(1===d.querySelectorAll(".PostHogWidget".concat(e.id)).length&&!r.getAttribute("PHWidgetSurveyClickListener")){var i,o,a=null===(i=d.querySelector(".PostHogWidget".concat(e.id)))||void 0===i||null===(o=i.shadowRoot)||void 0===o?void 0:o.querySelector(".survey-form");r.addEventListener("click",function(){a&&(a.style.display="none"===a.style.display?"block":"none",a.addEventListener("PHSurveyClosed",function(){t.removeSurveyFromFocus(e.id),a.style.display="none"}))}),r.setAttribute("PHWidgetSurveyClickListener","true")}}}),r(this,"callSurveysAndEvaluateDisplayLogic",function(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=t.posthog)||void 0===e||e.getActiveMatchingSurveys(function(e){var n=e.filter(function(e){return"api"!==e.type});t.sortSurveysByAppearanceDelay(n).forEach(function(e){if(eB(t.surveyInFocus)){var n,r,i;e.type===v.Widget&&("tab"===(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)&&0===d.querySelectorAll(".PostHogWidget".concat(e.id)).length&&t.handleWidget(e),"selector"===(null===(r=e.appearance)||void 0===r?void 0:r.widgetType)&&null!==(i=e.appearance)&&void 0!==i&&i.widgetSelector&&t.handleWidgetSelector(e)),e.type===v.Popover&&t.canShowNextEventBasedSurvey()&&t.handlePopoverSurvey(e)}})},n)}),r(this,"addSurveyToFocus",function(e){eB(t.surveyInFocus)||tn.error("Survey ".concat(o(t.surveyInFocus)," already in focus. Cannot add survey ").concat(e,".")),t.surveyInFocus=e}),r(this,"removeSurveyFromFocus",function(e){t.surveyInFocus!==e&&tn.error("Survey ".concat(e," is not in focus. Cannot remove survey ").concat(e,".")),t.surveyInFocus=null}),this.posthog=e,this.surveyInFocus=null}return e=[{key:"sortSurveysByAppearanceDelay",value:function(e){return e.sort(function(e,t){var n,r;return((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(r=t.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds)||0)})}},{key:"getTestAPI",value:function(){return{addSurveyToFocus:this.addSurveyToFocus,removeSurveyFromFocus:this.removeSurveyFromFocus,surveyInFocus:this.surveyInFocus,canShowNextEventBasedSurvey:this.canShowNextEventBasedSurvey,handleWidget:this.handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,handleWidgetSelector:this.handleWidgetSelector,sortSurveysByAppearanceDelay:this.sortSurveysByAppearanceDelay}}}],n(i.prototype,e),t&&n(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}();function ti(e){var n,r,o,a,s,u,c,d,f,p,h,v,g,m=e.survey,_=e.forceDisableHtml,y=e.posthog,b=e.style,k=e.previewPageIndex,C=e.removeSurveyFromFocus,w=Number.isInteger(k),I=null!==(d=m.appearance)&&void 0!==d&&d.surveyPopupDelaySeconds?1e3*m.appearance.surveyPopupDelaySeconds:0,S=(r=(n=i(ex(w||0===I),2))[0],o=n[1],s=(a=i(ex(!1),2))[0],u=a[1],eE(function(){if(!w&&y){var e,t=function(){C(m.id),o(!1)},n=function(){var e,t;null!==(e=m.appearance)&&void 0!==e&&e.displayThankYouMessage?(u(!0),C(m.id),null!==(t=m.appearance)&&void 0!==t&&t.autoDisappear&&setTimeout(function(){o(!1)},5e3)):(C(m.id),o(!1))},r=function(){var e;o(!0),l.dispatchEvent(new Event("PHSurveyShown")),y.capture("survey shown",{$survey_name:m.name,$survey_id:m.id,$survey_iteration:m.current_iteration,$survey_iteration_start_date:m.current_iteration_start_date,sessionRecordingUrl:null===(e=y.get_session_replay_url)||void 0===e?void 0:e.call(y)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())};return l.addEventListener("PHSurveyClosed",t),l.addEventListener("PHSurveySent",n),I>0?(e=setTimeout(function(){r()},I),function(){clearTimeout(e),l.removeEventListener("PHSurveyClosed",t),l.removeEventListener("PHSurveySent",n)}):(r(),function(){l.removeEventListener("PHSurveyClosed",t),l.removeEventListener("PHSurveySent",n)})}},[]),{isPopupVisible:r,isSurveySent:s,setIsPopupVisible:o}),x=S.isPopupVisible,E=S.isSurveySent,A=S.setIsPopupVisible,T=E||k===m.questions.length,M=null!==(f=b)&&void 0!==f&&f.left&&(c=null===(p=b)||void 0===p?void 0:p.left,"[object Number]"==eq.call(c))?{left:b.left-40}:{};return w&&((b=b||{}).left="unset",b.right="unset",b.transform="unset"),x?eU(ev.Provider,{value:{isPreviewMode:w,previewPageIndex:k,handleCloseSurveyPopup:function(){return ec(m,y,w)}},children:T?eU(e1,{header:(null===(h=m.appearance)||void 0===h?void 0:h.thankYouMessageHeader)||"Thank you!",description:(null===(v=m.appearance)||void 0===v?void 0:v.thankYouMessageDescription)||"",forceDisableHtml:!!_,contentType:null===(g=m.appearance)||void 0===g?void 0:g.thankYouMessageDescriptionContentType,appearance:m.appearance||es,styleOverrides:t(t({},b),M),onClose:function(){return A(!1)}}):eU(to,{survey:m,forceDisableHtml:!!_,posthog:y,styleOverrides:b})}):eU(L,{})}function to(e){var n,o,a=e.survey,s=e.forceDisableHtml,l=e.posthog,u=e.styleOverrides,c=X((null===(n=a.appearance)||void 0===n?void 0:n.backgroundColor)||es.backgroundColor),d=i(ex({}),2),f=d[0],p=d[1],h=eM(ev),v=h.isPreviewMode,g=h.previewPageIndex,_=i(ex(g||0),2),y=_[0],b=_[1],k=eT(function(){return a.questions.forEach(function(e,t){e.originalQuestionIndex=t}),a.appearance&&a.appearance.shuffleQuestions?ef(a.questions,ed(a.questions)):a.questions},[a]);return eE(function(){b(null!=g?g:0)},[g]),eU("form",{className:"survey-form",style:t({color:c,borderColor:null===(o=a.appearance)||void 0===o?void 0:o.borderColor},u),children:k.map(function(e,n){var i=e.originalQuestionIndex;return(v?y===i:y===n)&&eU("div",{children:ts({question:e,forceDisableHtml:s,displayQuestionIndex:n,appearance:a.appearance||es,onSubmit:function(e){return function(e){var n=e.res,i=e.originalQuestionIndex,o=e.displayQuestionIndex;if(l){var s=0===i?"$survey_response":"$survey_response_".concat(i);if(p(t(t({},f),{},r({},s,n))),l.getNextSurveyStep){var u=l.getNextSurveyStep(a,o,n);u===m.End?eu(t(t({},f),{},r({},s,n)),a,l):b(u)}else o===a.questions.length-1?eu(t(t({},f),{},r({},s,n)),a,l):b(o+1)}}({res:e,originalQuestionIndex:i,displayQuestionIndex:n})}})})})})}function ta(e){var t,n,r=e.survey,o=e.forceDisableHtml,a=e.posthog,s=e.readOnly,l=e.removeSurveyFromFocus,u=i(ex(!1),2),c=u[0],f=u[1],p=i(ex({}),2),h=p[0],v=p[1],g=eA(null);return eE(function(){var e,t;if(!s&&a){if("tab"===(null===(e=r.appearance)||void 0===e?void 0:e.widgetType)&&g.current){var n,i=g.current.getBoundingClientRect();v({top:"50%",left:parseInt("".concat(i.right-360)),bottom:"auto",borderRadius:10,borderBottom:"1.5px solid ".concat((null===(n=r.appearance)||void 0===n?void 0:n.borderColor)||"#c9c6c6")})}if("selector"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)){var o=d.querySelector(r.appearance.widgetSelector||"");null==o||o.addEventListener("click",function(){f(!c)}),null==o||o.setAttribute("PHWidgetSurveyClickListener","true")}}},[]),eU(L,{children:["tab"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)&&eU("div",{className:"ph-survey-widget-tab",ref:g,onClick:function(){return!s&&f(!c)},style:{color:X(r.appearance.widgetColor)},children:[eU("div",{className:"ph-survey-widget-tab-icon"}),(null===(n=r.appearance)||void 0===n?void 0:n.widgetLabel)||""]}),c&&eU(ti,{posthog:a,survey:r,forceDisableHtml:o,style:h,removeSurveyFromFocus:l},"feedback-widget-survey")]})}var ts=function(e){var n,i,o=e.question,a=e.forceDisableHtml,s=e.displayQuestionIndex,l=e.appearance,u=e.onSubmit,c=(r(n={},g.Open,e2),r(n,g.Link,e5),r(n,g.Rating,e3),r(n,g.SingleChoice,e8),r(n,g.MultipleChoice,e8),n),d=(r(i={},g.Open,{}),r(i,g.Link,{}),r(i,g.Rating,{displayQuestionIndex:s}),r(i,g.SingleChoice,{displayQuestionIndex:s}),r(i,g.MultipleChoice,{displayQuestionIndex:s}),i),f=c[o.type],p=t(t({},{question:o,forceDisableHtml:a,appearance:l,onSubmit:u}),d[o.type]);return eU(f,t({},p))};l&&(l.extendPostHogWithSurveys=function(e){if(d&&l){var t=new tr(e);t.callSurveysAndEvaluateDisplayLogic(!0),setInterval(function(){t.callSurveysAndEvaluateDisplayLogic(!1)},1e3)}})}(),function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,y=/\((\S*)(?::(\d+))(?::(\d+))\)/,b=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,k=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,C=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,w=(function(){for(var e=arguments.length,n=Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:0,i=[],a=e.split("\n"),s=n;s1024)){var u=v.test(l)?l.replace(v,"$1"):l;if(!u.match(/\S*Error: /)){var c,d=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}(o);try{for(d.s();!(c=d.n()).done;){var f=(0,c.value)(u);if(f){i.push(f);break}}}catch(e){d.e(e)}finally{d.f()}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var n=e.slice(0,50);return n.reverse(),n.map(function(e){return t(t({},e),{},{filename:e.filename||n[n.length-1].filename,function:e.function||"?"})})}(i)}}).apply(void 0,[[30,function(e){var t=_.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){var r=y.exec(t[2]);r&&(t[2]=r[1],t[3]=r[2],t[4]=r[3])}var i=n(I(t[1]||"?",t[2]),2),o=i[0];return g(i[1],o,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,function(e){var t=b.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=k.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var i=t[3],o=t[1]||"?",a=n(I(o,i),2);return o=a[0],g(i=a[1],o,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,function(e){var t=C.exec(e);return t?g(t[2],t[1]||"?",+t[3],t[4]?+t[4]:void 0):void 0}]]),I=function(e,t){var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:"?",n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]};(o=m||(m={})).GZipJS="gzip-js",o.Base64="base64";var S=["fatal","error","warning","log","info","debug"],x=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,E=/Minified React error #\d+;/i;function A(e){var t=function(e){var t=e.stacktrace||e.stack||"",n=function(e){if(e){var t;if(t=e.framesToPop,"[object Number]"==s.call(t))return e.framesToPop;if(E.test(e.message))return 1}return 0}(e);try{return w(t,n)}catch(e){}return[]}(e);return{$exception_type:e.name,$exception_message:e.message,$exception_stack_trace_raw:JSON.stringify(t),$exception_level:"error"}}function T(e){return c(e)&&!(c(e)&&0===e.trim().length)&&S.indexOf(e)>=0}function M(e){var r=n(e,5),i=r[0],o=r[1],a=r[2],s=r[3],l=r[4],v={};if(u(l)&&c(i)){var g="Error",m=i,_=i.match(x);_&&(g=_[1],m=_[2]),v={$exception_type:g,$exception_message:m}}var y=l||i;if(h(y)||p(y,"DOMException")){if("stack"in y)v=A(y);else{var b=y.name||(h(y)?"DOMError":"DOMException"),k=y.message?"".concat(b,": ").concat(y.message):b;(v={$exception_type:"Error",$exception_message:k,$exception_level:"error"}).$exception_type=h(y)?"DOMError":"DOMException",v.$exception_message=v.$exception_message||k}"code"in y&&(v.$exception_DOMException_code="".concat(y.code))}else p(y,"ErrorEvent")&&y.error?v=A(y.error):function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return f(e,Error)}}(y)?v=A(y):p(y,"Object")||d(y)?(v={$exception_type:d(y)?y.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:"".concat(i.slice(0,t),"...")}return""}(y)),$exception_level:T(y.level)?y.level:"error"}).$exception_is_synthetic=!0:(v.$exception_type=v.$exception_type||"Error",v.$exception_message=v.$exception_message||y,v.$exception_is_synthetic=!0);return t(t(t(t({},v),{},{$exception_type:v.$exception_type||"UnknownErrorType",$exception_message:v.$exception_message||"",$exception_level:T(v.$exception_level)?v.$exception_level:"error"},o?{$exception_source:o}:{}),a?{$exception_lineno:a}:{}),s?{$exception_colno:s}:{})}var O="undefined"!=typeof window?window:void 0,R="undefined"!=typeof globalThis?globalThis:O,F=null==R?void 0:R.navigator;null==R||R.document,null==R||R.location,null==R||R.fetch,null!=R&&R.XMLHttpRequest&&"withCredentials"in new R.XMLHttpRequest&&R.XMLHttpRequest,null==R||R.AbortController,null==F||F.userAgent;var N=null!=O?O:{},L="[PostHog.js]",P={_log:function(e){if(O&&N.POSTHOG_DEBUG&&!u(O.console)&&O.console){for(var t=("__rrweb_original__"in O.console[e])?O.console[e].__rrweb_original__:O.console[e],n=arguments.length,r=Array(n>1?n-1:0),i=1;i=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function t(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function n(e,t,n){try{if(!(t in e))return function(){};var r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,function(){e[t]=r}}catch(e){return function(){}}}var r="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:r,o=null==i?void 0:i.navigator;null==i||i.document,null==i||i.location,null==i||i.fetch,null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest&&i.XMLHttpRequest,null==i||i.AbortController,null==o||o.userAgent;var a=null!=r?r:{},s=function(e,t){var n=e.checkAndGetSessionAndWindowId(!0),r=n.sessionId,i=n.windowId;t.headers.set("X-POSTHOG-SESSION-ID",r),t.headers.set("X-POSTHOG-WINDOW-ID",i)};a&&(a.postHogTracingHeadersPatchFns={_patchFetch:function(i){return n(r,"fetch",function(n){var r,o;return r=e().mark(function t(r,o){var a;return e().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(i,a=new Request(r,o)),e.abrupt("return",n(a));case 3:case"end":return e.stop()}},t)}),o=function(){var e=this,n=arguments;return new Promise(function(i,o){var a=r.apply(e,n);function s(e){t(a,i,o,s,l,"next",e)}function l(e){t(a,i,o,s,l,"throw",e)}s(void 0)})},function(e,t){return o.apply(this,arguments)}})},_patchXHR:function(e){return n(r.XMLHttpRequest.prototype,"open",function(t){return function(n,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,l=new Request(r);return s(e,l),t.call(this,n,l.url,i,o,a)}})}})}(),X=-1,ee=function(e){addEventListener("pageshow",function(t){t.persisted&&(X=t.timeStamp,e(t))},!0)},et=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart=0?r="back-forward-cache":n&&(document.prerendering||en()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},ei=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},eo=function(e,t,n,r){var i,o;return function(a){var s;t.value>=0&&(a||r)&&((o=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=(s=t.value)>n[1]?"poor":s>n[0]?"needs-improvement":"good",e(t))}},ea=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},es=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},el=function(e){var t=!1;return function(){t||(e(),t=!0)}},eu=-1,ec=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},ed=function(e){"hidden"===document.visibilityState&&eu>-1&&(eu="visibilitychange"===e.type?e.timeStamp:0,ep())},ef=function(){addEventListener("visibilitychange",ed,!0),addEventListener("prerenderingchange",ed,!0)},ep=function(){removeEventListener("visibilitychange",ed,!0),removeEventListener("prerenderingchange",ed,!0)},eh=function(){return eu<0&&(eu=ec(),ef(),ee(function(){setTimeout(function(){eu=ec(),ef()},0)})),{get firstHiddenTime(){return eu}}},ev=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},eg=[1800,3e3],em=function(e,t){t=t||{},ev(function(){var n,r=eh(),i=er("FCP"),o=ei("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTimet.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};eS.set(r.id,r),eI.push(r)}eI.sort(function(e,t){return t.latency-e.latency}),eI.length>10&&eI.splice(10).forEach(function(e){return eS.delete(e.id)})}}},eT=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=el(e),"hidden"===document.visibilityState?e():(n=t(e),es(e)),n},eM=[200,500],eO=[2500,4e3],eR={},eF="undefined"!=typeof window?window:void 0,eL=null==(eN="undefined"!=typeof globalThis?globalThis:eF)?void 0:eN.navigator,null==eN||eN.document,null==eN||eN.location,null==eN||eN.fetch,null!=eN&&eN.XMLHttpRequest&&"withCredentials"in new eN.XMLHttpRequest&&eN.XMLHttpRequest,null==eN||eN.AbortController,null==eL||eL.userAgent,(null!=eF?eF:{}).postHogWebVitalsCallbacks={onLCP:function(e,t){t=t||{},ev(function(){var n,r=eh(),i=er("LCP"),o=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTimer.value&&(r.value=i,r.entries=o,n())},s=ei("layout-shift",a);s&&(n=eo(e,r,e_,t.reportAllChanges),es(function(){a(s.takeRecords()),n(!0)}),ee(function(){i=0,n=eo(e,r=er("CLS",0),e_,t.reportAllChanges),ea(function(){return n()})}),setTimeout(n,0))}))},onFCP:em,onINP:function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},ev(function(){ew();var n,r,i=er("INP"),o=function(e){eT(function(){e.forEach(eA);var t,n=(t=Math.min(eI.length-1,Math.floor(((J?ey:performance.interactionCount||0)-ex)/50)),eI[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())})},a=ei("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=eo(e,i,eM,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),es(function(){o(a.takeRecords()),r(!0)}),ee(function(){ex=0,eI.length=0,eS.clear(),r=eo(e,i=er("INP"),eM,t.reportAllChanges)}))}))}};var f,p,h={DEBUG:!1,LIB_VERSION:"1.143.0"},v=Array.isArray,g=Object.prototype,m=g.hasOwnProperty,_=g.toString,y=v||function(e){return"[object Array]"===_.call(e)},b=function(e){return"function"==typeof e},k=function(e){return e===Object(e)&&!y(e)},C=function(e){if(k(e)){for(var t in e)if(m.call(e,t))return!1;return!0}return!1},w=function(e){return void 0===e},I=function(e){return"[object String]"==_.call(e)},S=function(e){return I(e)&&0===e.trim().length},x=function(e){return null===e},E=function(e){return w(e)||x(e)},A=function(e){return"[object Number]"==_.call(e)},T=function(e){return"[object Boolean]"===_.call(e)},M="undefined"!=typeof window?window:void 0,O="undefined"!=typeof globalThis?globalThis:M,R=Array.prototype,F=R.forEach,N=R.indexOf,L=null==O?void 0:O.navigator,P=null==O?void 0:O.document,D=null==O?void 0:O.location,q=null==O?void 0:O.fetch,H=null!=O&&O.XMLHttpRequest&&"withCredentials"in new O.XMLHttpRequest?O.XMLHttpRequest:void 0,B=null==O?void 0:O.AbortController,j=null==L?void 0:L.userAgent,U=null!=M?M:{},W="[PostHog.js]",$={_log:function(e){if(M&&(h.DEBUG||U.POSTHOG_DEBUG)&&!w(M.console)&&M.console){for(var t=("__rrweb_original__"in M.console[e])?M.console[e].__rrweb_original__:M.console[e],n=arguments.length,r=Array(n>1?n-1:0),i=1;i1?t-1:0),r=1;r0&&(t[n]=e)}),t},ej=function(e){return e.replace(/^\$/,"")},eU=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),x(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},eW=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,o){if(t){if(t.addEventListener&&!i)t.addEventListener(n,r,!!o);else{var a="on"+n,s=t[a];t[a]=function(n){if(n=n||e(null==M?void 0:M.event)){var i,o=!0;b(s)&&(i=s(n));var a=r.call(t,n);return!1!==i&&!1!==a||(o=!1),o}}}}else $.error("No valid element provided to register_event")}}();function e$(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var n,r=this.getFlagVariants()[e],i="".concat(r),o=this.instance.get_property(tn)||{};return!t.send_event&&"send_event"in t||e in o&&o[e].includes(i)||(y(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register(a({},tn,o)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r})),r}$.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);$.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(t){return t!==e})}},{key:"receivedFeatureFlags",value:function(e,n){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads();(function(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e.featureFlags,l=e.featureFlagPayloads;if(s){if(y(s)){var u,c={};if(s)for(var d=0;d1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(e6);if(r&&!n)return e(r);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var r;if(n.json){var i=n.json.earlyAccessFeatures;return null===(r=t.instance.persistence)||void 0===r||r.register(a({},e6,i)),e(i)}}})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(function(e){return t[e]}),flagVariants:Object.keys(t).filter(function(e){return t[e]}).reduce(function(e,n){return e[n]=t[n],e},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(e){var t=this._prepareFeatureFlagsForCallbacks(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach(function(t){return t(n,r,{errorsLoading:e})})}},{key:"setPersonPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(e7)||{};this.instance.register(a({},e7,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(e7)}},{key:"setGroupPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(e9)||{};0!==Object.keys(r).length&&Object.keys(r).forEach(function(n){r[n]=t(t({},r[n]),e[n]),delete e[n]}),this.instance.register(a({},e9,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var n=this.instance.get_property(e9)||{};this.instance.register(a({},e9,t(t({},n),{},a({},e,{}))))}else this.instance.unregister(e9)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return A(e)&&isFinite(e)&&Math.floor(e)===e});var tm="0123456789abcdef",t_=function(){function e(t){if(r(this,e),this.bytes=t,16!==t.length)throw TypeError("not 128-bit length")}return o(e,[{key:"toString",value:function(){for(var e="",t=0;t>>4)+tm.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/1099511627776,o[1]=t/4294967296,o[2]=t/16777216,o[3]=t/65536,o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}}]),e}(),ty=function(){function e(){r(this,e),a(this,"timestamp",0),a(this,"counter",0),a(this,"random",new tI)}return o(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(w(e)){this.timestamp=0;var t=this.generateOrAbort();if(w(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return t_.fromFieldsV7(this.timestamp,Math.trunc(this.counter/1073741824),1073741823&this.counter,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),tb=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;t=this.buffer.length&&(tb(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),tS=function(){return tx().toString()},tx=function(){return(tC||(tC=new ty)).generate()},tE="",tA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,tT={is_supported:function(){return!!P},error:function(e){$.error("cookieStore error: "+e)},get:function(e){if(P){try{for(var t=e+"=",n=P.cookie.split(";").filter(function(e){return e.length}),r=0;r1&&void 0!==arguments[1]?arguments[1]:P;if(tE)return tE;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),r=Math.min(n.length,8),i="dmn_chk_"+tS(),o=RegExp("(^|;)\\s*"+i+"=1");!tE&&r--;){var a=n.slice(r).join("."),s=i+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires=Thu, 01 Jan 1970 00:00:00 GMT",tE=a)}return tE}(e);if(!n){var r,i=(r=e.match(tA))?r[0]:"";i!==n&&$.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}return""}(P.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*36e5),o="; expires="+l.toUTCString()}i&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+s+a;return u.length>3686.4&&$.warn("cookieStore warning: large cookie, len="+u.length),P.cookie=u,u}catch(e){return}},remove:function(e,t){try{tT.set(e,"",-1,t)}catch(e){return}}},tM=null,tO={is_supported:function(){if(!x(tM))return tM;var e=!0;if(w(M))e=!1;else try{var t="__mplssupport__";tO.set(t,"xyz"),'"xyz"'!==tO.get(t)&&(e=!1),tO.remove(t)}catch(t){e=!1}return e||$.error("localStorage unsupported; falling back to cookie store"),tM=e,e},error:function(e){$.error("localStorage error: "+e)},get:function(e){try{return null==M?void 0:M.localStorage.getItem(e)}catch(e){tO.error(e)}return null},parse:function(e){try{return JSON.parse(tO.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==M||M.localStorage.setItem(e,JSON.stringify(t))}catch(e){tO.error(e)}},remove:function(e){try{null==M||M.localStorage.removeItem(e)}catch(e){tO.error(e)}}},tR=["distinct_id",e3,e4,tu],tF=t(t({},tO),{},{parse:function(e){try{var t={};try{t=tT.parse(e)||{}}catch(e){}var n=Q(t,JSON.parse(tO.get(e)||"{}"));return tO.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{tO.set(e,t);var o={};tR.forEach(function(e){t[e]&&(o[e]=t[e])}),Object.keys(o).length&&tT.set(e,o,n,r,i)}catch(e){tO.error(e)}},remove:function(e,t){try{null==M||M.localStorage.removeItem(e),tT.remove(e,t)}catch(e){tO.error(e)}}}),tN={},tL={is_supported:function(){return!0},error:function(e){$.error("memoryStorage error: "+e)},get:function(e){return tN[e]||null},parse:function(e){return tN[e]||null},set:function(e,t){tN[e]=t},remove:function(e){delete tN[e]}},tP=null,tD={is_supported:function(){if(!x(tP))return tP;if(tP=!0,w(M))tP=!1;else try{var e="__support__";tD.set(e,"xyz"),'"xyz"'!==tD.get(e)&&(tP=!1),tD.remove(e)}catch(e){tP=!1}return tP},error:function(e){$.error("sessionStorage error: ",e)},get:function(e){try{return null==M?void 0:M.sessionStorage.getItem(e)}catch(e){tD.error(e)}return null},parse:function(e){try{return JSON.parse(tD.get(e))||null}catch(e){}return null},set:function(e,t){try{null==M||M.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){tD.error(e)}},remove:function(e){try{null==M||M.sessionStorage.removeItem(e)}catch(e){tD.error(e)}}},tq=["localhost","127.0.0.1"],tH=function(e){var t=null==P?void 0:P.createElement("a");return w(t)?null:(t.href=e,t)},tB=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},tj=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return z(e,function(e,r){w(e)||w(r)||"undefined"===r||(t=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)}),i.join(r)},tU=function(e,t){for(var n,r=((e.split("#")[0]||"").split("?")[1]||"").split("&"),i=0;i=3&&(t=w(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+tV+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+tV+")","i"),function(e){return e&&e[2]?[tV,[e[2],e[3],e[4]||"0"].join(".")]:[tV,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[t5,""]],[/Linux|debian/i,["Linux",""]]],nx=function(e){return nb.test(e)?nr:ny.test(e)?ni:n_.test(e)?no:RegExp(nd,"i").test(e)?nd:RegExp("("+nu+"|WPDesktop)","i").test(e)?nu:/iPad/.test(e)?tz:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?tK:nk.test(e)?tJ:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(nc,"i").test(e)?nc:/(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(t$).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)?tV:tZ:tV:RegExp("(pda|"+t$+")","i").test(e)?np:RegExp(tG,"i").test(e)&&!RegExp(tG+" pc","i").test(e)?nh:""},nE="https?://(.*)",nA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid"],nT={campaignParams:function(e){return P?this._campaignParamsFromUrl(P.URL,e):{}},_campaignParamsFromUrl:function(e,t){var n=nA.concat(t||[]),r={};return z(n,function(t){var n=tU(e,t);n&&(r[t]=n)}),r},_searchEngine:function(e){return e?0===e.search(nE+"google.([^/?]*)")?"google":0===e.search(nE+"bing.com")?"bing":0===e.search(nE+"yahoo.com")?"yahoo":0===e.search(nE+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=nT._searchEngine(e),n={};if(!x(t)){n.$search_engine=t;var r=P?tU(P.referrer,"yahoo"!=t?"q":"p"):"";r.length&&(n.ph_keyword=r)}return n},searchInfo:function(){var e=null==P?void 0:P.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:nw,browserVersion:function(e,t){var n=nI[nw(e,t)];if(w(n))return null;for(var r=0;r1e3?j.substring(0,997)+"...":j,$browser_version:nT.browserVersion(j,navigator.vendor),$browser_language:nT.browserLanguage(),$screen_height:null==M?void 0:M.screen.height,$screen_width:null==M?void 0:M.screen.width,$viewport_height:null==M?void 0:M.innerHeight,$viewport_width:null==M?void 0:M.innerWidth,$lib:"web",$lib_version:h.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:eD()/1e3})},people_properties:function(){if(!j)return{};var e=s(nT.os(j),2);return Q(eB({$os:e[0],$os_version:e[1],$browser:nT.browser(j,navigator.vendor)}),{$browser_version:nT.browserVersion(j,navigator.vendor)})}},nM=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],nO=function(){function e(t){var n;r(this,e),this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n="",t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+n+"_posthog"),this.storage=this.buildStorage(t),this.load(),this.update_config(t,t),this.save()}return o(e,[{key:"buildStorage",value:function(e){-1===nM.indexOf(e.persistence.toLowerCase())&&($.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&tO.is_supported()?tO:"localstorage+cookie"===t&&tF.is_supported()?tF:"sessionstorage"===t&&tD.is_supported()?tD:"memory"===t?tL:"cookie"===t?tT:tF.is_supported()?tF:tT}},{key:"properties",value:function(){var e={};return z(this.props,function(t,n){if(n===e8&&k(t))for(var r,i=Object.keys(t),o=0;o1&&void 0!==arguments[1])||arguments[1];return!(E(e)||I(e)&&(e=G(e),(t?nZ:nz).test((e||"").replace(/[- ]/g,""))||(t?nK:nY).test(e)))}function nX(e){var t=nD(e);return nJ(t="".concat(t," ").concat(function e(t){var n="";return t&&t.childNodes&&t.childNodes.length&&z(t.childNodes,function(t){var r;if(t&&"span"===(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase()))try{var i=nD(t);n="".concat(n," ").concat(i).trim(),t.childNodes&&t.childNodes.length&&(n="".concat(n," ").concat(e(t)).trim())}catch(e){$.error(e)}}),n}(e)).trim())?t:""}function n0(e){return e.replace(/"|\\"/g,'\\"')}var n1="[SessionRecording]",n2="redacted",n5={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(e){return e},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6},n3=["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"],n4=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],n8=["/s/","/e/","/i/"];function n6(e,t,n,r){if(E(e))return e;var i=(null==t?void 0:t["content-length"])||new Blob([e]).size;return I(i)&&(i=parseInt(i)),i>n?n1+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function n7(e,t){if(E(e))return e;var n=e;return nJ(n,!1)||(n=n1+" "+t+" body "+n2),z(n4,function(e){var r,i;null!==(r=n)&&void 0!==r&&r.length&&-1!==(null===(i=n)||void 0===i?void 0:i.indexOf(e))&&(n=n1+" "+t+" body "+n2+" as might contain: "+e)}),n}var n9,re,rt,rn=function(e,n){var r,i,o={payloadSizeLimitBytes:n5.payloadSizeLimitBytes,performanceEntryTypeToObserve:l(n5.performanceEntryTypeToObserve)},a=!1!==e.session_recording.recordHeaders&&n.recordHeaders,s=!1!==e.session_recording.recordBody&&n.recordBody,u=!1!==e.capture_performance&&n.recordPerformance,c=(i=Math.min(1e6,null!==(r=o.payloadSizeLimitBytes)&&void 0!==r?r:1e6),function(e){return null!=e&&e.requestBody&&(e.requestBody=n6(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=n6(e.responseBody,e.responseHeaders,i,"Response")),e}),d=function(e){var t;return c(function(e){var t=tH(e.name);if(!(t&&t.pathname&&n8.some(function(e){return 0===t.pathname.indexOf(e)})))return e}((E(t=e.requestHeaders)||z(Object.keys(null!=t?t:{}),function(e){n3.includes(e.toLowerCase())&&(t[e]=n2)}),e)))},f=b(e.session_recording.maskNetworkRequestFn);return f&&b(e.session_recording.maskCapturedNetworkRequestFn)&&$.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(e.session_recording.maskCapturedNetworkRequestFn=function(n){var r=e.session_recording.maskNetworkRequestFn({url:n.name});return t(t({},n),{},{name:null==r?void 0:r.url})}),o.maskRequestFn=b(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,r,i,o=d(t);return o&&null!==(n=null===(r=(i=e.session_recording).maskCapturedNetworkRequestFn)||void 0===r?void 0:r.call(i,o))&&void 0!==n?n:void 0}:function(e){return function(e){if(!w(e))return e.requestBody=n7(e.requestBody,"Request"),e.responseBody=n7(e.responseBody,"Response"),e}(d(e))},t(t(t({},n5),o),{},{recordHeaders:a,recordBody:s,recordPerformance:u,recordInitialRequests:u})},rr=o(function e(t){var n,i,o=this,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,e),a(this,"bucketSize",100),a(this,"refillRate",10),a(this,"mutationBuckets",{}),a(this,"loggedTracker",{}),a(this,"refillBuckets",function(){Object.keys(o.mutationBuckets).forEach(function(e){o.mutationBuckets[e]=o.mutationBuckets[e]+o.refillRate,o.mutationBuckets[e]>=o.bucketSize&&delete o.mutationBuckets[e]})}),a(this,"getNodeOrRelevantParent",function(e){var t=o.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var n=t.closest("svg");if(n)return[o.rrweb.mirror.getId(n),n]}return[e,t]}),a(this,"numberOfChanges",function(e){var t,n,r,i,o,a,s,l;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(r=null===(i=e.attributes)||void 0===i?void 0:i.length)&&void 0!==r?r:0)+(null!==(o=null===(a=e.texts)||void 0===a?void 0:a.length)&&void 0!==o?o:0)+(null!==(s=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==s?s:0)}),a(this,"throttleMutations",function(e){if(3!==e.type||0!==e.data.source)return e;var t=e.data,n=o.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter(function(e){var t,n,r,i=s(o.getNodeOrRelevantParent(e.id),2),a=i[0],l=i[1];return 0!==o.mutationBuckets[a]&&(o.mutationBuckets[a]=null!==(t=o.mutationBuckets[a])&&void 0!==t?t:o.bucketSize,o.mutationBuckets[a]=Math.max(o.mutationBuckets[a]-1,0),0===o.mutationBuckets[a]&&(o.loggedTracker[a]||(o.loggedTracker[a]=!0,null===(n=(r=o.options).onBlockedNode)||void 0===n||n.call(r,a,l))),e)}));var r=o.numberOfChanges(t);return 0!==r||n===r?e:void 0}),this.rrweb=t,this.options=l,this.refillRate=null!==(n=this.options.refillRate)&&void 0!==n?n:this.refillRate,this.bucketSize=null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,setInterval(function(){o.refillBuckets()},1e3)}),ri=[nF.MouseMove,nF.MouseInteraction,nF.Scroll,nF.ViewportResize,nF.Input,nF.TouchMove,nF.MediaInteraction,nF.Drag],ro=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}},ra="[SessionRecording]",rs=function(){function e(t){var n=this;if(r(this,e),a(this,"queuedRRWebEvents",[]),a(this,"isIdle",!1),a(this,"_linkedFlagSeen",!1),a(this,"_lastActivityTimestamp",Date.now()),a(this,"_linkedFlag",null),a(this,"_forceAllowLocalhostNetworkCapture",!1),a(this,"_samplingSessionListener",null),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,null==M||M.addEventListener("beforeunload",function(){n._flushBuffer()}),null==M||M.addEventListener("offline",function(){n._tryAddCustomEvent("browser offline",{})}),null==M||M.addEventListener("online",function(){n._tryAddCustomEvent("browser online",{})}),null==M||M.addEventListener("visibilitychange",function(){if(null!=P&&P.visibilityState){var e="window "+P.visibilityState;n._tryAddCustomEvent(e,{})}}),!this.instance.sessionManager)throw $.error(ra+" started without valid sessionManager"),Error(ra+" started without valid sessionManager. This is a bug.");var i=this.sessionManager.checkAndGetSessionAndWindowId(),o=i.sessionId,s=i.windowId;this.sessionId=o,this.windowId=s,this.buffer=this.clearBuffer(),this._setupSampling()}return o(e,[{key:"rrwebRecord",get:function(){var e;return null==U||null===(e=U.rrweb)||void 0===e?void 0:e.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw Error(ra+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var e;return(null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.full_snapshot_interval_millis)||3e5}},{key:"isSampled",get:function(){var e=this.instance.get_property(e4);return T(e)?e:null}},{key:"sessionDuration",get:function(){var e,t,n=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],r=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return n?n.timestamp-r:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(eJ),t=!this.instance.config.disable_session_recording;return M&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(eX),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"canvasRecording",get:function(){var e=this.instance.get_property(e1);return e&&e.fps&&e.quality?{enabled:e.enabled,fps:e.fps,quality:e.quality}:void 0}},{key:"networkPayloadCapture",get:function(){var e,t,n=this.instance.get_property(e0),r={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},i=(null==r?void 0:r.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==r?void 0:r.recordBody)||(null==n?void 0:n.recordBody),a=k(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,s=!!(T(a)?a:null==n?void 0:n.capturePerformance);return i||o||s?{recordHeaders:i,recordBody:o,recordPerformance:s}:void 0}},{key:"sampleRate",get:function(){var e=this.instance.get_property(e2);return A(e)?e:null}},{key:"minimumDuration",get:function(){var e=this.instance.get_property(e5);return A(e)?e:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?E(this._linkedFlag)||this._linkedFlagSeen?T(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startIfEnabledOrStop",value:function(){this.isRecordingEnabled?(this._startCapture(),$.info(ra+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,$.info(ra+" stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n,r=this.sessionId!==e,i=this.sampleRate;if(A(i)){var o,s=this.isSampled,l=r||!T(s);(o=l?Math.random()1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:eD()})}},{key:"_startCapture",value:function(){var e=this;w(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript("/static/recorder.js?v=".concat(h.LIB_VERSION),function(t){if(t)return $.error(ra+" could not load recorder.js",t);e._onScriptLoaded()}))}},{key:"isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==ri.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearTimeout(this._fullSnapshotTimer),this._flushBuffer());var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)),!this.isIdle){var r=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,o=r.sessionId,a=this.sessionId!==o,s=this.windowId!==i;this.windowId=i,this.sessionId=o,(n||-1===[2,4].indexOf(e.type)&&(s||a||w(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):$.warn(ra+" could not emit queued rrweb event.",t,e),!1}}},{key:"_tryAddCustomEvent",value:function(e,t){var n=this;return this._tryRRWebMethod(ro(function(){return n.rrwebRecord.addCustomEvent(e,t)}))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(ro(function(){return e.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){for(var e,n=this,r={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording,o=0,a=Object.entries(i||{});o10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var t=[],n=0;n2e3?t.push(e.data.payload.payload[n].slice(0,2e3)+"...[truncated]"):t.push(e.data.payload.payload[n]);return e.data.payload.payload=t,e}return e}(n),o=JSON.stringify(i,(r=[],function(e,t){if(k(t)){for(;r.length>0&&r.at(-1)!==this;)r.pop();return r.includes(t)?"[Circular]":(r.push(t),t)}return t})).length;if(this._updateWindowAndSessionIds(i),!this.isIdle||i.type===nR.Custom){var a={$snapshot_bytes:o,$snapshot_data:i,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(a):this.clearBuffer()}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&M){var e=this._maskUrl(M.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}},{key:"_processQueuedEvents",value:function(){var e=this;if(this.queuedRRWebEvents.length){var t=l(this.queuedRRWebEvents);this.queuedRRWebEvents=[],t.forEach(function(t){Date.now()-t.enqueuedAt<=2e3&&e._tryRRWebMethod(t)})}}},{key:"_maskUrl",value:function(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var n,r={url:e};return null===(n=r=t.maskNetworkRequestFn(r))||void 0===n?void 0:n.url}return e}},{key:"clearBuffer",value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:"_flushBuffer",value:function(){var e=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,r=A(n)&&n>=0,i=A(t)&&r&&n0&&this._captureSnapshot({$snapshot_bytes:this.buffer.size,$snapshot_data:this.buffer.data,$session_id:this.buffer.sessionId,$window_id:this.buffer.windowId}),this.clearBuffer())}},{key:"_captureSnapshotBuffered",value:function(e){var t,n=this,r=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);(this.buffer.size+e.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){n._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",_noHeatmaps:!0})}}]),e}(),rl=function(){function e(t){r(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return o(e,[{key:"call",value:function(){var e=this,t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(e7),group_properties:this.instance.get_property(e9),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:this.instance.config.disable_compression?void 0:eP.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){return e.parseDecideResponse(t.json)}})}},{key:"parseDecideResponse",value:function(e){var t=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var n=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(null!=e?e:{},n),n)$.error("Failed to fetch feature flags from PostHog.");else{if(!P||!P.body)return $.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){t.parseDecideResponse(e)},500);if(this.instance._afterDecideResponse(e),e.siteApps){if(this.instance.config.opt_in_site_apps){var r,i=d(e.siteApps);try{for(i.s();!(r=i.n()).done;)(function(){var e=r.value,n=e.id,i=e.url,o=t.instance.requestRouter.endpointFor("api",i);U["__$$ph_site_app_".concat(n)]=t.instance,t.instance.requestRouter.loadScript(o,function(e){e&&$.error("Error while initializing PostHog app with config id ".concat(n),e)})})()}catch(e){i.e(e)}finally{i.f()}}else e.siteApps.length>0&&$.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}}]),e}(),ru=null!=M&&M.location?tW(M.location.hash,"__posthog")||tW(location.hash,"state"):null,rc="_postHogToolbarParams";(rY=rt||(rt={}))[rY.UNINITIALIZED=0]="UNINITIALIZED",rY[rY.LOADING=1]="LOADING",rY[rY.LOADED=2]="LOADED";var rd=function(){function e(t){r(this,e),this.instance=t}return o(e,[{key:"setToolbarState",value:function(e){U.ph_toolbar_state=e}},{key:"getToolbarState",value:function(){var e;return null!==(e=U.ph_toolbar_state)&&void 0!==e?e:rt.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!M||!P)return!1;n=null!==(e=n)&&void 0!==e?e:M.location,i=null!==(t=i)&&void 0!==t?t:M.history;try{if(!r){try{M.localStorage.setItem("test","test"),M.localStorage.removeItem("test")}catch(e){return!1}r=null==M?void 0:M.localStorage}var o,a=ru||tW(n.hash,"__posthog")||tW(n.hash,"state"),s=a?eq(function(){return JSON.parse(atob(decodeURIComponent(a)))})||eq(function(){return JSON.parse(decodeURIComponent(a))}):null;return s&&"ph_authorize"===s.action?((o=s).source="url",o&&Object.keys(o).length>0&&(s.desiredHash?n.hash=s.desiredHash:i?i.replaceState(i.state,"",n.pathname+n.search):n.hash="")):((o=JSON.parse(r.getItem(rc)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch(e){return!1}}},{key:"_callLoadToolbar",value:function(e){(U.ph_load_toolbar||U.ph_load_editor)(e,this.instance)}},{key:"loadToolbar",value:function(e){var n=this,r=!(null==P||!P.getElementById(tc));if(!M||r)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=t(t({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(M.localStorage.setItem(rc,JSON.stringify(t(t({},o),{},{source:void 0}))),this.getToolbarState()===rt.LOADED)this._callLoadToolbar(o);else if(this.getToolbarState()===rt.UNINITIALIZED){this.setToolbarState(rt.LOADING);var a=3e5*Math.floor(Date.now()/3e5);this.instance.requestRouter.loadScript("/static/toolbar.js?t=".concat(a),function(e){if(e)return $.error("Failed to load toolbar",e),void n.setToolbarState(rt.UNINITIALIZED);n.setToolbarState(rt.LOADED),n._callLoadToolbar(o)}),eW(M,"turbolinks:load",function(){n.setToolbarState(rt.UNINITIALIZED),n.loadToolbar(o)})}return!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,n)}}]),e}(),rf=function(){function e(t){r(this,e),a(this,"isPaused",!0),a(this,"queue",[]),a(this,"flushTimeoutMs",3e3),this.sendRequest=t}return o(e,[{key:"enqueue",value:function(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var e=this;this.clearFlushTimeout();var n=Object.values(this.queue.length>0?this.formatQueue():{});[].concat(l(n.filter(function(e){return 0===e.url.indexOf("/e")})),l(n.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(n){e.sendRequest(t(t({},n),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var e=this;this.isPaused||(this.flushTimeout=setTimeout(function(){if(e.clearFlushTimeout(),e.queue.length>0){var t=e.formatQueue();for(var n in t)(function(n){var r=t[n],i=(new Date).getTime();r.data&&y(r.data)&&z(r.data,function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),e.sendRequest(r)})(n)}},this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var e={};return z(this.queue,function(n){var r,i=(n?n.batchKey:null)||n.url;w(e[i])&&(e[i]=t(t({},n),{},{data:[]})),null===(r=e[i].data)||void 0===r||r.push(n.data)}),this.queue=[],e}}]),e}(),rp=Uint8Array,rh=Uint16Array,rv=Uint32Array,rg=new rp([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]),rm=new rp([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]),r_=new rp([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ry=function(e,t){for(var n=new rh(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&rS)<<1;rx=(61680&(rx=(52428&rx)>>>2|(13107&rx)<<2))>>>4|(3855&rx)<<4,rI[rS]=((65280&rx)>>>8|(255&rx)<<8)>>>1}var rE=function(e,t,n){for(var r=e.length,i=0,o=new rh(t);i>>l]=u}else for(a=new rh(r),i=0;i>>15-e[i];return a},rA=new rp(288);for(rS=0;rS<144;++rS)rA[rS]=8;for(rS=144;rS<256;++rS)rA[rS]=9;for(rS=256;rS<280;++rS)rA[rS]=7;for(rS=280;rS<288;++rS)rA[rS]=8;var rT=new rp(32);for(rS=0;rS<32;++rS)rT[rS]=5;var rM=rE(rA,9,0),rO=rE(rT,5,0),rR=function(e){return(e/8>>0)+(7&e&&1)},rF=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof rh?rh:e instanceof rv?rv:rp)(n-t);return r.set(e.subarray(t,n)),r},rN=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},rL=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},rP=function(e,t){for(var n=[],r=0;rf&&(f=o[r].s);var p=new rh(f+1),h=rD(n[c-1],p,0);if(h>t){r=0;var v=0,g=h-t,m=1<t))break;v+=m-(1<>>=g;v>0;){var y=o[r].s;p[y]=0&&v;--r){var b=o[r].s;p[b]==t&&(--p[b],++v)}h=t}return[new rp(p),h]},rD=function e(t,n,r){return -1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},rq=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new rh(++t),r=0,i=e[0],o=1,a=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[n.subarray(0,r),t]},rH=function(e,t){for(var n=0,r=0;r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o4&&!x[r_[A-1]];--A);var T,M,O,R,F=u+5<<3,N=rH(i,rA)+rH(o,rT)+a,L=rH(i,f)+rH(o,v)+a+14+3*A+rH(w,x)+(2*w[16]+3*w[17]+7*w[18]);if(F<=N&&F<=L)return rB(t,c,e.subarray(l,l+u));if(rN(t,c,1+(L15&&(rN(t,c,H[I]>>>5&127),c+=H[I]>>>12)}}}else T=rM,M=rA,O=rO,R=rT;for(I=0;I255){rL(t,c,T[(B=r[I]>>>18&31)+257]),c+=M[B+257],B>7&&(rN(t,c,r[I]>>>23&31),c+=rg[B]);var j=31&r[I];rL(t,c,O[j]),c+=R[j],j>3&&(rL(t,c,r[I]>>>5&8191),c+=rm[j])}else rL(t,c,T[r[I]]),c+=M[r[I]];return rL(t,c,T[256]),c+M[256]},rU=new rv([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rW=new rp(0),r$=function(){for(var e=new rv(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),rV=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},rG=!!H||!!q,rZ="text/plain",rz=function(e,n){var r=s(e.split("?"),2),i=r[0],o=r[1],a=t({},n);null==o||o.split("&").forEach(function(e){var t=s(e.split("="),1)[0];delete a[t]});var l=tj(a);return l=l?(o?o+"&":"")+l:o,"".concat(i,"?").concat(l)},rQ=function(e){var t,n,r,i,o,a,s,l,u,c=e.data,d=e.compression;if(c)return d===eP.GZipJS?{contentType:rZ,body:new Blob([(t=function(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new rp(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},a=0;ar.length){var s=new rp(i+8+(n-a<<1));s.set(r),r=s}var l=e.charCodeAt(a);l<128?o(l):(l<2048?o(192|l>>>6):(l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),o(128|l>>>12&63)):o(224|l>>>12),o(128|l>>>6&63)),o(128|63&l))}return rF(r,0,i)}(JSON.stringify(c)),n={mtime:0},r=4294967295,i={p:function(e){for(var t=r,n=0;n>>8;r=t},d:function(){return 4294967295^r}},o=t.length,i.p(t),l=(a=10+(n.filename&&n.filename.length+1||0),s=function(e,t,n,r,i,o){var a=e.length,s=new rp(r+a+5*(1+Math.floor(a/7e3))+8),l=s.subarray(r,s.length-8),u=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var d=c+65535;d>>13,h=8191&f,v=(1<7e3||x>24576)&&R>423){u=rj(e,l,0,k,C,w,S,x,A,c-A,u),x=I=S=0,A=c;for(var F=0;F<286;++F)C[F]=0;for(F=0;F<30;++F)w[F]=0}var N=2,L=0,P=h,D=M-O&32767;if(R>2&&T==b(c-D))for(var q=Math.min(p,R)-1,H=Math.min(32767,c),B=Math.min(258,R);D<=H&&--P&&M!=O;){if(e[c+N]==e[c+N-D]){for(var j=0;jN){if(N=j,L=D,j>q)break;var U=Math.min(D,j-2),W=0;for(F=0;FW&&(W=V,O=$)}}}D+=(M=O)-(O=g[M])+32768&32767}if(L){k[x++]=268435456|rC[N]<<18|rw[L];var G=31&rC[N],Z=31&rw[L];S+=rg[G]+rm[Z],++C[257+G],++w[Z],E=c+N,++I}else k[x++]=e[c],++C[e[c]]}}u=rj(e,l,o,k,C,w,S,x,A,c-A,u),o||(u=rB(l,u,rW))}return rF(s,0,r+rR(u)+i)}(t,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+n.mem,a,8,!0)).length,function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&rV(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(s,n),rV(s,l-8,i.d()),rV(s,l-4,o),s)],{type:rZ})}:d===eP.Base64?{contentType:"application/x-www-form-urlencoded",body:"data="+encodeURIComponent("string"==typeof(u=function(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,l=0,u="",c=[];if(!e)return e;e=eU(e);do t=(o=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[l++]=a.charAt(t)+a.charAt(n)+a.charAt(r)+a.charAt(i);while(s=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,rX);A(r)&&r>0&&(i.url=rz(i.url,{retry_count:r})),this.instance._send_request(t(t({},i),{},{callback:function(e){var o;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=r?r:0)<10?n.enqueue(t({retriesPerformedSoFar:r},i)):null===(o=i.callback)||void 0===o||o.call(i,e)}}))}},{key:"enqueue",value:function(e){var t,n,r,i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var o=(r=(Math.random()-.5)*((n=Math.min(18e5,t=3e3*Math.pow(2,i)))-t/2),Math.ceil(n+r)),a=Date.now()+o;this.queue.push({retryAt:a,requestOptions:e});var s="Enqueued failed request for retry in ".concat(o);navigator.onLine||(s+=" (Browser is offline)"),$.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout(function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()},this.pollIntervalMs)}},{key:"flush",value:function(){var e=Date.now(),t=[],n=this.queue.filter(function(n){return n.retryAt0){var r,i=d(n);try{for(i.s();!(r=i.n()).done;){var o=r.value.requestOptions;this.retriableRequest(o)}}catch(e){i.e(e)}finally{i.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var e,n=d(this.queue);try{for(n.s();!(e=n.n()).done;){var r=e.value.requestOptions;try{this.instance._send_request(t(t({},r),{},{transport:"sendBeacon"}))}catch(e){$.error(e)}}}catch(e){n.e(e)}finally{n.f()}this.queue=[]}}]),e}(),r1=function(){function e(t,n,i,o){r(this,e),a(this,"_sessionIdChangedHandlers",[]),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=i||tS,this._windowIdGenerator=o||tS;var s,l=t.persistence_name||t.token,u=t.session_idle_timeout_seconds||1800;if(A(u)?u>1800?$.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):u<60&&$.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):($.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),u=1800),this._sessionTimeoutMs=1e3*Math.min(Math.max(u,60),1800),this._window_id_storage_key="ph_"+l+"_window_id",this._primary_window_exists_storage_key="ph_"+l+"_primary_window_exists",this._canUseSessionStorage()){var c=tD.parse(this._window_id_storage_key),d=tD.parse(this._primary_window_exists_storage_key);c&&!d?this._windowId=c:tD.remove(this._window_id_storage_key),tD.set(this._primary_window_exists_storage_key,!0)}if(null!==(s=this.config.bootstrap)&&void 0!==s&&s.sessionID)try{var f=function(e){var t=e.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),f)}catch(e){$.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}return o(e,[{key:"onSessionId",value:function(e){var t=this;return w(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){t._sessionIdChangedHandlers=t._sessionIdChangedHandlers.filter(function(t){return t!==e})}}},{key:"_canUseSessionStorage",value:function(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&tD.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&tD.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?tD.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register(a({},e3,[t,e,n])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[e3];return y(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;null==M||M.addEventListener("beforeunload",function(){e._canUseSessionStorage()&&tD.remove(e._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),n=s(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],a=this._getWindowId(),l=o&&o>0&&Math.abs(t-o)>864e5,u=!1,c=!i,d=!e&&Math.abs(t-r)>this._sessionTimeoutMs;c||d||l?(i=this._sessionIdGenerator(),a=this._windowIdGenerator(),$.info("[SessionId] new session ID generated",{sessionId:i,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}}),o=t,u=!0):a||(a=this._windowIdGenerator(),u=!0);var f=0===r||!e||l?t:r,p=0===o?(new Date).getTime():o;return this._setWindowId(a),this._setSessionId(i,f,p),u&&this._sessionIdChangedHandlers.forEach(function(e){return e(i,a)}),{sessionId:i,windowId:a,sessionStartTimestamp:p}}}]),e}();(r8=rJ||(rJ={})).US="us",r8.EU="eu",r8.CUSTOM="custom";var r2="i.posthog.com",r5=function(){function e(t){r(this,e),a(this,"_regionCache",{}),this.instance=t}return o(e,[{key:"apiHost",get:function(){return this.instance.config.api_host.trim().replace(/\/$/,"")}},{key:"uiHost",get:function(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=rJ.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=rJ.EU:this._regionCache[this.apiHost]=rJ.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return(this.uiHost||this.apiHost.replace(".".concat(r2),".posthog.com"))+t;if(this.region===rJ.CUSTOM)return this.apiHost+t;var n=r2+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}},{key:"loadScript",value:function(e,t){if(this.instance.config.disable_external_dependency_loading)return $.warn("".concat(e," was requested but loading of external scripts is disabled.")),t("Loading of external scripts is disabled");var n="/"===e[0]?this.endpointFor("assets",e):e,r=function(){if(!P)return t("document not found");var e=P.createElement("script");e.type="text/javascript",e.src=n,e.onload=function(e){return t(void 0,e)},e.onerror=function(e){return t(e)};var r,i=P.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(e,i[0]):P.body.appendChild(e)};null!=P&&P.body?r():null==P||P.addEventListener("DOMContentLoaded",r)}}]),e}(),r3="posthog-js";function r4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.organization,r=t.projectId,i=t.prefix,o=t.severityAllowList,a=void 0===o?["error"]:o;return function(t){if(!("*"===a||a.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var o,s,l,u,c,d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var f=(null===(o=t.exception)||void 0===o?void 0:o.values)||[],p={$exception_message:(null===(s=f[0])||void 0===s?void 0:s.value)||t.message,$exception_type:null===(l=f[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:t.level,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null===(u=f[0])||void 0===u?void 0:u.value)||t.message,$sentry_exception_type:null===(c=f[0])||void 0===c?void 0:c.type,$sentry_tags:t.tags,$level:t.level};return n&&r&&(p.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+t.event_id),e.capture("$exception",p),t}}var r8,r6,r7,r9,ie=o(function e(t,n,i,o,a){r(this,e),this.name=r3,this.setupOnce=function(e){e(r4(t,{organization:n,projectId:i,prefix:o,severityAllowList:a}))}}),it=function(){function e(t){r(this,e),this._instance=t}return o(e,[{key:"doPageView",value:function(){var e,t=this._previousScrollProperties();return this._currentPath=null!==(e=null==M?void 0:M.location.pathname)&&void 0!==e?e:"",this._instance.scrollManager.resetContext(),t}},{key:"doPageLeave",value:function(){return this._previousScrollProperties()}},{key:"_previousScrollProperties",value:function(){var e=this._currentPath,t=this._instance.scrollManager.getContext();if(!e||!t)return{};var n=t.maxScrollHeight,r=t.lastScrollY,i=t.maxScrollY,o=t.maxContentHeight,a=t.lastContentY,s=t.maxContentY;return w(n)||w(r)||w(i)||w(o)||w(a)||w(s)?{}:(n=Math.ceil(n),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),a=Math.ceil(a),s=Math.ceil(s),{$prev_pageview_pathname:e,$prev_pageview_last_scroll:r,$prev_pageview_last_scroll_percentage:n<=1?1:ir(r/n,0,1),$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:n<=1?1:ir(i/n,0,1),$prev_pageview_last_content:a,$prev_pageview_last_content_percentage:o<=1?1:ir(a/o,0,1),$prev_pageview_max_content:s,$prev_pageview_max_content_percentage:o<=1?1:ir(s/o,0,1)})}}]),e}();function ir(e,t,n){return Math.max(t,Math.min(e,n))}(io=r6||(r6={})).Popover="popover",io.API="api",io.Widget="widget",(ia=r7||(r7={})).Open="open",ia.MultipleChoice="multiple_choice",ia.SingleChoice="single_choice",ia.Rating="rating",ia.Link="link",(is=r9||(r9={})).NextQuestion="next_question",is.End="end",is.ResponseBased="response_based",is.SpecificQuestion="specific_question";var ii=function(){function e(t){r(this,e),this.persistence=t,this.eventRegistry=new Map}return o(e,[{key:"register",value:function(e){var t=this;e.forEach(function(e){var n,r,i,o,a;null!==(n=e.conditions)&&void 0!==n&&n.events&&null!==(r=e.conditions)&&void 0!==r&&null!==(i=r.events)&&void 0!==i&&i.values&&(null===(o=e.conditions)||void 0===o?void 0:o.events.values.length)>0&&t.eventRegistry.set(e.id,null===(a=e.conditions)||void 0===a?void 0:a.events.values.map(function(e){return e.name}))})}},{key:"on",value:function(t,n){var r,i=[],o=(null===(r=this.persistence)||void 0===r?void 0:r.props[tt])||[];if(e.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var a,s=null==n||null===(a=n.properties)||void 0===a?void 0:a.$survey_id;if(s){var l=o.indexOf(s);l>=0&&o.splice(l,1)}}else this.eventRegistry.forEach(function(e,n){e.includes(t)&&i.push(n)});var u=o.concat(i);this._saveSurveysToStorage(u)}},{key:"getSurveys",value:function(){var e;return(null===(e=this.persistence)||void 0===e?void 0:e.props[tt])||[]}},{key:"getEventRegistry",value:function(){return this.eventRegistry}},{key:"_saveSurveysToStorage",value:function(e){var t;null===(t=this.persistence)||void 0===t||t.register(a({},tt,l(new Set(e))))}}]),e}();a(ii,"SURVEY_SHOWN_EVENT_NAME","survey shown");var io,ia,is,il,iu,ic,id,ip,ih,iv,ig,im={},i_=[],iy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ib=Array.isArray;function ik(e,t){for(var n in t)e[n]=t[n];return e}function iC(e){var t=e.parentNode;t&&t.removeChild(e)}function iw(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++ic:i,__i:-1,__u:0};return null==i&&null!=iu.vnode&&iu.vnode(o),o}function iI(e){return e.children}function iS(e,t){this.props=e,this.context=t}function ix(e,t){if(null==t)return e.__?ix(e.__,e.__i+1):null;for(var n;tt&&id.sort(iv));iA.__r=0}function iT(e,t,n,r,i,o,a,s,l,u,c){var d,f,p,h,v,g=r&&r.__k||i_,m=t.length;for(n.__d=l,function(e,t,n){var r,i,o,a,s,l=t.length,u=n.length,c=u,d=0;for(e.__k=[],r=0;r0?iw(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,s=function(e,t,n,r){var i=e.key,o=e.type,a=n-1,s=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null!=l&&0==(131072&l.__u)?1:0))for(;a>=0||s=0){if((l=t[a])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return a;a--}if(sa?c>l-a?d+=s-a:d--:d=s0};iX={isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:function(){}},(i1={__c:i0="__cC"+ig++,__:iX,Consumer:function(e,t){return e.children(t)},Provider:function(e){var t,n;return this.getChildContext||(t=[],(n={})[i0]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&t.some(function(e){e.__e=!0,iE(e)})},this.sub=function(e){t.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t.splice(t.indexOf(e),1),n&&n.call(e)}}),e.children}}).Provider.__=i1.Consumer.contextType=i1;var iH={icontains:function(e){return!!M&&M.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e){return!!M&&-1===M.location.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e){return!!M&&tB(M.location.href,e)},not_regex:function(e){return!!M&&!tB(M.location.href,e)},exact:function(e){return(null==M?void 0:M.location.href)===e},is_not:function(e){return(null==M?void 0:M.location.href)!==e}},iB=function(){function e(t){r(this,e),this.instance=t,this._surveyEventReceiver=null}return o(e,[{key:"afterDecideResponse",value:function(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}},{key:"loadIfEnabled",value:function(){var e=this,t=null==U?void 0:U.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||t||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new ii(this.instance.persistence)),this.instance.requestRouter.loadScript("/static/surveys.js",function(t){if(t)return $.error("Could not load surveys script",t);U.extendPostHogWithSurveys(e.instance)}))}},{key:"getSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new ii(this.instance.persistence));var r=this.instance.get_property(te);if(r&&!n)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(n){if(200!==n.statusCode||!n.json)return e([]);var r,i,o=n.json.surveys||[],s=o.filter(function(e){var t,n,r,i,o,a;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r?void 0:r.values)&&(null===(i=e.conditions)||void 0===i||null===(o=i.events)||void 0===o||null===(a=o.values)||void 0===a?void 0:a.length)>0});return s.length>0&&!w(t.instance._addCaptureHook)&&(null===(i=t._surveyEventReceiver)||void 0===i||i.register(s),t.instance._addCaptureHook(function(e,n){var r;null===(r=t._surveyEventReceiver)||void 0===r||r.on(e,n)})),null===(r=t.instance.persistence)||void 0===r||r.register(a({},te,o)),e(o)}})}},{key:"getActiveMatchingSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys(function(n){var r,i=n.filter(function(e){return!(!e.start_date||e.end_date)}).filter(function(e){if(!e.conditions)return!0;var t,n,r,i,o=null===(t=e.conditions)||void 0===t||!t.url||iH[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),a=null===(i=e.conditions)||void 0===i||!i.selector||(null==P?void 0:P.querySelector(e.conditions.selector));return o&&a}),o=null===(r=t._surveyEventReceiver)||void 0===r?void 0:r.getSurveys();return e(i.filter(function(e){if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;var n,r,i=!e.linked_flag_key||t.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),a=!e.targeting_flag_key||t.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),s=!iq(e)||(null==o?void 0:o.includes(e.id)),l=!(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r||!r.repeatedActivation||!iq(e)),u=!(e.internal_targeting_flag_key&&!l)||t.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return i&&a&&u&&s}))},n)}},{key:"getNextSurveyStep",value:function(e,t,n){var r,i=e.questions[t],o=t+1;if(null===(r=i.branching)||void 0===r||!r.type)return t===e.questions.length-1?r9.End:o;if(i.branching.type===r9.End)return r9.End;if(i.branching.type===r9.SpecificQuestion){if(Number.isInteger(i.branching.index))return i.branching.index}else if(i.branching.type===r9.ResponseBased){if(i.type===r7.SingleChoice){var a,s,l=i.choices.indexOf("".concat(n));if(null!==(a=i.branching)&&void 0!==a&&null!==(s=a.responseValues)&&void 0!==s&&s.hasOwnProperty(l)){var u=i.branching.responseValues[l];return Number.isInteger(u)?u:u===r9.End?r9.End:o}}else if(i.type===r7.Rating){if("number"!=typeof n||!Number.isInteger(n))throw Error("The response type must be an integer");var c,d,f=function(e,t){if(3===t){if(e<1||e>3)throw Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw Error("The scale must be one of: 3, 5, 10")}(n,i.scale);if(null!==(c=i.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(f)){var p=i.branching.responseValues[f];return Number.isInteger(p)?p:p===r9.End?r9.End:o}}return o}return console.warn("Falling back to next question index due to unexpected branching type"),o}}]),e}(),ij=function(){function e(t){var n,i,o=this;r(this,e),a(this,"serverLimits",{}),a(this,"lastEventRateLimited",!1),a(this,"checkForLimiting",function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(function(e){$.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),o.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void $.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}}),this.instance=t,this.captureEventsPerSecond=(null===(n=t.config.rate_limiting)||void 0===n?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(i=t.config.rate_limiting)||void 0===i?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return o(e,[{key:"clientRateLimitContext",value:function(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=(new Date).getTime(),o=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(to))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:i};o.tokens+=(i-o.last)/1e3*this.captureEventsPerSecond,o.last=i,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||r||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property(to,o),{isRateLimited:a,remainingTokens:o.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()e?t.slice(0,e)+"...":t}var iX,i0,i1,i2,i5=function(){function e(t){r(this,e),a(this,"_initialized",!1),a(this,"_isDisabledServerSide",null),a(this,"rageclicks",new iG),a(this,"_elementsChainAsString",!1),this.instance=t}return o(e,[{key:"config",get:function(){var e,t=k(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=null===(e=t.url_allowlist)||void 0===e?void 0:e.map(function(e){return new RegExp(e)}),t}},{key:"_addDomEventHandlers",value:function(){var e=this;if(this.isBrowserSupported()){if(M&&P){var t=function(t){t=t||(null==M?void 0:M.event);try{e._captureEvent(t)}catch(e){$.error("Failed to capture event",e)}},n=function(t){t=t||(null==M?void 0:M.event),e._captureEvent(t,iY)};eW(P,"submit",t,!1,!0),eW(P,"change",t,!1,!0),eW(P,"click",t,!1,!0),this.config.capture_copied_text&&(eW(P,"copy",n,!1,!0),eW(P,"cut",n,!1,!0))}}else $.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(a({},ez,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"isEnabled",get:function(){var e,t,n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ez];if(x(this._isDisabledServerSide)&&!T(n)&&!this.instance.config.advanced_disable_decide)return!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!r}},{key:"_previousElementSibling",value:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!nq(t))return t}},{key:"_getAugmentPropertiesFromElement",value:function(e){if(!n$(e))return{};var t={};return z(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&nJ(r)&&(t[n]=r)}}),t}},{key:"_getPropertiesFromElement",value:function(e,t,n){var r,i=e.tagName.toLowerCase(),o={tag_name:i};nU.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=iJ(1024,nX(e)):o.$el_text=iJ(1024,nD(e)));var a=nL(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e}));var s=null===(r=this.config)||void 0===r?void 0:r.element_attribute_ignorelist;z(e.attributes,function(n){var r;if((!nV(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==s||!s.includes(n.name))&&!t&&nJ(n.value)&&(!I(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var i=n.value;"class"===n.name&&(i=nN(i).join(" ")),o["attr__"+n.name]=iJ(1024,i)}});for(var l=1,u=1,c=e;c=this._previousElementSibling(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}},{key:"_getDefaultProperties",value:function(e){return{$event_type:e,$ce_version:1}}},{key:"_getEventTarget",value:function(e){var t;return w(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}},{key:"_captureEvent",value:function(e){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var o,a=this._getEventTarget(e);nB(a)&&(a=a.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!==(o=this.rageclicks)&&void 0!==o&&o.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick");var l=i===iY;if(a&&function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!M||!e||nH(e,"html")||!nq(e))return!1;if(null!=r&&r.url_allowlist){var a=M.location.href,s=r.url_allowlist;if(s&&!s.some(function(e){return a.match(e)}))return!1}if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some(function(e){return t.type===e}))return!1}for(var u=!1,c=[e],f=!0,p=e;p.parentNode&&!nH(p,"body");)if(nj(p.parentNode))c.push(p.parentNode.host),p=p.parentNode.host;else{if(!(f=nW(p)))break;if(i||nU.indexOf(f.tagName.toLowerCase())>-1)u=!0;else{var h=M.getComputedStyle(f);h&&"pointer"===h.getPropertyValue("cursor")&&(u=!0)}c.push(f),p=f}if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(w(r))return!0;var i,o=d(e);try{for(o.s();!(i=o.n()).done;){var a=function(){var e=i.value;if(r.some(function(t){return e.tagName.toLowerCase()===t}))return{v:!0}}();if("object"===n(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(c,r)||!function(e,t){var r=null==t?void 0:t.css_selector_allowlist;if(w(r))return!0;var i,o=d(e);try{for(o.s();!(i=o.n()).done;){var a=function(){var e=i.value;if(r.some(function(t){return e.matches(t)}))return{v:!0}}();if("object"===n(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(c,r))return!1;var v=M.getComputedStyle(e);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(o||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(o||["change","click"]).indexOf(t.type)>=0;default:return u?(o||["click"]).indexOf(t.type)>=0:(o||["click"]).indexOf(t.type)>=0&&(nU.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(a,e,this.config,l,l?["copy","cut"]:void 0)){for(var u,c,f=[a],p=a;p.parentNode&&!nH(p,"body");)nj(p.parentNode)?(f.push(p.parentNode.host),p=p.parentNode.host):(f.push(p.parentNode),p=p.parentNode);var h,v,g=[],m={},_=!1;if(z(f,function(e){var t=n$(e);"a"===e.tagName.toLowerCase()&&(h=e.getAttribute("href"),h=t&&nJ(h)&&h),K(nL(e),"ph-no-capture")&&(_=!0),g.push(r._getPropertiesFromElement(e,r.instance.config.mask_all_element_attributes,r.instance.config.mask_all_text)),Q(m,r._getAugmentPropertiesFromElement(e))}),this.instance.config.mask_all_text||("a"===a.tagName.toLowerCase()||"button"===a.tagName.toLowerCase()?g[0].$el_text=nX(a):g[0].$el_text=nD(a)),h){g[0].attr__href=h;var b,k,C=null===(b=tH(h))||void 0===b?void 0:b.host,I=null==M||null===(k=M.location)||void 0===k?void 0:k.host;C&&I&&C!==I&&(v=h)}if(_)return!1;var S=Q(this._getDefaultProperties(e.type),this._elementsChainAsString?{$elements_chain:g.map(function(e){var t,n,r,i={text:null===(n=e.$el_text)||void 0===n?void 0:n.slice(0,400),tag_name:e.tag_name,href:null===(r=e.attr__href)||void 0===r?void 0:r.slice(0,2048),attr_class:(t=e.attr__class)?y(t)?t:nN(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Y(e).filter(function(e){return 0===s(e,1)[0].indexOf("attr__")}).forEach(function(e){var t=s(e,2),n=t[0],r=t[1];return i.attributes[n]=r}),i}).map(function(e){var n,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class){e.attr_class.sort();var o,a=d(e.attr_class);try{for(a.s();!(o=a.n()).done;){var l=o.value;i+=".".concat(l.replace(/"/g,""))}}catch(e){a.e(e)}finally{a.f()}}var u=t(t(t(t({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(n=e.nth_child)&&void 0!==n?n:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),c={};return Y(u).sort(function(e,t){var n=s(e,1)[0],r=s(t,1)[0];return n.localeCompare(r)}).forEach(function(e){var t=s(e,2),n=t[0],r=t[1];return c[n0(n.toString())]=n0(r.toString())}),i+=":"+Y(u).map(function(e){var t=s(e,2),n=t[0],r=t[1];return"".concat(n,'="').concat(r,'"')}).join("")}).join(";")}:{$elements:g},null!==(u=g[0])&&void 0!==u&&u.$el_text?{$el_text:null===(c=g[0])||void 0===c?void 0:c.$el_text}:{},v&&"click"===e.type?{$external_click_url:v}:{},m);if(i===iY){var x,E=nP(null==M||null===(x=M.getSelection())||void 0===x?void 0:x.toString()),A=e.type||"clipboard";if(!E)return!1;S.$selected_content=E,S.$copy_type=A}return this.instance.capture(i,S),!0}}}},{key:"isBrowserSupported",value:function(){return b(null==P?void 0:P.querySelectorAll)}}]),e}(),i3=function(){function e(t){var n=this;r(this,e),a(this,"_restoreXHRPatch",void 0),a(this,"_restoreFetchPatch",void 0),a(this,"_startCapturing",function(){w(n._restoreXHRPatch)&&U.postHogTracingHeadersPatchFns._patchXHR(n.instance.sessionManager),w(n._restoreFetchPatch)&&U.postHogTracingHeadersPatchFns._patchFetch(n.instance.sessionManager)}),this.instance=t}return o(e,[{key:"_loadScript",value:function(e){U.postHogTracingHeadersPatchFns&&e(),this.instance.requestRouter.loadScript("/static/tracing-headers.js?v=".concat(h.LIB_VERSION),function(t){t&&$.error("[TRACING-HEADERS] failed to load script",t),e()})}},{key:"startIfEnabledOrStop",value:function(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),e}();(f=i2||(i2={}))[f.PENDING=-1]="PENDING",f[f.DENIED=0]="DENIED",f[f.GRANTED=1]="GRANTED";var i4=function(){function e(t){r(this,e),this.instance=t}return o(e,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?i2.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===i2.DENIED||this.consent===i2.PENDING&&this.config.opt_out_capturing_by_default}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"optInOut",value:function(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:"reset",value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:"storageKey",get:function(){var e=this.instance.config,t=e.token;return(e.opt_out_capturing_cookie_prefix||"__ph_opt_in_out_")+t}},{key:"storedConsent",get:function(){var e=this.storage.get(this.storageKey);return"1"===e?i2.GRANTED:"0"===e?i2.DENIED:i2.PENDING}},{key:"storage",get:function(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?tO:tT;var t="localStorage"===e?tT:tO;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:"getDnt",value:function(){return!!this.config.respect_dnt&&!!e$([null==L?void 0:L.doNotTrack,null==L?void 0:L.msDoNotTrack,U.doNotTrack],function(e){return K([!0,1,"1","yes"],e)})}}]),e}(),i8="[Exception Capture]",i6=function(){function e(t){var n,i=this;r(this,e),a(this,"_endpoint","/e/"),a(this,"originalOnUnhandledRejectionHandler",void 0),a(this,"startCapturing",function(){var e;if(M&&i.isEnabled&&!i.hasHandlers&&(null===(e=M.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)){var t=M.posthogErrorWrappingFunctions.wrapOnError,n=M.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(t&&n)try{i.unwrapOnError=t(i.captureException.bind(i)),i.unwrapUnhandledRejection=n(i.captureException.bind(i))}catch(e){$.error(i8+" failed to start",e),i.stopCapturing()}else $.error(i8+" failed to load error wrapping functions - cannot start")}}),this.instance=t,this.remoteEnabled=!(null===(n=this.instance.persistence)||void 0===n||!n.props[eK]),this.startIfEnabled()}return o(e,[{key:"isEnabled",get:function(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}},{key:"isCapturing",get:function(){var e;return!(null==M||null===(e=M.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}},{key:"hasHandlers",get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.isCapturing&&($.info(i8+" enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(e){this.hasHandlers&&e(),this.instance.requestRouter.loadScript(this.instance.requestRouter.endpointFor("assets","/static/exception-autocapture.js?v=".concat(h.LIB_VERSION)),function(t){t&&$.error(i8+" failed to load script",t),e()})}},{key:"stopCapturing",value:function(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}},{key:"afterDecideResponse",value:function(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t,this._endpoint=k(t)&&t.endpoint||"/e/",this.instance.persistence&&(this.instance.persistence.register(a({},eK,this.remoteEnabled)),this.instance.persistence.register(a({},"$exception_capture_endpoint",this._endpoint))),this.startIfEnabled()}},{key:"captureException",value:function(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.sendExceptionEvent(e)}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0,_url:this._endpoint})}}]),e}(),i7="[Web Vitals]",i9=function(){function e(n){var i,o=this;r(this,e),a(this,"_enabledServerSide",!1),a(this,"_initialized",!1),a(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),a(this,"_flushToCapture",function(){clearTimeout(o._delayedFlushTimer),0!==o.buffer.metrics.length&&(o.instance.capture("$web_vitals",o.buffer.metrics.reduce(function(e,n){var r;return t(t({},e),{},(a(r={},"$web_vitals_".concat(n.name,"_event"),t({},n)),a(r,"$web_vitals_".concat(n.name,"_value"),n.value),r))},{})),o.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),a(this,"_addToBuffer",function(e){var n,r=null===(n=o.instance.sessionManager)||void 0===n?void 0:n.checkAndGetSessionAndWindowId(!0);if(w(r))$.error(i7+"Could not read session ID. Dropping metrics!");else{o.buffer=o.buffer||{};var i=o._currentURL();w(i)||(E(null==e?void 0:e.name)||E(null==e?void 0:e.value)?$.error(i7+"Invalid metric received",e):(o.buffer.url!==i&&(o._flushToCapture(),o._delayedFlushTimer=setTimeout(o._flushToCapture,8e3)),w(o.buffer.url)&&(o.buffer.url=i),o.buffer.firstMetricTimestamp=w(o.buffer.firstMetricTimestamp)?Date.now():o.buffer.firstMetricTimestamp,o.buffer.metrics.push(t(t({},e),{},{$current_url:i,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),4===o.buffer.metrics.length&&o._flushToCapture()))}}),a(this,"_startCapturing",function(){var e=U.postHogWebVitalsCallbacks,t=e.onLCP,n=e.onCLS,r=e.onFCP,i=e.onINP;t(o._addToBuffer),n(o._addToBuffer),r(o._addToBuffer),i(o._addToBuffer),o._initialized=!0}),this.instance=n,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[eY]),this.startIfEnabled()}return o(e,[{key:"isEnabled",get:function(){var e=k(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return T(e)?e:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&($.info(i7+" enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"afterDecideResponse",value:function(e){var t=k(e.capturePerformance)&&!!e.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(a({},eY,t)),this._enabledServerSide=t,this.startIfEnabled()}},{key:"loadScript",value:function(e){M.postHogWebVitalsCallbacks&&e(),this.instance.requestRouter.loadScript(this.instance.requestRouter.endpointFor("assets","/static/web-vitals.js?v=".concat(h.LIB_VERSION)),function(t){t&&$.error(i7+" failed to load script",t),e()})}},{key:"_currentURL",value:function(){var e=M?M.location.href:void 0;return e||$.error(i7+"Could not determine current URL"),e}}]),e}(),oe={},ot=function(){},on="posthog",or=!rG&&-1===(null==j?void 0:j.indexOf("MSIE"))&&-1===(null==j?void 0:j.indexOf("Mozilla")),oi=function(){var e,t,n;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:!!I(n=null==(t=null==P?void 0:P.location)?void 0:t.hostname)&&"herokuapp.com"!==n.split(".").slice(-2).join("."),persistence:"localStorage+cookie",persistence_name:"",loaded:ot,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:D&&I(null==D?void 0:D.search)&&-1!==D.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==M||null===(e=M.location)||void 0===e?void 0:e.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(e){var t="Bad HTTP status: "+e.statusCode+" "+e.text;$.error(t)},get_device_id:function(e){return e},_onCapture:ot,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"always",__add_tracing_headers:!1}},oo=function(e){var t={};w(e.process_person)||(t.person_profiles=e.process_person),w(e.xhr_headers)||(t.request_headers=e.xhr_headers),w(e.cookie_name)||(t.persistence_name=e.cookie_name),w(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var n=Q({},t,e);return y(e.property_blacklist)&&(w(e.property_denylist)?n.property_denylist=e.property_blacklist:y(e.property_denylist)?n.property_denylist=[].concat(l(e.property_blacklist),l(e.property_denylist)):$.error("Invalid value for property_denylist config: "+e.property_denylist)),n},oa=function(){function e(){r(this,e),a(this,"__forceAllowLocalhost",!1)}return o(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){$.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),os=function(){function e(){var t=this;r(this,e),a(this,"webPerformance",new oa),a(this,"_internalEventEmitter",new iK),this.config=oi(),this.decideEndpointWasHit=!1,this.SentryIntegration=ie,this.sentryIntegration=function(e){var n;return n=r4(t,e),{name:r3,processEvent:function(e){return n(e)}}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.featureFlags=new tg(this),this.toolbar=new rd(this),this.scrollManager=new iQ(this),this.pageViewManager=new it(this),this.surveys=new iB(this),this.rateLimiter=new ij(this),this.requestRouter=new r5(this),this.consent=new i4(this),this.people={set:function(e,n,r){var i=I(e)?a({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i=I(e)?a({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",function(e){return $.info("send",e)})}return o(e,[{key:"init",value:function(t,n,r){if(r&&r!==on){var i,o=null!==(i=oe[r])&&void 0!==i?i:new e;return o._init(t,n,r),oe[r]=o,oe[on][r]=o,o}return this._init(t,n,r)}},{key:"_init",value:function(e){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(w(e)||S(e))return $.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 $.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;if(this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(Q({},oi(),oo(o),{name:a,token:e})),this.compression=o.disable_compression?void 0:eP.Base64,this.persistence=new nO(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new nO(t(t({},this.config),{},{persistence:"sessionStorage"})),this._requestQueue=new rf(function(e){return i._send_retriable_request(e)}),this._retryQueue=new r0(this),this.__request_queue=[],this.sessionManager=new r1(this.config,this.persistence),this.sessionPropsManager=new iW(this.sessionManager,this.persistence),new i3(this).startIfEnabledOrStop(),this.sessionRecording=new rs(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new i5(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new iz(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new i9(this),this.exceptionObserver=new i6(this),this.exceptionObserver.startIfEnabled(),h.DEBUG=h.DEBUG||this.config.debug,this._sync_opt_out_with_persistence(),void 0!==(null===(n=o.bootstrap)||void 0===n?void 0:n.distinctID)){var s,l,u=this.config.get_device_id(tS()),c=null!==(s=o.bootstrap)&&void 0!==s&&s.isIdentifiedID?u:o.bootstrap.distinctID;this.persistence.set_property(tr,null!==(l=o.bootstrap)&&void 0!==l&&l.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:c})}if(this._hasBootstrappedFeatureFlags()){var d,f,p=Object.keys((null===(d=o.bootstrap)||void 0===d?void 0:d.featureFlags)||{}).filter(function(e){var t,n;return!(null===(t=o.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])}).reduce(function(e,t){var n,r;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e},{}),v=Object.keys((null===(f=o.bootstrap)||void 0===f?void 0:f.featureFlagPayloads)||{}).filter(function(e){return p[e]}).reduce(function(e,t){var n,r,i,a;return null!==(n=o.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(i=o.bootstrap)||void 0===i||null===(a=i.featureFlagPayloads)||void 0===a?void 0:a[t]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:p,featureFlagPayloads:v})}if(!this.get_distinct_id()){var g=this.config.get_device_id(tS());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(tr,"anonymous")}return null==M||null===(r=M.addEventListener)||void 0===r||r.call(M,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),o.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var r=function(n){var r=function(){return n.anonymousId()||tS()};e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(tr,"identified")),t()},i=n.user();"then"in i&&b(i.then)?i.then(function(e){return r(e)}):r(i)}(e,function(){var r;n.register((Promise&&Promise.resolve||$.warn("This browser does not have Promise support, and can not use the segment integration"),r=function(t,n){if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||e.reset(),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(e.register({distinct_id:t.event.userId}),e.reloadFeatureFlags());var r,i=e._calculate_event_properties(n,null!==(r=t.event.properties)&&void 0!==r?r:{});return t.event.properties=Object.assign({},i,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return r(e,e.event.event)},page:function(e){return r(e,"$pageview")},identify:function(e){return r(e,"$identify")},screen:function(e){return r(e,"$screen")}})).then(function(){t()})})}(this,function(){return i._loaded()}):this._loaded(),b(this.config._onCapture)&&this.on("eventCaptured",function(e){return i.config._onCapture(e.event,e)}),this}},{key:"_afterDecideResponse",value:function(e){var t,n,r,i,o,a,s;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=K(e.supportedCompression,eP.GZipJS)?eP.GZipJS:K(e.supportedCompression,eP.Base64)?eP.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),null===(n=this.sessionRecording)||void 0===n||n.afterDecideResponse(e),null===(r=this.autocapture)||void 0===r||r.afterDecideResponse(e),null===(i=this.heatmaps)||void 0===i||i.afterDecideResponse(e),null===(o=this.surveys)||void 0===o||o.afterDecideResponse(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.afterDecideResponse(e),null===(s=this.exceptionObserver)||void 0===s||s.afterDecideResponse(e)}},{key:"_loaded",value:function(){var e=this,t=this.config.advanced_disable_decide;t||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){$.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(function(){P&&e.capture("$pageview",{title:P.title},{send_instantly:!0})},1),t||(new rl(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||Z(this.__request_queue,function(t){return e._send_retriable_request(t)}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_handle_unload",value:function(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var n=this;this.__loaded&&(or?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=rz(e.url,{ip:this.config.ip?1:0}),e.headers=this.config.request_headers,e.compression="best-available"===e.compression?this.compression:e.compression,function(e){var n,r,i,o=t({},e);o.timeout=o.timeout||6e4,o.url=rz(o.url,{_:(new Date).getTime().toString(),ver:h.LIB_VERSION,compression:o.compression});var a=null!==(n=o.transport)&&void 0!==n?n:"XHR",s=null!==(r=null===(i=e$(rK,function(e){return e.transport===a}))||void 0===i?void 0:i.method)&&void 0!==r?r:rK[0].method;if(!s)throw Error("No available transport method");s(o)}(t(t({},e),{},{callback:function(t){var r,i,o;n.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null===(i=(o=n.config).on_request_error)||void 0===i||i.call(o,t)),null===(r=e.callback)||void 0===r||r.call(e,t)}}))))}},{key:"_send_retriable_request",value:function(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];Z(e,function(e){e&&(y(t=e[0])?o.push(e):b(e)?e.call(n):y(e)&&"alias"===t?r.push(e):y(e)&&-1!==t.indexOf("capture")&&b(n[t])?o.push(e):i.push(e))});var a=function(e,t){Z(e,function(e){if(y(e[0])){var n=t;z(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};a(r,this),a(i,this),a(o,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"capture",value:function(e,n,r){var i;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return $.uninitializedWarning("posthog.capture");if(!this.consent.isOptedOut()){if(!w(e)&&I(e)){if(!j||this.config.opt_out_useragent_filter||!iV(j,this.config.custom_blocked_useragents)){var o=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a,s,l,u,c={uuid:tS(),event:e,properties:this._calculate_event_properties(e,n||{},r)};o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==r?void 0:r.$set)&&(c.$set=null==r?void 0:r.$set);var d=this._calculate_set_once_properties(null==r?void 0:r.$set_once);d&&(c.$set_once=d),(a=c,s=null!=r&&r._noTruncate?null:this.config.properties_string_max_length,l=function(e){return I(e)&&!x(s)?e.slice(0,s):e},u=new Set,c=function e(t,n){var r;return t!==Object(t)?l?l(t,n):t:u.has(t)?void 0:(u.add(t),y(t)?(r=[],Z(t,function(t){r.push(e(t))})):(r={},z(t,function(t,n){u.has(t)||(r[n]=e(t,n))})),r)}(a)).timestamp=(null==r?void 0:r.timestamp)||new Date,w(null==r?void 0:r.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=new Date);var f=t(t({},c.properties.$set),c.$set);C(f)||this.setPersonPropertiesForFlags(f),this._internalEventEmitter.emit("eventCaptured",c);var p={method:"POST",url:null!==(i=null==r?void 0:r._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(p):this._requestQueue.enqueue(p),c}$.critical("This capture call is ignored due to client rate limiting.")}}else $.error("No event name provided to posthog.capture")}}},{key:"_addCaptureHook",value:function(e){this.on("eventCaptured",function(t){return e(t.event,t)})}},{key:"_calculate_event_properties",value:function(e,n,r){if(!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(e),o=t({},n);if(o.token=this.config.token,"$snapshot"===e){var a=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!I(o.distinct_id)&&!A(o.distinct_id)||S(o.distinct_id))&&$.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var s=nT.properties();if(this.sessionManager){var l=this.sessionManager.checkAndGetSessionAndWindowId(),u=l.sessionId,c=l.windowId;o.$session_id=u,o.$window_id=c}if(this.requestRouter.region===rJ.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var d=this.sessionPropsManager.getSessionProps();o=Q(o,d)}if(!this.config.disable_scroll_properties){var f={};"$pageview"===e?f=this.pageViewManager.doPageView():"$pageleave"===e&&(f=this.pageViewManager.doPageLeave()),o=Q(o,f)}if("$pageview"===e&&P&&(o.title=P.title),!w(i)){var p=(new Date).getTime()-i;o.$duration=parseFloat((p/1e3).toFixed(3))}if(j&&this.config.opt_out_useragent_filter&&(o.$browser_type=iV(j,this.config.custom_blocked_useragents)?"bot":"browser"),(o=Q({},s,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),null==r||!r._noHeatmaps){var h,v=null===(h=this.heatmaps)||void 0===h?void 0:h.getAndClearBuffer();v&&(o.$heatmap_data=v)}y(this.config.property_denylist)?z(this.config.property_denylist,function(e){delete o[e]}):$.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;return g&&(o=g(o,e)),o.$process_person_profile=this._hasPersonProcessing(),o}},{key:"_calculate_set_once_properties",value:function(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=Q({},this.persistence.get_initial_props(),e||{});return C(t)?void 0:t}},{key:"register",value:function(e,t){var n;null===(n=this.persistence)||void 0===n||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var r;null===(r=this.persistence)||void 0===r||r.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}},{key:"unregister",value:function(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}},{key:"_register_single",value:function(e,t){this.register(a({},e,t))}},{key:"getFeatureFlag",value:function(e,t){return this.featureFlags.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}},{key:"isFeatureEnabled",value:function(e,t){return this.featureFlags.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}},{key:"getEarlyAccessFeatures",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}},{key:"on",value:function(e,t){return this._internalEventEmitter.on(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){var t,n;return null!==(t=null===(n=this.sessionManager)||void 0===n?void 0:n.onSessionId(e))&&void 0!==t?t:function(){}}},{key:"getSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}},{key:"getActiveMatchingSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}},{key:"getNextSurveyStep",value:function(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}},{key:"identify",value:function(e,t,n){if(!this.__loaded||!this.persistence)return $.uninitializedWarning("posthog.identify");if(A(e)&&(e=e.toString(),$.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))$.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(eG)&&(this.unregister(eG),this.register({distinct_id:e}));var i="anonymous"===(this.persistence.get_property(tr)||"anonymous");e!==r&&i?(this.persistence.set_property(tr,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(tn))}}else $.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}},{key:"group",value:function(e,n,r){if(e&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},i),{},a({},e,n))}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags(a({},e,r))),i[e]===n||r||this.reloadFeatureFlags()}}else $.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){if(!this.__loaded)return $.uninitializedWarning("posthog.reset");var t,n,r,i,o=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),null===(r=this.persistence)||void 0===r||r.set_property(tr,"anonymous"),null===(i=this.sessionManager)||void 0===i||i.resetSessionId();var a=this.config.get_device_id(tS());this.register_once({distinct_id:a,$device_id:e?a:o},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionId,r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(null!=e&&e.withTimestamp&&r){var o,a=null!==(o=e.timestampLookBack)&&void 0!==o?o:10;if(!r)return i;var s=Math.max(Math.floor(((new Date).getTime()-r)/1e3)-a,0);i+="?t=".concat(s)}return i}},{key:"alias",value:function(e,t){return e===this.get_property(eV)?($.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(w(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(eG,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var n,r,i,o,a=t({},this.config);k(e)&&(Q(this.config,oo(e)),null===(n=this.persistence)||void 0===n||n.update_config(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new nO(t(t({},this.config),{},{persistence:"sessionStorage"})),tO.is_supported()&&"true"===tO.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(h.DEBUG=!0),null===(r=this.sessionRecording)||void 0===r||r.startIfEnabledOrStop(),null===(i=this.autocapture)||void 0===i||i.startIfEnabled(),null===(o=this.heatmaps)||void 0===o||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(e){if(null!=e&&e.sampling){var t,n,r=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId();null===(n=this.persistence)||void 0===n||n.register(a({},e4,!0)),$.info("Session recording started with sampling override for session: ",null==r?void 0:r.sessionId)}this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started)}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_property",value:function(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:on;return t!==on&&(t=on+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(tr))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(tr))}},{key:"_hasPersonProcessing",value:function(){var e,t,n,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[eG])&&(null===(n=this.persistence)||void 0===n||null===(r=n.props)||void 0===r||!r[tu]))}},{key:"_shouldCapturePageleave",value:function(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"_requirePersonProcessing",value:function(e){return"never"===this.config.person_profiles?($.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(tu,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var e,t,n,r,i=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,a=this.config.disable_persistence||i&&!!o;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==a&&(null===(n=this.persistence)||void 0===n||n.set_disabled(a)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==a&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(a))}},{key:"opt_in_capturing",value:function(e){var t;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(w(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0})}},{key:"opt_out_capturing",value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:"debug",value:function(e){!1===e?(null==M||M.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==M||M.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),e}();!function(e,t){for(var n=0;n - - {% if environment | lower in ["dev", "preprod"] %}