posthog-js 1.217.0 → 1.217.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){l(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(){n=function(){return e};var e={},t=Object.prototype,i=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof f?t:f,o=Object.create(r.prototype),s=new x(i||[]);return o._invoke=function(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return C()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=k(s,n);if(a){if(a===d)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(e,n,s),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function f(){}function h(){}function p(){}var v={};l(v,o,(function(){return this}));var _=Object.getPrototypeOf,g=_&&_(_(E([])));g&&g!==t&&i.call(g,o)&&(v=g);var m=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function n(r,o,s,a){var l=c(e[r],e,o);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==typeof d&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,a)}))}a(l.arg)}var r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=p,l(m,"constructor",p),l(p,"constructor",h),h.displayName=l(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,i,r,o){void 0===o&&(o=Promise);var s=new b(u(t,n,i,r),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},y(m),l(m,a,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(a&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(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 i=n.completion;if("throw"===i.type){var r=i.arg;S(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(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},i(e)}function r(e,t,n,i,r,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function p(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var v,_,g,m,y,b,k,w,S="$people_distinct_id",x="__alias",E="__timers",C="$autocapture_disabled_server_side",T="$heatmaps_enabled_server_side",P="$exception_capture_enabled_server_side",I="$web_vitals_enabled_server_side",F="$dead_clicks_enabled_server_side",R="$web_vitals_allowed_metrics",M="$session_recording_enabled_server_side",L="$console_log_recording_enabled_server_side",q="$session_recording_network_payload_capture",$="$session_recording_canvas_recording",O="$replay_sample_rate",A="$replay_minimum_duration",D="$replay_script_config",N="$sesid",H="$session_is_sampled",B="$session_recording_url_trigger_activated_session",j="$session_recording_event_trigger_activated_session",U="$enabled_feature_flags",V="$early_access_features",W="$stored_person_properties",z="$stored_group_properties",G="$surveys",Z="$surveys_activated",Q="$flag_call_reported",Y="$user_state",J="$client_session_props",X="$capture_rate_limit",K="$initial_campaign_params",ee="$initial_referrer_info",te="$initial_person_info",ne="$epp",ie="__POSTHOG_TOOLBAR__",re="$posthog_cookieless",oe=[S,x,"__cmpns",E,M,T,N,U,Y,V,z,W,G,Q,J,X,K,ee,ne],se={},ae=[],le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ue=Array.isArray;function ce(e,t){for(var n in t)e[n]=t[n];return e}function de(e){var t=e.parentNode;t&&t.removeChild(e)}function fe(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?v.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return he(e,s,i,r,null)}function he(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++g:r,__i:-1,__u:0};return null==r&&null!=_.vnode&&_.vnode(o),o}function pe(e){return e.children}function ve(e,t){this.props=e,this.context=t}function _e(e,t){if(null==t)return e.__?_e(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?_e(e):null}function ge(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return ge(e)}}function me(e){(!e.__d&&(e.__d=!0)&&m.push(e)&&!ye.__r++||y!==_.debounceRendering)&&((y=_.debounceRendering)||b)(ye)}function ye(){var e,t,n,i,r,o,s,a,l;for(m.sort(k);e=m.shift();)e.__d&&(t=m.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=ce({},r)).__v=r.__v+1,_.vnode&&_.vnode(i),Te(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?_e(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Pe(a,i,l),i.__e!=o&&ge(i)),m.length>t&&m.sort(k));ye.__r=0}function be(e,t,n,i,r,o,s,a,l,u,c){var d,f,h,p,v,_=i&&i.__k||ae,g=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,u=n.length,c=u,d=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?he(null,r,null,null,r):ue(r)?he(pe,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?he(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=we(r,n,s=i+d,c),r.__i=a,o=null,-1!==a&&(c--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&d--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?d++:a>s?c>l-s?d+=a-s:d--:d=a<s&&a==s-1?a-s:0,a!==i+d&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=_e(o)),Re(o,o,!1),n[i]=null,c--);if(c)for(i=0;i<u;i++)null!=(o=n[i])&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=_e(o)),Re(o,o))}(n,t,_),l=n.__d,d=0;d<g;d++)null!=(h=n.__k[d])&&"boolean"!=typeof h&&"function"!=typeof h&&(f=-1===h.__i?se:_[h.__i]||se,h.__i=d,Te(e,h,f,r,o,s,a,l,u,c),p=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Fe(f.ref,null,h),c.push(h.ref,h.__c||p,h)),null==v&&null!=p&&(v=p),65536&h.__u||f.__k===h.__k?l=ke(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:p&&(l=p.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=v}function ke(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=ke(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function we(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function Se(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||le.test(t)?n:n+"px"}function xe(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Se(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Se(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?Ce:Ee,o)):e.removeEventListener(t,o?Ce:Ee,o);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Ee(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(_.event?_.event(e):e)}function Ce(e){return this.l[e.type+!0](_.event?_.event(e):e)}function Te(e,t,n,i,r,o,s,a,l,u){var c,d,f,h,p,v,g,m,y,b,k,w,S,x,E,C=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(c=_.__b)&&c(t);e:if("function"==typeof C)try{if(m=t.props,y=(c=C.contextType)&&i[c.__c],b=c?y?y.props.value:c.__:i,n.__c?g=(d=t.__c=n.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(m,b):(t.__c=d=new ve(m,b),d.constructor=C,d.render=Me),y&&y.sub(d),d.props=m,d.state||(d.state={}),d.context=b,d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ce({},d.__s)),ce(d.__s,C.getDerivedStateFromProps(m,d.__s))),h=d.props,p=d.state,d.__v=t,f)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,b),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,b),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(h,p,v)}))}if(d.context=b,d.props=m,d.__P=e,d.__e=!1,w=_.__r,S=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[]}else do{d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(i=ce(ce({},i),d.getChildContext())),f||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(h,p)),be(e,ue(E=null!=c&&c.type===pe&&null==c.key?c.props.children:c)?E:[E],t,n,i,r,o,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),_.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ie(n.__e,t,n,i,r,o,s,l,u);(c=_.diffed)&&c(t)}function Pe(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Fe(n[i],n[++i],n[++i]);_.__c&&_.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){_.__e(e,t.__v)}}))}function Ie(e,t,n,i,r,o,s,a,l){var u,c,d,f,h,p,_,g=n.props,m=t.props,y=t.type;if("svg"===y&&(r=!0),null!=o)for(u=0;u<o.length;u++)if((h=o[u])&&"setAttribute"in h==!!y&&(y?h.localName===y:3===h.nodeType)){e=h,o[u]=null;break}if(null==e){if(null===y)return document.createTextNode(m);e=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,m.is&&m),o=null,a=!1}if(null===y)g===m||a&&e.data===m||(e.data=m);else{if(o=o&&v.call(e.childNodes),g=n.props||se,!a&&null!=o)for(g={},u=0;u<e.attributes.length;u++)g[(h=e.attributes[u]).name]=h.value;for(u in g)h=g[u],"children"==u||("dangerouslySetInnerHTML"==u?d=h:"key"===u||u in m||xe(e,u,null,h,r));for(u in m)h=m[u],"children"==u?f=h:"dangerouslySetInnerHTML"==u?c=h:"value"==u?p=h:"checked"==u?_=h:"key"===u||a&&"function"!=typeof h||g[u]===h||xe(e,u,h,g[u],r);if(c)a||d&&(c.__html===d.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),be(e,ue(f)?f:[f],t,n,i,r&&"foreignObject"!==y,o,s,o?o[0]:n.__k&&_e(n,0),a,l),null!=o)for(u=o.length;u--;)null!=o[u]&&de(o[u]);a||(u="value",void 0!==p&&(p!==e[u]||"progress"===y&&!p||"option"===y&&p!==g[u])&&xe(e,u,p,g[u],!1),u="checked",void 0!==_&&_!==e[u]&&xe(e,u,_,g[u],!1))}return e}function Fe(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){_.__e(e,n)}}function Re(e,t,n){var i,r;if(_.unmount&&_.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Fe(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){_.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Re(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||de(e.__e),e.__=e.__e=e.__d=void 0}function Me(e,t,n){return this.constructor(e,n)}function Le(e,t,n){var i,r,o,s;_.__&&_.__(e,t),r=(i="function"==typeof n)?null:t.__k,o=[],s=[],Te(t,e=(!i&&n||t).__k=fe(pe,null,[e]),r||se,se,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?v.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Pe(o,e,s)}function qe(e,t,n){var i,r,o,s,a=ce({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==o?i=t[o]:"ref"==o?r=t[o]:a[o]=void 0===t[o]&&void 0!==s?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?v.call(arguments,2):n),he(e.type,a,i||e.key,r||e.ref,null)}v=ae.slice,_={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},g=0,ve.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ce({},this.state),"function"==typeof e&&(e=e(ce({},n),this.props)),e&&ce(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),me(this))},ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),me(this))},ve.prototype.render=pe,m=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k=function(e,t){return e.__v.__b-t.__v.__b},ye.__r=0,w=0;var $e,Oe="undefined"!=typeof window?window:void 0,Ae="undefined"!=typeof globalThis?globalThis:Oe,De=Array.prototype,Ne=De.forEach,He=De.indexOf,Be=null==Ae?void 0:Ae.navigator,je=null==Ae?void 0:Ae.document,Ue=null==Ae?void 0:Ae.location,Ve=null==Ae?void 0:Ae.fetch,We=null!=Ae&&Ae.XMLHttpRequest&&"withCredentials"in new Ae.XMLHttpRequest?Ae.XMLHttpRequest:void 0,ze=null==Ae?void 0:Ae.AbortController,Ge=null==Be?void 0:Be.userAgent,Ze=null!=Oe?Oe:{},Qe={DEBUG:!1,LIB_VERSION:"1.217.0"},Ye="$copy_autocapture",Je=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];!function(e){e.GZipJS="gzip-js",e.Base64="base64"}($e||($e={}));var Xe=["fatal","error","warning","log","info","debug"],Ke={};function et(e,t,n){if(kt(e))if(Ne&&e.forEach===Ne)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var i=0,r=e.length;i<r;i++)if(i in e&&t.call(n,e[i],i)===Ke)return}function tt(e,t,n){if(!It(e)){if(kt(e))return et(e,t,n);if(Mt(e)){var i,r=p(e.entries());try{for(r.s();!(i=r.n()).done;){var o=i.value;if(t.call(n,o[1],o[0])===Ke)return}}catch(e){r.e(e)}finally{r.f()}}else for(var s in e)if(yt.call(e,s)&&t.call(n,e[s],s)===Ke)return}}var nt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return et(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},it=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return et(n,(function(t){et(t,(function(t){e.push(t)}))})),e};function rt(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var ot=function(e){try{return e()}catch(e){return}},st=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){$t.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$t.critical(e)}}},at=function(e){var t={};return tt(e,(function(e,n){Ct(e)&&e.length>0&&(t[n]=e)})),t};function lt(e,t){return n=e,i=function(e){return Ct(e)&&!Pt(t)?e.slice(0,t):e},r=new Set,function e(t,n){return t!==Object(t)?i?i(t,n):t:r.has(t)?void 0:(r.add(t),kt(t)?(o=[],et(t,(function(t){o.push(e(t))}))):(o={},tt(t,(function(t,n){r.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,i,r}var ut=["herokuapp.com","vercel.app","netlify.app"];function ct(e){var t=null==e?void 0:e.hostname;if(!Ct(t))return!1;var n,i=t.split(".").slice(-2).join("."),r=p(ut);try{for(r.s();!(n=r.n()).done;){if(i===n.value)return!1}}catch(e){r.e(e)}finally{r.f()}return!0}function dt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function ft(e,t,n,i){var r=null!=i?i:{},o=r.capture,s=void 0!==o&&o,a=r.passive,l=void 0===a||a;null==e||e.addEventListener(t,n,{capture:s,passive:l})}function ht(e,t){return-1!==e.indexOf(t)}var pt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},vt=function(e){return e.replace(/^\$/,"")};var _t=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},gt=Array.isArray,mt=Object.prototype,yt=mt.hasOwnProperty,bt=mt.toString,kt=gt||function(e){return"[object Array]"===bt.call(e)},wt=function(e){return"function"==typeof e},St=function(e){return e===Object(e)&&!kt(e)},xt=function(e){if(St(e)){for(var t in e)if(yt.call(e,t))return!1;return!0}return!1},Et=function(e){return void 0===e},Ct=function(e){return"[object String]"==bt.call(e)},Tt=function(e){return Ct(e)&&0===e.trim().length},Pt=function(e){return null===e},It=function(e){return Et(e)||Pt(e)},Ft=function(e){return"[object Number]"==bt.call(e)},Rt=function(e){return"[object Boolean]"===bt.call(e)},Mt=function(e){return e instanceof FormData},Lt=function(e){return e instanceof Error},qt=function(e){return ht(Je,e)},$t=function e(t){var n={_log:function(e){if(Oe&&(Qe.DEBUG||Ze.POSTHOG_DEBUG)&&!Et(Oe.console)&&Oe.console){for(var n=("__rrweb_original__"in Oe.console[e]?Oe.console[e].__rrweb_original__:Oe.console[e]),i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];n.apply(void 0,[t].concat(r))}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["log"].concat(t))},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["warn"].concat(t))},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["error"].concat(t))},critical:function(){for(var e,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];(e=console).error.apply(e,[t].concat(i))},uninitializedWarning:function(e){n.error("You must initialize PostHog before calling ".concat(e))},createLogger:function(n){return e("".concat(t," ").concat(n))}};return n}("[PostHog.js]"),Ot=$t.createLogger,At=Oe,Dt=je,Nt="seenSurvey_",Ht=Ot("[Surveys]"),Bt=function(e){return"\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: ".concat((null==e?void 0:e.fontFamily)||"-apple-system",', BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n text-align: left;\n max-width: ').concat(parseInt((null==e?void 0:e.maxWidth)||"300"),"px;\n width: 100%;\n z-index: ").concat(parseInt((null==e?void 0:e.zIndex)||"99999"),";\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n border-bottom: 0px;\n ").concat({left:"left: 30px;",right:"right: 30px;",center:"\n left: 50%;\n transform: translateX(-50%);\n "}[(null==e?void 0:e.position)||"right"]||"right: 30px;","\n flex-direction: column;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n\n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: 0.6;\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: ").concat((null==e?void 0:e.fontFamily)||"-apple-system",', BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ').concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ").concat((null==e?void 0:e.submitButtonColor)||"black"," !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n text-decoration: none;\n backgroundColor: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n color: ").concat(Ut((null==e?void 0:e.backgroundColor)||"#eeeded"),";\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ")};function jt(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 Ut(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Zt;"#"===t[0]&&(e=jt(t)),t.startsWith("rgb")&&(e=t);var n=function(e){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()]}(t);if(n&&(e=jt(n)),!e)return"black";var i=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var r=parseInt(i[1]),o=parseInt(i[2]),s=parseInt(i[3]);return Math.sqrt(r*r*.299+o*o*.587+s*s*.114)>127.5?"black":"white"}return"black"}var Vt,Wt,zt,Gt={backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},Zt="#eeeded",Qt=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;r?(localStorage.setItem(tn(i),"true"),r.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=r.get_session_replay_url)||void 0===e?void 0:e.call(r)},n),{},{$set:l({},nn(i,"responded"),!0)})),At.dispatchEvent(new Event("PHSurveySent"))):Ht.error("[survey sent] event not captured, PostHog instance not found.")},Yt=function(e,t,n){var i;t?n||(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:l({},nn(e,"dismissed"),!0)}),localStorage.setItem(tn(e),"true"),At.dispatchEvent(new Event("PHSurveyClosed"))):Ht.error("[survey dismissed] event not captured, PostHog instance not found.")},Jt=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}))},Xt=function(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))?t.reverse():t},Kt=function(e){return e.questions.forEach((function(e,t){e.originalQuestionIndex=t})),e.appearance&&e.appearance.shuffleQuestions?Xt(e.questions,Jt(e.questions)):e.questions},en=function(e){var t,n;return!(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||!n.repeatedActivation||!function(e){var t,n,i,r,o,s;return null!=(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(i=n.values)||void 0===i?void 0:i.length)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0}(e))},tn=function(e){var t="".concat(Nt).concat(e.id);return e.current_iteration&&e.current_iteration>0&&(t="".concat(Nt).concat(e.id,"_").concat(e.current_iteration)),t},nn=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},rn=function(e,t){var n={__c:t="__cC"+w++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,me(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:function(){},isPopup:!0,onPreviewSubmit:function(){}}),on=function(e){var t=e.component,n=e.children,i=e.renderAsHtml,r=e.style;return qe(t,i?{dangerouslySetInnerHTML:{__html:n},style:r}:{children:n,style:r})};!function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(Vt||(Vt={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(Wt||(Wt={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(zt||(zt={}));var sn,an=["localhost","127.0.0.1"],ln=function(e){var t=null==je?void 0:je.createElement("a");return Et(t)?null:(t.href=e,t)},un=function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return tt(e,(function(e,i){Et(e)||Et(i)||"undefined"===i||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(i),r[r.length]=n+"="+t)})),r.join(i)},cn=function(e,t){for(var n,i=((e.split("#")[0]||"").split("?")[1]||"").split("&"),r=0;r<i.length;r++){var o=i[r].split("=");if(o[0]===t){n=o;break}}if(!kt(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(e){$t.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},dn=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[0]||"",o=i[1],s=r.split("?"),a=s[1],l=s[0],u=(a||"").split("&"),c=[],d=0;d<u.length;d++){var f=u[d].split("=");kt(f)&&(t.includes(f[0])?c.push(f[0]+"="+n):c.push(u[d]))}var h=l;return null!=a&&(h+="?"+c.join("&")),null!=o&&(h+="#"+o),h},fn=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},hn="Mobile",pn="iOS",vn="Android",_n="Tablet",gn=vn+" "+_n,mn="iPad",yn="Apple",bn=yn+" Watch",kn="Safari",wn="BlackBerry",Sn="Samsung",xn=Sn+"Browser",En=Sn+" Internet",Cn="Chrome",Tn=Cn+" OS",Pn=Cn+" "+pn,In="Internet Explorer",Fn=In+" "+hn,Rn="Opera",Mn=Rn+" Mini",Ln="Edge",qn="Microsoft "+Ln,$n="Firefox",On=$n+" "+pn,An="Nintendo",Dn="PlayStation",Nn="Xbox",Hn=vn+" "+hn,Bn=hn+" "+kn,jn="Windows",Un=jn+" Phone",Vn="Nokia",Wn="Ouya",zn="Generic",Gn=zn+" "+hn.toLowerCase(),Zn=zn+" "+_n.toLowerCase(),Qn="Konqueror",Yn="(\\d+(\\.\\d+)?)",Jn=new RegExp("Version/"+Yn),Xn=new RegExp(Nn,"i"),Kn=new RegExp(Dn+" \\w+","i"),ei=new RegExp(An+" \\w+","i"),ti=new RegExp(wn+"|PlayBook|BB10","i"),ni={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var ii=function(e,t){return t&&ht(t,yn)||function(e){return ht(e,kn)&&!ht(e,Cn)&&!ht(e,vn)}(e)},ri=function(e,t){return t=t||"",ht(e," OPR/")&&ht(e,"Mini")?Mn:ht(e," OPR/")?Rn:ti.test(e)?wn:ht(e,"IE"+hn)||ht(e,"WPDesktop")?Fn:ht(e,xn)?En:ht(e,Ln)||ht(e,"Edg/")?qn:ht(e,"FBIOS")?"Facebook "+hn:ht(e,"UCWEB")||ht(e,"UCBrowser")?"UC Browser":ht(e,"CriOS")?Pn:ht(e,"CrMo")||ht(e,Cn)?Cn:ht(e,vn)&&ht(e,kn)?Hn:ht(e,"FxiOS")?On:ht(e.toLowerCase(),Qn.toLowerCase())?Qn:ii(e,t)?ht(e,hn)?Bn:kn:ht(e,$n)?$n:ht(e,"MSIE")||ht(e,"Trident/")?In:ht(e,"Gecko")?$n:""},oi=(l(sn={},Fn,[new RegExp("rv:"+Yn)]),l(sn,qn,[new RegExp(Ln+"?\\/"+Yn)]),l(sn,Cn,[new RegExp("("+Cn+"|CrMo)\\/"+Yn)]),l(sn,Pn,[new RegExp("CriOS\\/"+Yn)]),l(sn,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+Yn)]),l(sn,kn,[Jn]),l(sn,Bn,[Jn]),l(sn,Rn,[new RegExp("(Opera|OPR)\\/"+Yn)]),l(sn,$n,[new RegExp($n+"\\/"+Yn)]),l(sn,On,[new RegExp("FxiOS\\/"+Yn)]),l(sn,Qn,[new RegExp("Konqueror[:/]?"+Yn,"i")]),l(sn,wn,[new RegExp(wn+" "+Yn),Jn]),l(sn,Hn,[new RegExp("android\\s"+Yn,"i")]),l(sn,En,[new RegExp(xn+"\\/"+Yn)]),l(sn,In,[new RegExp("(rv:|MSIE )"+Yn)]),l(sn,"Mozilla",[new RegExp("rv:"+Yn)]),sn),si=[[new RegExp(Nn+"; "+Nn+" (.*?)[);]","i"),function(e){return[Nn,e&&e[1]||""]}],[new RegExp(An,"i"),[An,""]],[new RegExp(Dn,"i"),[Dn,""]],[ti,[wn,""]],[new RegExp(jn,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[Un,""];if(new RegExp(hn).test(t)&&!/IEMobile\b/.test(t))return[jn+" "+hn,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=n[1],r=ni[i]||"";return/arm/i.test(t)&&(r="RT"),[jn,r]}return[jn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[pn,t.join(".")]}return[pn,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+vn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+vn+")","i"),function(e){if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[vn,t.join(".")]}return[vn,""]}],[/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/,[Tn,""]],[/Linux|debian/i,["Linux",""]]],ai=function(e){return ei.test(e)?An:Kn.test(e)?Dn:Xn.test(e)?Nn:new RegExp(Wn,"i").test(e)?Wn:new RegExp("("+Un+"|WPDesktop)","i").test(e)?Un:/iPad/.test(e)?mn:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?bn:ti.test(e)?wn:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Vn,"i").test(e)?Vn:/(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(hn).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)?vn:gn:vn:new RegExp("(pda|"+hn+")","i").test(e)?Gn:new RegExp(_n,"i").test(e)&&!new RegExp(_n+" pc","i").test(e)?Zn:""},li="https?://(.*)",ui=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],ci=it(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ui),di="<masked>",fi={campaignParams:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.customTrackedParams,n=e.maskPersonalDataProperties,i=e.customPersonalDataProperties;if(!je)return{};var r=n?it([],ui,i||[]):[];return this._campaignParamsFromUrl(dn(je.URL,r,di),t)},_campaignParamsFromUrl:function(e,t){var n=ci.concat(t||[]),i={};return tt(n,(function(t){var n=cn(e,t);i[t]=n||null})),i},_searchEngine:function(e){return e?0===e.search(li+"google.([^/?]*)")?"google":0===e.search(li+"bing.com")?"bing":0===e.search(li+"yahoo.com")?"yahoo":0===e.search(li+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=fi._searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(!Pt(t)){i.$search_engine=t;var r=je?cn(je.referrer,n):"";r.length&&(i.ph_keyword=r)}return i},searchInfo:function(){var e=null==je?void 0:je.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:ri,browserVersion:function(e,t){var n=ri(e,t),i=oi[n];if(Et(i))return null;for(var r=0;r<i.length;r++){var o=i[r],s=e.match(o);if(s)return parseFloat(s[s.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<si.length;t++){var n=c(si[t],2),i=n[0],r=n[1],o=i.exec(e),s=o&&(wt(r)?r(o,e):r);if(s)return s}return["",""]},device:ai,deviceType:function(e){var t=ai(e);return t===mn||t===gn||"Kobo"===t||"Kindle Fire"===t||t===Zn?_n:t===An||t===Nn||t===Dn||t===Wn?"Console":t===bn?"Wearable":t?hn:"Desktop"},referrer:function(){return(null==je?void 0:je.referrer)||"$direct"},referringDomain:function(){var e;return null!=je&&je.referrer&&(null===(e=ln(je.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==Ue?void 0:Ue.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var t,n=e.r,i=e.u,r={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(t=ln(n))||void 0===t?void 0:t.host};if(i){r.$initial_current_url=i;var o=ln(i);r.$initial_host=null==o?void 0:o.host,r.$initial_pathname=null==o?void 0:o.pathname,tt(this._campaignParamsFromUrl(i),(function(e,t){r["$initial_"+vt(t)]=e}))}n&&tt(this._searchInfoFromReferrer(n),(function(e,t){r["$initial_"+vt(t)]=e}));return r},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maskPersonalDataProperties,n=e.customPersonalDataProperties;if(!Ge)return{};var i=t?it([],ui,n||[]):[],r=c(fi.os(Ge),2),o=r[0],s=r[1];return nt(at({$os:o,$os_version:s,$browser:fi.browser(Ge,navigator.vendor),$device:fi.device(Ge),$device_type:fi.deviceType(Ge),$timezone:fi.timezone(),$timezone_offset:fi.timezoneOffset()}),{$current_url:dn(null==Ue?void 0:Ue.href,i,di),$host:null==Ue?void 0:Ue.host,$pathname:null==Ue?void 0:Ue.pathname,$raw_user_agent:Ge.length>1e3?Ge.substring(0,997)+"...":Ge,$browser_version:fi.browserVersion(Ge,navigator.vendor),$browser_language:fi.browserLanguage(),$browser_language_prefix:fi.browserLanguagePrefix(),$screen_height:null==Oe?void 0:Oe.screen.height,$screen_width:null==Oe?void 0:Oe.screen.width,$viewport_height:null==Oe?void 0:Oe.innerHeight,$viewport_width:null==Oe?void 0:Oe.innerWidth,$lib:"web",$lib_version:Qe.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!Ge)return{};var e=c(fi.os(Ge),2),t=e[0],n=e[1];return nt(at({$os:t,$os_version:n,$browser:fi.browser(Ge,navigator.vendor)}),{$browser_version:fi.browserVersion(Ge,navigator.vendor)})}},hi=function(){function e(){o(this,e),l(this,"events",{}),this.events={}}return a(e,[{key:"on",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return e!==t}))}}},{key:"emit",value:function(e,t){var n,i=p(this.events[e]||[]);try{for(i.s();!(n=i.n()).done;){(0,n.value)(t)}}catch(e){i.e(e)}finally{i.f()}var r,o=p(this.events["*"]||[]);try{for(o.s();!(r=o.n()).done;){(0,r.value)(e,t)}}catch(e){o.e(e)}finally{o.f()}}}]),e}(),pi=function(){function e(t){var n=this;o(this,e),l(this,"_debugEventEmitter",new hi),l(this,"checkStep",(function(e,t){return n.checkStepEvent(e,t)&&n.checkStepUrl(e,t)&&n.checkStepElement(e,t)})),l(this,"checkStepEvent",(function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)})),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}return a(e,[{key:"init",value:function(){var e,t=this;if(!Et(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var n;null===(n=this.instance)||void 0===n||n._addCaptureHook((function(e,n){t.on(e,n)}))}}},{key:"register",value:function(e){var t,n,i=this;if(!Et(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((function(e){var t,n;null===(t=i.actionRegistry)||void 0===t||t.add(e),null===(n=e.steps)||void 0===n||n.forEach((function(e){var t;null===(t=i.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(n=this.instance)&&void 0!==n&&n.autocapture)){var r,o=new Set;e.forEach((function(e){var t;null===(t=e.steps)||void 0===t||t.forEach((function(e){null!=e&&e.selector&&o.add(null==e?void 0:e.selector)}))})),null===(r=this.instance)||void 0===r||r.autocapture.setElementSelectors(o)}}},{key:"on",value:function(e,t){var n,i=this;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(n=this.actionRegistry)||void 0===n?void 0:n.size)>0&&this.actionRegistry.forEach((function(e){i.checkAction(t,e)&&i._debugEventEmitter.emit("actionCaptured",e.name)}))}},{key:"_addActionHook",value:function(e){this.onAction("actionCaptured",(function(t){return e(t)}))}},{key:"checkAction",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n,i=p(t.steps);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(this.checkStep(e,r))return!0}}catch(e){i.e(e)}finally{i.f()}return!1}},{key:"onAction",value:function(e,t){return this._debugEventEmitter.on(e,t)}},{key:"checkStepUrl",value:function(t,n){if(null!=n&&n.url){var i,r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!e.matchString(r,null==n?void 0:n.url,(null==n?void 0:n.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(t,n){if((null!=n&&n.href||null!=n&&n.tag_name||null!=n&&n.text)&&!this.getElementsList(t).some((function(t){return!(null!=n&&n.href&&!e.matchString(t.href||"",null==n?void 0:n.href,(null==n?void 0:n.href_matching)||"exact"))&&((null==n||!n.tag_name||t.tag_name===(null==n?void 0:n.tag_name))&&!(null!=n&&n.text&&!e.matchString(t.text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact")&&!e.matchString(t.$el_text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact")))})))return!1;if(null!=n&&n.selector){var i,r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==n?void 0:n.selector))return!1}return!0}},{key:"getElementsList",value:function(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}],[{key:"matchString",value:function(t,n,i){switch(i){case"regex":return!!Oe&&_t(t,n);case"exact":return n===t;case"contains":var r=e.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return _t(t,r);default:return!1}}},{key:"escapeStringRegexp",value:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),e}(),vi=function(){function e(t){o(this,e),this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return a(e,[{key:"register",value:function(e){var t;Et(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}},{key:"setupActionBasedSurveys",value:function(e){var t=this,n=e.filter((function(e){var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(n=e.conditions)||void 0===n||null===(i=n.actions)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0}));if(0!==n.length){if(null==this.actionMatcher){this.actionMatcher=new pi(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((function(e){t.onAction(e)}))}n.forEach((function(e){var n,i,r,o,s,a,l,u,c,d;e.conditions&&null!==(n=e.conditions)&&void 0!==n&&n.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(r=i.actions)&&void 0!==r&&r.values&&(null===(o=e.conditions)||void 0===o||null===(s=o.actions)||void 0===s||null===(a=s.values)||void 0===a?void 0:a.length)>0&&(null===(l=t.actionMatcher)||void 0===l||l.register(e.conditions.actions.values),null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c||null===(d=c.values)||void 0===d||d.forEach((function(n){if(n&&n.name){var i=t.actionToSurveys.get(n.name);i&&i.push(e.id),t.actionToSurveys.set(n.name,i||[e.id])}})))}))}}},{key:"setupEventBasedSurveys",value:function(e){var t,n=this;if(0!==e.filter((function(e){var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook((function(e,t){n.onEvent(e,t)})),e.forEach((function(e){var t,i,r;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(r=i.values)||void 0===r||r.forEach((function(t){if(t&&t.name){var i=n.eventToSurveys.get(t.name);i&&i.push(e.id),n.eventToSurveys.set(t.name,i||[e.id])}}))}))}}},{key:"onEvent",value:function(t,n){var i,r,o=(null===(i=this.instance)||void 0===i||null===(r=i.persistence)||void 0===r?void 0:r.props[Z])||[];if(e.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var s,a=null==n||null===(s=n.properties)||void 0===s?void 0:s.$survey_id;if(a){var l=o.indexOf(a);l>=0&&(o.splice(l,1),this._updateActivatedSurveys(o))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(o.concat(this.eventToSurveys.get(t)||[]))}},{key:"onAction",value:function(e){var t,n,i=(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n?void 0:n.props[Z])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(e)||[]))}},{key:"_updateActivatedSurveys",value:function(e){var t,n;null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register(l({},Z,d(new Set(e))))}},{key:"getSurveys",value:function(){var e,t,n=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Z];return n||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),e}();l(vi,"SURVEY_SHOWN_EVENT_NAME","survey shown");var _i=Ot("[Surveys]"),gi={icontains:function(e,t){return e.some((function(e){return t.toLowerCase().includes(e.toLowerCase())}))},not_icontains:function(e,t){return e.every((function(e){return!t.toLowerCase().includes(e.toLowerCase())}))},regex:function(e,t){return e.some((function(e){return _t(t,e)}))},not_regex:function(e,t){return e.every((function(e){return!_t(t,e)}))},exact:function(e,t){return e.some((function(e){return t===e}))},is_not:function(e,t){return e.every((function(e){return t!==e}))}};function mi(e,t,n){var i,r=e.questions[t],o=t+1;if(null===(i=r.branching)||void 0===i||!i.type)return t===e.questions.length-1?zt.End:o;if(r.branching.type===zt.End)return zt.End;if(r.branching.type===zt.SpecificQuestion){if(Number.isInteger(r.branching.index))return r.branching.index}else if(r.branching.type===zt.ResponseBased){if(r.type===Wt.SingleChoice){var s,a,l=r.choices.indexOf("".concat(n));if(null!==(s=r.branching)&&void 0!==s&&null!==(a=s.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var u=r.branching.responseValues[l];return Number.isInteger(u)?u:u===zt.End?zt.End:o}}else if(r.type===Wt.Rating){var c,d;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");var f=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(n,r.scale);if(null!==(c=r.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(f)){var h=r.branching.responseValues[f];return Number.isInteger(h)?h:h===zt.End?zt.End:o}}return o}return _i.warn("Falling back to next question index due to unexpected branching type"),o}function yi(e){return null!=e?e:"icontains"}function bi(e){var t,n,i;if(null===(t=e.conditions)||void 0===t||!t.url)return!0;var r=null==Oe||null===(n=Oe.location)||void 0===n?void 0:n.href;if(!r)return!1;var o=[e.conditions.url];return gi[yi(null===(i=e.conditions)||void 0===i?void 0:i.urlMatchType)](o,r)}var ki,wi,Si,xi,Ei=function(){function e(t){o(this,e),l(this,"getNextSurveyStep",mi),this.instance=t,this._surveyEventReceiver=null}return a(e,[{key:"onRemoteConfig",value:function(e){this._decideServerResponse=!!e.surveys,_i.info("decideServerResponse set to ".concat(this._decideServerResponse)),this.loadIfEnabled()}},{key:"reset",value:function(){localStorage.removeItem("lastSeenSurveyDate");var e=function(){for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);null!=n&&n.startsWith(Nt)&&e.push(n)}return e}();e.forEach((function(e){return localStorage.removeItem(e)}))}},{key:"loadIfEnabled",value:function(){var e=this;if(!this._surveyManager)if(this.instance.config.disable_surveys)_i.info("Disabled. Not loading surveys.");else{var t=null==Ze?void 0:Ze.__PosthogExtensions__;if(t){var n=t.generateSurveys;if(this._decideServerResponse)if(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new vi(this.instance)),n)this._surveyManager=n(this.instance);else{var i=t.loadExternalDependency;i?i(this.instance,"surveys",(function(n){var i;n?_i.error("Could not load surveys script",n):e._surveyManager=null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,e.instance)})):_i.error("PostHog loadExternalDependency extension not found. Cannot load remote config.")}else _i.warn("Decide not loaded yet. Not loading surveys.")}else _i.error("PostHog Extensions not found.")}}},{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 _i.info("Disabled. Not loading surveys."),e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new vi(this.instance));var i=this.instance.get_property(G);if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var i,r=n.statusCode;if(200!==r||!n.json)return _i.error("Surveys API could not be loaded, status: ".concat(r)),e([]);var o,s=n.json.surveys||[],a=s.filter((function(e){var t,n,i,r,o,s,a,l,u,c,d,f;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i?void 0:i.values)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d||null===(f=d.values)||void 0===f?void 0:f.length)>0}));a.length>0&&(null===(o=t._surveyEventReceiver)||void 0===o||o.register(a));return null===(i=t.instance.persistence)||void 0===i||i.register(l({},G,s)),e(s)}})}},{key:"isSurveyFeatureFlagEnabled",value:function(e){return!e||this.instance.featureFlags.isFeatureEnabled(e)}},{key:"getActiveMatchingSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((function(n){var i,r=n.filter((function(e){return!(!e.start_date||e.end_date)})).filter((function(e){var t;if(!e.conditions)return!0;var n=bi(e),i=null===(t=e.conditions)||void 0===t||!t.selector||(null==je?void 0:je.querySelector(e.conditions.selector)),r=function(e){var t,n;if(null===(t=e.conditions)||void 0===t||!t.deviceTypes)return!0;if(!Ge)return!1;var i=fi.deviceType(Ge);return gi[yi(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypesMatchType)](e.conditions.deviceTypes,i)}(e);return n&&i&&r})),o=null===(i=t._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),s=r.filter((function(e){var n,i,r,s,a,l,u,c,d;if(!(e.linked_flag_key||e.targeting_flag_key||e.internal_targeting_flag_key||null!==(n=e.feature_flag_keys)&&void 0!==n&&n.length))return!0;var f=t.isSurveyFeatureFlagEnabled(e.linked_flag_key),h=t.isSurveyFeatureFlagEnabled(e.targeting_flag_key),p=(null!==(i=null===(r=e.conditions)||void 0===r||null===(s=r.events)||void 0===s||null===(a=s.values)||void 0===a?void 0:a.length)&&void 0!==i?i:0)>0,v=(null!==(l=null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c||null===(d=c.values)||void 0===d?void 0:d.length)&&void 0!==l?l:0)>0,_=!p&&!v||(null==o?void 0:o.includes(e.id)),g=t._canActivateRepeatedly(e)||t.isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key),m=t.checkFlags(e);return f&&h&&g&&_&&m}));return e(s)}),n)}},{key:"checkFlags",value:function(e){var t,n=this;return null===(t=e.feature_flag_keys)||void 0===t||!t.length||e.feature_flag_keys.every((function(e){var t=e.key,i=e.value;return!t||!i||n.instance.featureFlags.isFeatureEnabled(i)}))}},{key:"_canActivateRepeatedly",value:function(e){var t;return It(null===(t=Ze.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(_i.warn("init was not called"),!1):Ze.__PosthogExtensions__.canActivateRepeatedly(e)}},{key:"canRenderSurvey",value:function(e){var t=this;It(this._surveyManager)?_i.warn("init was not called"):this.getSurveys((function(n){var i=n.filter((function(t){return t.id===e}))[0];t._surveyManager.canRenderSurvey(i)}))}},{key:"renderSurvey",value:function(e,t){var n=this;It(this._surveyManager)?_i.warn("init was not called"):this.getSurveys((function(i){var r=i.filter((function(t){return t.id===e}))[0];n._surveyManager.renderSurvey(r,null==je?void 0:je.querySelector(t))}))}}]),e}(),Ci=0,Ti=[],Pi=[],Ii=_.__b,Fi=_.__r,Ri=_.diffed,Mi=_.__c,Li=_.unmount;function qi(e,t){_.__h&&_.__h(wi,e,Ci||t),Ci=0;var n=wi.__H||(wi.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Pi}),n.__[e]}function $i(e){return Ci=1,function(e,t,n){var i=qi(ki++,2);if(i.t=e,!i.__c&&(i.__=[zi(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=wi,!wi.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};wi.u=!0;var o=wi.shouldComponentUpdate,s=wi.componentWillUpdate;wi.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},wi.shouldComponentUpdate=r}return i.__N||i.__}(zi,e)}function Oi(e,t){var n=qi(ki++,3);!_.__s&&Wi(n.__H,t)&&(n.__=e,n.i=t,wi.__H.__h.push(n))}function Ai(e){return Ci=5,Di((function(){return{current:e}}),[])}function Di(e,t){var n=qi(ki++,7);return Wi(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Ni(e){var t=wi.context[e.__c],n=qi(ki++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(wi)),t.props.value):e.__}function Hi(){for(var e;e=Ti.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ui),e.__H.__h.forEach(Vi),e.__H.__h=[]}catch(t){e.__H.__h=[],_.__e(t,e.__v)}}_.__b=function(e){wi=null,Ii&&Ii(e)},_.__r=function(e){Fi&&Fi(e),ki=0;var t=(wi=e.__c).__H;t&&(Si===wi?(t.__h=[],wi.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Pi,e.__N=e.i=void 0}))):(t.__h.forEach(Ui),t.__h.forEach(Vi),t.__h=[],ki=0)),Si=wi},_.diffed=function(e){Ri&&Ri(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Ti.push(t)&&xi===_.requestAnimationFrame||((xi=_.requestAnimationFrame)||ji)(Hi)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Pi&&(e.__=e.__V),e.i=void 0,e.__V=Pi}))),Si=wi=null},_.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ui),e.__h=e.__h.filter((function(e){return!e.__||Vi(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],_.__e(n,e.__v)}})),Mi&&Mi(e,t)},_.unmount=function(e){Li&&Li(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ui(e)}catch(e){t=e}})),n.__H=void 0,t&&_.__e(t,n.__v))};var Bi="function"==typeof requestAnimationFrame;function ji(e){var t,n=function(){clearTimeout(i),Bi&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Bi&&(t=requestAnimationFrame(n))}function Ui(e){var t=wi,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),wi=t}function Vi(e){var t=wi;e.__c=e.__(),wi=t}function Wi(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function zi(e,t){return"function"==typeof t?t(e):t}var Gi=je;var Zi=0;function Qi(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Zi,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return _.vnode&&_.vnode(u),u}var Yi=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Ji=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Xi=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Ki=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),er=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),tr=Qi("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Qi("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"})}),nr=Qi("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Qi("g",{"clip-path":"url(#clip0_2415_6911)",children:[Qi("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Qi("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Qi("g",{mask:"url(#mask0_2415_6911)",children:[Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"})]})]}),Qi("defs",{children:Qi("clipPath",{id:"clip0_2415_6911",children:Qi("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),ir=Qi("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Qi("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 rr(){return Qi("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",nr]})}function or(e){var t=e.text,n=e.submitDisabled,i=e.appearance,r=e.onSubmit,o=e.link,s=e.onPreviewSubmit,a=Ni(rn),l=a.isPreviewMode,u=a.isPopup,c=i.submitButtonTextColor||Ut(i.submitButtonColor||Gt.submitButtonColor);return Qi("div",{className:"bottom-section",children:[Qi("div",{className:"buttons",children:Qi("button",{className:"form-submit",disabled:n&&!l,type:"button",style:u?{color:c}:{},onClick:function(){l?null==s||s():(o&&(null==Oe||Oe.open(o)),r())},children:t})}),!i.whiteLabel&&Qi(rr,{})]})}function sr(e){var t=e.question,n=e.description,i=e.descriptionContentType,r=e.backgroundColor,o=e.forceDisableHtml;return Qi("div",{style:Ni(rn).isPopup?{backgroundColor:r||Gt.backgroundColor}:{},children:[Qi("div",{className:"survey-question",children:t}),n&&on({component:fe("div",{className:"survey-question-description"}),children:n,renderAsHtml:!o&&"text"!==i})]})}function ar(e){var t=e.onClick,n=Ni(rn).isPreviewMode;return Qi("div",{className:"cancel-btn-wrapper",onClick:t,disabled:n,children:Qi("button",{className:"form-cancel",onClick:t,disabled:n,children:tr})})}function lr(e){var n=e.header,i=e.description,r=e.contentType,o=e.forceDisableHtml,s=e.appearance,a=e.onClose,l=e.styleOverrides,u=Ut(s.backgroundColor||Gt.backgroundColor),c=Ni(rn).isPopup;return Qi(pe,{children:Qi("div",{className:"thank-you-message",style:t({},l),children:Qi("div",{className:"thank-you-message-container",children:[c&&Qi(ar,{onClick:function(){return a()}}),Qi("h3",{className:"thank-you-message-header",style:{color:u},children:n}),i&&on({component:fe("div",{className:"thank-you-message-body"}),children:i,renderAsHtml:!o&&"text"!==r,style:{color:u}}),c&&Qi(or,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:function(){return a()}})]})})})}function ur(e){var t,n=Ai(null),i=c($i(null!==(t=e.defaultTextColor)&&void 0!==t?t:"black"),2),r=i[0],o=i[1];return Oi((function(){if(n.current){var e=function(e){var t=At.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 i=parseInt(n[1]),r=parseInt(n[2]),o=parseInt(n[3]);return Math.sqrt(i*i*.299+r*r*.587+o*o*.114)>127.5?"black":"white"}(n.current);o(e)}}),[e.appearance,e.forceUpdate]),{ref:n,textColor:r}}function cr(e){var t=e.question,n=e.forceDisableHtml,i=e.appearance,r=e.onSubmit,o=e.onPreviewSubmit,s=Ai(null),a=c($i(""),2),l=a[0],u=a[1];return Qi("div",{ref:s,children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,backgroundColor:i.backgroundColor,forceDisableHtml:n}),Qi("textarea",{rows:4,placeholder:null==i?void 0:i.placeholder,onInput:function(e){return u(e.currentTarget.value)}}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:!l&&!t.optional,appearance:i,onSubmit:function(){return r(l)},onPreviewSubmit:function(){return o(l)}})]})}function dr(e){var t=e.question,n=e.forceDisableHtml,i=e.appearance,r=e.onSubmit,o=e.onPreviewSubmit;return Qi(pe,{children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:function(){return r("link clicked")},onPreviewSubmit:function(){return o("link clicked")}})]})}function fr(e){var t=e.question,n=e.forceDisableHtml,i=e.displayQuestionIndex,r=e.appearance,o=e.onSubmit,s=e.onPreviewSubmit,a=t.scale,l=10===t.scale?0:1,u=c($i(null),2),d=u[0],f=u[1];return Qi(pe,{children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),Qi("div",{className:"rating-section",children:[Qi("div",{className:"rating-options",children:["emoji"===t.display&&Qi("div",{className:"rating-options-emoji",children:(3===t.scale?vr:_r).map((function(e,t){var n=t+1===d;return Qi("button",{className:"ratings-emoji question-".concat(i,"-rating-").concat(t," ").concat(n?"rating-active":null),value:t+1,type:"button",onClick:function(){f(t+1)},style:{fill:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:e},t)}))}),"number"===t.display&&Qi("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat(".concat(a-l+1,", minmax(0, 1fr))")},children:br(t.scale).map((function(e,t){return Qi(hr,{displayQuestionIndex:i,active:d===e,appearance:r,num:e,setActiveNumber:function(e){f(e)}},t)}))})]}),Qi("div",{className:"rating-text",children:[Qi("div",{children:t.lowerBoundLabel}),Qi("div",{children:t.upperBoundLabel})]})]}),Qi(or,{text:t.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:Pt(d)&&!t.optional,appearance:r,onSubmit:function(){return o(d)},onPreviewSubmit:function(){return s(d)}})]})}function hr(e){var t=e.num,n=e.active,i=e.displayQuestionIndex,r=e.appearance,o=e.setActiveNumber,s=ur({appearance:r,defaultTextColor:"black",forceUpdate:n}),a=s.textColor;return Qi("button",{ref:s.ref,className:"ratings-number question-".concat(i,"-rating-").concat(t," ").concat(n?"rating-active":null),type:"button",onClick:function(){o(t)},style:{color:a,backgroundColor:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:t})}function pr(e){var t=e.question,n=e.forceDisableHtml,i=e.displayQuestionIndex,r=e.appearance,o=e.onSubmit,s=e.onPreviewSubmit,a=Ai(null),l=Di((function(){return function(e){if(!e.shuffleOptions)return e.choices;var t=e.choices,n="";e.hasOpenChoice&&(n=t.pop());var i=Xt(t,Jt(t));return e.hasOpenChoice&&(e.choices.push(n),i.push(n)),i}(t)}),[t]),u=c($i(t.type===Wt.MultipleChoice?[]:null),2),f=u[0],h=u[1],p=c($i(!1),2),v=p[0],_=p[1],g=c($i(""),2),m=g[0],y=g[1],b=t.type===Wt.SingleChoice?"radio":"checkbox";return Qi("div",{ref:a,children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),Qi("div",{className:"multiple-choice-options",children:l.map((function(e,n){var r="choice-option",o=e,s=e;return t.hasOpenChoice&&n===t.choices.length-1&&(r+=" choice-option-open"),Qi("div",{className:r,children:[Qi("input",{type:b,id:"surveyQuestion".concat(i,"Choice").concat(n),name:"question".concat(i),value:o,disabled:!o,onInput:function(){return t.hasOpenChoice&&n===t.choices.length-1?_(!v):t.type===Wt.SingleChoice?h(o):t.type===Wt.MultipleChoice&&kt(f)?f.includes(o)?h(f.filter((function(e){return e!==o}))):h([].concat(d(f),[o])):void 0}}),Qi("label",{htmlFor:"surveyQuestion".concat(i,"Choice").concat(n),style:{color:"black"},children:t.hasOpenChoice&&n===t.choices.length-1?Qi(pe,{children:[Qi("span",{children:[s,":"]}),Qi("input",{type:"text",id:"surveyQuestion".concat(i,"Choice").concat(n,"Open"),name:"question".concat(i),onInput:function(e){var n=e.currentTarget.value;return t.type===Wt.SingleChoice?h(n):t.type===Wt.MultipleChoice&&kt(f)?y(n):void 0}})]}):s}),Qi("span",{className:"choice-check",style:{color:"black"},children:ir})]})}))}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:(Pt(f)||kt(f)&&!v&&0===f.length||kt(f)&&v&&!m&&0===f.length&&!t.optional)&&!t.optional,appearance:r,onSubmit:function(){v&&t.type===Wt.MultipleChoice?kt(f)&&o([].concat(d(f),[m])):o(f)},onPreviewSubmit:function(){v&&t.type===Wt.MultipleChoice?kt(f)&&s([].concat(d(f),[m])):s(f)}})]})}var vr=[Xi,Ji,Yi],_r=[Ki,Xi,Ji,Yi,er],gr=[1,2,3,4,5],mr=[1,2,3,4,5,6,7],yr=[0,1,2,3,4,5,6,7,8,9,10];function br(e){switch(e){case 5:default:return gr;case 7:return mr;case 10:return yr}}var kr=Ot("[Surveys]"),wr=Oe,Sr=je,xr=function(){function e(t){var n=this;o(this,e),l(this,"canShowNextEventBasedSurvey",(function(){var e,t=Sr.querySelectorAll("div[class^=PostHogSurvey]");return!(t.length>0)||1===(null===(e=t[t.length-1].shadowRoot)||void 0===e?void 0:e.childElementCount)})),l(this,"handlePopoverSurvey",(function(e){var t,i=null===(t=e.conditions)||void 0===t?void 0:t.seenSurveyWaitPeriodInDays,r=localStorage.getItem("lastSeenSurveyDate");if(i&&r){var o=new Date,s=Math.abs(o.getTime()-new Date(r).getTime());if(Math.ceil(s/864e5)<i)return}var a=function(e){return!!localStorage.getItem(tn(e))&&!en(e)}(e);if(!a){n.addSurveyToFocus(e.id);var l=function(e,t,n){var i=Dt.createElement("div");i.className="PostHogSurvey".concat(t);var r=i.attachShadow({mode:"open"});if(e){var o=Object.assign(Dt.createElement("style"),{innerText:e});r.appendChild(o)}return Dt.body.appendChild(i),r}(Bt(null==e?void 0:e.appearance),e.id);Le(Qi(Cr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus,isPopup:!0},"popover-survey"),l)}})),l(this,"handleWidget",(function(e){var t=function(e){var t,n=Gi.createElement("div");n.className="PostHogWidget".concat(e.id);var i,r=n.attachShadow({mode:"open"}),o=(i=null===(t=e.appearance)||void 0===t?void 0:t.widgetColor,"\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ".concat(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 "));return r.append(Object.assign(Gi.createElement("style"),{innerText:o})),Gi.body.appendChild(n),r}(e),i=Bt(e.appearance);t.appendChild(Object.assign(Sr.createElement("style"),{innerText:i})),Le(Qi(Pr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus},"feedback-survey"),t)})),l(this,"handleWidgetSelector",(function(e){var t,i=(null===(t=e.appearance)||void 0===t?void 0:t.widgetSelector)&&Sr.querySelector(e.appearance.widgetSelector);if(i)if(0===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length)n.handleWidget(e);else if(1===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length&&!i.getAttribute("PHWidgetSurveyClickListener")){var r,o,s=null===(r=Sr.querySelector(".PostHogWidget".concat(e.id)))||void 0===r||null===(o=r.shadowRoot)||void 0===o?void 0:o.querySelector(".survey-form");ft(i,"click",(function(){s&&(s.style.display="none"===s.style.display?"block":"none",ft(s,"PHSurveyClosed",(function(){n.removeSurveyFromFocus(e.id),s.style.display="none"})))})),i.setAttribute("PHWidgetSurveyClickListener","true")}})),l(this,"canRenderSurvey",(function(e){var t={visible:!1};return e.end_date?(t.disabledReason="survey was completed on ".concat(e.end_date),t):e.type!=Vt.Popover?(t.disabledReason="Only Popover survey types can be rendered",t):!e.linked_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.linked_flag_key)?!e.targeting_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.targeting_flag_key)?!e.internal_targeting_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key)?(t.visible=!0,t):(t.disabledReason="internal targeting feature flag ".concat(e.internal_targeting_flag_key," is false"),t):(t.disabledReason="targeting feature flag ".concat(e.targeting_flag_key," is false"),t):(t.disabledReason="linked feature flag ".concat(e.linked_flag_key," is false"),t)})),l(this,"renderSurvey",(function(e,t){Le(Qi(Cr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus,isPopup:!1},"popover-survey"),t)})),l(this,"callSurveysAndEvaluateDisplayLogic",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=n.posthog)||void 0===e||e.getActiveMatchingSurveys((function(e){var t=e.filter((function(e){return"api"!==e.type}));n.sortSurveysByAppearanceDelay(t).forEach((function(e){if(Pt(n.surveyInFocus)&&bi(e)){var t,i,r;if(e.type===Vt.Widget)"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&0===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length&&n.handleWidget(e),"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&null!==(r=e.appearance)&&void 0!==r&&r.widgetSelector&&n.handleWidgetSelector(e);e.type===Vt.Popover&&n.canShowNextEventBasedSurvey()&&n.handlePopoverSurvey(e)}}))}),t)})),l(this,"addSurveyToFocus",(function(e){Pt(n.surveyInFocus)||kr.error("Survey ".concat(d(n.surveyInFocus)," already in focus. Cannot add survey ").concat(e,".")),n.surveyInFocus=e})),l(this,"removeSurveyFromFocus",(function(e){n.surveyInFocus!==e&&kr.error("Survey ".concat(e," is not in focus. Cannot remove survey ").concat(e,".")),n.surveyInFocus=null})),this.posthog=t,this.surveyInFocus=null}return a(e,[{key:"sortSurveysByAppearanceDelay",value:function(e){return e.sort((function(e,t){var n,i;return((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)}))}},{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}}}]),e}();function Er(e){if(Sr&&wr){var t=new xr(e);return t.callSurveysAndEvaluateDisplayLogic(!0),setInterval((function(){t.callSurveysAndEvaluateDisplayLogic(!1)}),1e3),t}}function Cr(e){var n,i,r,o,s,a,l=e.survey,u=e.forceDisableHtml,d=e.posthog,f=e.style,h=e.previewPageIndex,p=e.removeSurveyFromFocus,v=e.isPopup,_=e.onPreviewSubmit,g=void 0===_?function(){}:_,m=Number.isInteger(h),y=null!==(n=l.appearance)&&void 0!==n&&n.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,b=function(e,t,n,i,r){var o=c($i(i||0===n),2),s=o[0],a=o[1],l=c($i(!1),2),u=l[0],d=l[1];return Oi((function(){if(t){if(!i){var o,s=function(){r(e.id),a(!1)},l=function(){var t,n;null!==(t=e.appearance)&&void 0!==t&&t.displayThankYouMessage?(d(!0),r(e.id),null!==(n=e.appearance)&&void 0!==n&&n.autoDisappear&&setTimeout((function(){a(!1)}),5e3)):(r(e.id),a(!1))},u=function(){var n;a(!0),wr.dispatchEvent(new Event("PHSurveyShown")),t.capture("survey shown",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(n=t.get_session_replay_url)||void 0===n?void 0:n.call(t)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())};return ft(wr,"PHSurveyClosed",s),ft(wr,"PHSurveySent",l),n>0?(o=setTimeout((function(){u()}),n),function(){clearTimeout(o),wr.removeEventListener("PHSurveyClosed",s),wr.removeEventListener("PHSurveySent",l)}):(u(),function(){wr.removeEventListener("PHSurveyClosed",s),wr.removeEventListener("PHSurveySent",l)})}}else kr.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Oi((function(){var t;if(!i&&null!==(t=e.conditions)&&void 0!==t&&t.url){var n=function(){bi(e)||(a(!1),r(e.id))};ft(wr,"popstate",n),ft(wr,"hashchange",n);var o=wr.history.pushState,s=wr.history.replaceState;return wr.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];o.apply(this,t),n()},wr.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.apply(this,t),n()},function(){wr.removeEventListener("popstate",n),wr.removeEventListener("hashchange",n),wr.history.pushState=o,wr.history.replaceState=s}}}),[i,e,r]),{isPopupVisible:s,isSurveySent:u,setIsPopupVisible:a}}(l,d,y,m,p),k=b.isPopupVisible,w=b.isSurveySent,S=b.setIsPopupVisible,x=w||h===l.questions.length,E=null!==(i=f)&&void 0!==i&&i.left&&Ft(null===(r=f)||void 0===r?void 0:r.left)?{left:f.left-40}:{};return m&&((f=f||{}).left="unset",f.right="unset",f.transform="unset"),k?Qi(rn.Provider,{value:{isPreviewMode:m,previewPageIndex:h,handleCloseSurveyPopup:function(){return Yt(l,d,m)},isPopup:v||!1,onPreviewSubmit:g},children:x?Qi(lr,{header:(null===(o=l.appearance)||void 0===o?void 0:o.thankYouMessageHeader)||"Thank you!",description:(null===(s=l.appearance)||void 0===s?void 0:s.thankYouMessageDescription)||"",forceDisableHtml:!!u,contentType:null===(a=l.appearance)||void 0===a?void 0:a.thankYouMessageDescriptionContentType,appearance:l.appearance||Gt,styleOverrides:t(t({},f),E),onClose:function(){return S(!1)}}):Qi(Tr,{survey:l,forceDisableHtml:!!u,posthog:d,styleOverrides:f})}):null}function Tr(e){var n,i,r=e.survey,o=e.forceDisableHtml,s=e.posthog,a=e.styleOverrides,u=Ut((null===(n=r.appearance)||void 0===n?void 0:n.backgroundColor)||Gt.backgroundColor),d=c($i({}),2),f=d[0],h=d[1],p=Ni(rn),v=p.isPreviewMode,_=p.previewPageIndex,g=p.handleCloseSurveyPopup,m=p.isPopup,y=p.onPreviewSubmit,b=c($i(_||0),2),k=b[0],w=b[1],S=Di((function(){return Kt(r)}),[r]);Oi((function(){w(null!=_?_:0)}),[_]);return Qi("form",{className:"survey-form",style:m?t({color:u,borderColor:null===(i=r.appearance)||void 0===i?void 0:i.borderColor},a):{},children:S.map((function(e,n){var i,a=e.originalQuestionIndex;return(v?k===a:k===n)&&Qi("div",{className:"survey-box",style:m?{backgroundColor:(null===(i=r.appearance)||void 0===i?void 0:i.backgroundColor)||Gt.backgroundColor}:{},children:[m&&Qi(ar,{onClick:function(){return g()}}),Ir({question:e,forceDisableHtml:o,displayQuestionIndex:n,appearance:r.appearance||Gt,onSubmit:function(e){return function(e){var n=e.res,i=e.originalQuestionIndex,o=e.displayQuestionIndex;if(s){var a=0===i?"$survey_response":"$survey_response_".concat(i);if(h(t(t({},f),{},l({},a,n))),s.getNextSurveyStep){var u=s.getNextSurveyStep(r,o,n);u===zt.End?Qt(t(t({},f),{},l({},a,n)),r,s):w(u)}else o===r.questions.length-1?Qt(t(t({},f),{},l({},a,n)),r,s):w(o+1)}else kr.error("onNextButtonClick called without a PostHog instance.")}({res:e,originalQuestionIndex:a,displayQuestionIndex:n})},onPreviewSubmit:y})]})}))})}function Pr(e){var t,n,i=e.survey,r=e.forceDisableHtml,o=e.posthog,s=e.readOnly,a=e.removeSurveyFromFocus,l=c($i(!1),2),u=l[0],d=l[1],f=c($i({}),2),h=f[0],p=f[1],v=Ai(null);return Oi((function(){var e,t;if(o){if(!s){if("tab"===(null===(e=i.appearance)||void 0===e?void 0:e.widgetType)&&v.current){var n,r=v.current.getBoundingClientRect(),a={top:"50%",left:parseInt("".concat(r.right-360)),bottom:"auto",borderRadius:10,borderBottom:"1.5px solid ".concat((null===(n=i.appearance)||void 0===n?void 0:n.borderColor)||"#c9c6c6")};p(a)}if("selector"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)){var l,c=null!==(l=Sr.querySelector(i.appearance.widgetSelector||""))&&void 0!==l?l:void 0;ft(c,"click",(function(){d(!u)})),null==c||c.setAttribute("PHWidgetSurveyClickListener","true")}}}else kr.error("FeedbackWidget called without a PostHog instance.")}),[]),Qi(pe,{children:["tab"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)&&Qi("div",{className:"ph-survey-widget-tab",ref:v,onClick:function(){return!s&&d(!u)},style:{color:Ut(i.appearance.widgetColor)},children:[Qi("div",{className:"ph-survey-widget-tab-icon"}),(null===(n=i.appearance)||void 0===n?void 0:n.widgetLabel)||""]}),u&&Qi(Cr,{posthog:o,survey:i,forceDisableHtml:r,style:h,removeSurveyFromFocus:a,isPopup:!0},"feedback-widget-survey")]})}var Ir=function(e){var n,i,r=e.question,o=e.forceDisableHtml,s=e.displayQuestionIndex,a=e.appearance,u=e.onSubmit,c=e.onPreviewSubmit,d=(l(n={},Wt.Open,cr),l(n,Wt.Link,dr),l(n,Wt.Rating,fr),l(n,Wt.SingleChoice,pr),l(n,Wt.MultipleChoice,pr),n),f={question:r,forceDisableHtml:o,appearance:a,onPreviewSubmit:function(e){c(e)},onSubmit:function(e){u(e)}},h=(l(i={},Wt.Open,{}),l(i,Wt.Link,{}),l(i,Wt.Rating,{displayQuestionIndex:s}),l(i,Wt.SingleChoice,{displayQuestionIndex:s}),l(i,Wt.MultipleChoice,{displayQuestionIndex:s}),i),p=d[r.type],v=t(t({},f),h[r.type]);return Qi(p,t({},v))};function Fr(e){return!Et(Event)&&Rr(e,Event)}function Rr(e,t){try{return e instanceof t}catch(e){return!1}}function Mr(e){return Pt(e)||!St(e)&&!wt(e)}function Lr(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function qr(e){return Lr(e,"DOMError")}Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{},Ze.__PosthogExtensions__.canActivateRepeatedly=en,Ze.__PosthogExtensions__.generateSurveys=Er,Ze.extendPostHogWithSurveys=Er;var $r=/\(error: (.*)\)/,Or=50,Ar="?";function Dr(e,t,n,i){var r={platform:"web:javascript",filename:e,function:"<anonymous>"===t?Ar:t,in_app:!0};return Et(n)||(r.lineno=n),Et(i)||(r.colno=i),r}var Nr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Br=/\((\S*)(?::(\d+))(?::(\d+))\)/,jr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ur=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vr=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=n.sort((function(e,t){return e[0]-t[0]})).map((function(e){return e[1]}));return function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=[],o=e.split("\n"),s=n;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var l=$r.test(a)?a.replace($r,"$1"):a;if(!l.match(/\S*Error: /)){var u,c=p(r);try{for(c.s();!(u=c.n()).done;){var d=(0,u.value)(l);if(d){i.push(d);break}}}catch(e){c.e(e)}finally{c.f()}if(i.length>=Or)break}}}return function(e){if(!e.length)return[];var n=Array.from(e);return n.reverse(),n.slice(0,Or).map((function(e){return t(t({},e),{},{filename:e.filename||Wr(n).filename,function:e.function||Ar})}))}(i)}}.apply(void 0,[[30,function(e){var t=Nr.exec(e);if(t){var n=c(t,4),i=n[1],r=n[2],o=n[3];return Dr(i,Ar,+r,+o)}var s=Hr.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var a=Br.exec(s[2]);a&&(s[2]=a[1],s[3]=a[2],s[4]=a[3])}var l=c(zr(s[1]||Ar,s[2]),2),u=l[0];return Dr(l[1],u,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,function(e){var t=jr.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=Ur.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var i=t[3],r=t[1]||Ar,o=c(zr(r,i),2);return r=o[0],Dr(i=o[1],r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]);function Wr(e){return e[e.length-1]||{}}var zr=function(e,t){var n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:Ar,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Gr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Zr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e.stacktrace||e.stack||"",i=function(e){if(e&&Qr.test(e.message))return 1;return 0}(e);try{var r=Vr(n,i);return r.slice(0,r.length-t)}catch(e){}return[]}var Qr=/Minified React error #\d+;/i;function Yr(e,t){var n,i,r=Zr(e),o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null!==(i=null==t?void 0:t.synthetic)&&void 0!==i&&i;return{$exception_list:[{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:function(e){var t=e.message;if(t.error&&"string"==typeof t.error.message)return t.error.message;return t}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:o,synthetic:s}}],$exception_level:"error"}}function Jr(e,t){var n,i,r,o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(r=null==t?void 0:t.defaultExceptionType)&&void 0!==r?r:"Error",value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:s}};if(null!=t&&t.syntheticException){var l=Zr(t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function Xr(e){return Ct(e)&&!Tt(e)&&Xe.indexOf(e)>=0}function Kr(e,t){var n,i,r=null===(n=null==t?void 0:t.handled)||void 0===n||n,o=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,s=null!=t&&t.overrideExceptionType?t.overrideExceptionType:Fr(e)?e.constructor.name:"Error",a=null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var r=n.slice(0,i).join(", ");if(!(r.length>t))return i===n.length||r.length<=t?r:"".concat(r.slice(0,t),"...")}return""}(e)),l={type:s,value:a,mechanism:{handled:r,synthetic:o}};if(null!=t&&t.syntheticException){var u=Zr(null==t?void 0:t.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Xr(e.level)?e.level:"error"}}function eo(e,n){var i=e.error,r=e.event,o={$exception_list:[]},s=i||r;if(qr(s)||function(e){return Lr(e,"DOMException")}(s)){var a=s;if(function(e){return"stack"in e}(s))o=Yr(s,n);else{var l=a.name||(qr(a)?"DOMError":"DOMException"),u=a.message?"".concat(l,": ").concat(a.message):l,c=qr(a)?"DOMError":"DOMException";o=Jr(u,t(t({},n),{},{overrideExceptionType:c,defaultExceptionMessage:u}))}return"code"in a&&(o.$exception_DOMException_code="".concat(a.code)),o}if(function(e){return Lr(e,"ErrorEvent")}(s)&&s.error)return Yr(s.error,n);if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Rr(e,Error)}}(s))return Yr(s,n);if(function(e){return Lr(e,"Object")}(s)||Fr(s))return Kr(s,n);if(Et(i)&&Ct(r)){var d="Error",f=r,h=r.match(Gr);return h&&(d=h[1],f=h[2]),Jr(f,t(t({},n),{},{overrideExceptionType:d,defaultExceptionMessage:f}))}return Jr(s,n)}function to(e){var t=function(e){if(Mr(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}(c(e,1)[0]);return Mr(t)?Jr("Non-Error promise rejection captured with value: ".concat(String(t)),{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):eo({event:t},{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(t)})}var no=Ot("[ExceptionAutocapture]"),io={wrapOnError:function(e){var t=Oe;t||no.info("window not available, cannot wrap onerror");var n=t.onerror;return t.onerror=function(){for(var t,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];var s=eo({event:r[0],error:r[4]});return e(s),null!==(t=null==n?void 0:n.apply(void 0,r))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,function(){var e;null===(e=t.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=n}},wrapUnhandledRejection:function(e){var t=Oe;t||no.info("window not available, cannot wrap onUnhandledRejection");var n=t.onunhandledrejection;return t.onunhandledrejection=function(){for(var i,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=to(o);return e(a),null!==(i=null==n?void 0:n.apply(t,o))&&void 0!==i&&i},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,function(){var e;null===(e=t.onunhandledrejection)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=n}}};function ro(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return wt(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,function(){e[t]=i}}catch(e){return function(){}}}Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{},Ze.__PosthogExtensions__.errorWrappingFunctions=io,Ze.__PosthogExtensions__.parseErrorAsProperties=eo,Ze.posthogErrorWrappingFunctions=io,Ze.parseErrorAsProperties=eo;var oo=function(e,t){if(e){var n=e.checkAndGetSessionAndWindowId(!0),i=n.sessionId,r=n.windowId;t.headers.set("X-POSTHOG-SESSION-ID",i),t.headers.set("X-POSTHOG-WINDOW-ID",r)}};Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{};var so={_patchFetch:function(e){return ro(Oe,"fetch",(function(t){return function(){var i,o=(i=n().mark((function i(r,o){var s;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=new Request(r,o),oo(e,s),n.abrupt("return",t(s));case 3:case"end":return n.stop()}}),i)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var s=i.apply(e,t);function a(e){r(s,n,o,a,l,"next",e)}function l(e){r(s,n,o,a,l,"throw",e)}a(void 0)}))});return function(e,t){return o.apply(this,arguments)}}()}))},_patchXHR:function(e){return ro(Oe.XMLHttpRequest.prototype,"open",(function(t){return function(n,i){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,a=new Request(i);return oo(e,a),t.call(this,n,a.url,r,o,s)}}))}};Ze.__PosthogExtensions__.tracingHeadersPatchFns=so,Ze.postHogTracingHeadersPatchFns=so;var ao=Ot("[FeatureFlags]"),lo="$active_feature_flags",uo="$override_feature_flags",co="$feature_flag_payloads",fo="$override_feature_flag_payloads",ho=function(e){var t,n={},i=p(rt(e||{}));try{for(i.s();!(t=i.n()).done;){var r=c(t.value,2),o=r[0],s=r[1];s&&(n[o]=s)}}catch(e){i.e(e)}finally{i.f()}return n},po=function(){function e(t){o(this,e),l(this,"_override_warning",!1),l(this,"_hasLoadedFlags",!1),l(this,"_requestInFlight",!1),l(this,"_reloadingDisabled",!1),l(this,"_additionalReloadRequested",!1),l(this,"_decideCalled",!1),l(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}return a(e,[{key:"decide",value:function(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}},{key:"hasLoadedFlags",get:function(){return this._hasLoadedFlags}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(U),t=this.instance.get_property(uo);if(!t)return e||{};for(var n=nt({},e),i=Object.keys(t),r=0;r<i.length;r++)n[i[r]]=t[i[r]];return this._override_warning||(ao.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.instance.get_property(co),t=this.instance.get_property(fo);if(!t)return e||{};for(var n=nt({},e||{}),i=Object.keys(t),r=0;r<i.length;r++)n[i[r]]=t[i[r]];return this._override_warning||(ao.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this._override_warning=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((function(){e._callDecideEndpoint()}),5))}},{key:"clearDebouncer",value:function(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}},{key:"ensureFlagsLoaded",value:function(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this._reloadingDisabled=e}},{key:"_callDecideEndpoint",value:function(e){var t=this;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var n={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:this.instance.get_property(W),group_properties:this.instance.get_property(z)};(null!=e&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:n,compression:this.instance.config.disable_compression?void 0:$e.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(e){var i,r,o=!0;(200===e.statusCode&&(t.$anon_distinct_id=void 0,o=!1),t._requestInFlight=!1,t._decideCalled)||(t._decideCalled=!0,t.instance._onRemoteConfig(null!==(r=e.json)&&void 0!==r?r:{}));n.disable_flags||(t._flagsLoadedFromRemote=!o,t.receivedFeatureFlags(null!==(i=e.json)&&void 0!==i?i:{},o),t._additionalReloadRequested&&(t._additionalReloadRequested=!1,t._callDecideEndpoint()))}})}}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var n,i,r,o,s,a=this.getFlagVariants()[e],u="".concat(a),c=this.instance.get_property(Q)||{};if(t.send_event||!("send_event"in t))if(!(e in c)||!c[e].includes(u))kt(c[e])?c[e].push(u):c[e]=[u],null===(n=this.instance.persistence)||void 0===n||n.register(l({},Q,c)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_bootstrapped_response:(null===(i=this.instance.config.bootstrap)||void 0===i||null===(r=i.featureFlags)||void 0===r?void 0:r[e])||null,$feature_flag_bootstrapped_payload:(null===(o=this.instance.config.bootstrap)||void 0===o||null===(s=o.featureFlagPayloads)||void 0===s?void 0:s[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote});return a}ao.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._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);ao.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._hasLoadedFlags=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e.featureFlags,a=e.featureFlagPayloads;if(s)if(kt(s)){var u,c={};if(s)for(var d=0;d<s.length;d++)c[s[d]]=!0;n&&n.register((l(u={},lo,s),l(u,U,c),u))}else{var f=s,h=a;e.errorsWhileComputingFlags&&(f=t(t({},r),f),h=t(t({},o),h)),n&&n.register((l(i={},lo,Object.keys(ho(f))),l(i,U,f||{}),l(i,co,h||{}),i))}}(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks(n)}}},{key:"override",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ao.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return ao.uninitializedWarning("posthog.feature_flags.overrideFeatureFlags");if(!1===e)return this.instance.persistence.unregister(uo),this.instance.persistence.unregister(fo),void this._fireFeatureFlagsCallbacks();if(e&&"object"===i(e)&&("flags"in e||"payloads"in e)){var t,n=e;if(this._override_warning=Boolean(null!==(t=n.suppressWarning)&&void 0!==t&&t),"flags"in n)if(!1===n.flags)this.instance.persistence.unregister(uo);else if(n.flags)if(kt(n.flags)){for(var r={},o=0;o<n.flags.length;o++)r[n.flags[o]]=!0;this.instance.persistence.register(l({},uo,r))}else this.instance.persistence.register(l({},uo,n.flags));return"payloads"in n&&(!1===n.payloads?this.instance.persistence.unregister(fo):n.payloads&&this.instance.persistence.register(l({},fo,n.payloads))),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var n=this._prepareFeatureFlagsForCallbacks(),i=n.flags,r=n.flagVariants;e(i,r)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,n){var i,r,o=(this.instance.get_property(V)||[]).find((function(t){return t.flagKey===e})),s=l({},"$feature_enrollment/".concat(e),n),a={$feature_flag:e,$feature_enrollment:n,$set:s};o&&(a.$early_access_feature_name=o.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var u=t(t({},this.getFlagVariants()),{},l({},e,n));null===(i=this.instance.persistence)||void 0===i||i.register((l(r={},lo,Object.keys(ho(u))),l(r,U,u),r)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.instance.get_property(V);if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var i;if(n.json){var r=n.json.earlyAccessFeatures;return null===(i=t.instance.persistence)||void 0===i||i.register(l({},V,r)),e(r)}}})}},{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,i=t.flagVariants;this.featureFlagEventHandlers.forEach((function(t){return t(n,i,{errorsLoading:e})}))}},{key:"setPersonPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(W)||{};this.instance.register(l({},W,t(t({},i),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(W)}},{key:"setGroupPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(z)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((function(n){i[n]=t(t({},i[n]),e[n]),delete e[n]})),this.instance.register(l({},z,t(t({},i),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var n=this.instance.get_property(z)||{};this.instance.register(l({},z,t(t({},n),{},l({},e,{}))))}else this.instance.unregister(z)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ft(e)&&isFinite(e)&&Math.floor(e)===e});var vo="0123456789abcdef",_o=function(){function e(t){if(o(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return a(e,[{key:"toString",value:function(){for(var e="",t=0;t<this.bytes.length;t++)e=e+vo.charAt(this.bytes[t]>>>4)+vo.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,i,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(r)||t<0||n<0||i<0||r<0||t>0xffffffffffff||n>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=r>>>24,o[13]=r>>>16,o[14]=r>>>8,o[15]=r,new e(o)}}]),e}(),go=function(){function e(){o(this,e),l(this,"timestamp",0),l(this,"counter",0),l(this,"random",new bo)}return a(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Et(e)){this.timestamp=0;var t=this.generateOrAbort();if(Et(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return _o.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),mo=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Oe&&!Et(Oe.crypto)&&crypto.getRandomValues&&(mo=function(e){return crypto.getRandomValues(e)});var yo,bo=function(){function e(){o(this,e),l(this,"buffer",new Uint32Array(8)),l(this,"cursor",1/0)}return a(e,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(mo(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),ko=function(){return wo().toString()},wo=function(){return(yo||(yo=new go)).generate()},So="Thu, 01 Jan 1970 00:00:00 GMT",xo="";var Eo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Co(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:je;if(xo)return xo;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),r="dmn_chk_"+ko(),o=new RegExp("(^|;)\\s*"+r+"=1");!xo&&i--;){var s=n.slice(i).join("."),a=r+"=1;domain=."+s;t.cookie=a,o.test(t.cookie)&&(t.cookie=a+";expires="+So,xo=s)}return xo}(e);if(!n){var i=function(e){var t=e.match(Eo);return t?t[0]:""}(e);i!==n&&$t.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}return""}var To={is_supported:function(){return!!je},error:function(e){$t.error("cookieStore error: "+e)},get:function(e){if(je){try{for(var t=e+"=",n=je.cookie.split(";").filter((function(e){return e.length})),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},parse:function(e){var t;try{t=JSON.parse(To.get(e))||{}}catch(e){}return t},set:function(e,t,n,i,r){if(je)try{var o="",s="",a=Co(je.location.hostname,i);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),o="; expires="+l.toUTCString()}r&&(s="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+a+s;return u.length>3686.4&&$t.warn("cookieStore warning: large cookie, len="+u.length),je.cookie=u,u}catch(e){return}},remove:function(e,t){try{To.set(e,"",-1,t)}catch(e){return}}},Po=null,Io={is_supported:function(){if(!Pt(Po))return Po;var e=!0;if(Et(Oe))e=!1;else try{var t="__mplssupport__";Io.set(t,"xyz"),'"xyz"'!==Io.get(t)&&(e=!1),Io.remove(t)}catch(t){e=!1}return e||$t.error("localStorage unsupported; falling back to cookie store"),Po=e,e},error:function(e){$t.error("localStorage error: "+e)},get:function(e){try{return null==Oe?void 0:Oe.localStorage.getItem(e)}catch(e){Io.error(e)}return null},parse:function(e){try{return JSON.parse(Io.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==Oe||Oe.localStorage.setItem(e,JSON.stringify(t))}catch(e){Io.error(e)}},remove:function(e){try{null==Oe||Oe.localStorage.removeItem(e)}catch(e){Io.error(e)}}},Fo=["distinct_id",N,H,ne,te],Ro=t(t({},Io),{},{parse:function(e){try{var t={};try{t=To.parse(e)||{}}catch(e){}var n=nt(t,JSON.parse(Io.get(e)||"{}"));return Io.set(e,n),n}catch(e){}return null},set:function(e,t,n,i,r,o){try{Io.set(e,t,void 0,void 0,o);var s={};Fo.forEach((function(e){t[e]&&(s[e]=t[e])})),Object.keys(s).length&&To.set(e,s,n,i,r,o)}catch(e){Io.error(e)}},remove:function(e,t){try{null==Oe||Oe.localStorage.removeItem(e),To.remove(e,t)}catch(e){Io.error(e)}}}),Mo={},Lo={is_supported:function(){return!0},error:function(e){$t.error("memoryStorage error: "+e)},get:function(e){return Mo[e]||null},parse:function(e){return Mo[e]||null},set:function(e,t){Mo[e]=t},remove:function(e){delete Mo[e]}},qo=null,$o={is_supported:function(){if(!Pt(qo))return qo;if(qo=!0,Et(Oe))qo=!1;else try{var e="__support__";$o.set(e,"xyz"),'"xyz"'!==$o.get(e)&&(qo=!1),$o.remove(e)}catch(e){qo=!1}return qo},error:function(e){$t.error("sessionStorage error: ",e)},get:function(e){try{return null==Oe?void 0:Oe.sessionStorage.getItem(e)}catch(e){$o.error(e)}return null},parse:function(e){try{return JSON.parse($o.get(e))||null}catch(e){}return null},set:function(e,t){try{null==Oe||Oe.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){$o.error(e)}},remove:function(e){try{null==Oe||Oe.sessionStorage.removeItem(e)}catch(e){$o.error(e)}}},Oo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ao=function(){function e(n){o(this,e),this.config=n,this.props={},this.campaign_params_saved=!1,this.name=function(e){var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"}(n),this.storage=this.buildStorage(n),this.load(),n.debug&&$t.info("Persistence loaded",n.persistence,t({},this.props)),this.update_config(n,n),this.save()}return a(e,[{key:"buildStorage",value:function(e){-1===Oo.indexOf(e.persistence.toLowerCase())&&($t.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Io.is_supported()?Io:"localstorage+cookie"===t&&Ro.is_supported()?Ro:"sessionstorage"===t&&$o.is_supported()?$o:"memory"===t?Lo:"cookie"===t?To:Ro.is_supported()?Ro:To}},{key:"properties",value:function(){var e={};return tt(this.props,(function(t,n){if(n===U&&St(t))for(var i=Object.keys(t),r=0;r<i.length;r++)e["$feature/".concat(i[r])]=t[i[r]];else s=n,a=!1,(Pt(o=oe)?a:He&&o.indexOf===He?-1!=o.indexOf(s):(tt(o,(function(e){if(a||(a=e===s))return Ke})),a))||(e[n]=t);var o,s,a})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=nt({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(St(e)){Et(t)&&(t="None"),this.expire_days=Et(n)?this.default_expiry:n;var r=!1;if(tt(e,(function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(St(e)){this.expire_days=Et(t)?this.default_expiry:t;var i=!1;if(tt(e,(function(t,r){e.hasOwnProperty(r)&&n.props[r]!==t&&(n.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){if(!this.campaign_params_saved){var e=fi.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});xt(at(e))||this.register(e),this.campaign_params_saved=!0}}},{key:"update_search_keyword",value:function(){this.register(fi.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(fi.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[K]||this.props[ee]||this.register_once(l({},te,fi.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return at({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var e=this,t={};tt([ee,K],(function(n){var i=e.props[n];i&&tt(i,(function(e,n){t["$initial_"+vt(n)]=e}))}));var n=this.props[te];if(n){var i=fi.initialPersonPropsFromInfo(n);nt(t,i)}return t}},{key:"safe_merge",value:function(e){return tt(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.buildStorage(e),i=this.props;this.clear(),this.storage=n,this.props=i,this.save()}}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[E]||{};n[e]=t,this.props[E]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[E]||{})[e];return Et(t)||(delete this.props[E][e],this.save()),t}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this.props[e]=t,this.save()}}]),e}();function Do(e){var t,n;return(null===(t=JSON.stringify(e,(n=[],function(e,t){if(St(t)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(t)?"[Circular]":(n.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function No(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),i=e.data.slice(0,n),r=e.data.slice(n);return[No({size:Do(i),data:i,sessionId:e.sessionId,windowId:e.windowId}),No({size:Do(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap((function(e){return e}))}return[e]}var Ho=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}(Ho||{}),Bo=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}(Bo||{});function jo(e){var t;return e instanceof Element&&(e.id===ie||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container")))}function Uo(e){return!!e&&1===e.nodeType}function Vo(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Wo(e){return!!e&&3===e.nodeType}function zo(e){return!!e&&11===e.nodeType}function Go(e){return e?pt(e).split(/\s+/):[]}function Zo(e){var t=null==Oe?void 0:Oe.location.href;return!!(t&&e&&e.some((function(e){return t.match(e)})))}function Qo(e){var t="";switch(i(e.className)){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Go(t)}function Yo(e){return It(e)?null:pt(e).split(/(\s+)/).filter((function(e){return cs(e)})).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Jo(e){var t="";return ns(e)&&!is(e)&&e.childNodes&&e.childNodes.length&&tt(e.childNodes,(function(e){var n;Wo(e)&&e.textContent&&(t+=null!==(n=Yo(e.textContent))&&void 0!==n?n:"")})),pt(t)}function Xo(e){return Et(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ko=["a","button","form","input","select","textarea","label"];function es(e){var t=e.parentNode;return!(!t||!Uo(t))&&t}function ts(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!Oe||!e||Vo(e,"html")||!Uo(e))return!1;if(null!=n&&n.url_allowlist&&!Zo(n.url_allowlist))return!1;if(null!=n&&n.url_ignorelist&&Zo(n.url_ignorelist))return!1;if(null!=n&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some((function(e){return t.type===e})))return!1}for(var a=!1,l=[e],u=!0,c=e;c.parentNode&&!Vo(c,"body");)if(zo(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(u=es(c)))break;if(r||Ko.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=Oe.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),c=u}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(Et(n))return!0;var r,o=p(e);try{var s=function(){var e=r.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(o.s();!(r=o.n()).done;){var a=s();if("object"===i(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(l,n))return!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(Et(n))return!0;var r,o=p(e);try{var s=function(){var e=r.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(o.s();!(r=o.n()).done;){var a=s();if("object"===i(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(l,n))return!1;var f=Oe.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){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 a?(o||["click"]).indexOf(t.type)>=0:(o||["click"]).indexOf(t.type)>=0&&(Ko.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}function ns(e){for(var t=e;t.parentNode&&!Vo(t,"body");t=t.parentNode){var n=Qo(t);if(ht(n,"ph-sensitive")||ht(n,"ph-no-capture"))return!1}if(ht(Qo(e),"ph-include"))return!0;var i=e.type||"";if(Ct(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(Ct(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function is(e){return!!(Vo(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Vo(e,"select")||Vo(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rs="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",os=new RegExp("^(?:".concat(rs,")$")),ss=new RegExp(rs),as="\\d{3}-?\\d{2}-?\\d{4}",ls=new RegExp("^(".concat(as,")$")),us=new RegExp("(".concat(as,")"));function cs(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(It(e))return!1;if(Ct(e)){if(e=pt(e),(t?os:ss).test((e||"").replace(/[- ]/g,"")))return!1;if((t?ls:us).test(e))return!1}return!0}function ds(e){var t=Jo(e);return cs(t="".concat(t," ").concat(fs(e)).trim())?t:""}function fs(e){var t="";return e&&e.childNodes&&e.childNodes.length&&tt(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var i=Jo(e);t="".concat(t," ").concat(i).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(fs(e)).trim())}catch(e){$t.error("[AutoCapture]",e)}})),t}function hs(e){return function(e){var n=e.map((function(e){var n,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class){e.attr_class.sort();var o,s=p(e.attr_class);try{for(s.s();!(o=s.n()).done;){var a=o.value;r+=".".concat(a.replace(/"/g,""))}}catch(e){s.e(e)}finally{s.f()}}var l=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!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),u={};return rt(l).sort((function(e,t){var n=c(e,1)[0],i=c(t,1)[0];return n.localeCompare(i)})).forEach((function(e){var t=c(e,2),n=t[0],i=t[1];return u[ps(n.toString())]=ps(i.toString())})),r+=":",r+=rt(l).map((function(e){var t=c(e,2),n=t[0],i=t[1];return"".concat(n,'="').concat(i,'"')})).join("")}));return n.join(";")}(function(e){return e.map((function(e){var t,n,i={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(n=e.attr__href)||void 0===n?void 0:n.slice(0,2048),attr_class:vs(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return rt(e).filter((function(e){return 0===c(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=c(e,2),n=t[0],r=t[1];return i.attributes[n]=r})),i}))}(e))}function ps(e){return e.replace(/"|\\"/g,'\\"')}function vs(e){var t=e.attr__class;return t?kt(t)?t:Go(t):void 0}var _s="[SessionRecording]",gs="redacted",ms={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,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},ys=["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"],bs=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ks=["/s/","/e/","/i/"];function ws(e,t,n,i){if(It(e))return e;var r=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ct(r)&&(r=parseInt(r)),r>n?_s+" ".concat(i," body too large to record (").concat(r," bytes)"):e}function Ss(e,t){if(It(e))return e;var n=e;return cs(n,!1)||(n=_s+" "+t+" body "+gs),tt(bs,(function(e){var i,r;null!==(i=n)&&void 0!==i&&i.length&&-1!==(null===(r=n)||void 0===r?void 0:r.indexOf(e))&&(n=_s+" "+t+" body "+gs+" as might contain: "+e)})),n}var xs=function(e,n){var i,r,o,s={payloadSizeLimitBytes:ms.payloadSizeLimitBytes,performanceEntryTypeToObserve:d(ms.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(d(n.payloadHostDenyList||[]),d(ms.payloadHostDenyList))},a=!1!==e.session_recording.recordHeaders&&n.recordHeaders,l=!1!==e.session_recording.recordBody&&n.recordBody,u=!1!==e.capture_performance&&n.recordPerformance,c=(i=s,o=Math.min(1e6,null!==(r=i.payloadSizeLimitBytes)&&void 0!==r?r:1e6),function(e){return null!=e&&e.requestBody&&(e.requestBody=ws(e.requestBody,e.requestHeaders,o,"Request")),null!=e&&e.responseBody&&(e.responseBody=ws(e.responseBody,e.responseHeaders,o,"Response")),e}),f=function(t){return c(function(e,t){var n,i=ln(e.name),r=0===t.indexOf("http")?null===(n=ln(t))||void 0===n?void 0:n.pathname:t;"/"===r&&(r="");var o=null==i?void 0:i.pathname.replace(r||"","");if(!(i&&o&&ks.some((function(e){return 0===o.indexOf(e)}))))return e}((i=(n=t).requestHeaders,It(i)||tt(Object.keys(null!=i?i:{}),(function(e){ys.includes(e.toLowerCase())&&(i[e]=gs)})),n),e.api_host));var n,i},h=wt(e.session_recording.maskNetworkRequestFn);return h&&wt(e.session_recording.maskCapturedNetworkRequestFn)&&$t.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=function(n){var i=e.session_recording.maskNetworkRequestFn({url:n.name});return t(t({},n),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=wt(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,i,r,o=f(t);return o&&null!==(n=null===(i=(r=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(r,o))&&void 0!==n?n:void 0}:function(e){return function(e){if(!Et(e))return e.requestBody=Ss(e.requestBody,"Request"),e.responseBody=Ss(e.responseBody,"Response"),e}(f(e))},t(t(t({},ms),s),{},{recordHeaders:a,recordBody:l,recordPerformance:u,recordInitialRequests:u})};function Es(e,t,n,i,r){return t>n&&($t.warn("min cannot be greater than max."),t=n),Ft(e)?e>n?(i&&$t.warn(i+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(i&&$t.warn(i+" cannot be less than min: "+t+". Using min value instead."),t):e:(i&&$t.warn(i+" must be a number. using max or fallback. max: "+n+", fallback: "+r),Es(r||n,t,n,i))}var Cs=a((function e(t){var n,i,r=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),l(this,"bucketSize",100),l(this,"refillRate",10),l(this,"mutationBuckets",{}),l(this,"loggedTracker",{}),l(this,"refillBuckets",(function(){Object.keys(r.mutationBuckets).forEach((function(e){r.mutationBuckets[e]=r.mutationBuckets[e]+r.refillRate,r.mutationBuckets[e]>=r.bucketSize&&delete r.mutationBuckets[e]}))})),l(this,"getNodeOrRelevantParent",(function(e){var t=r.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var n=t.closest("svg");if(n)return[r.rrweb.mirror.getId(n),n]}return[e,t]})),l(this,"numberOfChanges",(function(e){var t,n,i,r,o,s,a,l;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(i=null===(r=e.attributes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)+(null!==(o=null===(s=e.texts)||void 0===s?void 0:s.length)&&void 0!==o?o:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),l(this,"throttleMutations",(function(e){if(3!==e.type||0!==e.data.source)return e;var t=e.data,n=r.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((function(e){var t,n,i,o=c(r.getNodeOrRelevantParent(e.id),2),s=o[0],a=o[1];if(0===r.mutationBuckets[s])return!1;(r.mutationBuckets[s]=null!==(t=r.mutationBuckets[s])&&void 0!==t?t:r.bucketSize,r.mutationBuckets[s]=Math.max(r.mutationBuckets[s]-1,0),0===r.mutationBuckets[s])&&(r.loggedTracker[s]||(r.loggedTracker[s]=!0,null===(n=(i=r.options).onBlockedNode)||void 0===n||n.call(i,s,a)));return e})));var i=r.numberOfChanges(t);return 0!==i||n===i?e:void 0})),this.rrweb=t,this.options=s,this.refillRate=Es(null!==(n=this.options.refillRate)&&void 0!==n?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Es(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((function(){r.refillBuckets()}),1e3)})),Ts=Uint8Array,Ps=Uint16Array,Is=Uint32Array,Fs=new Ts([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]),Rs=new Ts([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]),Ms=new Ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(e,t){for(var n=new Ps(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Is(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},qs=Ls(Fs,2),$s=qs[0],Os=qs[1];$s[28]=258,Os[258]=28;for(var As=Ls(Rs,0)[1],Ds=new Ps(32768),Ns=0;Ns<32768;++Ns){var Hs=(43690&Ns)>>>1|(21845&Ns)<<1;Hs=(61680&(Hs=(52428&Hs)>>>2|(13107&Hs)<<2))>>>4|(3855&Hs)<<4,Ds[Ns]=((65280&Hs)>>>8|(255&Hs)<<8)>>>1}var Bs=function(e,t,n){for(var i=e.length,r=0,o=new Ps(t);r<i;++r)++o[e[r]-1];var s,a=new Ps(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new Ps(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)s[Ds[d]>>>l]=u}else for(s=new Ps(i),r=0;r<i;++r)s[r]=Ds[a[e[r]-1]++]>>>15-e[r];return s},js=new Ts(288);for(Ns=0;Ns<144;++Ns)js[Ns]=8;for(Ns=144;Ns<256;++Ns)js[Ns]=9;for(Ns=256;Ns<280;++Ns)js[Ns]=7;for(Ns=280;Ns<288;++Ns)js[Ns]=8;var Us=new Ts(32);for(Ns=0;Ns<32;++Ns)Us[Ns]=5;var Vs=Bs(js,9,0),Ws=Bs(Us,5,0),zs=function(e){return(e/8>>0)+(7&e&&1)},Gs=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof Ps?Ps:e instanceof Is?Is:Ts)(n-t);return i.set(e.subarray(t,n)),i},Zs=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8},Qs=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ys=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new Ts(0),0];if(1==r){var s=new Ts(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[u].f<n[d].f?u++:d++],l=n[u!=c&&n[u].f<n[d].f?u++:d++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var f=o[0].s;for(i=1;i<r;++i)o[i].s>f&&(f=o[i].s);var h=new Ps(f+1),p=Js(n[c-1],h,0);if(p>t){i=0;var v=0,_=p-t,g=1<<_;for(o.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));i<r;++i){var m=o[i].s;if(!(h[m]>t))break;v+=g-(1<<p-h[m]),h[m]=t}for(v>>>=_;v>0;){var y=o[i].s;h[y]<t?v-=1<<t-h[y]++-1:++i}for(;i>=0&&v;--i){var b=o[i].s;h[b]==t&&(--h[b],++v)}p=t}return[new Ts(h),p]},Js=function e(t,n,i){return-1==t.s?Math.max(e(t.l,n,i+1),e(t.r,n,i+1)):n[t.s]=i},Xs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ps(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Ks=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},ea=function(e,t,n){var i=n.length,r=zs(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},ta=function(e,t,n,i,r,o,s,a,l,u,c){Zs(t,c++,n),++r[256];for(var d=Ys(r,15),f=d[0],h=d[1],p=Ys(o,15),v=p[0],_=p[1],g=Xs(f),m=g[0],y=g[1],b=Xs(v),k=b[0],w=b[1],S=new Ps(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<k.length;++x)S[31&k[x]]++;for(var E=Ys(S,7),C=E[0],T=E[1],P=19;P>4&&!C[Ms[P-1]];--P);var I,F,R,M,L=u+5<<3,q=Ks(r,js)+Ks(o,Us)+s,$=Ks(r,f)+Ks(o,v)+s+14+3*P+Ks(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L<=q&&L<=$)return ea(t,c,e.subarray(l,l+u));if(Zs(t,c,1+($<q)),c+=2,$<q){I=Bs(f,h,0),F=f,R=Bs(v,_,0),M=v;var O=Bs(C,T,0);Zs(t,c,y-257),Zs(t,c+5,w-1),Zs(t,c+10,P-4),c+=14;for(x=0;x<P;++x)Zs(t,c+3*x,C[Ms[x]]);c+=3*P;for(var A=[m,k],D=0;D<2;++D){var N=A[D];for(x=0;x<N.length;++x){var H=31&N[x];Zs(t,c,O[H]),c+=C[H],H>15&&(Zs(t,c,N[x]>>>5&127),c+=N[x]>>>12)}}}else I=Vs,F=js,R=Ws,M=Us;for(x=0;x<a;++x)if(i[x]>255){H=i[x]>>>18&31;Qs(t,c,I[H+257]),c+=F[H+257],H>7&&(Zs(t,c,i[x]>>>23&31),c+=Fs[H]);var B=31&i[x];Qs(t,c,R[B]),c+=M[B],B>3&&(Qs(t,c,i[x]>>>5&8191),c+=Rs[B])}else Qs(t,c,I[i[x]]),c+=F[i[x]];return Qs(t,c,I[256]),c+F[256]},na=new Is([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=function(){for(var e=new Is(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),ra=function(){var e=4294967295;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=ia[255&n^t[i]]^n>>>8;e=n},d:function(){return 4294967295^e}}},oa=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new Ts(i+s+5*(1+Math.floor(s/7e3))+r),l=a.subarray(i,a.length-r),u=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var d=c+65535;d<s?u=ea(l,u,e.subarray(c,d)):(l[c]=o,u=ea(l,u,e.subarray(c,s)))}else{for(var f=na[t-1],h=f>>>13,p=8191&f,v=(1<<n)-1,_=new Ps(32768),g=new Ps(v+1),m=Math.ceil(n/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},k=new Is(25e3),w=new Ps(288),S=new Ps(32),x=0,E=0,C=(c=0,0),T=0,P=0;c<s;++c){var I=b(c),F=32767&c,R=g[I];if(_[F]=R,g[I]=F,T<=c){var M=s-c;if((x>7e3||C>24576)&&M>423){u=ta(e,l,0,k,w,S,E,C,P,c-P,u),C=x=E=0,P=c;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)S[L]=0}var q=2,$=0,O=p,A=F-R&32767;if(M>2&&I==b(c-A))for(var D=Math.min(h,M)-1,N=Math.min(32767,c),H=Math.min(258,M);A<=N&&--O&&F!=R;){if(e[c+q]==e[c+q-A]){for(var B=0;B<H&&e[c+B]==e[c+B-A];++B);if(B>q){if(q=B,$=A,B>D)break;var j=Math.min(A,B-2),U=0;for(L=0;L<j;++L){var V=c-A+L+32768&32767,W=V-_[V]+32768&32767;W>U&&(U=W,R=V)}}}A+=(F=R)-(R=_[F])+32768&32767}if($){k[C++]=268435456|Os[q]<<18|As[$];var z=31&Os[q],G=31&As[$];E+=Fs[z]+Rs[G],++w[257+z],++S[G],T=c+q,++x}else k[C++]=e[c],++w[e[c]]}}u=ta(e,l,o,k,w,S,E,C,P,c-P,u)}return Gs(a,0,i+zs(u)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},sa=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},aa=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&&sa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}},la=function(e){return 10+(e.filename&&e.filename.length+1||0)};function ua(e,t){void 0===t&&(t={});var n=ra(),i=e.length;n.p(e);var r=oa(e,t,la(t),8),o=r.length;return aa(r,t),sa(r,o-8,n.d()),sa(r,o-4,i),r}function ca(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Ts(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new Ts(r+8+(n-s<<1));a.set(i),i=a}var l=e.charCodeAt(s);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return Gs(i,0,r)}function da(e,t){return function(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(e)%100<Es(100*t,0,100)}var fa="[SessionRecording]",ha=Ot(fa),pa=3e5,va=[Bo.MouseMove,Bo.MouseInteraction,Bo.Scroll,Bo.ViewportResize,Bo.Input,Bo.TouchMove,Bo.MediaInteraction,Bo.Drag],_a=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}};function ga(e){return function(e,t){for(var n="",i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}(ua(ca(JSON.stringify(e))),!0)}function ma(e){return e.type===Ho.Custom&&"sessionIdle"===e.data.tag}function ya(e,t){return t.some((function(t){return"regex"===t.matching&&new RegExp(t.url).test(e)}))}var ba,ka=function(){function e(t){var n=this;if(o(this,e),l(this,"queuedRRWebEvents",[]),l(this,"isIdle",!1),l(this,"_linkedFlagSeen",!1),l(this,"_lastActivityTimestamp",Date.now()),l(this,"_linkedFlag",null),l(this,"_removePageViewCaptureHook",void 0),l(this,"_onSessionIdListener",void 0),l(this,"_persistDecideOnSessionListener",void 0),l(this,"_samplingSessionListener",void 0),l(this,"_urlTriggers",[]),l(this,"_urlBlocklist",[]),l(this,"_urlBlocked",!1),l(this,"_eventTriggers",[]),l(this,"_removeEventTriggerCaptureHook",void 0),l(this,"_forceAllowLocalhostNetworkCapture",!1),l(this,"_onBeforeUnload",(function(){n._flushBuffer()})),l(this,"_onOffline",(function(){n._tryAddCustomEvent("browser offline",{})})),l(this,"_onOnline",(function(){n._tryAddCustomEvent("browser online",{})})),l(this,"_onVisibilityChange",(function(){if(null!=je&&je.visibilityState){var e="window "+je.visibilityState;n._tryAddCustomEvent(e,{})}})),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw ha.error("started without valid sessionManager"),new Error(fa+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(fa+" cannot be used with __preview_experimental_cookieless_mode.");var i=this.sessionManager.checkAndGetSessionAndWindowId(),r=i.sessionId,s=i.windowId;this.sessionId=r,this.windowId=s,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&ha.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}return a(e,[{key:"sessionIdleThresholdMilliseconds",get:function(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}},{key:"rrwebRecord",get:function(){var e,t;return null==Ze||null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fa+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:pa}},{key:"isSampled",get:function(){var e=this.instance.get_property(H);return Rt(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],i=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return n?n.timestamp-i:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(M),t=!this.instance.config.disable_session_recording;return Oe&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(L),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"canvasRecording",get:function(){var e,t,n,i,r,o,s=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property($),l=null!==(e=null!==(t=null==s?void 0:s.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,u=null!==(n=null!==(i=null==s?void 0:s.canvasFps)&&void 0!==i?i:null==a?void 0:a.fps)&&void 0!==n?n:0,c=null!==(r=null!==(o=null==s?void 0:s.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:0;return{enabled:l,fps:Es(u,0,12,"canvas recording fps"),quality:Es(c,0,1,"canvas recording quality")}}},{key:"networkPayloadCapture",get:function(){var e,t,n=this.instance.get_property(q),i={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},r=(null==i?void 0:i.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==i?void 0:i.recordBody)||(null==n?void 0:n.recordBody),s=St(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(Rt(s)?s:null==n?void 0:n.capturePerformance);return r||o||a?{recordHeaders:r,recordBody:o,recordPerformance:a}:void 0}},{key:"sampleRate",get:function(){var e=this.instance.get_property(O);return Ft(e)?e:null}},{key:"minimumDuration",get:function(){var e=this.instance.get_property(A);return Ft(e)?e:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?!1===this.isSampled?"disabled":this._urlBlocked?"paused":It(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":Rt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"urlTriggerStatus",get:function(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(B))===this.sessionId?"trigger_activated":"trigger_pending"}},{key:"eventTriggerStatus",get:function(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(j))===this.sessionId?"trigger_activated":"trigger_pending"}},{key:"triggerStatus",get:function(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}},{key:"startIfEnabledOrStop",value:function(e){var t=this;this.isRecordingEnabled?(this._startCapture(e),ft(Oe,"beforeunload",this._onBeforeUnload),ft(Oe,"offline",this._onOffline),ft(Oe,"online",this._onOnline),ft(Oe,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),It(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",(function(e){try{if("$pageview"===e.event){var n=null!=e&&e.properties.$current_url?t._maskUrl(null==e?void 0:e.properties.$current_url):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n})}}catch(e){ha.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((function(e,n,i){var r,o,s,a;i&&(t._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:n,changeReason:i}),null===(r=t.instance)||void 0===r||null===(o=r.persistence)||void 0===o||o.unregister(j),null===(s=t.instance)||void 0===s||null===(a=s.persistence)||void 0===a||a.unregister(B))})))):this.stopRecording()}},{key:"stopRecording",value:function(){var e,t,n,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==Oe||Oe.removeEventListener("beforeunload",this._onBeforeUnload),null==Oe||Oe.removeEventListener("offline",this._onOffline),null==Oe||Oe.removeEventListener("online",this._onOnline),null==Oe||Oe.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(e=this._removePageViewCaptureHook)||void 0===e||e.call(this),this._removePageViewCaptureHook=void 0,null===(t=this._removeEventTriggerCaptureHook)||void 0===t||t.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(i=this._samplingSessionListener)||void 0===i||i.call(this),this._samplingSessionListener=void 0,ha.info("stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n=this.sessionId!==e,i=this.sampleRate;if(Ft(i)){var r=this.isSampled,o=n||!Rt(r),s=o?da(e,i):r;o&&(s?this._reportStarted("sampled"):ha.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:s})),null===(t=this.instance.persistence)||void 0===t||t.register(l({},H,s))}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register(l({},H,null))}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r,o,s,a=this;(this._tryAddCustomEvent("$remote_config_received",e),this._persistRemoteConfig(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(n=e.sessionRecording)&&void 0!==n&&n.endpoint)&&(this._endpoint=null===(s=e.sessionRecording)||void 0===s?void 0:s.endpoint);if(this._setupSampling(),!It(this._linkedFlag)&&!this._linkedFlagSeen){var l=Ct(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=Ct(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((function(e,t){var n=St(t)&&l in t,i=u?t[l]===u:n;i&&a._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),a._linkedFlagSeen=i}))}null!==(i=e.sessionRecording)&&void 0!==i&&i.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(r=e.sessionRecording)&&void 0!==r&&r.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(o=e.sessionRecording)&&void 0!==o&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var e=this;Ft(this.sampleRate)&&It(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((function(t){e.makeSamplingDecision(t)})))}},{key:"_persistRemoteConfig",value:function(e){if(this.instance.persistence){var n,i=this.instance.persistence,r=function(){var n,r,o,s,a,u,c,d,f,h=null===(n=e.sessionRecording)||void 0===n?void 0:n.sampleRate,p=It(h)?null:parseFloat(h),v=null===(r=e.sessionRecording)||void 0===r?void 0:r.minimumDurationMilliseconds;i.register((l(f={},M,!!e.sessionRecording),l(f,L,null===(o=e.sessionRecording)||void 0===o?void 0:o.consoleLogRecordingEnabled),l(f,q,t({capturePerformance:e.capturePerformance},null===(s=e.sessionRecording)||void 0===s?void 0:s.networkPayloadCapture)),l(f,$,{enabled:null===(a=e.sessionRecording)||void 0===a?void 0:a.recordCanvas,fps:null===(u=e.sessionRecording)||void 0===u?void 0:u.canvasFps,quality:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasQuality}),l(f,O,p),l(f,A,Et(v)?null:v),l(f,D,null===(d=e.sessionRecording)||void 0===d?void 0:d.scriptConfig),f))};r(),null===(n=this._persistDecideOnSessionListener)||void 0===n||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}},{key:"log",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}},{key:"_startCapture",value:function(e){var t=this;if(!Et(Object.assign)&&!Et(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,this.scriptName,(function(e){if(e)return ha.error("could not load recorder",e);t._onScriptLoaded()}));ha.info("starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}},{key:"scriptName",get:function(){var e,t,n;return(null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t||null===(n=t.get_property(D))||void 0===n?void 0:n.script)||"recorder"}},{key:"isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==va.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>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)),!this.isIdle){var i=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=i.windowId,o=i.sessionId,s=this.sessionId!==o,a=this.windowId!==r;this.windowId=r,this.sessionId=o,s||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this._scheduleFullSnapshot()}}},{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}):ha.warn("could not emit queued rrweb event.",t,e),!1}}},{key:"_tryAddCustomEvent",value:function(e,t){var n=this;return this._tryRRWebMethod(_a((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(_a((function(){return e.rrwebRecord.takeFullSnapshot()})))}},{key:"_onScriptLoaded",value:function(){for(var e,n=this,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},r=this.instance.config.session_recording,o=0,s=Object.entries(r||{});o<s.length;o++){var a=c(s[o],2),l=a[0],u=a[1];l in i&&("maskInputOptions"===l?i.maskInputOptions=t({password:!0},u):i[l]=u)}if(this.canvasRecording&&this.canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling={canvas:this.canvasRecording.fps},i.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new Cs(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:function(e,t){var i="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");ha.info(i,{node:t}),n.log(fa+" "+i,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t({emit:function(e){n.onRRwebEmit(e)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map((function(e){return null==e?void 0:e.name}))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else ha.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var e=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval((function(){e._tryTakeFullSnapshot()}),t))}}},{key:"_gatherRRWebPlugins",value:function(){var e,t,n,i,r=[],o=null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&r.push(o());var s=null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.rrwebPlugins)||void 0===i?void 0:i.getRecordNetworkPlugin;this.networkPayloadCapture&&wt(s)&&(!an.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(xs(this.instance.config,this.networkPayloadCapture))):ha.info("NetworkCapture not started because we are on localhost."));return r}},{key:"onRRwebEmit",value:function(e){var n;if(this._processQueuedEvents(),e&&St(e)){if(e.type===Ho.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(e){return e.type===Ho.Custom&&"recording paused"===e.data.tag}(e)){e.type===Ho.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Ho.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var o=function(e){var t=e;if(t&&St(t)&&6===t.type&&St(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var n=[],i=0;i<t.data.payload.payload.length;i++)t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?n.push(t.data.payload.payload[i].slice(0,2e3)+"...[truncated]"):n.push(t.data.payload.payload[i]);return t.data.payload.payload=n,e}return e}(r);if(this._updateWindowAndSessionIds(o),!this.isIdle||ma(o)){if(ma(o)){var s=o.data.payload;if(s){var a=s.lastActivityTimestamp,l=s.threshold;o.timestamp=a+l}}var u=null===(n=this.instance.config.session_recording.compress_events)||void 0===n||n?function(e){if(Do(e)<1024)return e;try{if(e.type===Ho.FullSnapshot)return t(t({},e),{},{data:ga(e.data),cv:"2024-10"});if(e.type===Ho.IncrementalSnapshot&&e.data.source===Bo.Mutation)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{texts:ga(e.data.texts),attributes:ga(e.data.attributes),removes:ga(e.data.removes),adds:ga(e.data.adds)})});if(e.type===Ho.IncrementalSnapshot&&e.data.source===Bo.StyleSheetRule)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{adds:ga(e.data.adds),removes:ga(e.data.removes)})})}catch(e){ha.error("could not compress event - will use uncompressed event",e)}return e}(o):o,c={$snapshot_bytes:Do(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(c):this.clearBuffer()}}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&Oe){var e=this._maskUrl(Oe.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=d(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,i={url:e};return null===(n=i=t.maskNetworkRequestFn(i))||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,i=Ft(n)&&n>=0,r=Ft(t)&&i&&n<t;if("buffering"===this.status||"paused"===this.status||"disabled"===this.status||r)return this.flushBufferTimer=setTimeout((function(){e._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&No(this.buffer).forEach((function(t){e._captureSnapshot({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:"web",$lib_version:Qe.LIB_VERSION})}));return this.clearBuffer()}},{key:"_captureSnapshotBuffered",value:function(e){var t,n=this,i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((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",skip_client_rate_limiting:!0})}},{key:"_checkUrlTriggerConditions",value:function(){if(void 0!==Oe&&Oe.location.href){var e=Oe.location.href,t=this._urlBlocked,n=ya(e,this._urlBlocklist);n&&!t?this._pauseRecording():!n&&t&&this._resumeRecording(),ya(e,this._urlTriggers)&&this._activateTrigger("url")}}},{key:"_activateTrigger",value:function(e){var t,n;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register(l({},"url"===e?B:j,this.sessionId)),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}},{key:"_pauseRecording",value:function(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),ha.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}},{key:"_resumeRecording",value:function(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),ha.info("recording resumed"))}},{key:"_addEventTriggerListener",value:function(){var e=this;0!==this._eventTriggers.length&&It(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(function(t){try{e._eventTriggers.includes(t.event)&&e._activateTrigger("event")}catch(e){ha.error("Could not activate event trigger",e)}})))}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}},{key:"overrideSampling",value:function(){var e;null===(e=this.instance.persistence)||void 0===e||e.register(l({},H,!0)),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}},{key:"overrideTrigger",value:function(e){this._activateTrigger(e)}},{key:"_reportStarted",value:function(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),ha.info(e.replace("_"," "),t),ht(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}]),e}(),wa=Ot("[RemoteConfig]"),Sa=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"remoteConfig",get:function(){var e,t;return null===(e=Ze._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.config}},{key:"_loadRemoteConfigJs",value:function(e){var t,n,i,r=this;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.loadExternalDependency?null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"remote-config",(function(){return e(r.remoteConfig)})):(wa.error("PostHog Extensions not found. Cannot load remote config."),e())}},{key:"_loadRemoteConfigJSON",value:function(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:function(t){e(t.json)}})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return wa.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void wa.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((function(t){if(!t)return wa.info("No config found after loading remote JS config. Falling back to JSON."),void e._loadRemoteConfigJSON((function(t){e.onRemoteConfig(t)}));e.onRemoteConfig(t)}))}catch(e){wa.error("Error loading remote config",e)}}},{key:"onRemoteConfig",value:function(e){e?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this.instance.featureFlags.ensureFlagsLoaded()):wa.info("__preview_remote_config is disabled. Logging config instead",e):wa.error("Failed to fetch remote config from PostHog.")}}]),e}(),xa=null!=Oe&&Oe.location?fn(Oe.location.hash,"__posthog")||fn(location.hash,"state"):null,Ea="_postHogToolbarParams",Ca=Ot("[Toolbar]");!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(ba||(ba={}));var Ta=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"setToolbarState",value:function(e){Ze.ph_toolbar_state=e}},{key:"getToolbarState",value:function(){var e;return null!==(e=Ze.ph_toolbar_state)&&void 0!==e?e:ba.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!Oe||!je)return!1;n=null!==(e=n)&&void 0!==e?e:Oe.location,r=null!==(t=r)&&void 0!==t?t:Oe.history;try{if(!i){try{Oe.localStorage.setItem("test","test"),Oe.localStorage.removeItem("test")}catch(e){return!1}i=null==Oe?void 0:Oe.localStorage}var o,s=xa||fn(n.hash,"__posthog")||fn(n.hash,"state"),a=s?ot((function(){return JSON.parse(atob(decodeURIComponent(s)))}))||ot((function(){return JSON.parse(decodeURIComponent(s))})):null;return a&&"ph_authorize"===a.action?((o=a).source="url",o&&Object.keys(o).length>0&&(a.desiredHash?n.hash=a.desiredHash:r?r.replaceState(r.state,"",n.pathname+n.search):n.hash="")):((o=JSON.parse(i.getItem(Ea)||"{}")).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){var t=Ze.ph_load_toolbar||Ze.ph_load_editor;!It(t)&&wt(t)?t(e,this.instance):Ca.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var n=this,i=!(null==je||!je.getElementById(ie));if(!Oe||i)return!1;var r="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")},r?{instrument:!1}:{});if(Oe.localStorage.setItem(Ea,JSON.stringify(t(t({},o),{},{source:void 0}))),this.getToolbarState()===ba.LOADED)this._callLoadToolbar(o);else if(this.getToolbarState()===ba.UNINITIALIZED){var s,a;this.setToolbarState(ba.LOADING),null===(s=Ze.__PosthogExtensions__)||void 0===s||null===(a=s.loadExternalDependency)||void 0===a||a.call(s,this.instance,"toolbar",(function(e){if(e)return Ca.error("[Toolbar] Failed to load",e),void n.setToolbarState(ba.UNINITIALIZED);n.setToolbarState(ba.LOADED),n._callLoadToolbar(o)})),ft(Oe,"turbolinks:load",(function(){n.setToolbarState(ba.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}(),Pa=3e3,Ia=function(){function e(t,n){o(this,e),l(this,"isPaused",!0),l(this,"queue",[]),this.flushTimeoutMs=Es((null==n?void 0:n.flush_interval_ms)||Pa,250,5e3,"flush interval",Pa),this.sendRequest=t}return a(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=this.queue.length>0?this.formatQueue():{},i=Object.values(n),r=[].concat(d(i.filter((function(e){return 0===e.url.indexOf("/e")}))),d(i.filter((function(e){return 0!==e.url.indexOf("/e")}))));r.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(),n=function(n){var i=t[n],r=(new Date).getTime();i.data&&kt(i.data)&&tt(i.data,(function(e){e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e.sendRequest(i)};for(var i in t)n(i)}}),this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var e={};return tt(this.queue,(function(n){var i,r=n,o=(r?r.batchKey:null)||r.url;Et(e[o])&&(e[o]=t(t({},r),{},{data:[]})),null===(i=e[o].data)||void 0===i||i.push(r.data)})),this.queue=[],e}}]),e}();var Fa=function(e){var t,n,i,r,o="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,r=0;r<i;r++){var s=e.charCodeAt(r),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),Pt(a)||(n>t&&(o+=e.substring(t,n)),o+=a,t=n=r+1)}return n>t&&(o+=e.substring(t,e.length)),o},Ra=!!We||!!Ve,Ma="text/plain",La=function(e,n){var i=c(e.split("?"),2),r=i[0],o=i[1],s=t({},n);null==o||o.split("&").forEach((function(e){var t=c(e.split("="),1)[0];delete s[t]}));var a=un(s);return a=a?(o?o+"&":"")+a:o,"".concat(r,"?").concat(a)},qa=function(e,t){return JSON.stringify(e,(function(e,t){return"bigint"==typeof t?t.toString():t}),t)},$a=function(e){var t=e.data,n=e.compression;if(t){if(n===$e.GZipJS){var i=ua(ca(qa(t)),{mtime:0}),r=new Blob([i],{type:Ma});return{contentType:Ma,body:r,estimatedSize:r.size}}if(n===$e.Base64){var o=function(e){var t,n,i,r,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=Fa(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,i=o>>6&63,r=63&o,c[l++]=s.charAt(t)+s.charAt(n)+s.charAt(i)+s.charAt(r)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(qa(t)),s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:qa(e))}(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=qa(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Oa=[];Ve&&Oa.push({transport:"fetch",method:function(e){var n,i,r=null!==(n=$a(e))&&void 0!==n?n:{},o=r.contentType,s=r.body,a=r.estimatedSize,l=new Headers;tt(e.headers,(function(e,t){l.append(t,e)})),o&&l.append("Content-Type",o);var u=e.url,c=null;if(ze){var d=new ze;c={signal:d.signal,timeout:setTimeout((function(){return d.abort()}),e.timeout)}}Ve(u,t({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&(a||0)<52428.8,body:s,signal:null===(i=c)||void 0===i?void 0:i.signal},e.fetchOptions)).then((function(t){return t.text().then((function(n){var i,r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){$t.error(e)}null===(i=e.callback)||void 0===i||i.call(e,r)}))})).catch((function(t){var n;$t.error(t),null===(n=e.callback)||void 0===n||n.call(e,{statusCode:0,text:t})})).finally((function(){return c?clearTimeout(c.timeout):null}))}}),We&&Oa.push({transport:"XHR",method:function(e){var t,n=new We;n.open(e.method||"GET",e.url,!0);var i=null!==(t=$a(e))&&void 0!==t?t:{},r=i.contentType,o=i.body;tt(e.headers,(function(e,t){n.setRequestHeader(t,e)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=function(){if(4===n.readyState){var t,i={statusCode:n.status,text:n.responseText};if(200===n.status)try{i.json=JSON.parse(n.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},n.send(o)}}),null!=Be&&Be.sendBeacon&&Oa.push({transport:"sendBeacon",method:function(e){var t=La(e.url,{beacon:"1"});try{var n,i=null!==(n=$a(e))&&void 0!==n?n:{},r=i.contentType,o=i.body,s="string"==typeof o?new Blob([o],{type:r}):o;Be.sendBeacon(t,s)}catch(e){}}});var Aa=["retriesPerformedSoFar"];var Da,Na=function(){function e(t){var n=this;o(this,e),l(this,"isPolling",!1),l(this,"pollIntervalMs",3e3),l(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Et(Oe)&&"onLine"in Oe.navigator&&(this.areWeOnline=Oe.navigator.onLine,ft(Oe,"online",(function(){n.areWeOnline=!0,n.flush()})),ft(Oe,"offline",(function(){n.areWeOnline=!1})))}return a(e,[{key:"retriableRequest",value:function(e){var n=this,i=e.retriesPerformedSoFar,r=u(e,Aa);Ft(i)&&i>0&&(r.url=La(r.url,{retry_count:i})),this.instance._send_request(t(t({},r),{},{callback:function(e){var o;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=i?i:0)<10?n.enqueue(t({retriesPerformedSoFar:i},r)):null===(o=r.callback)||void 0===o||o.call(r,e)}}))}},{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*Math.pow(2,e),n=t/2,i=Math.min(18e5,t),r=(Math.random()-.5)*(i-n);return Math.ceil(i+r)}(t),i=Date.now()+n;this.queue.push({retryAt:i,requestOptions:e});var r="Enqueued failed request for retry in ".concat(n);navigator.onLine||(r+=" (Browser is offline)"),$t.warn(r),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout((function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()}),this.pollIntervalMs)}},{key:"flush",value:function(){var e=Date.now(),t=[],n=this.queue.filter((function(n){return n.retryAt<e||(t.push(n),!1)}));if(this.queue=t,n.length>0){var i,r=p(n);try{for(r.s();!(i=r.n()).done;){var o=i.value.requestOptions;this.retriableRequest(o)}}catch(e){r.e(e)}finally{r.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var e,n=p(this.queue);try{for(n.s();!(e=n.n()).done;){var i=e.value.requestOptions;try{this.instance._send_request(t(t({},i),{},{transport:"sendBeacon"}))}catch(e){$t.error(e)}}}catch(e){n.e(e)}finally{n.f()}this.queue=[]}}]),e}(),Ha=Ot("[SessionId]"),Ba=function(){function e(t,n,i){var r;if(o(this,e),l(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||ko,this._windowIdGenerator=i||ko;var s=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Es(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var u=$o.parse(this._window_id_storage_key),c=$o.parse(this._primary_window_exists_storage_key);u&&!c?this._windowId=u:$o.remove(this._window_id_storage_key),$o.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{var d=function(e){var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),d)}catch(e){Ha.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}return a(e,[{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return Et(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&&$o.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&$o.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?$o.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(l({},N,[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[N];return kt(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;ft(Oe,"beforeunload",(function(){e._canUseSessionStorage()&&$o.remove(e._primary_window_exists_storage_key)}),{capture:!1})}},{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;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||(new Date).getTime(),i=c(this._getSessionId(),3),r=i[0],o=i[1],s=i[2],a=this._getWindowId(),l=Ft(s)&&s>0&&Math.abs(n-s)>864e5,u=!1,d=!o,f=!e&&Math.abs(n-r)>this.sessionTimeoutMs;d||f||l?(o=this._sessionIdGenerator(),a=this._windowIdGenerator(),Ha.info("new session ID generated",{sessionId:o,windowId:a,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),s=n,u=!0):a||(a=this._windowIdGenerator(),u=!0);var h=0===r||!e||l?n:r,p=0===s?(new Date).getTime():s;return this._setWindowId(a),this._setSessionId(o,h,p),e||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach((function(e){return e(o,a,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)})),{sessionId:o,windowId:a,sessionStartTimestamp:p,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}},{key:"resetIdleTimer",value:function(){var e=this;clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((function(){e.resetSessionId()}),1.1*this.sessionTimeoutMs)}}]),e}();!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(Da||(Da={}));var ja="i.posthog.com",Ua=function(){function e(t){o(this,e),l(this,"_regionCache",{}),this.instance=t}return a(e,[{key:"apiHost",get:function(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}},{key:"uiHost",get:function(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(ja),".posthog.com")),"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]=Da.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Da.EU:this._regionCache[this.apiHost]=Da.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+t;if(this.region===Da.CUSTOM)return this.apiHost+t;var n=ja+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}}]),e}(),Va="posthog-js";function Wa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.organization,i=t.projectId,r=t.prefix,o=t.severityAllowList,s=void 0===o?["error"]:o;return function(t){var o,a,l,u,c;if(!("*"===s||s.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var 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)||[];f.forEach((function(e){e.stacktrace&&(e.stacktrace.type="raw",e.stacktrace.frames.forEach((function(e){e.platform="web:javascript"})))}));var h={$exception_message:(null===(a=f[0])||void 0===a?void 0:a.value)||t.message,$exception_type:null===(l=f[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:t.level,$exception_list:f,$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};return n&&i&&(h.$sentry_url=(r||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+t.event_id),e.exceptions.sendExceptionEvent(h),t}}var za=a((function e(t,n,i,r,s){o(this,e),this.name=Va,this.setupOnce=function(e){e(Wa(t,{organization:n,projectId:i,prefix:r,severityAllowList:s}))}})),Ga=Ot("[SegmentIntegration]");function Za(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=function(n){var i=function(){return n.anonymousId()||ko()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(Y,"identified")),t()},r=n.user();"then"in r&&wt(r.then)?r.then((function(e){return i(e)})):i(r)}(e,(function(){n.register(function(e){Promise&&Promise.resolve||Ga.warn("This browser does not have Promise support, and can not use the segment integration");var t=function(t,n){var i;if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ga.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ga.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e._calculate_event_properties(n,null!==(i=t.event.properties)&&void 0!==i?i:{},new Date);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,"$pageview")},identify:function(e){return t(e,"$identify")},screen:function(e){return t(e,"$screen")}}}(e)).then((function(){t()}))}))}var Qa=function(){function e(t){o(this,e),this._instance=t}return a(e,[{key:"doPageView",value:function(e,t){var n,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(n=null==Oe?void 0:Oe.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}},{key:"_previousPageViewProperties",value:function(e,t){var n=this._currentPageview;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var o=r.maxScrollHeight,s=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,c=r.maxContentY;if(!(Et(o)||Et(s)||Et(a)||Et(l)||Et(u)||Et(c))){o=Math.ceil(o),s=Math.ceil(s),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=o<=1?1:Es(s/o,0,1),f=o<=1?1:Es(a/o,0,1),h=l<=1?1:Es(u/l,0,1),p=l<=1?1:Es(c/l,0,1);i=nt(i,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),Ya=Ot("[RateLimiter]"),Ja=function(){function e(t){var n,i,r=this;o(this,e),l(this,"serverLimits",{}),l(this,"lastEventRateLimited",!1),l(this,"checkForLimiting",(function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((function(e){Ya.info("".concat(e||"events"," is quota limited.")),r.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Ya.warn('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 a(e,[{key:"clientRateLimitContext",value:function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=(new Date).getTime(),o=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(X))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:r};o.tokens+=(r-o.last)/1e3*this.captureEventsPerSecond,o.last=r,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||i||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,null===(n=this.instance.persistence)||void 0===n||n.set_property(X,o),{isRateLimited:s,remainingTokens:o.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Xa=function(e){var n=null==e?void 0:e.config;return t({initialPathName:(null==Ue?void 0:Ue.pathname)||"",referringDomain:fi.referringDomain()},fi.campaignParams({customTrackedParams:null==n?void 0:n.custom_campaign_params,maskPersonalDataProperties:null==n?void 0:n.mask_personal_data_properties,customPersonalDataProperties:null==n?void 0:n.custom_personal_data_properties}))},Ka=function(){function e(t,n,i,r){var s=this;o(this,e),l(this,"_onSessionIdCallback",(function(e){var t=s._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:s._sessionSourceParamGenerator(s.instance)};s._persistence.register(l({},J,n))}})),this.instance=t,this._sessionIdManager=n,this._persistence=i,this._sessionSourceParamGenerator=r||Xa,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return a(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[J]}},{key:"getSessionProps",value:function(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}]),e}(),el=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","better uptime bot","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","gptbot","oai-searchbot","chatgpt-user","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],tl=function(e,t){if(!e)return!1;var n=e.toLowerCase();return el.concat(t||[]).some((function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)}))},nl=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&tl(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((function(e){return tl(null==e?void 0:e.brand,t)})))return!0}catch(e){}return!!e.webdriver},il=function(){function e(){o(this,e),this.clicks=[]}return a(e,[{key:"isRageClick",value:function(e,t,n){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<30&&n-i.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),rl=Ot("[Dead Clicks]"),ol=function(){return!0},sl=function(e){var t,n=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(F)),i=e.instance.config.capture_dead_clicks;return Rt(i)?i:n},al=function(){function e(t,n,i){o(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabled()}return a(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this._lazyLoadedDeadClicksAutocapture}},{key:"onRemoteConfig",value:function(e){this.instance.persistence&&this.instance.persistence.register(l({},F,null==e?void 0:e.captureDeadClicks)),this.startIfEnabled()}},{key:"startIfEnabled",value:function(){var e=this;this.isEnabled(this)&&this.loadScript((function(){e.start()}))}},{key:"loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"dead-clicks-autocapture",(function(t){t?rl.error("failed to load script",t):e()}))}},{key:"start",value:function(){var e;if(je){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=Ze.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=St(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ze.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(je),rl.info("starting...")}}else rl.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,rl.info("stopping..."))}}]),e}(),ll=Ot("[Heatmaps]");function ul(e){return St(e)&&"clientX"in e&&"clientY"in e&&Ft(e.clientX)&&Ft(e.clientY)}var cl=function(){function e(t){var n;o(this,e),l(this,"rageclicks",new il),l(this,"_enabledServerSide",!1),l(this,"_initialized",!1),l(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!(null===(n=this.instance.persistence)||void 0===n||!n.props[T]),ft(Oe,"beforeunload",this.flush)}return a(e,[{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return St(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return Et(this.instance.config.capture_heatmaps)?Et(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;ll.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(l({},T,t)),this._enabledServerSide=t,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var e=this.buffer;return this.buffer=void 0,e}},{key:"_onDeadClick",value:function(e){this._onClick(e.originalEvent,"deadclick")}},{key:"_setupListeners",value:function(){var e=this;Oe&&je&&(ft(je,"click",(function(t){return e._onClick(t||(null==Oe?void 0:Oe.event))}),{capture:!0}),ft(je,"mousemove",(function(t){return e._onMouseMove(t||(null==Oe?void 0:Oe.event))}),{capture:!0}),this.deadClicksCapture=new al(this.instance,ol,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}},{key:"_getProperties",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,t,n){for(var i=e;i&&Uo(i)&&!Vo(i,"body");){if(i===n)return!1;if(ht(t,null==Oe?void 0:Oe.getComputedStyle(i).position))return!0;i=es(i)}return!1}(Xo(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}},{key:"_onClick",value:function(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!jo(e.target)&&ul(e)){var r=this._getProperties(e,i);null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(t(t({},r),{},{type:"rageclick"})),this._capture(r)}}},{key:"_onMouseMove",value:function(e){var t=this;!jo(e.target)&&ul(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((function(){t._capture(t._getProperties(e,"mousemove"))}),500))}},{key:"_capture",value:function(e){if(Oe){var t=Oe.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}},{key:"flush",value:function(){this.buffer&&!xt(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),dl=function(){function e(t){var n=this;o(this,e),l(this,"_updateScrollData",(function(){var e,t,i,r;n.context||(n.context={});var o=n.scrollElement(),s=n.scrollY(),a=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=s+((null==o?void 0:o.clientHeight)||0),u=(null==o?void 0:o.scrollHeight)||0;n.context.lastScrollY=Math.ceil(s),n.context.maxScrollY=Math.max(s,null!==(e=n.context.maxScrollY)&&void 0!==e?e:0),n.context.maxScrollHeight=Math.max(a,null!==(t=n.context.maxScrollHeight)&&void 0!==t?t:0),n.context.lastContentY=l,n.context.maxContentY=Math.max(l,null!==(i=n.context.maxContentY)&&void 0!==i?i:0),n.context.maxContentHeight=Math.max(u,null!==(r=n.context.maxContentHeight)&&void 0!==r?r:0)})),this.instance=t}return a(e,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var e=this.context;return setTimeout(this._updateScrollData,0),e}},{key:"startMeasuringScrollPosition",value:function(){ft(Oe,"scroll",this._updateScrollData,{capture:!0}),ft(Oe,"scrollend",this._updateScrollData,{capture:!0}),ft(Oe,"resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return null==Oe?void 0:Oe.document.documentElement;var e,t=p(kt(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(t.s();!(e=t.n()).done;){var n=e.value,i=null==Oe?void 0:Oe.document.querySelector(n);if(i)return i}}catch(e){t.e(e)}finally{t.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Oe&&(Oe.scrollY||Oe.pageYOffset||Oe.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Oe&&(Oe.scrollX||Oe.pageXOffset||Oe.document.documentElement.scrollLeft)||0}}]),e}(),fl=Ot("[AutoCapture]");function hl(e,t){return t.length>e?t.slice(0,e)+"...":t}function pl(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Uo(t));return t}function vl(e,t,n,i){var r=e.tagName.toLowerCase(),o={tag_name:r};Ko.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?o.$el_text=hl(1024,ds(e)):o.$el_text=hl(1024,Jo(e)));var s=Qo(e);s.length>0&&(o.classes=s.filter((function(e){return""!==e}))),tt(e.attributes,(function(n){var r;if((!is(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&((null==i||!i.includes(n.name))&&!t&&cs(n.value)&&(r=n.name,!Ct(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var s=n.value;"class"===n.name&&(s=Go(s).join(" ")),o["attr__"+n.name]=hl(1024,s)}}));for(var a=1,l=1,u=e;u=pl(u);)a++,u.tagName===e.tagName&&l++;return o.nth_child=a,o.nth_of_type=l,o}function _l(e,t){for(var n,i,r=t.e,o=t.maskAllElementAttributes,s=t.maskAllText,a=t.elementAttributeIgnoreList,l=t.elementsChainAsString,u=[e],c=e;c.parentNode&&!Vo(c,"body");)zo(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var d,f=[],h={},p=!1,v=!1;if(tt(u,(function(e){var t=ns(e);"a"===e.tagName.toLowerCase()&&(p=e.getAttribute("href"),p=t&&p&&cs(p)&&p),ht(Qo(e),"ph-no-capture")&&(v=!0),f.push(vl(e,o,s,a));var n=function(e){if(!ns(e))return{};var t={};return tt(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&cs(i)&&(t[n]=i)}})),t}(e);nt(h,n)})),v)return{props:{},explicitNoCapture:v};if(s||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?f[0].$el_text=ds(e):f[0].$el_text=Jo(e)),p){var _,g;f[0].attr__href=p;var m=null===(_=ln(p))||void 0===_?void 0:_.host,y=null==Oe||null===(g=Oe.location)||void 0===g?void 0:g.host;m&&y&&m!==y&&(d=p)}return{props:nt({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:hs(f)},null!==(n=f[0])&&void 0!==n&&n.$el_text?{$el_text:null===(i=f[0])||void 0===i?void 0:i.$el_text}:{},d&&"click"===r.type?{$external_click_url:d}:{},h)}}var gl,ml=function(){function e(t){o(this,e),l(this,"_initialized",!1),l(this,"_isDisabledServerSide",null),l(this,"rageclicks",new il),l(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}return a(e,[{key:"config",get:function(){var e,t,n=St(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null===(e=n.url_allowlist)||void 0===e?void 0:e.map((function(e){return new RegExp(e)})),n.url_ignorelist=null===(t=n.url_ignorelist)||void 0===t?void 0:t.map((function(e){return new RegExp(e)})),n}},{key:"_addDomEventHandlers",value:function(){var e=this;if(this.isBrowserSupported()){if(Oe&&je){var t=function(t){t=t||(null==Oe?void 0:Oe.event);try{e._captureEvent(t)}catch(e){fl.error("Failed to capture event",e)}};if(ft(je,"submit",t,{capture:!0}),ft(je,"change",t,{capture:!0}),ft(je,"click",t,{capture:!0}),this.config.capture_copied_text){var n=function(t){t=t||(null==Oe?void 0:Oe.event),e._captureEvent(t,Ye)};ft(je,"copy",n,{capture:!0}),ft(je,"cut",n,{capture:!0})}}}else fl.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:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(l({},C,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this._elementSelectors=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((function(t){var i=null==je?void 0:je.querySelectorAll(t);null==i||i.forEach((function(i){e===i&&n.push(t)}))})),n}},{key:"isEnabled",get:function(){var e,t,n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C],i=this._isDisabledServerSide;if(Pt(i)&&!Rt(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:"_captureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var n,i=Xo(e);if(Wo(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this.instance.config.rageclick&&null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick");var r=t===Ye;if(i&&ts(i,e,this.config,r,r?["copy","cut"]:void 0)){var o=_l(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString}),s=o.props;if(o.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(s.$element_selectors=a),t===Ye){var l,u=Yo(null==Oe||null===(l=Oe.getSelection())||void 0===l?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=c}return this.instance.capture(t,s),!0}}}},{key:"isBrowserSupported",value:function(){return wt(null==je?void 0:je.querySelectorAll)}}]),e}(),yl=Ot("[TracingHeaders]"),bl=function(){function e(t){var n=this;o(this,e),l(this,"_restoreXHRPatch",void 0),l(this,"_restoreFetchPatch",void 0),l(this,"_startCapturing",(function(){var e,t,i,r;Et(n._restoreXHRPatch)&&(null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(n.instance.sessionManager));Et(n._restoreFetchPatch)&&(null===(i=Ze.__PosthogExtensions__)||void 0===i||null===(r=i.tracingHeadersPatchFns)||void 0===r||r._patchFetch(n.instance.sessionManager))})),this.instance=t}return a(e,[{key:"_loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"tracing-headers",(function(t){if(t)return yl.error("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}();!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(gl||(gl={}));var kl=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?gl.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===gl.DENIED||this.consent===gl.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?gl.GRANTED:"0"===e?gl.DENIED:gl.PENDING}},{key:"storage",get:function(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?Io:To;var t="localStorage"===e?To:Io;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&&!!dt([null==Be?void 0:Be.doNotTrack,null==Be?void 0:Be.msDoNotTrack,Ze.doNotTrack],(function(e){return ht([!0,1,"1","yes"],e)}))}}]),e}(),wl=Ot("[ExceptionAutocapture]"),Sl=function(){function e(t){var n,i=this;o(this,e),l(this,"startCapturing",(function(){var e,t,n,r;if(Oe&&i.isEnabled&&!i.hasHandlers){var o=null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.errorWrappingFunctions)||void 0===t?void 0:t.wrapOnError,s=null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(r=n.errorWrappingFunctions)||void 0===r?void 0:r.wrapUnhandledRejection;if(o&&s)try{i.unwrapOnError=o(i.captureException.bind(i)),i.unwrapUnhandledRejection=s(i.captureException.bind(i))}catch(e){wl.error("failed to start",e),i.stopCapturing()}else wl.error("failed to load error wrapping functions - cannot start")}})),this.instance=t,this.remoteEnabled=!(null===(n=this.instance.persistence)||void 0===n||!n.props[P]),this.startIfEnabled()}return a(e,[{key:"isEnabled",get:function(){var e;return Rt(this.instance.config.capture_exceptions)?this.instance.config.capture_exceptions:null!==(e=this.remoteEnabled)&&void 0!==e&&e}},{key:"hasHandlers",get:function(){return!Et(this.unwrapOnError)}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.hasHandlers&&(wl.info("enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(e){var t,n;this.hasHandlers&&e(),null===(t=Ze.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"exception-autocapture",(function(t){if(t)return wl.error("failed to load script",t);e()}))}},{key:"stopCapturing",value:function(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),this.unwrapOnError=void 0,null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this),this.unwrapUnhandledRejection=void 0}},{key:"onRemoteConfig",value:function(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register(l({},P,this.remoteEnabled)),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.instance.exceptions.sendExceptionEvent(e)}}]),e}(),xl=Ot("[Web Vitals]"),El=9e5,Cl=function(){function e(n){var i,r=this;o(this,e),l(this,"_enabledServerSide",!1),l(this,"_initialized",!1),l(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),l(this,"_flushToCapture",(function(){clearTimeout(r._delayedFlushTimer),0!==r.buffer.metrics.length&&(r.instance.capture("$web_vitals",r.buffer.metrics.reduce((function(e,n){var i;return t(t({},e),{},(l(i={},"$web_vitals_".concat(n.name,"_event"),t({},n)),l(i,"$web_vitals_".concat(n.name,"_value"),n.value),i))}),{})),r.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),l(this,"_addToBuffer",(function(e){var n,i=null===(n=r.instance.sessionManager)||void 0===n?void 0:n.checkAndGetSessionAndWindowId(!0);if(Et(i))xl.error("Could not read session ID. Dropping metrics!");else{r.buffer=r.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=r._currentURL();if(!Et(o))if(It(null==e?void 0:e.name)||It(null==e?void 0:e.value))xl.error("Invalid metric received",e);else if(r._maxAllowedValue&&e.value>=r._maxAllowedValue)xl.error("Ignoring metric with value >= "+r._maxAllowedValue,e);else r.buffer.url!==o&&(r._flushToCapture(),r._delayedFlushTimer=setTimeout(r._flushToCapture,r.flushToCaptureTimeoutMs)),Et(r.buffer.url)&&(r.buffer.url=o),r.buffer.firstMetricTimestamp=Et(r.buffer.firstMetricTimestamp)?Date.now():r.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),r.buffer.metrics.push(t(t({},e),{},{$current_url:o,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),r.buffer.metrics.length===r.allowedMetrics.length&&r._flushToCapture()}})),l(this,"_startCapturing",(function(){var e,t,n,i,o=Ze.__PosthogExtensions__;if(!Et(o)&&!Et(o.postHogWebVitalsCallbacks)){var s=o.postHogWebVitalsCallbacks;e=s.onLCP,t=s.onCLS,n=s.onFCP,i=s.onINP}e&&t&&n&&i?(r.allowedMetrics.indexOf("LCP")>-1&&e(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("CLS")>-1&&t(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("FCP")>-1&&n(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("INP")>-1&&i(r._addToBuffer.bind(r)),r._initialized=!0):xl.error("web vitals callbacks not loaded - not starting")})),this.instance=n,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[I]),this.startIfEnabled()}return a(e,[{key:"allowedMetrics",get:function(){var e,t,n=St(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Et(n)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[R])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(St(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"_maxAllowedValue",get:function(){var e=St(this.instance.config.capture_performance)&&Ft(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:El;return 0<e&&e<=6e4?El:e}},{key:"isEnabled",get:function(){var e=St(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Rt(e)?e:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(xl.info("enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"onRemoteConfig",value:function(e){var t=St(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=St(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register(l({},I,t)),this.instance.persistence.register(l({},R,n))),this._enabledServerSide=t,this.startIfEnabled()}},{key:"loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"web-vitals",(function(t){t?xl.error("failed to load script",t):e()}))}},{key:"_currentURL",value:function(){var e=Oe?Oe.location.href:void 0;return e||xl.error("Could not determine current URL"),e}}]),e}(),Tl={icontains:function(e,t){return!!Oe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!Oe&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!Oe&&_t(t.href,e)},not_regex:function(e,t){return!!Oe&&!_t(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},Pl=function(){function e(t){var n=this;o(this,e),l(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];n.getWebExperiments((function(t){e.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,t.forEach((function(t){if(t.feature_flag_key){var i;if(n._flagToExperiments)e.logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=n._flagToExperiments)||void 0===i||i.set(t.feature_flag_key,t);var r=n.instance.getFeatureFlag(t.feature_flag_key);Ct(r)&&t.variants[r]&&n.applyTransforms(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var o in t.variants){var s=t.variants[o];e.matchesTestVariant(s)&&n.applyTransforms(t.name,o,s.transforms)}}))}),t)})),this.instance=t,this.instance.onFeatureFlags((function(e){n.onFeatureFlags(e)}))}return a(e,[{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(It(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.logInfo("applying feature flags",t),t.forEach((function(e){var t;if(n._flagToExperiments&&null!==(t=n._flagToExperiments)&&void 0!==t&&t.has(e)){var i,r=n.instance.getFeatureFlag(e),o=null===(i=n._flagToExperiments)||void 0===i?void 0:i.get(e);r&&null!=o&&o.variants[r]&&n.applyTransforms(o.name,r,o.variants[r].transforms)}}))}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=cn(null==n?void 0:n.search,"__experiment_id"),r=cn(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.logInfo("previewing web experiments ".concat(i," && ").concat(r)),this.getWebExperiments((function(e){t.showPreviewWebExperiment(parseInt(i),r,e)}),!1,!0))}}},{key:"loadIfEnabled",value:function(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.instance.config.disable_web_experiments&&!n)return e([]);var i=this.instance.get_property("$web_experiments");if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:function(t){if(200!==t.statusCode||!t.json)return e([]);var n=t.json.experiments||[];return e(n)}})}},{key:"showPreviewWebExperiment",value:function(t,n,i){var r=i.filter((function(e){return e.id===t}));r&&r.length>0&&(e.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(r[0].name,n,r[0].variants[n].transforms))}},{key:"applyTransforms",value:function(t,n,i){this._is_bot()?e.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==n?i.forEach((function(i){if(i.selector){var r;e.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var o=null===(r=document)||void 0===r?void 0:r.querySelectorAll(i.selector);null==o||o.forEach((function(e){var t=e;i.attributes&&i.attributes.forEach((function(e){switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),i.text&&(t.innerText=i.text),i.html&&(t.parentElement?t.parentElement.innerHTML=i.html:t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):e.logInfo("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return Be&&this.instance?nl(Be,this.instance.config.custom_blocked_useragents):void 0}}],[{key:"matchesTestVariant",value:function(t){return!It(t.conditions)&&(e.matchUrlConditions(t)&&e.matchUTMConditions(t))}},{key:"matchUrlConditions",value:function(t){var n;if(It(t.conditions)||It(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;var i,r,o,s=e.getWindowLocation();return!!s&&(null===(i=t.conditions)||void 0===i||!i.url||Tl[null!==(r=null===(o=t.conditions)||void 0===o?void 0:o.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,s))}},{key:"getWindowLocation",value:function(){return null==Oe?void 0:Oe.location}},{key:"matchUTMConditions",value:function(e){var t;if(It(e.conditions)||It(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var n=fi.campaignParams();if(n.utm_source){var i,r,o,s,a,l,u,c,d,f,h,p,v,_,g,m,y=null===(i=e.conditions)||void 0===i||null===(r=i.utm)||void 0===r||!r.utm_campaign||(null===(o=e.conditions)||void 0===o||null===(s=o.utm)||void 0===s?void 0:s.utm_campaign)==n.utm_campaign,b=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(u=e.conditions)||void 0===u||null===(c=u.utm)||void 0===c?void 0:c.utm_source)==n.utm_source,k=null===(d=e.conditions)||void 0===d||null===(f=d.utm)||void 0===f||!f.utm_medium||(null===(h=e.conditions)||void 0===h||null===(p=h.utm)||void 0===p?void 0:p.utm_medium)==n.utm_medium,w=null===(v=e.conditions)||void 0===v||null===(_=v.utm)||void 0===_||!_.utm_term||(null===(g=e.conditions)||void 0===g||null===(m=g.utm)||void 0===m?void 0:m.utm_term)==n.utm_term;return y&&k&&w&&b}return!1}},{key:"logInfo",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];$t.info("[WebExperiments] ".concat(e),n)}}]),e}(),Il=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),e}(),Fl=["$set_once","$set"],Rl=Ot("[SiteApps]"),Ml=function(){function e(t){o(this,e),this.instance=t,this.bufferedInvocations=[],this.apps={}}return a(e,[{key:"isEnabled",get:function(){return!!this.instance.config.opt_in_site_apps}},{key:"eventCollector",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.bufferedInvocations.push(n),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}},{key:"siteAppLoaders",get:function(){var e,t;return null===(e=Ze._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.siteApps}},{key:"init",value:function(){var e=this;if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=function(){t(),e.bufferedInvocations=[],e.stopBuffering=void 0}}}},{key:"globalsForEvent",value:function(e){var n,i,r,o,s,a,l;if(!e)throw new Error("Event payload is required");for(var d={},f=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{},p=0,v=Object.entries(h);p<v.length;p++){var _=c(v[p],2),g=_[0],m=_[1];d[g]={id:f[g],type:g,properties:m}}var y=e.$set_once,b=e.$set;return{event:t(t({},u(e,Fl)),{},{properties:t(t(t({},e.properties),b?{$set:t(t({},null!==(n=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==n?n:{}),b)}:{}),y?{$set_once:t(t({},null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$set_once)&&void 0!==r?r:{}),y)}:{}),elements_chain:null!==(s=null===(a=e.properties)||void 0===a?void 0:a.$elements_chain)&&void 0!==s?s:"",distinct_id:null===(l=e.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:d}}},{key:"setupSiteApp",value:function(e){var t=this,n={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=n;var i=function(i){var r;t.apps[e.id].errored=!i,t.apps[e.id].loaded=!0,Rl.info("Site app with id ".concat(e.id," ").concat(i?"loaded":"errored")),i&&t.bufferedInvocations.length&&(Rl.info("Processing ".concat(t.bufferedInvocations.length," events for site app with id ").concat(e.id)),t.bufferedInvocations.forEach((function(e){var t;return null===(t=n.processEvent)||void 0===t?void 0:t.call(n,e)})));for(var o=0,s=Object.values(t.apps);o<s.length;o++){if(!s[o].loaded)return}null===(r=t.stopBuffering)||void 0===r||r.call(t)};try{var r=e.init({posthog:this.instance,callback:function(e){i(e)}}).processEvent;r&&(n.processEvent=r)}catch(t){Rl.error("Error while initializing PostHog app with config id ".concat(e.id),t),i(!1)}}},{key:"onCapturedEvent",value:function(e){if(0!==Object.keys(this.apps).length)for(var t=this.globalsForEvent(e),n=0,i=Object.values(this.apps);n<i.length;n++){var r=i[n];try{var o;null===(o=r.processEvent)||void 0===o||o.call(r,t)}catch(t){Rl.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),t)}}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r=this;if(null!==(t=this.siteAppLoaders)&&void 0!==t&&t.length){if(!this.isEnabled)return void Rl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');var o,s=p(this.siteAppLoaders);try{for(s.s();!(o=s.n()).done;){var a=o.value;this.setupSiteApp(a)}}catch(e){s.e(e)}finally{s.f()}this.instance.on("eventCaptured",(function(e){return r.onCapturedEvent(e)}))}else if(null===(n=this.stopBuffering)||void 0===n||n.call(this),null!==(i=e.siteApps)&&void 0!==i&&i.length)if(this.isEnabled){var l,u=p(e.siteApps);try{var c=function(){var e,t,n=l.value,i=n.id,o=n.url;Ze["__$$ph_site_app_".concat(i)]=r.instance,null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.loadSiteApp)||void 0===t||t.call(e,r.instance,o,(function(e){if(e)return Rl.error("Error while initializing PostHog app with config id ".concat(i),e)}))};for(u.s();!(l=u.n()).done;)c()}catch(e){u.e(e)}finally{u.f()}}else Rl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}();function Ll(e,t,n){return qa({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ql={},$l=function(){},Ol="posthog",Al=!Ra&&-1===(null==Ge?void 0:Ge.indexOf("MSIE"))&&-1===(null==Ge?void 0:Ge.indexOf("Mozilla")),Dl=function(){var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:ct(null==je?void 0:je.location),persistence:"localStorage+cookie",persistence_name:"",loaded:$l,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Ue&&Ct(null==Ue?void 0:Ue.search)&&-1!==Ue.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Oe||null===(e=Oe.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:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],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;$t.error(t)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Pa},_onCapture:$l}},Nl=function(e){var t={};Et(e.process_person)||(t.person_profiles=e.process_person),Et(e.xhr_headers)||(t.request_headers=e.xhr_headers),Et(e.cookie_name)||(t.persistence_name=e.cookie_name),Et(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Et(e.store_google)||(t.save_campaign_params=e.store_google),Et(e.verbose)||(t.debug=e.verbose);var n=nt({},t,e);return kt(e.property_blacklist)&&(Et(e.property_denylist)?n.property_denylist=e.property_blacklist:kt(e.property_denylist)?n.property_denylist=[].concat(d(e.property_blacklist),d(e.property_denylist)):$t.error("Invalid value for property_denylist config: "+e.property_denylist)),n},Hl=function(){function e(){o(this,e),l(this,"__forceAllowLocalhost",!1)}return a(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){$t.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),Bl=function(){function e(){var t=this;o(this,e),l(this,"webPerformance",new Hl),l(this,"version",Qe.LIB_VERSION),l(this,"_internalEventEmitter",new hi),this.config=Dl(),this.SentryIntegration=za,this.sentryIntegration=function(e){return function(e,t){var n=Wa(e,t);return{name:Va,processEvent:function(e){return n(e)}}}(t,e)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedIdentify=null,this.featureFlags=new po(this),this.toolbar=new Ta(this),this.scrollManager=new dl(this),this.pageViewManager=new Qa(this),this.surveys=new Ei(this),this.experiments=new Pl(this),this.exceptions=new Il(this),this.rateLimiter=new Ja(this),this.requestRouter=new Ua(this),this.consent=new kl(this),this.people={set:function(e,n,i){var r=Ct(e)?l({},e,n):e;t.setPersonProperties(r),null==i||i({})},set_once:function(e,n,i){var r=Ct(e)?l({},e,n):e;t.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(function(e){return $t.info('send "'.concat(null==e?void 0:e.event,'"'),e)}))}return a(e,[{key:"decideEndpointWasHit",get:function(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"init",value:function(t,n,i){if(i&&i!==Ol){var r,o=null!==(r=ql[i])&&void 0!==r?r:new e;return o._init(t,n,i),ql[i]=o,ql[Ol][i]=o,o}return this._init(t,n,i)}},{key:"_init",value:function(e){var n,i,r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(Et(e)||Tt(e))return $t.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 $t.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],o.person_profiles&&(this._initialPersonProfilesConfig=o.person_profiles),this.set_config(nt({},Dl(),Nl(o),{name:s,token:e})),this.config.on_xhr_error&&$t.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=o.disable_compression?void 0:$e.GZipJS,this.persistence=new Ao(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ao(t(t({},this.config),{},{persistence:"sessionStorage"}));var a=t({},this.persistence.props),l=t({},this.sessionPersistence.props);if(this._requestQueue=new Ia((function(e){return r._send_retriable_request(e)}),this.config.request_queue_config),this._retryQueue=new Na(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new Ba(this),this.sessionPropsManager=new Ka(this,this.sessionManager,this.persistence)),new bl(this).startIfEnabledOrStop(),this.siteApps=new Ml(this),null===(n=this.siteApps)||void 0===n||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new ka(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ml(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new cl(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Cl(this),this.exceptionObserver=new Sl(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new al(this,sl),this.deadClicksAutocapture.startIfEnabled(),Qe.DEBUG=Qe.DEBUG||this.config.debug,Qe.DEBUG&&$t.info("Starting in debug mode",{this:this,config:o,thisC:t({},this.config),p:a,s:l}),this._sync_opt_out_with_persistence(),void 0!==(null===(i=o.bootstrap)||void 0===i?void 0:i.distinctID)){var u,c,d=this.config.get_device_id(ko()),f=null!==(u=o.bootstrap)&&void 0!==u&&u.isIdentifiedID?d:o.bootstrap.distinctID;this.persistence.set_property(Y,null!==(c=o.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:f})}if(this._hasBootstrappedFeatureFlags()){var h,p,v=Object.keys((null===(h=o.bootstrap)||void 0===h?void 0:h.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,i;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(i=n.featureFlags)||void 0===i?void 0:i[t])||!1,e}),{}),_=Object.keys((null===(p=o.bootstrap)||void 0===p?void 0:p.featureFlagPayloads)||{}).filter((function(e){return v[e]})).reduce((function(e,t){var n,i,r,s;null!==(n=o.bootstrap)&&void 0!==n&&null!==(i=n.featureFlagPayloads)&&void 0!==i&&i[t]&&(e[t]=null===(r=o.bootstrap)||void 0===r||null===(s=r.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:_})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:re,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(ko());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(Y,"anonymous")}return ft(Oe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),o.segment?Za(this,(function(){return r._loaded()})):this._loaded(),wt(this.config._onCapture)&&this.config._onCapture!==$l&&($t.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(function(e){return r.config._onCapture(e.event,e)}))),this}},{key:"_onRemoteConfig",value:function(e){var t,n,i,r,o,s,a,l,u=this;if(!je||!je.body)return $t.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){u._onRemoteConfig(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ht(e.supportedCompression,$e.GZipJS)?$e.GZipJS:ht(e.supportedCompression,$e.Base64)?$e.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),null===(n=this.siteApps)||void 0===n||n.onRemoteConfig(e),null===(i=this.sessionRecording)||void 0===i||i.onRemoteConfig(e),null===(r=this.autocapture)||void 0===r||r.onRemoteConfig(e),null===(o=this.heatmaps)||void 0===o||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null===(s=this.webVitalsAutocapture)||void 0===s||s.onRemoteConfig(e),null===(a=this.exceptionObserver)||void 0===a||a.onRemoteConfig(e),null===(l=this.deadClicksAutocapture)||void 0===l||l.onRemoteConfig(e)}},{key:"_loaded",value:function(){var e=this;try{this.config.loaded(this)}catch(e){$t.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((function(){e.consent.isOptedIn()&&e._captureInitialPageview()}),1),new Sa(this).load(),this.featureFlags.decide()}},{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()||et(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&&(Al?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=La(e.url,{ip:this.config.ip?1:0}),e.headers=t({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var n,i,r,o=t({},e);o.timeout=o.timeout||6e4,o.url=La(o.url,{_:(new Date).getTime().toString(),ver:Qe.LIB_VERSION,compression:o.compression});var s=null!==(n=o.transport)&&void 0!==n?n:"fetch",a=null!==(i=null===(r=dt(Oa,(function(e){return e.transport===s})))||void 0===r?void 0:r.method)&&void 0!==i?i:Oa[0].method;if(!a)throw new Error("No available transport method");a(o)}(t(t({},e),{},{callback:function(t){var i,r,o;(n.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(r=(o=n.config).on_request_error)||void 0===r||r.call(o,t));null===(i=e.callback)||void 0===i||i.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,i=[],r=[],o=[];et(e,(function(e){e&&(t=e[0],kt(t)?o.push(e):wt(e)?e.call(n):kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&wt(n[t])?o.push(e):r.push(e))}));var s=function(e,t){et(e,(function(e){if(kt(e[0])){var n=t;tt(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};s(i,this),s(r,this),s(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,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Et(e)&&Ct(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=(null==i?void 0:i.timestamp)||s,l=ko(),u={uuid:l,event:e,properties:this._calculate_event_properties(e,n||{},a,l)};o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==i?void 0:i.$set)&&(u.$set=null==i?void 0:i.$set);var c=this._calculate_set_once_properties(null==i?void 0:i.$set_once);c&&(u.$set_once=c),(u=lt(u,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,Et(null==i?void 0:i.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=s);var d=t(t({},u.properties.$set),u.$set);if(xt(d)||this.setPersonPropertiesForFlags(d),!It(this.config.before_send)){var f=this._runBeforeSend(u);if(!f)return;u=f}this._internalEventEmitter.emit("eventCaptured",u);var h={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(h):this._requestQueue.enqueue(h),u}$t.critical("This capture call is ignored due to client rate limiting.")}}else $t.error("No event name provided to posthog.capture")}else $t.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",(function(t){return e(t.event,t)}))}},{key:"_calculate_event_properties",value:function(e,n,i,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var o=this.persistence.remove_event_timer(e),s=t({},n);if(s.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),"$snapshot"===e){var a=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=a.distinct_id,(!Ct(s.distinct_id)&&!Ft(s.distinct_id)||Tt(s.distinct_id))&&$t.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var l,u=fi.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(),d=c.sessionId,f=c.windowId;s.$session_id=d,s.$window_id=f}if(this.sessionRecording&&(s.$recording_status=this.sessionRecording.status),this.requestRouter.region===Da.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),l="$pageview"===e?this.pageViewManager.doPageView(i,r):"$pageleave"===e?this.pageViewManager.doPageLeave(i):this.pageViewManager.doEvent(),s=nt(s,l),"$pageview"===e&&je&&(s.title=je.title),!Et(o)){var h=i.getTime()-o;s.$duration=parseFloat((h/1e3).toFixed(3))}Ge&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=nt({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),kt(this.config.property_denylist)?tt(this.config.property_denylist,(function(e){delete s[e]})):$t.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&($t.error("sanitize_properties is deprecated. Use before_send instead"),s=p(s,e));var v=this._hasPersonProcessing();return s.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),s}},{key:"_calculate_set_once_properties",value:function(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=nt({},this.persistence.get_initial_props(),e||{}),n=this.config.sanitize_properties;return n&&($t.error("sanitize_properties is deprecated. Use before_send instead"),t=n(t,"$set_once")),xt(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 i;null===(i=this.persistence)||void 0===i||i.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(l({},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:"renderSurvey",value:function(e,t){this.surveys.renderSurvey(e,t)}},{key:"canRenderSurvey",value:function(e){this.surveys.canRenderSurvey(e)}},{key:"getNextSurveyStep",value:function(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}},{key:"identify",value:function(e,n,i){if(!this.__loaded||!this.persistence)return $t.uninitializedWarning("posthog.identify");if(Ft(e)&&(e=e.toString(),$t.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()))$t.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(x)&&(this.unregister(x),this.register({distinct_id:e}));var s="anonymous"===(this.persistence.get_property(Y)||"anonymous");e!==r&&s?(this.persistence.set_property(Y,"identified"),this.setPersonPropertiesForFlags(t(t({},i||{}),n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:n||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(r),this._cachedIdentify=Ll(e,n,i)):(n||i)&&(this._cachedIdentify!==Ll(e,n,i)?(this.setPersonProperties(n,i),this._cachedIdentify=Ll(e,n,i)):$t.info("A duplicate posthog.identify call was made with the same properties. It has been ignored.")),e!==r&&(this.reloadFeatureFlags(),this.unregister(Q))}}else $t.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,n){(e||n)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(t(t({},n||{}),e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}))}},{key:"group",value:function(e,n,i){if(e&&n){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},r),{},l({},e,n))}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:i}),this.setGroupPropertiesForFlags(l({},e,i))),r[e]===n||i||this.reloadFeatureFlags()}}else $t.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,i,r;if($t.info("reset"),!this.__loaded)return $t.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.surveys.reset(),null===(i=this.persistence)||void 0===i||i.set_property(Y,"anonymous"),null===(r=this.sessionManager)||void 0===r||r.resetSessionId(),this._cachedIdentify=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:re,$device_id:null},"");else{var s=this.config.get_device_id(ko());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}},{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,i=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(null!=e&&e.withTimestamp&&i){var o,s=null!==(o=e.timestampLookBack)&&void 0!==o?o:10;if(!i)return r;var a=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0);r+="?t=".concat(a)}return r}},{key:"alias",value:function(e,t){return e===this.get_property(S)?($t.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(x,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($t.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var n,i,r,o,s=t({},this.config);St(e)&&(nt(this.config,Nl(e)),null===(n=this.persistence)||void 0===n||n.update_config(this.config,s),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ao(t(t({},this.config),{},{persistence:"sessionStorage"})),Io.is_supported()&&"true"===Io.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(Qe.DEBUG=!0,$t.info("set_config",{config:e,oldConfig:s,newConfig:t({},this.config)})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(r=this.autocapture)||void 0===r||r.startIfEnabled(),null===(o=this.heatmaps)||void 0===o||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(e){var t=!0===e,n={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(n).some(Boolean)){var i,r,o,s,a;if(null===(i=this.sessionManager)||void 0===i||i.checkAndGetSessionAndWindowId(),n.sampling)null===(r=this.sessionRecording)||void 0===r||r.overrideSampling();if(n.linked_flag)null===(o=this.sessionRecording)||void 0===o||o.overrideLinkedFlag();if(n.url_trigger)null===(s=this.sessionRecording)||void 0===s||s.overrideTrigger("url");if(n.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}},{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:"captureException",value:function(e,n){var i,r=new Error("PostHog syntheticException"),o=wt(null===(i=Ze.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?t(t({},Ze.__PosthogExtensions__.parseErrorAsProperties(Lt(e)?{error:e,event:e.message}:{event:e},{syntheticException:r})),n):t({$exception_level:"error",$exception_list:[{type:Lt(e)?e.name:"Error",value:Lt(e)?e.message:e,mechanism:{handled:!0,synthetic:!1}}]},n);this.exceptions.sendExceptionEvent(o)}},{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:Ol;return t!==Ol&&(t=Ol+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(Y))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(Y))}},{key:"_hasPersonProcessing",value:function(){var e,t,n,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&xt(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[x])&&(null===(n=this.persistence)||void 0===n||null===(i=n.props)||void 0===i||!i[ne]))}},{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?($t.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ne,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var e,t,n,i,r=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||r&&!!o;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==s&&(null===(n=this.persistence)||void 0===n||n.set_disabled(s));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==s&&(null===(i=this.sessionPersistence)||void 0===i||i.set_disabled(s))}},{key:"opt_in_capturing",value:function(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),Et(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}},{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:"_is_bot",value:function(){return Be?nl(Be,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){je&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:je.title},{send_instantly:!0}))}},{key:"debug",value:function(e){!1===e?(null==Oe||Oe.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==Oe||Oe.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}))}},{key:"_runBeforeSend",value:function(e){if(It(this.config.before_send))return e;var t,n=e,i=p(kt(this.config.before_send)?this.config.before_send:[this.config.before_send]);try{for(i.s();!(t=i.n()).done;){if(n=(0,t.value)(n),It(n)){var r="Event '".concat(e.event,"' was rejected in beforeSend function");return qt(e.event)?$t.warn("".concat(r,". This can cause unexpected behavior.")):$t.info(r),null}n.properties&&!xt(n.properties)||$t.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"getPageViewId",value:function(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}}]),e}();!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=st(e.prototype[t[n]])}(Bl,["identify"]);var jl,Ul;jl=ql[Ol]=new Bl,(Ul=Ze.posthog)&&tt(Ul._i,(function(e){if(e&&kt(e)){var t=jl.init(e[0],e[1],e[2]),n=Ul[e[2]]||Ul;t&&(t._execute_array.call(t.people,n.people),t._execute_array(n))}})),Ze.posthog=jl,function(){function e(){e.done||(e.done=!0,Al=!1,tt(ql,(function(e){e._dom_loaded()})))}null!=je&&je.addEventListener?"complete"===je.readyState?e():ft(je,"DOMContentLoaded",e,{capture:!1}):Oe&&$t.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
1
+ !function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){l(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(){n=function(){return e};var e={},t=Object.prototype,i=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof f?t:f,o=Object.create(r.prototype),s=new x(i||[]);return o._invoke=function(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return C()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=k(s,n);if(a){if(a===d)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(e,n,s),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function f(){}function h(){}function p(){}var v={};l(v,o,(function(){return this}));var _=Object.getPrototypeOf,g=_&&_(_(E([])));g&&g!==t&&i.call(g,o)&&(v=g);var m=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function n(r,o,s,a){var l=c(e[r],e,o);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==typeof d&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,a)}))}a(l.arg)}var r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=p,l(m,"constructor",p),l(p,"constructor",h),h.displayName=l(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,i,r,o){void 0===o&&(o=Promise);var s=new b(u(t,n,i,r),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},y(m),l(m,a,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(a&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(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 i=n.completion;if("throw"===i.type){var r=i.arg;S(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(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},i(e)}function r(e,t,n,i,r,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function p(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var v,_,g,m,y,b,k,w,S="$people_distinct_id",x="__alias",E="__timers",C="$autocapture_disabled_server_side",T="$heatmaps_enabled_server_side",P="$exception_capture_enabled_server_side",I="$web_vitals_enabled_server_side",F="$dead_clicks_enabled_server_side",R="$web_vitals_allowed_metrics",M="$session_recording_enabled_server_side",L="$console_log_recording_enabled_server_side",q="$session_recording_network_payload_capture",$="$session_recording_canvas_recording",O="$replay_sample_rate",A="$replay_minimum_duration",D="$replay_script_config",N="$sesid",H="$session_is_sampled",B="$session_recording_url_trigger_activated_session",j="$session_recording_event_trigger_activated_session",U="$enabled_feature_flags",V="$early_access_features",W="$stored_person_properties",z="$stored_group_properties",G="$surveys",Z="$surveys_activated",Q="$flag_call_reported",Y="$user_state",J="$client_session_props",X="$capture_rate_limit",K="$initial_campaign_params",ee="$initial_referrer_info",te="$initial_person_info",ne="$epp",ie="__POSTHOG_TOOLBAR__",re="$posthog_cookieless",oe=[S,x,"__cmpns",E,M,T,N,U,Y,V,z,W,G,Q,J,X,K,ee,ne],se={},ae=[],le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ue=Array.isArray;function ce(e,t){for(var n in t)e[n]=t[n];return e}function de(e){var t=e.parentNode;t&&t.removeChild(e)}function fe(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?v.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return he(e,s,i,r,null)}function he(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++g:r,__i:-1,__u:0};return null==r&&null!=_.vnode&&_.vnode(o),o}function pe(e){return e.children}function ve(e,t){this.props=e,this.context=t}function _e(e,t){if(null==t)return e.__?_e(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?_e(e):null}function ge(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return ge(e)}}function me(e){(!e.__d&&(e.__d=!0)&&m.push(e)&&!ye.__r++||y!==_.debounceRendering)&&((y=_.debounceRendering)||b)(ye)}function ye(){var e,t,n,i,r,o,s,a,l;for(m.sort(k);e=m.shift();)e.__d&&(t=m.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=ce({},r)).__v=r.__v+1,_.vnode&&_.vnode(i),Te(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?_e(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Pe(a,i,l),i.__e!=o&&ge(i)),m.length>t&&m.sort(k));ye.__r=0}function be(e,t,n,i,r,o,s,a,l,u,c){var d,f,h,p,v,_=i&&i.__k||ae,g=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,u=n.length,c=u,d=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?he(null,r,null,null,r):ue(r)?he(pe,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?he(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=we(r,n,s=i+d,c),r.__i=a,o=null,-1!==a&&(c--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&d--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?d++:a>s?c>l-s?d+=a-s:d--:d=a<s&&a==s-1?a-s:0,a!==i+d&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=_e(o)),Re(o,o,!1),n[i]=null,c--);if(c)for(i=0;i<u;i++)null!=(o=n[i])&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=_e(o)),Re(o,o))}(n,t,_),l=n.__d,d=0;d<g;d++)null!=(h=n.__k[d])&&"boolean"!=typeof h&&"function"!=typeof h&&(f=-1===h.__i?se:_[h.__i]||se,h.__i=d,Te(e,h,f,r,o,s,a,l,u,c),p=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Fe(f.ref,null,h),c.push(h.ref,h.__c||p,h)),null==v&&null!=p&&(v=p),65536&h.__u||f.__k===h.__k?l=ke(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:p&&(l=p.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=v}function ke(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=ke(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function we(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function Se(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||le.test(t)?n:n+"px"}function xe(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Se(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Se(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?Ce:Ee,o)):e.removeEventListener(t,o?Ce:Ee,o);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Ee(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(_.event?_.event(e):e)}function Ce(e){return this.l[e.type+!0](_.event?_.event(e):e)}function Te(e,t,n,i,r,o,s,a,l,u){var c,d,f,h,p,v,g,m,y,b,k,w,S,x,E,C=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(c=_.__b)&&c(t);e:if("function"==typeof C)try{if(m=t.props,y=(c=C.contextType)&&i[c.__c],b=c?y?y.props.value:c.__:i,n.__c?g=(d=t.__c=n.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(m,b):(t.__c=d=new ve(m,b),d.constructor=C,d.render=Me),y&&y.sub(d),d.props=m,d.state||(d.state={}),d.context=b,d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ce({},d.__s)),ce(d.__s,C.getDerivedStateFromProps(m,d.__s))),h=d.props,p=d.state,d.__v=t,f)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,b),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,b),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(h,p,v)}))}if(d.context=b,d.props=m,d.__P=e,d.__e=!1,w=_.__r,S=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[]}else do{d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(i=ce(ce({},i),d.getChildContext())),f||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(h,p)),be(e,ue(E=null!=c&&c.type===pe&&null==c.key?c.props.children:c)?E:[E],t,n,i,r,o,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),_.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ie(n.__e,t,n,i,r,o,s,l,u);(c=_.diffed)&&c(t)}function Pe(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Fe(n[i],n[++i],n[++i]);_.__c&&_.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){_.__e(e,t.__v)}}))}function Ie(e,t,n,i,r,o,s,a,l){var u,c,d,f,h,p,_,g=n.props,m=t.props,y=t.type;if("svg"===y&&(r=!0),null!=o)for(u=0;u<o.length;u++)if((h=o[u])&&"setAttribute"in h==!!y&&(y?h.localName===y:3===h.nodeType)){e=h,o[u]=null;break}if(null==e){if(null===y)return document.createTextNode(m);e=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,m.is&&m),o=null,a=!1}if(null===y)g===m||a&&e.data===m||(e.data=m);else{if(o=o&&v.call(e.childNodes),g=n.props||se,!a&&null!=o)for(g={},u=0;u<e.attributes.length;u++)g[(h=e.attributes[u]).name]=h.value;for(u in g)h=g[u],"children"==u||("dangerouslySetInnerHTML"==u?d=h:"key"===u||u in m||xe(e,u,null,h,r));for(u in m)h=m[u],"children"==u?f=h:"dangerouslySetInnerHTML"==u?c=h:"value"==u?p=h:"checked"==u?_=h:"key"===u||a&&"function"!=typeof h||g[u]===h||xe(e,u,h,g[u],r);if(c)a||d&&(c.__html===d.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),be(e,ue(f)?f:[f],t,n,i,r&&"foreignObject"!==y,o,s,o?o[0]:n.__k&&_e(n,0),a,l),null!=o)for(u=o.length;u--;)null!=o[u]&&de(o[u]);a||(u="value",void 0!==p&&(p!==e[u]||"progress"===y&&!p||"option"===y&&p!==g[u])&&xe(e,u,p,g[u],!1),u="checked",void 0!==_&&_!==e[u]&&xe(e,u,_,g[u],!1))}return e}function Fe(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){_.__e(e,n)}}function Re(e,t,n){var i,r;if(_.unmount&&_.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Fe(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){_.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Re(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||de(e.__e),e.__=e.__e=e.__d=void 0}function Me(e,t,n){return this.constructor(e,n)}function Le(e,t,n){var i,r,o,s;_.__&&_.__(e,t),r=(i="function"==typeof n)?null:t.__k,o=[],s=[],Te(t,e=(!i&&n||t).__k=fe(pe,null,[e]),r||se,se,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?v.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Pe(o,e,s)}function qe(e,t,n){var i,r,o,s,a=ce({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==o?i=t[o]:"ref"==o?r=t[o]:a[o]=void 0===t[o]&&void 0!==s?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?v.call(arguments,2):n),he(e.type,a,i||e.key,r||e.ref,null)}v=ae.slice,_={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},g=0,ve.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ce({},this.state),"function"==typeof e&&(e=e(ce({},n),this.props)),e&&ce(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),me(this))},ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),me(this))},ve.prototype.render=pe,m=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k=function(e,t){return e.__v.__b-t.__v.__b},ye.__r=0,w=0;var $e,Oe="undefined"!=typeof window?window:void 0,Ae="undefined"!=typeof globalThis?globalThis:Oe,De=Array.prototype,Ne=De.forEach,He=De.indexOf,Be=null==Ae?void 0:Ae.navigator,je=null==Ae?void 0:Ae.document,Ue=null==Ae?void 0:Ae.location,Ve=null==Ae?void 0:Ae.fetch,We=null!=Ae&&Ae.XMLHttpRequest&&"withCredentials"in new Ae.XMLHttpRequest?Ae.XMLHttpRequest:void 0,ze=null==Ae?void 0:Ae.AbortController,Ge=null==Be?void 0:Be.userAgent,Ze=null!=Oe?Oe:{},Qe={DEBUG:!1,LIB_VERSION:"1.217.2"},Ye="$copy_autocapture",Je=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];!function(e){e.GZipJS="gzip-js",e.Base64="base64"}($e||($e={}));var Xe=["fatal","error","warning","log","info","debug"],Ke={};function et(e,t,n){if(kt(e))if(Ne&&e.forEach===Ne)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var i=0,r=e.length;i<r;i++)if(i in e&&t.call(n,e[i],i)===Ke)return}function tt(e,t,n){if(!It(e)){if(kt(e))return et(e,t,n);if(Mt(e)){var i,r=p(e.entries());try{for(r.s();!(i=r.n()).done;){var o=i.value;if(t.call(n,o[1],o[0])===Ke)return}}catch(e){r.e(e)}finally{r.f()}}else for(var s in e)if(yt.call(e,s)&&t.call(n,e[s],s)===Ke)return}}var nt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return et(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},it=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return et(n,(function(t){et(t,(function(t){e.push(t)}))})),e};function rt(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var ot=function(e){try{return e()}catch(e){return}},st=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){$t.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$t.critical(e)}}},at=function(e){var t={};return tt(e,(function(e,n){Ct(e)&&e.length>0&&(t[n]=e)})),t};function lt(e,t){return n=e,i=function(e){return Ct(e)&&!Pt(t)?e.slice(0,t):e},r=new Set,function e(t,n){return t!==Object(t)?i?i(t,n):t:r.has(t)?void 0:(r.add(t),kt(t)?(o=[],et(t,(function(t){o.push(e(t))}))):(o={},tt(t,(function(t,n){r.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,i,r}var ut=["herokuapp.com","vercel.app","netlify.app"];function ct(e){var t=null==e?void 0:e.hostname;if(!Ct(t))return!1;var n,i=t.split(".").slice(-2).join("."),r=p(ut);try{for(r.s();!(n=r.n()).done;){if(i===n.value)return!1}}catch(e){r.e(e)}finally{r.f()}return!0}function dt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function ft(e,t,n,i){var r=null!=i?i:{},o=r.capture,s=void 0!==o&&o,a=r.passive,l=void 0===a||a;null==e||e.addEventListener(t,n,{capture:s,passive:l})}function ht(e,t){return-1!==e.indexOf(t)}var pt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},vt=function(e){return e.replace(/^\$/,"")};var _t=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},gt=Array.isArray,mt=Object.prototype,yt=mt.hasOwnProperty,bt=mt.toString,kt=gt||function(e){return"[object Array]"===bt.call(e)},wt=function(e){return"function"==typeof e},St=function(e){return e===Object(e)&&!kt(e)},xt=function(e){if(St(e)){for(var t in e)if(yt.call(e,t))return!1;return!0}return!1},Et=function(e){return void 0===e},Ct=function(e){return"[object String]"==bt.call(e)},Tt=function(e){return Ct(e)&&0===e.trim().length},Pt=function(e){return null===e},It=function(e){return Et(e)||Pt(e)},Ft=function(e){return"[object Number]"==bt.call(e)},Rt=function(e){return"[object Boolean]"===bt.call(e)},Mt=function(e){return e instanceof FormData},Lt=function(e){return e instanceof Error},qt=function(e){return ht(Je,e)},$t=function e(t){var n={_log:function(e){if(Oe&&(Qe.DEBUG||Ze.POSTHOG_DEBUG)&&!Et(Oe.console)&&Oe.console){for(var n=("__rrweb_original__"in Oe.console[e]?Oe.console[e].__rrweb_original__:Oe.console[e]),i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];n.apply(void 0,[t].concat(r))}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["log"].concat(t))},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["warn"].concat(t))},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n._log.apply(n,["error"].concat(t))},critical:function(){for(var e,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];(e=console).error.apply(e,[t].concat(i))},uninitializedWarning:function(e){n.error("You must initialize PostHog before calling ".concat(e))},createLogger:function(n){return e("".concat(t," ").concat(n))}};return n}("[PostHog.js]"),Ot=$t.createLogger,At=Oe,Dt=je,Nt="seenSurvey_",Ht=Ot("[Surveys]"),Bt=function(e){return"\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: ".concat((null==e?void 0:e.fontFamily)||"-apple-system",', BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n text-align: left;\n max-width: ').concat(parseInt((null==e?void 0:e.maxWidth)||"300"),"px;\n width: 100%;\n z-index: ").concat(parseInt((null==e?void 0:e.zIndex)||"99999"),";\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n border-bottom: 0px;\n ").concat({left:"left: 30px;",right:"right: 30px;",center:"\n left: 50%;\n transform: translateX(-50%);\n "}[(null==e?void 0:e.position)||"right"]||"right: 30px;","\n flex-direction: column;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n\n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: 0.6;\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: ").concat((null==e?void 0:e.fontFamily)||"-apple-system",', BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ').concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ").concat((null==e?void 0:e.submitButtonColor)||"black"," !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n text-decoration: none;\n backgroundColor: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n color: ").concat(Ut((null==e?void 0:e.backgroundColor)||"#eeeded"),";\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ")};function jt(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 Ut(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Zt;"#"===t[0]&&(e=jt(t)),t.startsWith("rgb")&&(e=t);var n=function(e){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()]}(t);if(n&&(e=jt(n)),!e)return"black";var i=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var r=parseInt(i[1]),o=parseInt(i[2]),s=parseInt(i[3]);return Math.sqrt(r*r*.299+o*o*.587+s*s*.114)>127.5?"black":"white"}return"black"}var Vt,Wt,zt,Gt={backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},Zt="#eeeded",Qt=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;r?(localStorage.setItem(tn(i),"true"),r.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=r.get_session_replay_url)||void 0===e?void 0:e.call(r)},n),{},{$set:l({},nn(i,"responded"),!0)})),At.dispatchEvent(new Event("PHSurveySent"))):Ht.error("[survey sent] event not captured, PostHog instance not found.")},Yt=function(e,t,n){var i;t?n||(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:l({},nn(e,"dismissed"),!0)}),localStorage.setItem(tn(e),"true"),At.dispatchEvent(new Event("PHSurveyClosed"))):Ht.error("[survey dismissed] event not captured, PostHog instance not found.")},Jt=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}))},Xt=function(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))?t.reverse():t},Kt=function(e){return e.questions.forEach((function(e,t){e.originalQuestionIndex=t})),e.appearance&&e.appearance.shuffleQuestions?Xt(e.questions,Jt(e.questions)):e.questions},en=function(e){var t,n;return!(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||!n.repeatedActivation||!function(e){var t,n,i,r,o,s;return null!=(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(i=n.values)||void 0===i?void 0:i.length)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0}(e))},tn=function(e){var t="".concat(Nt).concat(e.id);return e.current_iteration&&e.current_iteration>0&&(t="".concat(Nt).concat(e.id,"_").concat(e.current_iteration)),t},nn=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},rn=function(e,t){var n={__c:t="__cC"+w++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,me(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:function(){},isPopup:!0,onPreviewSubmit:function(){}}),on=function(e){var t=e.component,n=e.children,i=e.renderAsHtml,r=e.style;return qe(t,i?{dangerouslySetInnerHTML:{__html:n},style:r}:{children:n,style:r})};!function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(Vt||(Vt={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(Wt||(Wt={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(zt||(zt={}));var sn,an=["localhost","127.0.0.1"],ln=function(e){var t=null==je?void 0:je.createElement("a");return Et(t)?null:(t.href=e,t)},un=function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return tt(e,(function(e,i){Et(e)||Et(i)||"undefined"===i||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(i),r[r.length]=n+"="+t)})),r.join(i)},cn=function(e,t){for(var n,i=((e.split("#")[0]||"").split("?")[1]||"").split("&"),r=0;r<i.length;r++){var o=i[r].split("=");if(o[0]===t){n=o;break}}if(!kt(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(e){$t.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},dn=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[0]||"",o=i[1],s=r.split("?"),a=s[1],l=s[0],u=(a||"").split("&"),c=[],d=0;d<u.length;d++){var f=u[d].split("=");kt(f)&&(t.includes(f[0])?c.push(f[0]+"="+n):c.push(u[d]))}var h=l;return null!=a&&(h+="?"+c.join("&")),null!=o&&(h+="#"+o),h},fn=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},hn="Mobile",pn="iOS",vn="Android",_n="Tablet",gn=vn+" "+_n,mn="iPad",yn="Apple",bn=yn+" Watch",kn="Safari",wn="BlackBerry",Sn="Samsung",xn=Sn+"Browser",En=Sn+" Internet",Cn="Chrome",Tn=Cn+" OS",Pn=Cn+" "+pn,In="Internet Explorer",Fn=In+" "+hn,Rn="Opera",Mn=Rn+" Mini",Ln="Edge",qn="Microsoft "+Ln,$n="Firefox",On=$n+" "+pn,An="Nintendo",Dn="PlayStation",Nn="Xbox",Hn=vn+" "+hn,Bn=hn+" "+kn,jn="Windows",Un=jn+" Phone",Vn="Nokia",Wn="Ouya",zn="Generic",Gn=zn+" "+hn.toLowerCase(),Zn=zn+" "+_n.toLowerCase(),Qn="Konqueror",Yn="(\\d+(\\.\\d+)?)",Jn=new RegExp("Version/"+Yn),Xn=new RegExp(Nn,"i"),Kn=new RegExp(Dn+" \\w+","i"),ei=new RegExp(An+" \\w+","i"),ti=new RegExp(wn+"|PlayBook|BB10","i"),ni={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var ii=function(e,t){return t&&ht(t,yn)||function(e){return ht(e,kn)&&!ht(e,Cn)&&!ht(e,vn)}(e)},ri=function(e,t){return t=t||"",ht(e," OPR/")&&ht(e,"Mini")?Mn:ht(e," OPR/")?Rn:ti.test(e)?wn:ht(e,"IE"+hn)||ht(e,"WPDesktop")?Fn:ht(e,xn)?En:ht(e,Ln)||ht(e,"Edg/")?qn:ht(e,"FBIOS")?"Facebook "+hn:ht(e,"UCWEB")||ht(e,"UCBrowser")?"UC Browser":ht(e,"CriOS")?Pn:ht(e,"CrMo")||ht(e,Cn)?Cn:ht(e,vn)&&ht(e,kn)?Hn:ht(e,"FxiOS")?On:ht(e.toLowerCase(),Qn.toLowerCase())?Qn:ii(e,t)?ht(e,hn)?Bn:kn:ht(e,$n)?$n:ht(e,"MSIE")||ht(e,"Trident/")?In:ht(e,"Gecko")?$n:""},oi=(l(sn={},Fn,[new RegExp("rv:"+Yn)]),l(sn,qn,[new RegExp(Ln+"?\\/"+Yn)]),l(sn,Cn,[new RegExp("("+Cn+"|CrMo)\\/"+Yn)]),l(sn,Pn,[new RegExp("CriOS\\/"+Yn)]),l(sn,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+Yn)]),l(sn,kn,[Jn]),l(sn,Bn,[Jn]),l(sn,Rn,[new RegExp("(Opera|OPR)\\/"+Yn)]),l(sn,$n,[new RegExp($n+"\\/"+Yn)]),l(sn,On,[new RegExp("FxiOS\\/"+Yn)]),l(sn,Qn,[new RegExp("Konqueror[:/]?"+Yn,"i")]),l(sn,wn,[new RegExp(wn+" "+Yn),Jn]),l(sn,Hn,[new RegExp("android\\s"+Yn,"i")]),l(sn,En,[new RegExp(xn+"\\/"+Yn)]),l(sn,In,[new RegExp("(rv:|MSIE )"+Yn)]),l(sn,"Mozilla",[new RegExp("rv:"+Yn)]),sn),si=[[new RegExp(Nn+"; "+Nn+" (.*?)[);]","i"),function(e){return[Nn,e&&e[1]||""]}],[new RegExp(An,"i"),[An,""]],[new RegExp(Dn,"i"),[Dn,""]],[ti,[wn,""]],[new RegExp(jn,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[Un,""];if(new RegExp(hn).test(t)&&!/IEMobile\b/.test(t))return[jn+" "+hn,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=n[1],r=ni[i]||"";return/arm/i.test(t)&&(r="RT"),[jn,r]}return[jn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[pn,t.join(".")]}return[pn,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+vn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+vn+")","i"),function(e){if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[vn,t.join(".")]}return[vn,""]}],[/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/,[Tn,""]],[/Linux|debian/i,["Linux",""]]],ai=function(e){return ei.test(e)?An:Kn.test(e)?Dn:Xn.test(e)?Nn:new RegExp(Wn,"i").test(e)?Wn:new RegExp("("+Un+"|WPDesktop)","i").test(e)?Un:/iPad/.test(e)?mn:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?bn:ti.test(e)?wn:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Vn,"i").test(e)?Vn:/(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(hn).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)?vn:gn:vn:new RegExp("(pda|"+hn+")","i").test(e)?Gn:new RegExp(_n,"i").test(e)&&!new RegExp(_n+" pc","i").test(e)?Zn:""},li="https?://(.*)",ui=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],ci=it(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ui),di="<masked>",fi={campaignParams:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.customTrackedParams,n=e.maskPersonalDataProperties,i=e.customPersonalDataProperties;if(!je)return{};var r=n?it([],ui,i||[]):[];return this._campaignParamsFromUrl(dn(je.URL,r,di),t)},_campaignParamsFromUrl:function(e,t){var n=ci.concat(t||[]),i={};return tt(n,(function(t){var n=cn(e,t);i[t]=n||null})),i},_searchEngine:function(e){return e?0===e.search(li+"google.([^/?]*)")?"google":0===e.search(li+"bing.com")?"bing":0===e.search(li+"yahoo.com")?"yahoo":0===e.search(li+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=fi._searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(!Pt(t)){i.$search_engine=t;var r=je?cn(je.referrer,n):"";r.length&&(i.ph_keyword=r)}return i},searchInfo:function(){var e=null==je?void 0:je.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:ri,browserVersion:function(e,t){var n=ri(e,t),i=oi[n];if(Et(i))return null;for(var r=0;r<i.length;r++){var o=i[r],s=e.match(o);if(s)return parseFloat(s[s.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<si.length;t++){var n=c(si[t],2),i=n[0],r=n[1],o=i.exec(e),s=o&&(wt(r)?r(o,e):r);if(s)return s}return["",""]},device:ai,deviceType:function(e){var t=ai(e);return t===mn||t===gn||"Kobo"===t||"Kindle Fire"===t||t===Zn?_n:t===An||t===Nn||t===Dn||t===Wn?"Console":t===bn?"Wearable":t?hn:"Desktop"},referrer:function(){return(null==je?void 0:je.referrer)||"$direct"},referringDomain:function(){var e;return null!=je&&je.referrer&&(null===(e=ln(je.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==Ue?void 0:Ue.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var t,n=e.r,i=e.u,r={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(t=ln(n))||void 0===t?void 0:t.host};if(i){r.$initial_current_url=i;var o=ln(i);r.$initial_host=null==o?void 0:o.host,r.$initial_pathname=null==o?void 0:o.pathname,tt(this._campaignParamsFromUrl(i),(function(e,t){r["$initial_"+vt(t)]=e}))}n&&tt(this._searchInfoFromReferrer(n),(function(e,t){r["$initial_"+vt(t)]=e}));return r},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maskPersonalDataProperties,n=e.customPersonalDataProperties;if(!Ge)return{};var i=t?it([],ui,n||[]):[],r=c(fi.os(Ge),2),o=r[0],s=r[1];return nt(at({$os:o,$os_version:s,$browser:fi.browser(Ge,navigator.vendor),$device:fi.device(Ge),$device_type:fi.deviceType(Ge),$timezone:fi.timezone(),$timezone_offset:fi.timezoneOffset()}),{$current_url:dn(null==Ue?void 0:Ue.href,i,di),$host:null==Ue?void 0:Ue.host,$pathname:null==Ue?void 0:Ue.pathname,$raw_user_agent:Ge.length>1e3?Ge.substring(0,997)+"...":Ge,$browser_version:fi.browserVersion(Ge,navigator.vendor),$browser_language:fi.browserLanguage(),$browser_language_prefix:fi.browserLanguagePrefix(),$screen_height:null==Oe?void 0:Oe.screen.height,$screen_width:null==Oe?void 0:Oe.screen.width,$viewport_height:null==Oe?void 0:Oe.innerHeight,$viewport_width:null==Oe?void 0:Oe.innerWidth,$lib:"web",$lib_version:Qe.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!Ge)return{};var e=c(fi.os(Ge),2),t=e[0],n=e[1];return nt(at({$os:t,$os_version:n,$browser:fi.browser(Ge,navigator.vendor)}),{$browser_version:fi.browserVersion(Ge,navigator.vendor)})}},hi=function(){function e(){o(this,e),l(this,"events",{}),this.events={}}return a(e,[{key:"on",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return e!==t}))}}},{key:"emit",value:function(e,t){var n,i=p(this.events[e]||[]);try{for(i.s();!(n=i.n()).done;){(0,n.value)(t)}}catch(e){i.e(e)}finally{i.f()}var r,o=p(this.events["*"]||[]);try{for(o.s();!(r=o.n()).done;){(0,r.value)(e,t)}}catch(e){o.e(e)}finally{o.f()}}}]),e}(),pi=function(){function e(t){var n=this;o(this,e),l(this,"_debugEventEmitter",new hi),l(this,"checkStep",(function(e,t){return n.checkStepEvent(e,t)&&n.checkStepUrl(e,t)&&n.checkStepElement(e,t)})),l(this,"checkStepEvent",(function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)})),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}return a(e,[{key:"init",value:function(){var e,t=this;if(!Et(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var n;null===(n=this.instance)||void 0===n||n._addCaptureHook((function(e,n){t.on(e,n)}))}}},{key:"register",value:function(e){var t,n,i=this;if(!Et(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((function(e){var t,n;null===(t=i.actionRegistry)||void 0===t||t.add(e),null===(n=e.steps)||void 0===n||n.forEach((function(e){var t;null===(t=i.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(n=this.instance)&&void 0!==n&&n.autocapture)){var r,o=new Set;e.forEach((function(e){var t;null===(t=e.steps)||void 0===t||t.forEach((function(e){null!=e&&e.selector&&o.add(null==e?void 0:e.selector)}))})),null===(r=this.instance)||void 0===r||r.autocapture.setElementSelectors(o)}}},{key:"on",value:function(e,t){var n,i=this;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(n=this.actionRegistry)||void 0===n?void 0:n.size)>0&&this.actionRegistry.forEach((function(e){i.checkAction(t,e)&&i._debugEventEmitter.emit("actionCaptured",e.name)}))}},{key:"_addActionHook",value:function(e){this.onAction("actionCaptured",(function(t){return e(t)}))}},{key:"checkAction",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n,i=p(t.steps);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(this.checkStep(e,r))return!0}}catch(e){i.e(e)}finally{i.f()}return!1}},{key:"onAction",value:function(e,t){return this._debugEventEmitter.on(e,t)}},{key:"checkStepUrl",value:function(t,n){if(null!=n&&n.url){var i,r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!e.matchString(r,null==n?void 0:n.url,(null==n?void 0:n.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(t,n){if((null!=n&&n.href||null!=n&&n.tag_name||null!=n&&n.text)&&!this.getElementsList(t).some((function(t){return!(null!=n&&n.href&&!e.matchString(t.href||"",null==n?void 0:n.href,(null==n?void 0:n.href_matching)||"exact"))&&((null==n||!n.tag_name||t.tag_name===(null==n?void 0:n.tag_name))&&!(null!=n&&n.text&&!e.matchString(t.text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact")&&!e.matchString(t.$el_text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact")))})))return!1;if(null!=n&&n.selector){var i,r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==n?void 0:n.selector))return!1}return!0}},{key:"getElementsList",value:function(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}],[{key:"matchString",value:function(t,n,i){switch(i){case"regex":return!!Oe&&_t(t,n);case"exact":return n===t;case"contains":var r=e.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return _t(t,r);default:return!1}}},{key:"escapeStringRegexp",value:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),e}(),vi=function(){function e(t){o(this,e),this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return a(e,[{key:"register",value:function(e){var t;Et(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}},{key:"setupActionBasedSurveys",value:function(e){var t=this,n=e.filter((function(e){var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(n=e.conditions)||void 0===n||null===(i=n.actions)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0}));if(0!==n.length){if(null==this.actionMatcher){this.actionMatcher=new pi(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((function(e){t.onAction(e)}))}n.forEach((function(e){var n,i,r,o,s,a,l,u,c,d;e.conditions&&null!==(n=e.conditions)&&void 0!==n&&n.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(r=i.actions)&&void 0!==r&&r.values&&(null===(o=e.conditions)||void 0===o||null===(s=o.actions)||void 0===s||null===(a=s.values)||void 0===a?void 0:a.length)>0&&(null===(l=t.actionMatcher)||void 0===l||l.register(e.conditions.actions.values),null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c||null===(d=c.values)||void 0===d||d.forEach((function(n){if(n&&n.name){var i=t.actionToSurveys.get(n.name);i&&i.push(e.id),t.actionToSurveys.set(n.name,i||[e.id])}})))}))}}},{key:"setupEventBasedSurveys",value:function(e){var t,n=this;if(0!==e.filter((function(e){var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook((function(e,t){n.onEvent(e,t)})),e.forEach((function(e){var t,i,r;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(r=i.values)||void 0===r||r.forEach((function(t){if(t&&t.name){var i=n.eventToSurveys.get(t.name);i&&i.push(e.id),n.eventToSurveys.set(t.name,i||[e.id])}}))}))}}},{key:"onEvent",value:function(t,n){var i,r,o=(null===(i=this.instance)||void 0===i||null===(r=i.persistence)||void 0===r?void 0:r.props[Z])||[];if(e.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var s,a=null==n||null===(s=n.properties)||void 0===s?void 0:s.$survey_id;if(a){var l=o.indexOf(a);l>=0&&(o.splice(l,1),this._updateActivatedSurveys(o))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(o.concat(this.eventToSurveys.get(t)||[]))}},{key:"onAction",value:function(e){var t,n,i=(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n?void 0:n.props[Z])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(e)||[]))}},{key:"_updateActivatedSurveys",value:function(e){var t,n;null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register(l({},Z,d(new Set(e))))}},{key:"getSurveys",value:function(){var e,t,n=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Z];return n||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),e}();l(vi,"SURVEY_SHOWN_EVENT_NAME","survey shown");var _i=Ot("[Surveys]"),gi={icontains:function(e,t){return e.some((function(e){return t.toLowerCase().includes(e.toLowerCase())}))},not_icontains:function(e,t){return e.every((function(e){return!t.toLowerCase().includes(e.toLowerCase())}))},regex:function(e,t){return e.some((function(e){return _t(t,e)}))},not_regex:function(e,t){return e.every((function(e){return!_t(t,e)}))},exact:function(e,t){return e.some((function(e){return t===e}))},is_not:function(e,t){return e.every((function(e){return t!==e}))}};function mi(e,t,n){var i,r=e.questions[t],o=t+1;if(null===(i=r.branching)||void 0===i||!i.type)return t===e.questions.length-1?zt.End:o;if(r.branching.type===zt.End)return zt.End;if(r.branching.type===zt.SpecificQuestion){if(Number.isInteger(r.branching.index))return r.branching.index}else if(r.branching.type===zt.ResponseBased){if(r.type===Wt.SingleChoice){var s,a,l=r.choices.indexOf("".concat(n));if(null!==(s=r.branching)&&void 0!==s&&null!==(a=s.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var u=r.branching.responseValues[l];return Number.isInteger(u)?u:u===zt.End?zt.End:o}}else if(r.type===Wt.Rating){var c,d;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");var f=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(n,r.scale);if(null!==(c=r.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(f)){var h=r.branching.responseValues[f];return Number.isInteger(h)?h:h===zt.End?zt.End:o}}return o}return _i.warn("Falling back to next question index due to unexpected branching type"),o}function yi(e){return null!=e?e:"icontains"}function bi(e){var t,n,i;if(null===(t=e.conditions)||void 0===t||!t.url)return!0;var r=null==Oe||null===(n=Oe.location)||void 0===n?void 0:n.href;if(!r)return!1;var o=[e.conditions.url];return gi[yi(null===(i=e.conditions)||void 0===i?void 0:i.urlMatchType)](o,r)}var ki,wi,Si,xi,Ei=function(){function e(t){o(this,e),l(this,"getNextSurveyStep",mi),this.instance=t,this._surveyEventReceiver=null}return a(e,[{key:"onRemoteConfig",value:function(e){this._decideServerResponse=!!e.surveys,_i.info("decideServerResponse set to ".concat(this._decideServerResponse)),this.loadIfEnabled()}},{key:"reset",value:function(){localStorage.removeItem("lastSeenSurveyDate");var e=function(){for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);null!=n&&n.startsWith(Nt)&&e.push(n)}return e}();e.forEach((function(e){return localStorage.removeItem(e)}))}},{key:"loadIfEnabled",value:function(){var e=this;if(!this._surveyManager)if(this.instance.config.disable_surveys)_i.info("Disabled. Not loading surveys.");else{var t=null==Ze?void 0:Ze.__PosthogExtensions__;if(t){var n=t.generateSurveys;if(this._decideServerResponse)if(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new vi(this.instance)),n)this._surveyManager=n(this.instance);else{var i=t.loadExternalDependency;i?i(this.instance,"surveys",(function(n){var i;n?_i.error("Could not load surveys script",n):e._surveyManager=null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,e.instance)})):_i.error("PostHog loadExternalDependency extension not found. Cannot load remote config.")}else _i.warn("Decide not loaded yet. Not loading surveys.")}else _i.error("PostHog Extensions not found.")}}},{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 _i.info("Disabled. Not loading surveys."),e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new vi(this.instance));var i=this.instance.get_property(G);if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var i,r=n.statusCode;if(200!==r||!n.json)return _i.error("Surveys API could not be loaded, status: ".concat(r)),e([]);var o,s=n.json.surveys||[],a=s.filter((function(e){var t,n,i,r,o,s,a,l,u,c,d,f;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i?void 0:i.values)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d||null===(f=d.values)||void 0===f?void 0:f.length)>0}));a.length>0&&(null===(o=t._surveyEventReceiver)||void 0===o||o.register(a));return null===(i=t.instance.persistence)||void 0===i||i.register(l({},G,s)),e(s)}})}},{key:"isSurveyFeatureFlagEnabled",value:function(e){return!e||this.instance.featureFlags.isFeatureEnabled(e)}},{key:"getActiveMatchingSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((function(n){var i,r=n.filter((function(e){return!(!e.start_date||e.end_date)})).filter((function(e){var t;if(!e.conditions)return!0;var n=bi(e),i=null===(t=e.conditions)||void 0===t||!t.selector||(null==je?void 0:je.querySelector(e.conditions.selector)),r=function(e){var t,n;if(null===(t=e.conditions)||void 0===t||!t.deviceTypes)return!0;if(!Ge)return!1;var i=fi.deviceType(Ge);return gi[yi(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypesMatchType)](e.conditions.deviceTypes,i)}(e);return n&&i&&r})),o=null===(i=t._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),s=r.filter((function(e){var n,i,r,s,a,l,u,c,d;if(!(e.linked_flag_key||e.targeting_flag_key||e.internal_targeting_flag_key||null!==(n=e.feature_flag_keys)&&void 0!==n&&n.length))return!0;var f=t.isSurveyFeatureFlagEnabled(e.linked_flag_key),h=t.isSurveyFeatureFlagEnabled(e.targeting_flag_key),p=(null!==(i=null===(r=e.conditions)||void 0===r||null===(s=r.events)||void 0===s||null===(a=s.values)||void 0===a?void 0:a.length)&&void 0!==i?i:0)>0,v=(null!==(l=null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c||null===(d=c.values)||void 0===d?void 0:d.length)&&void 0!==l?l:0)>0,_=!p&&!v||(null==o?void 0:o.includes(e.id)),g=t._canActivateRepeatedly(e)||t.isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key),m=t.checkFlags(e);return f&&h&&g&&_&&m}));return e(s)}),n)}},{key:"checkFlags",value:function(e){var t,n=this;return null===(t=e.feature_flag_keys)||void 0===t||!t.length||e.feature_flag_keys.every((function(e){var t=e.key,i=e.value;return!t||!i||n.instance.featureFlags.isFeatureEnabled(i)}))}},{key:"_canActivateRepeatedly",value:function(e){var t;return It(null===(t=Ze.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(_i.warn("init was not called"),!1):Ze.__PosthogExtensions__.canActivateRepeatedly(e)}},{key:"canRenderSurvey",value:function(e){var t=this;It(this._surveyManager)?_i.warn("init was not called"):this.getSurveys((function(n){var i=n.filter((function(t){return t.id===e}))[0];t._surveyManager.canRenderSurvey(i)}))}},{key:"renderSurvey",value:function(e,t){var n=this;It(this._surveyManager)?_i.warn("init was not called"):this.getSurveys((function(i){var r=i.filter((function(t){return t.id===e}))[0];n._surveyManager.renderSurvey(r,null==je?void 0:je.querySelector(t))}))}}]),e}(),Ci=0,Ti=[],Pi=[],Ii=_.__b,Fi=_.__r,Ri=_.diffed,Mi=_.__c,Li=_.unmount;function qi(e,t){_.__h&&_.__h(wi,e,Ci||t),Ci=0;var n=wi.__H||(wi.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Pi}),n.__[e]}function $i(e){return Ci=1,function(e,t,n){var i=qi(ki++,2);if(i.t=e,!i.__c&&(i.__=[zi(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=wi,!wi.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};wi.u=!0;var o=wi.shouldComponentUpdate,s=wi.componentWillUpdate;wi.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},wi.shouldComponentUpdate=r}return i.__N||i.__}(zi,e)}function Oi(e,t){var n=qi(ki++,3);!_.__s&&Wi(n.__H,t)&&(n.__=e,n.i=t,wi.__H.__h.push(n))}function Ai(e){return Ci=5,Di((function(){return{current:e}}),[])}function Di(e,t){var n=qi(ki++,7);return Wi(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Ni(e){var t=wi.context[e.__c],n=qi(ki++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(wi)),t.props.value):e.__}function Hi(){for(var e;e=Ti.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ui),e.__H.__h.forEach(Vi),e.__H.__h=[]}catch(t){e.__H.__h=[],_.__e(t,e.__v)}}_.__b=function(e){wi=null,Ii&&Ii(e)},_.__r=function(e){Fi&&Fi(e),ki=0;var t=(wi=e.__c).__H;t&&(Si===wi?(t.__h=[],wi.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Pi,e.__N=e.i=void 0}))):(t.__h.forEach(Ui),t.__h.forEach(Vi),t.__h=[],ki=0)),Si=wi},_.diffed=function(e){Ri&&Ri(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Ti.push(t)&&xi===_.requestAnimationFrame||((xi=_.requestAnimationFrame)||ji)(Hi)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Pi&&(e.__=e.__V),e.i=void 0,e.__V=Pi}))),Si=wi=null},_.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ui),e.__h=e.__h.filter((function(e){return!e.__||Vi(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],_.__e(n,e.__v)}})),Mi&&Mi(e,t)},_.unmount=function(e){Li&&Li(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ui(e)}catch(e){t=e}})),n.__H=void 0,t&&_.__e(t,n.__v))};var Bi="function"==typeof requestAnimationFrame;function ji(e){var t,n=function(){clearTimeout(i),Bi&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Bi&&(t=requestAnimationFrame(n))}function Ui(e){var t=wi,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),wi=t}function Vi(e){var t=wi;e.__c=e.__(),wi=t}function Wi(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function zi(e,t){return"function"==typeof t?t(e):t}var Gi=je;var Zi=0;function Qi(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Zi,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return _.vnode&&_.vnode(u),u}var Yi=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Ji=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Xi=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),Ki=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),er=Qi("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Qi("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"})}),tr=Qi("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Qi("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"})}),nr=Qi("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Qi("g",{"clip-path":"url(#clip0_2415_6911)",children:[Qi("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Qi("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Qi("g",{mask:"url(#mask0_2415_6911)",children:[Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"}),Qi("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"})]})]}),Qi("defs",{children:Qi("clipPath",{id:"clip0_2415_6911",children:Qi("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),ir=Qi("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Qi("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 rr(){return Qi("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",nr]})}function or(e){var t=e.text,n=e.submitDisabled,i=e.appearance,r=e.onSubmit,o=e.link,s=e.onPreviewSubmit,a=Ni(rn),l=a.isPreviewMode,u=a.isPopup,c=i.submitButtonTextColor||Ut(i.submitButtonColor||Gt.submitButtonColor);return Qi("div",{className:"bottom-section",children:[Qi("div",{className:"buttons",children:Qi("button",{className:"form-submit",disabled:n&&!l,type:"button",style:u?{color:c}:{},onClick:function(){l?null==s||s():(o&&(null==Oe||Oe.open(o)),r())},children:t})}),!i.whiteLabel&&Qi(rr,{})]})}function sr(e){var t=e.question,n=e.description,i=e.descriptionContentType,r=e.backgroundColor,o=e.forceDisableHtml;return Qi("div",{style:Ni(rn).isPopup?{backgroundColor:r||Gt.backgroundColor}:{},children:[Qi("div",{className:"survey-question",children:t}),n&&on({component:fe("div",{className:"survey-question-description"}),children:n,renderAsHtml:!o&&"text"!==i})]})}function ar(e){var t=e.onClick,n=Ni(rn).isPreviewMode;return Qi("div",{className:"cancel-btn-wrapper",onClick:t,disabled:n,children:Qi("button",{className:"form-cancel",onClick:t,disabled:n,children:tr})})}function lr(e){var n=e.header,i=e.description,r=e.contentType,o=e.forceDisableHtml,s=e.appearance,a=e.onClose,l=e.styleOverrides,u=Ut(s.backgroundColor||Gt.backgroundColor),c=Ni(rn).isPopup;return Qi(pe,{children:Qi("div",{className:"thank-you-message",style:t({},l),children:Qi("div",{className:"thank-you-message-container",children:[c&&Qi(ar,{onClick:function(){return a()}}),Qi("h3",{className:"thank-you-message-header",style:{color:u},children:n}),i&&on({component:fe("div",{className:"thank-you-message-body"}),children:i,renderAsHtml:!o&&"text"!==r,style:{color:u}}),c&&Qi(or,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:function(){return a()}})]})})})}function ur(e){var t,n=Ai(null),i=c($i(null!==(t=e.defaultTextColor)&&void 0!==t?t:"black"),2),r=i[0],o=i[1];return Oi((function(){if(n.current){var e=function(e){var t=At.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 i=parseInt(n[1]),r=parseInt(n[2]),o=parseInt(n[3]);return Math.sqrt(i*i*.299+r*r*.587+o*o*.114)>127.5?"black":"white"}(n.current);o(e)}}),[e.appearance,e.forceUpdate]),{ref:n,textColor:r}}function cr(e){var t=e.question,n=e.forceDisableHtml,i=e.appearance,r=e.onSubmit,o=e.onPreviewSubmit,s=Ai(null),a=c($i(""),2),l=a[0],u=a[1];return Qi("div",{ref:s,children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,backgroundColor:i.backgroundColor,forceDisableHtml:n}),Qi("textarea",{rows:4,placeholder:null==i?void 0:i.placeholder,onInput:function(e){return u(e.currentTarget.value)}}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:!l&&!t.optional,appearance:i,onSubmit:function(){return r(l)},onPreviewSubmit:function(){return o(l)}})]})}function dr(e){var t=e.question,n=e.forceDisableHtml,i=e.appearance,r=e.onSubmit,o=e.onPreviewSubmit;return Qi(pe,{children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:function(){return r("link clicked")},onPreviewSubmit:function(){return o("link clicked")}})]})}function fr(e){var t=e.question,n=e.forceDisableHtml,i=e.displayQuestionIndex,r=e.appearance,o=e.onSubmit,s=e.onPreviewSubmit,a=t.scale,l=10===t.scale?0:1,u=c($i(null),2),d=u[0],f=u[1];return Qi(pe,{children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),Qi("div",{className:"rating-section",children:[Qi("div",{className:"rating-options",children:["emoji"===t.display&&Qi("div",{className:"rating-options-emoji",children:(3===t.scale?vr:_r).map((function(e,t){var n=t+1===d;return Qi("button",{className:"ratings-emoji question-".concat(i,"-rating-").concat(t," ").concat(n?"rating-active":null),value:t+1,type:"button",onClick:function(){f(t+1)},style:{fill:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:e},t)}))}),"number"===t.display&&Qi("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat(".concat(a-l+1,", minmax(0, 1fr))")},children:br(t.scale).map((function(e,t){return Qi(hr,{displayQuestionIndex:i,active:d===e,appearance:r,num:e,setActiveNumber:function(e){f(e)}},t)}))})]}),Qi("div",{className:"rating-text",children:[Qi("div",{children:t.lowerBoundLabel}),Qi("div",{children:t.upperBoundLabel})]})]}),Qi(or,{text:t.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:Pt(d)&&!t.optional,appearance:r,onSubmit:function(){return o(d)},onPreviewSubmit:function(){return s(d)}})]})}function hr(e){var t=e.num,n=e.active,i=e.displayQuestionIndex,r=e.appearance,o=e.setActiveNumber,s=ur({appearance:r,defaultTextColor:"black",forceUpdate:n}),a=s.textColor;return Qi("button",{ref:s.ref,className:"ratings-number question-".concat(i,"-rating-").concat(t," ").concat(n?"rating-active":null),type:"button",onClick:function(){o(t)},style:{color:a,backgroundColor:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:t})}function pr(e){var t=e.question,n=e.forceDisableHtml,i=e.displayQuestionIndex,r=e.appearance,o=e.onSubmit,s=e.onPreviewSubmit,a=Ai(null),l=Di((function(){return function(e){if(!e.shuffleOptions)return e.choices;var t=e.choices,n="";e.hasOpenChoice&&(n=t.pop());var i=Xt(t,Jt(t));return e.hasOpenChoice&&(e.choices.push(n),i.push(n)),i}(t)}),[t]),u=c($i(t.type===Wt.MultipleChoice?[]:null),2),f=u[0],h=u[1],p=c($i(!1),2),v=p[0],_=p[1],g=c($i(""),2),m=g[0],y=g[1],b=t.type===Wt.SingleChoice?"radio":"checkbox";return Qi("div",{ref:a,children:[Qi(sr,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),Qi("div",{className:"multiple-choice-options",children:l.map((function(e,n){var r="choice-option",o=e,s=e;return t.hasOpenChoice&&n===t.choices.length-1&&(r+=" choice-option-open"),Qi("div",{className:r,children:[Qi("input",{type:b,id:"surveyQuestion".concat(i,"Choice").concat(n),name:"question".concat(i),value:o,disabled:!o,onInput:function(){return t.hasOpenChoice&&n===t.choices.length-1?_(!v):t.type===Wt.SingleChoice?h(o):t.type===Wt.MultipleChoice&&kt(f)?f.includes(o)?h(f.filter((function(e){return e!==o}))):h([].concat(d(f),[o])):void 0}}),Qi("label",{htmlFor:"surveyQuestion".concat(i,"Choice").concat(n),style:{color:"black"},children:t.hasOpenChoice&&n===t.choices.length-1?Qi(pe,{children:[Qi("span",{children:[s,":"]}),Qi("input",{type:"text",id:"surveyQuestion".concat(i,"Choice").concat(n,"Open"),name:"question".concat(i),onInput:function(e){var n=e.currentTarget.value;return t.type===Wt.SingleChoice?h(n):t.type===Wt.MultipleChoice&&kt(f)?y(n):void 0}})]}):s}),Qi("span",{className:"choice-check",style:{color:"black"},children:ir})]})}))}),Qi(or,{text:t.buttonText||"Submit",submitDisabled:(Pt(f)||kt(f)&&!v&&0===f.length||kt(f)&&v&&!m&&0===f.length&&!t.optional)&&!t.optional,appearance:r,onSubmit:function(){v&&t.type===Wt.MultipleChoice?kt(f)&&o([].concat(d(f),[m])):o(f)},onPreviewSubmit:function(){v&&t.type===Wt.MultipleChoice?kt(f)&&s([].concat(d(f),[m])):s(f)}})]})}var vr=[Xi,Ji,Yi],_r=[Ki,Xi,Ji,Yi,er],gr=[1,2,3,4,5],mr=[1,2,3,4,5,6,7],yr=[0,1,2,3,4,5,6,7,8,9,10];function br(e){switch(e){case 5:default:return gr;case 7:return mr;case 10:return yr}}var kr=Ot("[Surveys]"),wr=Oe,Sr=je,xr=function(){function e(t){var n=this;o(this,e),l(this,"canShowNextEventBasedSurvey",(function(){var e,t=Sr.querySelectorAll("div[class^=PostHogSurvey]");return!(t.length>0)||1===(null===(e=t[t.length-1].shadowRoot)||void 0===e?void 0:e.childElementCount)})),l(this,"handlePopoverSurvey",(function(e){var t,i=null===(t=e.conditions)||void 0===t?void 0:t.seenSurveyWaitPeriodInDays,r=localStorage.getItem("lastSeenSurveyDate");if(i&&r){var o=new Date,s=Math.abs(o.getTime()-new Date(r).getTime());if(Math.ceil(s/864e5)<i)return}var a=function(e){return!!localStorage.getItem(tn(e))&&!en(e)}(e);if(!a){n.addSurveyToFocus(e.id);var l=function(e,t,n){var i=Dt.createElement("div");i.className="PostHogSurvey".concat(t);var r=i.attachShadow({mode:"open"});if(e){var o=Object.assign(Dt.createElement("style"),{innerText:e});r.appendChild(o)}return Dt.body.appendChild(i),r}(Bt(null==e?void 0:e.appearance),e.id);Le(Qi(Cr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus,isPopup:!0},"popover-survey"),l)}})),l(this,"handleWidget",(function(e){var t=function(e){var t,n=Gi.createElement("div");n.className="PostHogWidget".concat(e.id);var i,r=n.attachShadow({mode:"open"}),o=(i=null===(t=e.appearance)||void 0===t?void 0:t.widgetColor,"\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ".concat(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 "));return r.append(Object.assign(Gi.createElement("style"),{innerText:o})),Gi.body.appendChild(n),r}(e),i=Bt(e.appearance);t.appendChild(Object.assign(Sr.createElement("style"),{innerText:i})),Le(Qi(Pr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus},"feedback-survey"),t)})),l(this,"handleWidgetSelector",(function(e){var t,i=(null===(t=e.appearance)||void 0===t?void 0:t.widgetSelector)&&Sr.querySelector(e.appearance.widgetSelector);if(i)if(0===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length)n.handleWidget(e);else if(1===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length&&!i.getAttribute("PHWidgetSurveyClickListener")){var r,o,s=null===(r=Sr.querySelector(".PostHogWidget".concat(e.id)))||void 0===r||null===(o=r.shadowRoot)||void 0===o?void 0:o.querySelector(".survey-form");ft(i,"click",(function(){s&&(s.style.display="none"===s.style.display?"block":"none",ft(s,"PHSurveyClosed",(function(){n.removeSurveyFromFocus(e.id),s.style.display="none"})))})),i.setAttribute("PHWidgetSurveyClickListener","true")}})),l(this,"canRenderSurvey",(function(e){var t={visible:!1};return e.end_date?(t.disabledReason="survey was completed on ".concat(e.end_date),t):e.type!=Vt.Popover?(t.disabledReason="Only Popover survey types can be rendered",t):!e.linked_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.linked_flag_key)?!e.targeting_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.targeting_flag_key)?!e.internal_targeting_flag_key||n.posthog.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key)?(t.visible=!0,t):(t.disabledReason="internal targeting feature flag ".concat(e.internal_targeting_flag_key," is false"),t):(t.disabledReason="targeting feature flag ".concat(e.targeting_flag_key," is false"),t):(t.disabledReason="linked feature flag ".concat(e.linked_flag_key," is false"),t)})),l(this,"renderSurvey",(function(e,t){Le(Qi(Cr,{posthog:n.posthog,survey:e,removeSurveyFromFocus:n.removeSurveyFromFocus,isPopup:!1},"popover-survey"),t)})),l(this,"callSurveysAndEvaluateDisplayLogic",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=n.posthog)||void 0===e||e.getActiveMatchingSurveys((function(e){var t=e.filter((function(e){return"api"!==e.type}));n.sortSurveysByAppearanceDelay(t).forEach((function(e){if(Pt(n.surveyInFocus)&&bi(e)){var t,i,r;if(e.type===Vt.Widget)"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&0===Sr.querySelectorAll(".PostHogWidget".concat(e.id)).length&&n.handleWidget(e),"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&null!==(r=e.appearance)&&void 0!==r&&r.widgetSelector&&n.handleWidgetSelector(e);e.type===Vt.Popover&&n.canShowNextEventBasedSurvey()&&n.handlePopoverSurvey(e)}}))}),t)})),l(this,"addSurveyToFocus",(function(e){Pt(n.surveyInFocus)||kr.error("Survey ".concat(d(n.surveyInFocus)," already in focus. Cannot add survey ").concat(e,".")),n.surveyInFocus=e})),l(this,"removeSurveyFromFocus",(function(e){n.surveyInFocus!==e&&kr.error("Survey ".concat(e," is not in focus. Cannot remove survey ").concat(e,".")),n.surveyInFocus=null})),this.posthog=t,this.surveyInFocus=null}return a(e,[{key:"sortSurveysByAppearanceDelay",value:function(e){return e.sort((function(e,t){var n,i;return((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)}))}},{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}}}]),e}();function Er(e){if(Sr&&wr){var t=new xr(e);return t.callSurveysAndEvaluateDisplayLogic(!0),setInterval((function(){t.callSurveysAndEvaluateDisplayLogic(!1)}),1e3),t}}function Cr(e){var n,i,r,o,s,a,l=e.survey,u=e.forceDisableHtml,d=e.posthog,f=e.style,h=e.previewPageIndex,p=e.removeSurveyFromFocus,v=e.isPopup,_=e.onPreviewSubmit,g=void 0===_?function(){}:_,m=Number.isInteger(h),y=null!==(n=l.appearance)&&void 0!==n&&n.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,b=function(e,t,n,i,r){var o=c($i(i||0===n),2),s=o[0],a=o[1],l=c($i(!1),2),u=l[0],d=l[1];return Oi((function(){if(t){if(!i){var o,s=function(){r(e.id),a(!1)},l=function(){var t,n;null!==(t=e.appearance)&&void 0!==t&&t.displayThankYouMessage?(d(!0),r(e.id),null!==(n=e.appearance)&&void 0!==n&&n.autoDisappear&&setTimeout((function(){a(!1)}),5e3)):(r(e.id),a(!1))},u=function(){var n;a(!0),wr.dispatchEvent(new Event("PHSurveyShown")),t.capture("survey shown",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(n=t.get_session_replay_url)||void 0===n?void 0:n.call(t)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())};return ft(wr,"PHSurveyClosed",s),ft(wr,"PHSurveySent",l),n>0?(o=setTimeout((function(){u()}),n),function(){clearTimeout(o),wr.removeEventListener("PHSurveyClosed",s),wr.removeEventListener("PHSurveySent",l)}):(u(),function(){wr.removeEventListener("PHSurveyClosed",s),wr.removeEventListener("PHSurveySent",l)})}}else kr.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Oi((function(){var t;if(!i&&null!==(t=e.conditions)&&void 0!==t&&t.url){var n=function(){bi(e)||(a(!1),r(e.id))};ft(wr,"popstate",n),ft(wr,"hashchange",n);var o=wr.history.pushState,s=wr.history.replaceState;return wr.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];o.apply(this,t),n()},wr.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.apply(this,t),n()},function(){wr.removeEventListener("popstate",n),wr.removeEventListener("hashchange",n),wr.history.pushState=o,wr.history.replaceState=s}}}),[i,e,r]),{isPopupVisible:s,isSurveySent:u,setIsPopupVisible:a}}(l,d,y,m,p),k=b.isPopupVisible,w=b.isSurveySent,S=b.setIsPopupVisible,x=w||h===l.questions.length,E=null!==(i=f)&&void 0!==i&&i.left&&Ft(null===(r=f)||void 0===r?void 0:r.left)?{left:f.left-40}:{};return m&&((f=f||{}).left="unset",f.right="unset",f.transform="unset"),k?Qi(rn.Provider,{value:{isPreviewMode:m,previewPageIndex:h,handleCloseSurveyPopup:function(){return Yt(l,d,m)},isPopup:v||!1,onPreviewSubmit:g},children:x?Qi(lr,{header:(null===(o=l.appearance)||void 0===o?void 0:o.thankYouMessageHeader)||"Thank you!",description:(null===(s=l.appearance)||void 0===s?void 0:s.thankYouMessageDescription)||"",forceDisableHtml:!!u,contentType:null===(a=l.appearance)||void 0===a?void 0:a.thankYouMessageDescriptionContentType,appearance:l.appearance||Gt,styleOverrides:t(t({},f),E),onClose:function(){return S(!1)}}):Qi(Tr,{survey:l,forceDisableHtml:!!u,posthog:d,styleOverrides:f})}):null}function Tr(e){var n,i,r=e.survey,o=e.forceDisableHtml,s=e.posthog,a=e.styleOverrides,u=Ut((null===(n=r.appearance)||void 0===n?void 0:n.backgroundColor)||Gt.backgroundColor),d=c($i({}),2),f=d[0],h=d[1],p=Ni(rn),v=p.isPreviewMode,_=p.previewPageIndex,g=p.handleCloseSurveyPopup,m=p.isPopup,y=p.onPreviewSubmit,b=c($i(_||0),2),k=b[0],w=b[1],S=Di((function(){return Kt(r)}),[r]);Oi((function(){w(null!=_?_:0)}),[_]);return Qi("form",{className:"survey-form",style:m?t({color:u,borderColor:null===(i=r.appearance)||void 0===i?void 0:i.borderColor},a):{},children:S.map((function(e,n){var i,a=e.originalQuestionIndex;return(v?k===a:k===n)&&Qi("div",{className:"survey-box",style:m?{backgroundColor:(null===(i=r.appearance)||void 0===i?void 0:i.backgroundColor)||Gt.backgroundColor}:{},children:[m&&Qi(ar,{onClick:function(){return g()}}),Ir({question:e,forceDisableHtml:o,displayQuestionIndex:n,appearance:r.appearance||Gt,onSubmit:function(e){return function(e){var n=e.res,i=e.originalQuestionIndex,o=e.displayQuestionIndex;if(s){var a=0===i?"$survey_response":"$survey_response_".concat(i);if(h(t(t({},f),{},l({},a,n))),s.getNextSurveyStep){var u=s.getNextSurveyStep(r,o,n);u===zt.End?Qt(t(t({},f),{},l({},a,n)),r,s):w(u)}else o===r.questions.length-1?Qt(t(t({},f),{},l({},a,n)),r,s):w(o+1)}else kr.error("onNextButtonClick called without a PostHog instance.")}({res:e,originalQuestionIndex:a,displayQuestionIndex:n})},onPreviewSubmit:y})]})}))})}function Pr(e){var t,n,i=e.survey,r=e.forceDisableHtml,o=e.posthog,s=e.readOnly,a=e.removeSurveyFromFocus,l=c($i(!1),2),u=l[0],d=l[1],f=c($i({}),2),h=f[0],p=f[1],v=Ai(null);return Oi((function(){var e,t;if(o){if(!s){if("tab"===(null===(e=i.appearance)||void 0===e?void 0:e.widgetType)&&v.current){var n,r=v.current.getBoundingClientRect(),a={top:"50%",left:parseInt("".concat(r.right-360)),bottom:"auto",borderRadius:10,borderBottom:"1.5px solid ".concat((null===(n=i.appearance)||void 0===n?void 0:n.borderColor)||"#c9c6c6")};p(a)}if("selector"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)){var l,c=null!==(l=Sr.querySelector(i.appearance.widgetSelector||""))&&void 0!==l?l:void 0;ft(c,"click",(function(){d(!u)})),null==c||c.setAttribute("PHWidgetSurveyClickListener","true")}}}else kr.error("FeedbackWidget called without a PostHog instance.")}),[]),Qi(pe,{children:["tab"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)&&Qi("div",{className:"ph-survey-widget-tab",ref:v,onClick:function(){return!s&&d(!u)},style:{color:Ut(i.appearance.widgetColor)},children:[Qi("div",{className:"ph-survey-widget-tab-icon"}),(null===(n=i.appearance)||void 0===n?void 0:n.widgetLabel)||""]}),u&&Qi(Cr,{posthog:o,survey:i,forceDisableHtml:r,style:h,removeSurveyFromFocus:a,isPopup:!0},"feedback-widget-survey")]})}var Ir=function(e){var n,i,r=e.question,o=e.forceDisableHtml,s=e.displayQuestionIndex,a=e.appearance,u=e.onSubmit,c=e.onPreviewSubmit,d=(l(n={},Wt.Open,cr),l(n,Wt.Link,dr),l(n,Wt.Rating,fr),l(n,Wt.SingleChoice,pr),l(n,Wt.MultipleChoice,pr),n),f={question:r,forceDisableHtml:o,appearance:a,onPreviewSubmit:function(e){c(e)},onSubmit:function(e){u(e)}},h=(l(i={},Wt.Open,{}),l(i,Wt.Link,{}),l(i,Wt.Rating,{displayQuestionIndex:s}),l(i,Wt.SingleChoice,{displayQuestionIndex:s}),l(i,Wt.MultipleChoice,{displayQuestionIndex:s}),i),p=d[r.type],v=t(t({},f),h[r.type]);return Qi(p,t({},v))};function Fr(e){return!Et(Event)&&Rr(e,Event)}function Rr(e,t){try{return e instanceof t}catch(e){return!1}}function Mr(e){return Pt(e)||!St(e)&&!wt(e)}function Lr(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function qr(e){return Lr(e,"DOMError")}Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{},Ze.__PosthogExtensions__.canActivateRepeatedly=en,Ze.__PosthogExtensions__.generateSurveys=Er,Ze.extendPostHogWithSurveys=Er;var $r=/\(error: (.*)\)/,Or=50,Ar="?";function Dr(e,t,n,i){var r={platform:"web:javascript",filename:e,function:"<anonymous>"===t?Ar:t,in_app:!0};return Et(n)||(r.lineno=n),Et(i)||(r.colno=i),r}var Nr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Br=/\((\S*)(?::(\d+))(?::(\d+))\)/,jr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ur=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vr=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=n.sort((function(e,t){return e[0]-t[0]})).map((function(e){return e[1]}));return function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=[],o=e.split("\n"),s=n;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var l=$r.test(a)?a.replace($r,"$1"):a;if(!l.match(/\S*Error: /)){var u,c=p(r);try{for(c.s();!(u=c.n()).done;){var d=(0,u.value)(l);if(d){i.push(d);break}}}catch(e){c.e(e)}finally{c.f()}if(i.length>=Or)break}}}return function(e){if(!e.length)return[];var n=Array.from(e);return n.reverse(),n.slice(0,Or).map((function(e){return t(t({},e),{},{filename:e.filename||Wr(n).filename,function:e.function||Ar})}))}(i)}}.apply(void 0,[[30,function(e){var t=Nr.exec(e);if(t){var n=c(t,4),i=n[1],r=n[2],o=n[3];return Dr(i,Ar,+r,+o)}var s=Hr.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var a=Br.exec(s[2]);a&&(s[2]=a[1],s[3]=a[2],s[4]=a[3])}var l=c(zr(s[1]||Ar,s[2]),2),u=l[0];return Dr(l[1],u,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,function(e){var t=jr.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=Ur.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var i=t[3],r=t[1]||Ar,o=c(zr(r,i),2);return r=o[0],Dr(i=o[1],r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]);function Wr(e){return e[e.length-1]||{}}var zr=function(e,t){var n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:Ar,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Gr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Zr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e.stacktrace||e.stack||"",i=function(e){if(e&&Qr.test(e.message))return 1;return 0}(e);try{var r=Vr(n,i);return r.slice(0,r.length-t)}catch(e){}return[]}var Qr=/Minified React error #\d+;/i;function Yr(e,t){var n,i,r=Zr(e),o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null!==(i=null==t?void 0:t.synthetic)&&void 0!==i&&i;return{$exception_list:[{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:function(e){var t=e.message;if(t.error&&"string"==typeof t.error.message)return t.error.message;return t}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:o,synthetic:s}}],$exception_level:"error"}}function Jr(e,t){var n,i,r,o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(r=null==t?void 0:t.defaultExceptionType)&&void 0!==r?r:"Error",value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:s}};if(null!=t&&t.syntheticException){var l=Zr(t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function Xr(e){return Ct(e)&&!Tt(e)&&Xe.indexOf(e)>=0}function Kr(e,t){var n,i,r=null===(n=null==t?void 0:t.handled)||void 0===n||n,o=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,s=null!=t&&t.overrideExceptionType?t.overrideExceptionType:Fr(e)?e.constructor.name:"Error",a=null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var r=n.slice(0,i).join(", ");if(!(r.length>t))return i===n.length||r.length<=t?r:"".concat(r.slice(0,t),"...")}return""}(e)),l={type:s,value:a,mechanism:{handled:r,synthetic:o}};if(null!=t&&t.syntheticException){var u=Zr(null==t?void 0:t.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Xr(e.level)?e.level:"error"}}function eo(e,n){var i=e.error,r=e.event,o={$exception_list:[]},s=i||r;if(qr(s)||function(e){return Lr(e,"DOMException")}(s)){var a=s;if(function(e){return"stack"in e}(s))o=Yr(s,n);else{var l=a.name||(qr(a)?"DOMError":"DOMException"),u=a.message?"".concat(l,": ").concat(a.message):l,c=qr(a)?"DOMError":"DOMException";o=Jr(u,t(t({},n),{},{overrideExceptionType:c,defaultExceptionMessage:u}))}return"code"in a&&(o.$exception_DOMException_code="".concat(a.code)),o}if(function(e){return Lr(e,"ErrorEvent")}(s)&&s.error)return Yr(s.error,n);if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Rr(e,Error)}}(s))return Yr(s,n);if(function(e){return Lr(e,"Object")}(s)||Fr(s))return Kr(s,n);if(Et(i)&&Ct(r)){var d="Error",f=r,h=r.match(Gr);return h&&(d=h[1],f=h[2]),Jr(f,t(t({},n),{},{overrideExceptionType:d,defaultExceptionMessage:f}))}return Jr(s,n)}function to(e){var t=function(e){if(Mr(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}(c(e,1)[0]);return Mr(t)?Jr("Non-Error promise rejection captured with value: ".concat(String(t)),{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):eo({event:t},{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(t)})}var no=Ot("[ExceptionAutocapture]"),io={wrapOnError:function(e){var t=Oe;t||no.info("window not available, cannot wrap onerror");var n=t.onerror;return t.onerror=function(){for(var t,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];var s=eo({event:r[0],error:r[4]});return e(s),null!==(t=null==n?void 0:n.apply(void 0,r))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,function(){var e;null===(e=t.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=n}},wrapUnhandledRejection:function(e){var t=Oe;t||no.info("window not available, cannot wrap onUnhandledRejection");var n=t.onunhandledrejection;return t.onunhandledrejection=function(){for(var i,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=to(o);return e(a),null!==(i=null==n?void 0:n.apply(t,o))&&void 0!==i&&i},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,function(){var e;null===(e=t.onunhandledrejection)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=n}}};function ro(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return wt(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,function(){e[t]=i}}catch(e){return function(){}}}Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{},Ze.__PosthogExtensions__.errorWrappingFunctions=io,Ze.__PosthogExtensions__.parseErrorAsProperties=eo,Ze.posthogErrorWrappingFunctions=io,Ze.parseErrorAsProperties=eo;var oo=function(e,t){if(e){var n=e.checkAndGetSessionAndWindowId(!0),i=n.sessionId,r=n.windowId;t.headers.set("X-POSTHOG-SESSION-ID",i),t.headers.set("X-POSTHOG-WINDOW-ID",r)}};Ze.__PosthogExtensions__=Ze.__PosthogExtensions__||{};var so={_patchFetch:function(e){return ro(Oe,"fetch",(function(t){return function(){var i,o=(i=n().mark((function i(r,o){var s;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=new Request(r,o),oo(e,s),n.abrupt("return",t(s));case 3:case"end":return n.stop()}}),i)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var s=i.apply(e,t);function a(e){r(s,n,o,a,l,"next",e)}function l(e){r(s,n,o,a,l,"throw",e)}a(void 0)}))});return function(e,t){return o.apply(this,arguments)}}()}))},_patchXHR:function(e){return ro(Oe.XMLHttpRequest.prototype,"open",(function(t){return function(n,i){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,a=new Request(i);return oo(e,a),t.call(this,n,a.url,r,o,s)}}))}};Ze.__PosthogExtensions__.tracingHeadersPatchFns=so,Ze.postHogTracingHeadersPatchFns=so;var ao=Ot("[FeatureFlags]"),lo="$active_feature_flags",uo="$override_feature_flags",co="$feature_flag_payloads",fo="$override_feature_flag_payloads",ho=function(e){var t,n={},i=p(rt(e||{}));try{for(i.s();!(t=i.n()).done;){var r=c(t.value,2),o=r[0],s=r[1];s&&(n[o]=s)}}catch(e){i.e(e)}finally{i.f()}return n},po=function(){function e(t){o(this,e),l(this,"_override_warning",!1),l(this,"_hasLoadedFlags",!1),l(this,"_requestInFlight",!1),l(this,"_reloadingDisabled",!1),l(this,"_additionalReloadRequested",!1),l(this,"_decideCalled",!1),l(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}return a(e,[{key:"decide",value:function(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}},{key:"hasLoadedFlags",get:function(){return this._hasLoadedFlags}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(U),t=this.instance.get_property(uo);if(!t)return e||{};for(var n=nt({},e),i=Object.keys(t),r=0;r<i.length;r++)n[i[r]]=t[i[r]];return this._override_warning||(ao.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.instance.get_property(co),t=this.instance.get_property(fo);if(!t)return e||{};for(var n=nt({},e||{}),i=Object.keys(t),r=0;r<i.length;r++)n[i[r]]=t[i[r]];return this._override_warning||(ao.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this._override_warning=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((function(){e._callDecideEndpoint()}),5))}},{key:"clearDebouncer",value:function(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}},{key:"ensureFlagsLoaded",value:function(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this._reloadingDisabled=e}},{key:"_callDecideEndpoint",value:function(e){var t=this;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var n={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:this.instance.get_property(W),group_properties:this.instance.get_property(z)};(null!=e&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:n,compression:this.instance.config.disable_compression?void 0:$e.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(e){var i,r,o=!0;(200===e.statusCode&&(t.$anon_distinct_id=void 0,o=!1),t._requestInFlight=!1,t._decideCalled)||(t._decideCalled=!0,t.instance._onRemoteConfig(null!==(r=e.json)&&void 0!==r?r:{}));n.disable_flags||(t._flagsLoadedFromRemote=!o,t.receivedFeatureFlags(null!==(i=e.json)&&void 0!==i?i:{},o),t._additionalReloadRequested&&(t._additionalReloadRequested=!1,t._callDecideEndpoint()))}})}}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var n,i,r,o,s,a=this.getFlagVariants()[e],u="".concat(a),c=this.instance.get_property(Q)||{};if(t.send_event||!("send_event"in t))if(!(e in c)||!c[e].includes(u))kt(c[e])?c[e].push(u):c[e]=[u],null===(n=this.instance.persistence)||void 0===n||n.register(l({},Q,c)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_bootstrapped_response:(null===(i=this.instance.config.bootstrap)||void 0===i||null===(r=i.featureFlags)||void 0===r?void 0:r[e])||null,$feature_flag_bootstrapped_payload:(null===(o=this.instance.config.bootstrap)||void 0===o||null===(s=o.featureFlagPayloads)||void 0===s?void 0:s[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote});return a}ao.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._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);ao.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._hasLoadedFlags=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e.featureFlags,a=e.featureFlagPayloads;if(s)if(kt(s)){var u,c={};if(s)for(var d=0;d<s.length;d++)c[s[d]]=!0;n&&n.register((l(u={},lo,s),l(u,U,c),u))}else{var f=s,h=a;e.errorsWhileComputingFlags&&(f=t(t({},r),f),h=t(t({},o),h)),n&&n.register((l(i={},lo,Object.keys(ho(f))),l(i,U,f||{}),l(i,co,h||{}),i))}}(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks(n)}}},{key:"override",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ao.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return ao.uninitializedWarning("posthog.feature_flags.overrideFeatureFlags");if(!1===e)return this.instance.persistence.unregister(uo),this.instance.persistence.unregister(fo),void this._fireFeatureFlagsCallbacks();if(e&&"object"===i(e)&&("flags"in e||"payloads"in e)){var t,n=e;if(this._override_warning=Boolean(null!==(t=n.suppressWarning)&&void 0!==t&&t),"flags"in n)if(!1===n.flags)this.instance.persistence.unregister(uo);else if(n.flags)if(kt(n.flags)){for(var r={},o=0;o<n.flags.length;o++)r[n.flags[o]]=!0;this.instance.persistence.register(l({},uo,r))}else this.instance.persistence.register(l({},uo,n.flags));return"payloads"in n&&(!1===n.payloads?this.instance.persistence.unregister(fo):n.payloads&&this.instance.persistence.register(l({},fo,n.payloads))),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var n=this._prepareFeatureFlagsForCallbacks(),i=n.flags,r=n.flagVariants;e(i,r)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,n){var i,r,o=(this.instance.get_property(V)||[]).find((function(t){return t.flagKey===e})),s=l({},"$feature_enrollment/".concat(e),n),a={$feature_flag:e,$feature_enrollment:n,$set:s};o&&(a.$early_access_feature_name=o.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var u=t(t({},this.getFlagVariants()),{},l({},e,n));null===(i=this.instance.persistence)||void 0===i||i.register((l(r={},lo,Object.keys(ho(u))),l(r,U,u),r)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.instance.get_property(V);if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var i;if(n.json){var r=n.json.earlyAccessFeatures;return null===(i=t.instance.persistence)||void 0===i||i.register(l({},V,r)),e(r)}}})}},{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,i=t.flagVariants;this.featureFlagEventHandlers.forEach((function(t){return t(n,i,{errorsLoading:e})}))}},{key:"setPersonPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(W)||{};this.instance.register(l({},W,t(t({},i),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(W)}},{key:"setGroupPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(z)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((function(n){i[n]=t(t({},i[n]),e[n]),delete e[n]})),this.instance.register(l({},z,t(t({},i),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var n=this.instance.get_property(z)||{};this.instance.register(l({},z,t(t({},n),{},l({},e,{}))))}else this.instance.unregister(z)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ft(e)&&isFinite(e)&&Math.floor(e)===e});var vo="0123456789abcdef",_o=function(){function e(t){if(o(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return a(e,[{key:"toString",value:function(){for(var e="",t=0;t<this.bytes.length;t++)e=e+vo.charAt(this.bytes[t]>>>4)+vo.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,i,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(r)||t<0||n<0||i<0||r<0||t>0xffffffffffff||n>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=r>>>24,o[13]=r>>>16,o[14]=r>>>8,o[15]=r,new e(o)}}]),e}(),go=function(){function e(){o(this,e),l(this,"timestamp",0),l(this,"counter",0),l(this,"random",new bo)}return a(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Et(e)){this.timestamp=0;var t=this.generateOrAbort();if(Et(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return _o.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),mo=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Oe&&!Et(Oe.crypto)&&crypto.getRandomValues&&(mo=function(e){return crypto.getRandomValues(e)});var yo,bo=function(){function e(){o(this,e),l(this,"buffer",new Uint32Array(8)),l(this,"cursor",1/0)}return a(e,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(mo(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),ko=function(){return wo().toString()},wo=function(){return(yo||(yo=new go)).generate()},So="Thu, 01 Jan 1970 00:00:00 GMT",xo="";var Eo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Co(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:je;if(xo)return xo;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),r="dmn_chk_"+ko(),o=new RegExp("(^|;)\\s*"+r+"=1");!xo&&i--;){var s=n.slice(i).join("."),a=r+"=1;domain=."+s;t.cookie=a,o.test(t.cookie)&&(t.cookie=a+";expires="+So,xo=s)}return xo}(e);if(!n){var i=function(e){var t=e.match(Eo);return t?t[0]:""}(e);i!==n&&$t.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}return""}var To={is_supported:function(){return!!je},error:function(e){$t.error("cookieStore error: "+e)},get:function(e){if(je){try{for(var t=e+"=",n=je.cookie.split(";").filter((function(e){return e.length})),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},parse:function(e){var t;try{t=JSON.parse(To.get(e))||{}}catch(e){}return t},set:function(e,t,n,i,r){if(je)try{var o="",s="",a=Co(je.location.hostname,i);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),o="; expires="+l.toUTCString()}r&&(s="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+a+s;return u.length>3686.4&&$t.warn("cookieStore warning: large cookie, len="+u.length),je.cookie=u,u}catch(e){return}},remove:function(e,t){try{To.set(e,"",-1,t)}catch(e){return}}},Po=null,Io={is_supported:function(){if(!Pt(Po))return Po;var e=!0;if(Et(Oe))e=!1;else try{var t="__mplssupport__";Io.set(t,"xyz"),'"xyz"'!==Io.get(t)&&(e=!1),Io.remove(t)}catch(t){e=!1}return e||$t.error("localStorage unsupported; falling back to cookie store"),Po=e,e},error:function(e){$t.error("localStorage error: "+e)},get:function(e){try{return null==Oe?void 0:Oe.localStorage.getItem(e)}catch(e){Io.error(e)}return null},parse:function(e){try{return JSON.parse(Io.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==Oe||Oe.localStorage.setItem(e,JSON.stringify(t))}catch(e){Io.error(e)}},remove:function(e){try{null==Oe||Oe.localStorage.removeItem(e)}catch(e){Io.error(e)}}},Fo=["distinct_id",N,H,ne,te],Ro=t(t({},Io),{},{parse:function(e){try{var t={};try{t=To.parse(e)||{}}catch(e){}var n=nt(t,JSON.parse(Io.get(e)||"{}"));return Io.set(e,n),n}catch(e){}return null},set:function(e,t,n,i,r,o){try{Io.set(e,t,void 0,void 0,o);var s={};Fo.forEach((function(e){t[e]&&(s[e]=t[e])})),Object.keys(s).length&&To.set(e,s,n,i,r,o)}catch(e){Io.error(e)}},remove:function(e,t){try{null==Oe||Oe.localStorage.removeItem(e),To.remove(e,t)}catch(e){Io.error(e)}}}),Mo={},Lo={is_supported:function(){return!0},error:function(e){$t.error("memoryStorage error: "+e)},get:function(e){return Mo[e]||null},parse:function(e){return Mo[e]||null},set:function(e,t){Mo[e]=t},remove:function(e){delete Mo[e]}},qo=null,$o={is_supported:function(){if(!Pt(qo))return qo;if(qo=!0,Et(Oe))qo=!1;else try{var e="__support__";$o.set(e,"xyz"),'"xyz"'!==$o.get(e)&&(qo=!1),$o.remove(e)}catch(e){qo=!1}return qo},error:function(e){$t.error("sessionStorage error: ",e)},get:function(e){try{return null==Oe?void 0:Oe.sessionStorage.getItem(e)}catch(e){$o.error(e)}return null},parse:function(e){try{return JSON.parse($o.get(e))||null}catch(e){}return null},set:function(e,t){try{null==Oe||Oe.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){$o.error(e)}},remove:function(e){try{null==Oe||Oe.sessionStorage.removeItem(e)}catch(e){$o.error(e)}}},Oo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ao=function(){function e(n){o(this,e),this.config=n,this.props={},this.campaign_params_saved=!1,this.name=function(e){var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"}(n),this.storage=this.buildStorage(n),this.load(),n.debug&&$t.info("Persistence loaded",n.persistence,t({},this.props)),this.update_config(n,n),this.save()}return a(e,[{key:"buildStorage",value:function(e){-1===Oo.indexOf(e.persistence.toLowerCase())&&($t.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Io.is_supported()?Io:"localstorage+cookie"===t&&Ro.is_supported()?Ro:"sessionstorage"===t&&$o.is_supported()?$o:"memory"===t?Lo:"cookie"===t?To:Ro.is_supported()?Ro:To}},{key:"properties",value:function(){var e={};return tt(this.props,(function(t,n){if(n===U&&St(t))for(var i=Object.keys(t),r=0;r<i.length;r++)e["$feature/".concat(i[r])]=t[i[r]];else s=n,a=!1,(Pt(o=oe)?a:He&&o.indexOf===He?-1!=o.indexOf(s):(tt(o,(function(e){if(a||(a=e===s))return Ke})),a))||(e[n]=t);var o,s,a})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=nt({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(St(e)){Et(t)&&(t="None"),this.expire_days=Et(n)?this.default_expiry:n;var r=!1;if(tt(e,(function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(St(e)){this.expire_days=Et(t)?this.default_expiry:t;var i=!1;if(tt(e,(function(t,r){e.hasOwnProperty(r)&&n.props[r]!==t&&(n.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){if(!this.campaign_params_saved){var e=fi.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});xt(at(e))||this.register(e),this.campaign_params_saved=!0}}},{key:"update_search_keyword",value:function(){this.register(fi.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(fi.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[K]||this.props[ee]||this.register_once(l({},te,fi.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return at({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var e=this,t={};tt([ee,K],(function(n){var i=e.props[n];i&&tt(i,(function(e,n){t["$initial_"+vt(n)]=e}))}));var n=this.props[te];if(n){var i=fi.initialPersonPropsFromInfo(n);nt(t,i)}return t}},{key:"safe_merge",value:function(e){return tt(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.buildStorage(e),i=this.props;this.clear(),this.storage=n,this.props=i,this.save()}}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[E]||{};n[e]=t,this.props[E]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[E]||{})[e];return Et(t)||(delete this.props[E][e],this.save()),t}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this.props[e]=t,this.save()}}]),e}();function Do(e){var t,n;return(null===(t=JSON.stringify(e,(n=[],function(e,t){if(St(t)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(t)?"[Circular]":(n.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function No(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),i=e.data.slice(0,n),r=e.data.slice(n);return[No({size:Do(i),data:i,sessionId:e.sessionId,windowId:e.windowId}),No({size:Do(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap((function(e){return e}))}return[e]}var Ho=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}(Ho||{}),Bo=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}(Bo||{});function jo(e){var t;return e instanceof Element&&(e.id===ie||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container")))}function Uo(e){return!!e&&1===e.nodeType}function Vo(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Wo(e){return!!e&&3===e.nodeType}function zo(e){return!!e&&11===e.nodeType}function Go(e){return e?pt(e).split(/\s+/):[]}function Zo(e){var t=null==Oe?void 0:Oe.location.href;return!!(t&&e&&e.some((function(e){return t.match(e)})))}function Qo(e){var t="";switch(i(e.className)){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Go(t)}function Yo(e){return It(e)?null:pt(e).split(/(\s+)/).filter((function(e){return cs(e)})).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Jo(e){var t="";return ns(e)&&!is(e)&&e.childNodes&&e.childNodes.length&&tt(e.childNodes,(function(e){var n;Wo(e)&&e.textContent&&(t+=null!==(n=Yo(e.textContent))&&void 0!==n?n:"")})),pt(t)}function Xo(e){return Et(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ko=["a","button","form","input","select","textarea","label"];function es(e){var t=e.parentNode;return!(!t||!Uo(t))&&t}function ts(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!Oe||!e||Vo(e,"html")||!Uo(e))return!1;if(null!=n&&n.url_allowlist&&!Zo(n.url_allowlist))return!1;if(null!=n&&n.url_ignorelist&&Zo(n.url_ignorelist))return!1;if(null!=n&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some((function(e){return t.type===e})))return!1}for(var a=!1,l=[e],u=!0,c=e;c.parentNode&&!Vo(c,"body");)if(zo(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(u=es(c)))break;if(r||Ko.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=Oe.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),c=u}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(Et(n))return!0;var r,o=p(e);try{var s=function(){var e=r.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(o.s();!(r=o.n()).done;){var a=s();if("object"===i(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(l,n))return!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(Et(n))return!0;var r,o=p(e);try{var s=function(){var e=r.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(o.s();!(r=o.n()).done;){var a=s();if("object"===i(a))return a.v}}catch(e){o.e(e)}finally{o.f()}return!1}(l,n))return!1;var f=Oe.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){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 a?(o||["click"]).indexOf(t.type)>=0:(o||["click"]).indexOf(t.type)>=0&&(Ko.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}function ns(e){for(var t=e;t.parentNode&&!Vo(t,"body");t=t.parentNode){var n=Qo(t);if(ht(n,"ph-sensitive")||ht(n,"ph-no-capture"))return!1}if(ht(Qo(e),"ph-include"))return!0;var i=e.type||"";if(Ct(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(Ct(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function is(e){return!!(Vo(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Vo(e,"select")||Vo(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rs="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",os=new RegExp("^(?:".concat(rs,")$")),ss=new RegExp(rs),as="\\d{3}-?\\d{2}-?\\d{4}",ls=new RegExp("^(".concat(as,")$")),us=new RegExp("(".concat(as,")"));function cs(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(It(e))return!1;if(Ct(e)){if(e=pt(e),(t?os:ss).test((e||"").replace(/[- ]/g,"")))return!1;if((t?ls:us).test(e))return!1}return!0}function ds(e){var t=Jo(e);return cs(t="".concat(t," ").concat(fs(e)).trim())?t:""}function fs(e){var t="";return e&&e.childNodes&&e.childNodes.length&&tt(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var i=Jo(e);t="".concat(t," ").concat(i).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(fs(e)).trim())}catch(e){$t.error("[AutoCapture]",e)}})),t}function hs(e){return function(e){var n=e.map((function(e){var n,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class){e.attr_class.sort();var o,s=p(e.attr_class);try{for(s.s();!(o=s.n()).done;){var a=o.value;r+=".".concat(a.replace(/"/g,""))}}catch(e){s.e(e)}finally{s.f()}}var l=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!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),u={};return rt(l).sort((function(e,t){var n=c(e,1)[0],i=c(t,1)[0];return n.localeCompare(i)})).forEach((function(e){var t=c(e,2),n=t[0],i=t[1];return u[ps(n.toString())]=ps(i.toString())})),r+=":",r+=rt(l).map((function(e){var t=c(e,2),n=t[0],i=t[1];return"".concat(n,'="').concat(i,'"')})).join("")}));return n.join(";")}(function(e){return e.map((function(e){var t,n,i={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(n=e.attr__href)||void 0===n?void 0:n.slice(0,2048),attr_class:vs(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return rt(e).filter((function(e){return 0===c(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=c(e,2),n=t[0],r=t[1];return i.attributes[n]=r})),i}))}(e))}function ps(e){return e.replace(/"|\\"/g,'\\"')}function vs(e){var t=e.attr__class;return t?kt(t)?t:Go(t):void 0}var _s="[SessionRecording]",gs="redacted",ms={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,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},ys=["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"],bs=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ks=["/s/","/e/","/i/"];function ws(e,t,n,i){if(It(e))return e;var r=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ct(r)&&(r=parseInt(r)),r>n?_s+" ".concat(i," body too large to record (").concat(r," bytes)"):e}function Ss(e,t){if(It(e))return e;var n=e;return cs(n,!1)||(n=_s+" "+t+" body "+gs),tt(bs,(function(e){var i,r;null!==(i=n)&&void 0!==i&&i.length&&-1!==(null===(r=n)||void 0===r?void 0:r.indexOf(e))&&(n=_s+" "+t+" body "+gs+" as might contain: "+e)})),n}var xs=function(e,n){var i,r,o,s={payloadSizeLimitBytes:ms.payloadSizeLimitBytes,performanceEntryTypeToObserve:d(ms.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(d(n.payloadHostDenyList||[]),d(ms.payloadHostDenyList))},a=!1!==e.session_recording.recordHeaders&&n.recordHeaders,l=!1!==e.session_recording.recordBody&&n.recordBody,u=!1!==e.capture_performance&&n.recordPerformance,c=(i=s,o=Math.min(1e6,null!==(r=i.payloadSizeLimitBytes)&&void 0!==r?r:1e6),function(e){return null!=e&&e.requestBody&&(e.requestBody=ws(e.requestBody,e.requestHeaders,o,"Request")),null!=e&&e.responseBody&&(e.responseBody=ws(e.responseBody,e.responseHeaders,o,"Response")),e}),f=function(t){return c(function(e,t){var n,i=ln(e.name),r=0===t.indexOf("http")?null===(n=ln(t))||void 0===n?void 0:n.pathname:t;"/"===r&&(r="");var o=null==i?void 0:i.pathname.replace(r||"","");if(!(i&&o&&ks.some((function(e){return 0===o.indexOf(e)}))))return e}((i=(n=t).requestHeaders,It(i)||tt(Object.keys(null!=i?i:{}),(function(e){ys.includes(e.toLowerCase())&&(i[e]=gs)})),n),e.api_host));var n,i},h=wt(e.session_recording.maskNetworkRequestFn);return h&&wt(e.session_recording.maskCapturedNetworkRequestFn)&&$t.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=function(n){var i=e.session_recording.maskNetworkRequestFn({url:n.name});return t(t({},n),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=wt(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,i,r,o=f(t);return o&&null!==(n=null===(i=(r=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(r,o))&&void 0!==n?n:void 0}:function(e){return function(e){if(!Et(e))return e.requestBody=Ss(e.requestBody,"Request"),e.responseBody=Ss(e.responseBody,"Response"),e}(f(e))},t(t(t({},ms),s),{},{recordHeaders:a,recordBody:l,recordPerformance:u,recordInitialRequests:u})};function Es(e,t,n,i,r){return t>n&&($t.warn("min cannot be greater than max."),t=n),Ft(e)?e>n?(i&&$t.warn(i+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(i&&$t.warn(i+" cannot be less than min: "+t+". Using min value instead."),t):e:(i&&$t.warn(i+" must be a number. using max or fallback. max: "+n+", fallback: "+r),Es(r||n,t,n,i))}var Cs=a((function e(t){var n,i,r=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),l(this,"bucketSize",100),l(this,"refillRate",10),l(this,"mutationBuckets",{}),l(this,"loggedTracker",{}),l(this,"refillBuckets",(function(){Object.keys(r.mutationBuckets).forEach((function(e){r.mutationBuckets[e]=r.mutationBuckets[e]+r.refillRate,r.mutationBuckets[e]>=r.bucketSize&&delete r.mutationBuckets[e]}))})),l(this,"getNodeOrRelevantParent",(function(e){var t=r.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var n=t.closest("svg");if(n)return[r.rrweb.mirror.getId(n),n]}return[e,t]})),l(this,"numberOfChanges",(function(e){var t,n,i,r,o,s,a,l;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(i=null===(r=e.attributes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)+(null!==(o=null===(s=e.texts)||void 0===s?void 0:s.length)&&void 0!==o?o:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),l(this,"throttleMutations",(function(e){if(3!==e.type||0!==e.data.source)return e;var t=e.data,n=r.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((function(e){var t,n,i,o=c(r.getNodeOrRelevantParent(e.id),2),s=o[0],a=o[1];if(0===r.mutationBuckets[s])return!1;(r.mutationBuckets[s]=null!==(t=r.mutationBuckets[s])&&void 0!==t?t:r.bucketSize,r.mutationBuckets[s]=Math.max(r.mutationBuckets[s]-1,0),0===r.mutationBuckets[s])&&(r.loggedTracker[s]||(r.loggedTracker[s]=!0,null===(n=(i=r.options).onBlockedNode)||void 0===n||n.call(i,s,a)));return e})));var i=r.numberOfChanges(t);return 0!==i||n===i?e:void 0})),this.rrweb=t,this.options=s,this.refillRate=Es(null!==(n=this.options.refillRate)&&void 0!==n?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Es(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((function(){r.refillBuckets()}),1e3)})),Ts=Uint8Array,Ps=Uint16Array,Is=Uint32Array,Fs=new Ts([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]),Rs=new Ts([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]),Ms=new Ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(e,t){for(var n=new Ps(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Is(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},qs=Ls(Fs,2),$s=qs[0],Os=qs[1];$s[28]=258,Os[258]=28;for(var As=Ls(Rs,0)[1],Ds=new Ps(32768),Ns=0;Ns<32768;++Ns){var Hs=(43690&Ns)>>>1|(21845&Ns)<<1;Hs=(61680&(Hs=(52428&Hs)>>>2|(13107&Hs)<<2))>>>4|(3855&Hs)<<4,Ds[Ns]=((65280&Hs)>>>8|(255&Hs)<<8)>>>1}var Bs=function(e,t,n){for(var i=e.length,r=0,o=new Ps(t);r<i;++r)++o[e[r]-1];var s,a=new Ps(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new Ps(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)s[Ds[d]>>>l]=u}else for(s=new Ps(i),r=0;r<i;++r)s[r]=Ds[a[e[r]-1]++]>>>15-e[r];return s},js=new Ts(288);for(Ns=0;Ns<144;++Ns)js[Ns]=8;for(Ns=144;Ns<256;++Ns)js[Ns]=9;for(Ns=256;Ns<280;++Ns)js[Ns]=7;for(Ns=280;Ns<288;++Ns)js[Ns]=8;var Us=new Ts(32);for(Ns=0;Ns<32;++Ns)Us[Ns]=5;var Vs=Bs(js,9,0),Ws=Bs(Us,5,0),zs=function(e){return(e/8>>0)+(7&e&&1)},Gs=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof Ps?Ps:e instanceof Is?Is:Ts)(n-t);return i.set(e.subarray(t,n)),i},Zs=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8},Qs=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ys=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new Ts(0),0];if(1==r){var s=new Ts(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[u].f<n[d].f?u++:d++],l=n[u!=c&&n[u].f<n[d].f?u++:d++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var f=o[0].s;for(i=1;i<r;++i)o[i].s>f&&(f=o[i].s);var h=new Ps(f+1),p=Js(n[c-1],h,0);if(p>t){i=0;var v=0,_=p-t,g=1<<_;for(o.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));i<r;++i){var m=o[i].s;if(!(h[m]>t))break;v+=g-(1<<p-h[m]),h[m]=t}for(v>>>=_;v>0;){var y=o[i].s;h[y]<t?v-=1<<t-h[y]++-1:++i}for(;i>=0&&v;--i){var b=o[i].s;h[b]==t&&(--h[b],++v)}p=t}return[new Ts(h),p]},Js=function e(t,n,i){return-1==t.s?Math.max(e(t.l,n,i+1),e(t.r,n,i+1)):n[t.s]=i},Xs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ps(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Ks=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},ea=function(e,t,n){var i=n.length,r=zs(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},ta=function(e,t,n,i,r,o,s,a,l,u,c){Zs(t,c++,n),++r[256];for(var d=Ys(r,15),f=d[0],h=d[1],p=Ys(o,15),v=p[0],_=p[1],g=Xs(f),m=g[0],y=g[1],b=Xs(v),k=b[0],w=b[1],S=new Ps(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<k.length;++x)S[31&k[x]]++;for(var E=Ys(S,7),C=E[0],T=E[1],P=19;P>4&&!C[Ms[P-1]];--P);var I,F,R,M,L=u+5<<3,q=Ks(r,js)+Ks(o,Us)+s,$=Ks(r,f)+Ks(o,v)+s+14+3*P+Ks(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L<=q&&L<=$)return ea(t,c,e.subarray(l,l+u));if(Zs(t,c,1+($<q)),c+=2,$<q){I=Bs(f,h,0),F=f,R=Bs(v,_,0),M=v;var O=Bs(C,T,0);Zs(t,c,y-257),Zs(t,c+5,w-1),Zs(t,c+10,P-4),c+=14;for(x=0;x<P;++x)Zs(t,c+3*x,C[Ms[x]]);c+=3*P;for(var A=[m,k],D=0;D<2;++D){var N=A[D];for(x=0;x<N.length;++x){var H=31&N[x];Zs(t,c,O[H]),c+=C[H],H>15&&(Zs(t,c,N[x]>>>5&127),c+=N[x]>>>12)}}}else I=Vs,F=js,R=Ws,M=Us;for(x=0;x<a;++x)if(i[x]>255){H=i[x]>>>18&31;Qs(t,c,I[H+257]),c+=F[H+257],H>7&&(Zs(t,c,i[x]>>>23&31),c+=Fs[H]);var B=31&i[x];Qs(t,c,R[B]),c+=M[B],B>3&&(Qs(t,c,i[x]>>>5&8191),c+=Rs[B])}else Qs(t,c,I[i[x]]),c+=F[i[x]];return Qs(t,c,I[256]),c+F[256]},na=new Is([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=function(){for(var e=new Is(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),ra=function(){var e=4294967295;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=ia[255&n^t[i]]^n>>>8;e=n},d:function(){return 4294967295^e}}},oa=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new Ts(i+s+5*(1+Math.floor(s/7e3))+r),l=a.subarray(i,a.length-r),u=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var d=c+65535;d<s?u=ea(l,u,e.subarray(c,d)):(l[c]=o,u=ea(l,u,e.subarray(c,s)))}else{for(var f=na[t-1],h=f>>>13,p=8191&f,v=(1<<n)-1,_=new Ps(32768),g=new Ps(v+1),m=Math.ceil(n/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},k=new Is(25e3),w=new Ps(288),S=new Ps(32),x=0,E=0,C=(c=0,0),T=0,P=0;c<s;++c){var I=b(c),F=32767&c,R=g[I];if(_[F]=R,g[I]=F,T<=c){var M=s-c;if((x>7e3||C>24576)&&M>423){u=ta(e,l,0,k,w,S,E,C,P,c-P,u),C=x=E=0,P=c;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)S[L]=0}var q=2,$=0,O=p,A=F-R&32767;if(M>2&&I==b(c-A))for(var D=Math.min(h,M)-1,N=Math.min(32767,c),H=Math.min(258,M);A<=N&&--O&&F!=R;){if(e[c+q]==e[c+q-A]){for(var B=0;B<H&&e[c+B]==e[c+B-A];++B);if(B>q){if(q=B,$=A,B>D)break;var j=Math.min(A,B-2),U=0;for(L=0;L<j;++L){var V=c-A+L+32768&32767,W=V-_[V]+32768&32767;W>U&&(U=W,R=V)}}}A+=(F=R)-(R=_[F])+32768&32767}if($){k[C++]=268435456|Os[q]<<18|As[$];var z=31&Os[q],G=31&As[$];E+=Fs[z]+Rs[G],++w[257+z],++S[G],T=c+q,++x}else k[C++]=e[c],++w[e[c]]}}u=ta(e,l,o,k,w,S,E,C,P,c-P,u)}return Gs(a,0,i+zs(u)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},sa=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},aa=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&&sa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}},la=function(e){return 10+(e.filename&&e.filename.length+1||0)};function ua(e,t){void 0===t&&(t={});var n=ra(),i=e.length;n.p(e);var r=oa(e,t,la(t),8),o=r.length;return aa(r,t),sa(r,o-8,n.d()),sa(r,o-4,i),r}function ca(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Ts(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new Ts(r+8+(n-s<<1));a.set(i),i=a}var l=e.charCodeAt(s);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return Gs(i,0,r)}function da(e,t){return function(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(e)%100<Es(100*t,0,100)}var fa="[SessionRecording]",ha=Ot(fa),pa=3e5,va=[Bo.MouseMove,Bo.MouseInteraction,Bo.Scroll,Bo.ViewportResize,Bo.Input,Bo.TouchMove,Bo.MediaInteraction,Bo.Drag],_a=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}};function ga(e){return function(e,t){for(var n="",i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}(ua(ca(JSON.stringify(e))),!0)}function ma(e){return e.type===Ho.Custom&&"sessionIdle"===e.data.tag}function ya(e,t){return t.some((function(t){return"regex"===t.matching&&new RegExp(t.url).test(e)}))}var ba,ka=function(){function e(t){var n=this;if(o(this,e),l(this,"queuedRRWebEvents",[]),l(this,"isIdle",!1),l(this,"_linkedFlagSeen",!1),l(this,"_lastActivityTimestamp",Date.now()),l(this,"_linkedFlag",null),l(this,"_removePageViewCaptureHook",void 0),l(this,"_onSessionIdListener",void 0),l(this,"_persistDecideOnSessionListener",void 0),l(this,"_samplingSessionListener",void 0),l(this,"_urlTriggers",[]),l(this,"_urlBlocklist",[]),l(this,"_urlBlocked",!1),l(this,"_eventTriggers",[]),l(this,"_removeEventTriggerCaptureHook",void 0),l(this,"_forceAllowLocalhostNetworkCapture",!1),l(this,"_onBeforeUnload",(function(){n._flushBuffer()})),l(this,"_onOffline",(function(){n._tryAddCustomEvent("browser offline",{})})),l(this,"_onOnline",(function(){n._tryAddCustomEvent("browser online",{})})),l(this,"_onVisibilityChange",(function(){if(null!=je&&je.visibilityState){var e="window "+je.visibilityState;n._tryAddCustomEvent(e,{})}})),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw ha.error("started without valid sessionManager"),new Error(fa+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(fa+" cannot be used with __preview_experimental_cookieless_mode.");var i=this.sessionManager.checkAndGetSessionAndWindowId(),r=i.sessionId,s=i.windowId;this.sessionId=r,this.windowId=s,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&ha.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}return a(e,[{key:"sessionIdleThresholdMilliseconds",get:function(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}},{key:"rrwebRecord",get:function(){var e,t;return null==Ze||null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fa+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:pa}},{key:"isSampled",get:function(){var e=this.instance.get_property(H);return Rt(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],i=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return n?n.timestamp-i:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(M),t=!this.instance.config.disable_session_recording;return Oe&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(L),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"canvasRecording",get:function(){var e,t,n,i,r,o,s=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property($),l=null!==(e=null!==(t=null==s?void 0:s.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,u=null!==(n=null!==(i=null==s?void 0:s.canvasFps)&&void 0!==i?i:null==a?void 0:a.fps)&&void 0!==n?n:4,c=null!==(r=null!==(o=null==s?void 0:s.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:.4;if("string"==typeof c){var d=parseFloat(c);c=isNaN(d)?.4:d}return{enabled:l,fps:Es(u,0,12,"canvas recording fps",4),quality:Es(c,0,1,"canvas recording quality",.4)}}},{key:"networkPayloadCapture",get:function(){var e,t,n=this.instance.get_property(q),i={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},r=(null==i?void 0:i.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==i?void 0:i.recordBody)||(null==n?void 0:n.recordBody),s=St(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(Rt(s)?s:null==n?void 0:n.capturePerformance);return r||o||a?{recordHeaders:r,recordBody:o,recordPerformance:a}:void 0}},{key:"sampleRate",get:function(){var e=this.instance.get_property(O);return Ft(e)?e:null}},{key:"minimumDuration",get:function(){var e=this.instance.get_property(A);return Ft(e)?e:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?!1===this.isSampled?"disabled":this._urlBlocked?"paused":It(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":Rt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"urlTriggerStatus",get:function(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(B))===this.sessionId?"trigger_activated":"trigger_pending"}},{key:"eventTriggerStatus",get:function(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(j))===this.sessionId?"trigger_activated":"trigger_pending"}},{key:"triggerStatus",get:function(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}},{key:"startIfEnabledOrStop",value:function(e){var t=this;this.isRecordingEnabled?(this._startCapture(e),ft(Oe,"beforeunload",this._onBeforeUnload),ft(Oe,"offline",this._onOffline),ft(Oe,"online",this._onOnline),ft(Oe,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),It(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",(function(e){try{if("$pageview"===e.event){var n=null!=e&&e.properties.$current_url?t._maskUrl(null==e?void 0:e.properties.$current_url):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n})}}catch(e){ha.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((function(e,n,i){var r,o,s,a;i&&(t._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:n,changeReason:i}),null===(r=t.instance)||void 0===r||null===(o=r.persistence)||void 0===o||o.unregister(j),null===(s=t.instance)||void 0===s||null===(a=s.persistence)||void 0===a||a.unregister(B))})))):this.stopRecording()}},{key:"stopRecording",value:function(){var e,t,n,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==Oe||Oe.removeEventListener("beforeunload",this._onBeforeUnload),null==Oe||Oe.removeEventListener("offline",this._onOffline),null==Oe||Oe.removeEventListener("online",this._onOnline),null==Oe||Oe.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(e=this._removePageViewCaptureHook)||void 0===e||e.call(this),this._removePageViewCaptureHook=void 0,null===(t=this._removeEventTriggerCaptureHook)||void 0===t||t.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(i=this._samplingSessionListener)||void 0===i||i.call(this),this._samplingSessionListener=void 0,ha.info("stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n=this.sessionId!==e,i=this.sampleRate;if(Ft(i)){var r=this.isSampled,o=n||!Rt(r),s=o?da(e,i):r;o&&(s?this._reportStarted("sampled"):ha.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:s})),null===(t=this.instance.persistence)||void 0===t||t.register(l({},H,s))}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register(l({},H,null))}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r,o,s,a=this;(this._tryAddCustomEvent("$remote_config_received",e),this._persistRemoteConfig(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(n=e.sessionRecording)&&void 0!==n&&n.endpoint)&&(this._endpoint=null===(s=e.sessionRecording)||void 0===s?void 0:s.endpoint);if(this._setupSampling(),!It(this._linkedFlag)&&!this._linkedFlagSeen){var l=Ct(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=Ct(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((function(e,t){var n=St(t)&&l in t,i=u?t[l]===u:n;i&&a._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),a._linkedFlagSeen=i}))}null!==(i=e.sessionRecording)&&void 0!==i&&i.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(r=e.sessionRecording)&&void 0!==r&&r.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(o=e.sessionRecording)&&void 0!==o&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var e=this;Ft(this.sampleRate)&&It(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((function(t){e.makeSamplingDecision(t)})))}},{key:"_persistRemoteConfig",value:function(e){if(this.instance.persistence){var n,i=this.instance.persistence,r=function(){var n,r,o,s,a,u,c,d,f,h=null===(n=e.sessionRecording)||void 0===n?void 0:n.sampleRate,p=It(h)?null:parseFloat(h),v=null===(r=e.sessionRecording)||void 0===r?void 0:r.minimumDurationMilliseconds;i.register((l(f={},M,!!e.sessionRecording),l(f,L,null===(o=e.sessionRecording)||void 0===o?void 0:o.consoleLogRecordingEnabled),l(f,q,t({capturePerformance:e.capturePerformance},null===(s=e.sessionRecording)||void 0===s?void 0:s.networkPayloadCapture)),l(f,$,{enabled:null===(a=e.sessionRecording)||void 0===a?void 0:a.recordCanvas,fps:null===(u=e.sessionRecording)||void 0===u?void 0:u.canvasFps,quality:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasQuality}),l(f,O,p),l(f,A,Et(v)?null:v),l(f,D,null===(d=e.sessionRecording)||void 0===d?void 0:d.scriptConfig),f))};r(),null===(n=this._persistDecideOnSessionListener)||void 0===n||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}},{key:"log",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}},{key:"_startCapture",value:function(e){var t=this;if(!Et(Object.assign)&&!Et(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,this.scriptName,(function(e){if(e)return ha.error("could not load recorder",e);t._onScriptLoaded()}));ha.info("starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}},{key:"scriptName",get:function(){var e,t,n;return(null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t||null===(n=t.get_property(D))||void 0===n?void 0:n.script)||"recorder"}},{key:"isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==va.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>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)),!this.isIdle){var i=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=i.windowId,o=i.sessionId,s=this.sessionId!==o,a=this.windowId!==r;this.windowId=r,this.sessionId=o,s||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this._scheduleFullSnapshot()}}},{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}):ha.warn("could not emit queued rrweb event.",t,e),!1}}},{key:"_tryAddCustomEvent",value:function(e,t){var n=this;return this._tryRRWebMethod(_a((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(_a((function(){return e.rrwebRecord.takeFullSnapshot()})))}},{key:"_onScriptLoaded",value:function(){for(var e,n=this,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},r=this.instance.config.session_recording,o=0,s=Object.entries(r||{});o<s.length;o++){var a=c(s[o],2),l=a[0],u=a[1];l in i&&("maskInputOptions"===l?i.maskInputOptions=t({password:!0},u):i[l]=u)}if(this.canvasRecording&&this.canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling={canvas:this.canvasRecording.fps},i.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new Cs(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:function(e,t){var i="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");ha.info(i,{node:t}),n.log(fa+" "+i,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t({emit:function(e){n.onRRwebEmit(e)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map((function(e){return null==e?void 0:e.name}))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else ha.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var e=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval((function(){e._tryTakeFullSnapshot()}),t))}}},{key:"_gatherRRWebPlugins",value:function(){var e,t,n,i,r=[],o=null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&r.push(o());var s=null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.rrwebPlugins)||void 0===i?void 0:i.getRecordNetworkPlugin;this.networkPayloadCapture&&wt(s)&&(!an.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(xs(this.instance.config,this.networkPayloadCapture))):ha.info("NetworkCapture not started because we are on localhost."));return r}},{key:"onRRwebEmit",value:function(e){var n;if(this._processQueuedEvents(),e&&St(e)){if(e.type===Ho.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(e){return e.type===Ho.Custom&&"recording paused"===e.data.tag}(e)){e.type===Ho.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Ho.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var o=function(e){var t=e;if(t&&St(t)&&6===t.type&&St(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var n=[],i=0;i<t.data.payload.payload.length;i++)t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?n.push(t.data.payload.payload[i].slice(0,2e3)+"...[truncated]"):n.push(t.data.payload.payload[i]);return t.data.payload.payload=n,e}return e}(r);if(this._updateWindowAndSessionIds(o),!this.isIdle||ma(o)){if(ma(o)){var s=o.data.payload;if(s){var a=s.lastActivityTimestamp,l=s.threshold;o.timestamp=a+l}}var u=null===(n=this.instance.config.session_recording.compress_events)||void 0===n||n?function(e){if(Do(e)<1024)return e;try{if(e.type===Ho.FullSnapshot)return t(t({},e),{},{data:ga(e.data),cv:"2024-10"});if(e.type===Ho.IncrementalSnapshot&&e.data.source===Bo.Mutation)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{texts:ga(e.data.texts),attributes:ga(e.data.attributes),removes:ga(e.data.removes),adds:ga(e.data.adds)})});if(e.type===Ho.IncrementalSnapshot&&e.data.source===Bo.StyleSheetRule)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{adds:ga(e.data.adds),removes:ga(e.data.removes)})})}catch(e){ha.error("could not compress event - will use uncompressed event",e)}return e}(o):o,c={$snapshot_bytes:Do(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(c):this.clearBuffer()}}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&Oe){var e=this._maskUrl(Oe.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=d(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,i={url:e};return null===(n=i=t.maskNetworkRequestFn(i))||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,i=Ft(n)&&n>=0,r=Ft(t)&&i&&n<t;if("buffering"===this.status||"paused"===this.status||"disabled"===this.status||r)return this.flushBufferTimer=setTimeout((function(){e._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&No(this.buffer).forEach((function(t){e._captureSnapshot({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:"web",$lib_version:Qe.LIB_VERSION})}));return this.clearBuffer()}},{key:"_captureSnapshotBuffered",value:function(e){var t,n=this,i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((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",skip_client_rate_limiting:!0})}},{key:"_checkUrlTriggerConditions",value:function(){if(void 0!==Oe&&Oe.location.href){var e=Oe.location.href,t=this._urlBlocked,n=ya(e,this._urlBlocklist);n&&!t?this._pauseRecording():!n&&t&&this._resumeRecording(),ya(e,this._urlTriggers)&&this._activateTrigger("url")}}},{key:"_activateTrigger",value:function(e){var t,n;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register(l({},"url"===e?B:j,this.sessionId)),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}},{key:"_pauseRecording",value:function(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),ha.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}},{key:"_resumeRecording",value:function(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),ha.info("recording resumed"))}},{key:"_addEventTriggerListener",value:function(){var e=this;0!==this._eventTriggers.length&&It(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(function(t){try{e._eventTriggers.includes(t.event)&&e._activateTrigger("event")}catch(e){ha.error("Could not activate event trigger",e)}})))}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}},{key:"overrideSampling",value:function(){var e;null===(e=this.instance.persistence)||void 0===e||e.register(l({},H,!0)),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}},{key:"overrideTrigger",value:function(e){this._activateTrigger(e)}},{key:"_reportStarted",value:function(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),ha.info(e.replace("_"," "),t),ht(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}]),e}(),wa=Ot("[RemoteConfig]"),Sa=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"remoteConfig",get:function(){var e,t;return null===(e=Ze._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.config}},{key:"_loadRemoteConfigJs",value:function(e){var t,n,i,r=this;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.loadExternalDependency?null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"remote-config",(function(){return e(r.remoteConfig)})):(wa.error("PostHog Extensions not found. Cannot load remote config."),e())}},{key:"_loadRemoteConfigJSON",value:function(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:function(t){e(t.json)}})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return wa.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void wa.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((function(t){if(!t)return wa.info("No config found after loading remote JS config. Falling back to JSON."),void e._loadRemoteConfigJSON((function(t){e.onRemoteConfig(t)}));e.onRemoteConfig(t)}))}catch(e){wa.error("Error loading remote config",e)}}},{key:"onRemoteConfig",value:function(e){e?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this.instance.featureFlags.ensureFlagsLoaded()):wa.info("__preview_remote_config is disabled. Logging config instead",e):wa.error("Failed to fetch remote config from PostHog.")}}]),e}(),xa=null!=Oe&&Oe.location?fn(Oe.location.hash,"__posthog")||fn(location.hash,"state"):null,Ea="_postHogToolbarParams",Ca=Ot("[Toolbar]");!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(ba||(ba={}));var Ta=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"setToolbarState",value:function(e){Ze.ph_toolbar_state=e}},{key:"getToolbarState",value:function(){var e;return null!==(e=Ze.ph_toolbar_state)&&void 0!==e?e:ba.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!Oe||!je)return!1;n=null!==(e=n)&&void 0!==e?e:Oe.location,r=null!==(t=r)&&void 0!==t?t:Oe.history;try{if(!i){try{Oe.localStorage.setItem("test","test"),Oe.localStorage.removeItem("test")}catch(e){return!1}i=null==Oe?void 0:Oe.localStorage}var o,s=xa||fn(n.hash,"__posthog")||fn(n.hash,"state"),a=s?ot((function(){return JSON.parse(atob(decodeURIComponent(s)))}))||ot((function(){return JSON.parse(decodeURIComponent(s))})):null;return a&&"ph_authorize"===a.action?((o=a).source="url",o&&Object.keys(o).length>0&&(a.desiredHash?n.hash=a.desiredHash:r?r.replaceState(r.state,"",n.pathname+n.search):n.hash="")):((o=JSON.parse(i.getItem(Ea)||"{}")).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){var t=Ze.ph_load_toolbar||Ze.ph_load_editor;!It(t)&&wt(t)?t(e,this.instance):Ca.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var n=this,i=!(null==je||!je.getElementById(ie));if(!Oe||i)return!1;var r="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")},r?{instrument:!1}:{});if(Oe.localStorage.setItem(Ea,JSON.stringify(t(t({},o),{},{source:void 0}))),this.getToolbarState()===ba.LOADED)this._callLoadToolbar(o);else if(this.getToolbarState()===ba.UNINITIALIZED){var s,a;this.setToolbarState(ba.LOADING),null===(s=Ze.__PosthogExtensions__)||void 0===s||null===(a=s.loadExternalDependency)||void 0===a||a.call(s,this.instance,"toolbar",(function(e){if(e)return Ca.error("[Toolbar] Failed to load",e),void n.setToolbarState(ba.UNINITIALIZED);n.setToolbarState(ba.LOADED),n._callLoadToolbar(o)})),ft(Oe,"turbolinks:load",(function(){n.setToolbarState(ba.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}(),Pa=3e3,Ia=function(){function e(t,n){o(this,e),l(this,"isPaused",!0),l(this,"queue",[]),this.flushTimeoutMs=Es((null==n?void 0:n.flush_interval_ms)||Pa,250,5e3,"flush interval",Pa),this.sendRequest=t}return a(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=this.queue.length>0?this.formatQueue():{},i=Object.values(n),r=[].concat(d(i.filter((function(e){return 0===e.url.indexOf("/e")}))),d(i.filter((function(e){return 0!==e.url.indexOf("/e")}))));r.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(),n=function(n){var i=t[n],r=(new Date).getTime();i.data&&kt(i.data)&&tt(i.data,(function(e){e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e.sendRequest(i)};for(var i in t)n(i)}}),this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var e={};return tt(this.queue,(function(n){var i,r=n,o=(r?r.batchKey:null)||r.url;Et(e[o])&&(e[o]=t(t({},r),{},{data:[]})),null===(i=e[o].data)||void 0===i||i.push(r.data)})),this.queue=[],e}}]),e}();var Fa=function(e){var t,n,i,r,o="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,r=0;r<i;r++){var s=e.charCodeAt(r),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),Pt(a)||(n>t&&(o+=e.substring(t,n)),o+=a,t=n=r+1)}return n>t&&(o+=e.substring(t,e.length)),o},Ra=!!We||!!Ve,Ma="text/plain",La=function(e,n){var i=c(e.split("?"),2),r=i[0],o=i[1],s=t({},n);null==o||o.split("&").forEach((function(e){var t=c(e.split("="),1)[0];delete s[t]}));var a=un(s);return a=a?(o?o+"&":"")+a:o,"".concat(r,"?").concat(a)},qa=function(e,t){return JSON.stringify(e,(function(e,t){return"bigint"==typeof t?t.toString():t}),t)},$a=function(e){var t=e.data,n=e.compression;if(t){if(n===$e.GZipJS){var i=ua(ca(qa(t)),{mtime:0}),r=new Blob([i],{type:Ma});return{contentType:Ma,body:r,estimatedSize:r.size}}if(n===$e.Base64){var o=function(e){var t,n,i,r,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=Fa(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,i=o>>6&63,r=63&o,c[l++]=s.charAt(t)+s.charAt(n)+s.charAt(i)+s.charAt(r)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(qa(t)),s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:qa(e))}(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=qa(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Oa=[];Ve&&Oa.push({transport:"fetch",method:function(e){var n,i,r=null!==(n=$a(e))&&void 0!==n?n:{},o=r.contentType,s=r.body,a=r.estimatedSize,l=new Headers;tt(e.headers,(function(e,t){l.append(t,e)})),o&&l.append("Content-Type",o);var u=e.url,c=null;if(ze){var d=new ze;c={signal:d.signal,timeout:setTimeout((function(){return d.abort()}),e.timeout)}}Ve(u,t({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&(a||0)<52428.8,body:s,signal:null===(i=c)||void 0===i?void 0:i.signal},e.fetchOptions)).then((function(t){return t.text().then((function(n){var i,r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){$t.error(e)}null===(i=e.callback)||void 0===i||i.call(e,r)}))})).catch((function(t){var n;$t.error(t),null===(n=e.callback)||void 0===n||n.call(e,{statusCode:0,text:t})})).finally((function(){return c?clearTimeout(c.timeout):null}))}}),We&&Oa.push({transport:"XHR",method:function(e){var t,n=new We;n.open(e.method||"GET",e.url,!0);var i=null!==(t=$a(e))&&void 0!==t?t:{},r=i.contentType,o=i.body;tt(e.headers,(function(e,t){n.setRequestHeader(t,e)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=function(){if(4===n.readyState){var t,i={statusCode:n.status,text:n.responseText};if(200===n.status)try{i.json=JSON.parse(n.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},n.send(o)}}),null!=Be&&Be.sendBeacon&&Oa.push({transport:"sendBeacon",method:function(e){var t=La(e.url,{beacon:"1"});try{var n,i=null!==(n=$a(e))&&void 0!==n?n:{},r=i.contentType,o=i.body,s="string"==typeof o?new Blob([o],{type:r}):o;Be.sendBeacon(t,s)}catch(e){}}});var Aa=["retriesPerformedSoFar"];var Da,Na=function(){function e(t){var n=this;o(this,e),l(this,"isPolling",!1),l(this,"pollIntervalMs",3e3),l(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Et(Oe)&&"onLine"in Oe.navigator&&(this.areWeOnline=Oe.navigator.onLine,ft(Oe,"online",(function(){n.areWeOnline=!0,n.flush()})),ft(Oe,"offline",(function(){n.areWeOnline=!1})))}return a(e,[{key:"retriableRequest",value:function(e){var n=this,i=e.retriesPerformedSoFar,r=u(e,Aa);Ft(i)&&i>0&&(r.url=La(r.url,{retry_count:i})),this.instance._send_request(t(t({},r),{},{callback:function(e){var o;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=i?i:0)<10?n.enqueue(t({retriesPerformedSoFar:i},r)):null===(o=r.callback)||void 0===o||o.call(r,e)}}))}},{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*Math.pow(2,e),n=t/2,i=Math.min(18e5,t),r=(Math.random()-.5)*(i-n);return Math.ceil(i+r)}(t),i=Date.now()+n;this.queue.push({retryAt:i,requestOptions:e});var r="Enqueued failed request for retry in ".concat(n);navigator.onLine||(r+=" (Browser is offline)"),$t.warn(r),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout((function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()}),this.pollIntervalMs)}},{key:"flush",value:function(){var e=Date.now(),t=[],n=this.queue.filter((function(n){return n.retryAt<e||(t.push(n),!1)}));if(this.queue=t,n.length>0){var i,r=p(n);try{for(r.s();!(i=r.n()).done;){var o=i.value.requestOptions;this.retriableRequest(o)}}catch(e){r.e(e)}finally{r.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var e,n=p(this.queue);try{for(n.s();!(e=n.n()).done;){var i=e.value.requestOptions;try{this.instance._send_request(t(t({},i),{},{transport:"sendBeacon"}))}catch(e){$t.error(e)}}}catch(e){n.e(e)}finally{n.f()}this.queue=[]}}]),e}(),Ha=Ot("[SessionId]"),Ba=function(){function e(t,n,i){var r;if(o(this,e),l(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||ko,this._windowIdGenerator=i||ko;var s=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Es(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var u=$o.parse(this._window_id_storage_key),c=$o.parse(this._primary_window_exists_storage_key);u&&!c?this._windowId=u:$o.remove(this._window_id_storage_key),$o.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{var d=function(e){var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),d)}catch(e){Ha.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}return a(e,[{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return Et(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&&$o.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&$o.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?$o.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(l({},N,[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[N];return kt(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;ft(Oe,"beforeunload",(function(){e._canUseSessionStorage()&&$o.remove(e._primary_window_exists_storage_key)}),{capture:!1})}},{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;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||(new Date).getTime(),i=c(this._getSessionId(),3),r=i[0],o=i[1],s=i[2],a=this._getWindowId(),l=Ft(s)&&s>0&&Math.abs(n-s)>864e5,u=!1,d=!o,f=!e&&Math.abs(n-r)>this.sessionTimeoutMs;d||f||l?(o=this._sessionIdGenerator(),a=this._windowIdGenerator(),Ha.info("new session ID generated",{sessionId:o,windowId:a,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),s=n,u=!0):a||(a=this._windowIdGenerator(),u=!0);var h=0===r||!e||l?n:r,p=0===s?(new Date).getTime():s;return this._setWindowId(a),this._setSessionId(o,h,p),e||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach((function(e){return e(o,a,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)})),{sessionId:o,windowId:a,sessionStartTimestamp:p,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}},{key:"resetIdleTimer",value:function(){var e=this;clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((function(){e.resetSessionId()}),1.1*this.sessionTimeoutMs)}}]),e}();!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(Da||(Da={}));var ja="i.posthog.com",Ua=function(){function e(t){o(this,e),l(this,"_regionCache",{}),this.instance=t}return a(e,[{key:"apiHost",get:function(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}},{key:"uiHost",get:function(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(ja),".posthog.com")),"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]=Da.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Da.EU:this._regionCache[this.apiHost]=Da.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+t;if(this.region===Da.CUSTOM)return this.apiHost+t;var n=ja+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}}]),e}(),Va="posthog-js";function Wa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.organization,i=t.projectId,r=t.prefix,o=t.severityAllowList,s=void 0===o?["error"]:o;return function(t){var o,a,l,u,c;if(!("*"===s||s.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var 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)||[];f.forEach((function(e){e.stacktrace&&(e.stacktrace.type="raw",e.stacktrace.frames.forEach((function(e){e.platform="web:javascript"})))}));var h={$exception_message:(null===(a=f[0])||void 0===a?void 0:a.value)||t.message,$exception_type:null===(l=f[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:t.level,$exception_list:f,$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};return n&&i&&(h.$sentry_url=(r||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+t.event_id),e.exceptions.sendExceptionEvent(h),t}}var za=a((function e(t,n,i,r,s){o(this,e),this.name=Va,this.setupOnce=function(e){e(Wa(t,{organization:n,projectId:i,prefix:r,severityAllowList:s}))}})),Ga=Ot("[SegmentIntegration]");function Za(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=function(n){var i=function(){return n.anonymousId()||ko()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(Y,"identified")),t()},r=n.user();"then"in r&&wt(r.then)?r.then((function(e){return i(e)})):i(r)}(e,(function(){n.register(function(e){Promise&&Promise.resolve||Ga.warn("This browser does not have Promise support, and can not use the segment integration");var t=function(t,n){var i;if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ga.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ga.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e._calculate_event_properties(n,null!==(i=t.event.properties)&&void 0!==i?i:{},new Date);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,"$pageview")},identify:function(e){return t(e,"$identify")},screen:function(e){return t(e,"$screen")}}}(e)).then((function(){t()}))}))}var Qa=function(){function e(t){o(this,e),this._instance=t}return a(e,[{key:"doPageView",value:function(e,t){var n,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(n=null==Oe?void 0:Oe.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}},{key:"_previousPageViewProperties",value:function(e,t){var n=this._currentPageview;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var o=r.maxScrollHeight,s=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,c=r.maxContentY;if(!(Et(o)||Et(s)||Et(a)||Et(l)||Et(u)||Et(c))){o=Math.ceil(o),s=Math.ceil(s),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=o<=1?1:Es(s/o,0,1),f=o<=1?1:Es(a/o,0,1),h=l<=1?1:Es(u/l,0,1),p=l<=1?1:Es(c/l,0,1);i=nt(i,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),Ya=Ot("[RateLimiter]"),Ja=function(){function e(t){var n,i,r=this;o(this,e),l(this,"serverLimits",{}),l(this,"lastEventRateLimited",!1),l(this,"checkForLimiting",(function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((function(e){Ya.info("".concat(e||"events"," is quota limited.")),r.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Ya.warn('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 a(e,[{key:"clientRateLimitContext",value:function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=(new Date).getTime(),o=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(X))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:r};o.tokens+=(r-o.last)/1e3*this.captureEventsPerSecond,o.last=r,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||i||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,null===(n=this.instance.persistence)||void 0===n||n.set_property(X,o),{isRateLimited:s,remainingTokens:o.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Xa=function(e){var n=null==e?void 0:e.config;return t({initialPathName:(null==Ue?void 0:Ue.pathname)||"",referringDomain:fi.referringDomain()},fi.campaignParams({customTrackedParams:null==n?void 0:n.custom_campaign_params,maskPersonalDataProperties:null==n?void 0:n.mask_personal_data_properties,customPersonalDataProperties:null==n?void 0:n.custom_personal_data_properties}))},Ka=function(){function e(t,n,i,r){var s=this;o(this,e),l(this,"_onSessionIdCallback",(function(e){var t=s._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:s._sessionSourceParamGenerator(s.instance)};s._persistence.register(l({},J,n))}})),this.instance=t,this._sessionIdManager=n,this._persistence=i,this._sessionSourceParamGenerator=r||Xa,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return a(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[J]}},{key:"getSessionProps",value:function(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}]),e}(),el=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","better uptime bot","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","gptbot","oai-searchbot","chatgpt-user","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],tl=function(e,t){if(!e)return!1;var n=e.toLowerCase();return el.concat(t||[]).some((function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)}))},nl=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&tl(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((function(e){return tl(null==e?void 0:e.brand,t)})))return!0}catch(e){}return!!e.webdriver},il=function(){function e(){o(this,e),this.clicks=[]}return a(e,[{key:"isRageClick",value:function(e,t,n){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<30&&n-i.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),rl=Ot("[Dead Clicks]"),ol=function(){return!0},sl=function(e){var t,n=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(F)),i=e.instance.config.capture_dead_clicks;return Rt(i)?i:n},al=function(){function e(t,n,i){o(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabled()}return a(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this._lazyLoadedDeadClicksAutocapture}},{key:"onRemoteConfig",value:function(e){this.instance.persistence&&this.instance.persistence.register(l({},F,null==e?void 0:e.captureDeadClicks)),this.startIfEnabled()}},{key:"startIfEnabled",value:function(){var e=this;this.isEnabled(this)&&this.loadScript((function(){e.start()}))}},{key:"loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"dead-clicks-autocapture",(function(t){t?rl.error("failed to load script",t):e()}))}},{key:"start",value:function(){var e;if(je){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=Ze.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=St(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ze.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(je),rl.info("starting...")}}else rl.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,rl.info("stopping..."))}}]),e}(),ll=Ot("[Heatmaps]");function ul(e){return St(e)&&"clientX"in e&&"clientY"in e&&Ft(e.clientX)&&Ft(e.clientY)}var cl=function(){function e(t){var n;o(this,e),l(this,"rageclicks",new il),l(this,"_enabledServerSide",!1),l(this,"_initialized",!1),l(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!(null===(n=this.instance.persistence)||void 0===n||!n.props[T]),ft(Oe,"beforeunload",this.flush)}return a(e,[{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return St(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return Et(this.instance.config.capture_heatmaps)?Et(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;ll.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(l({},T,t)),this._enabledServerSide=t,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var e=this.buffer;return this.buffer=void 0,e}},{key:"_onDeadClick",value:function(e){this._onClick(e.originalEvent,"deadclick")}},{key:"_setupListeners",value:function(){var e=this;Oe&&je&&(ft(je,"click",(function(t){return e._onClick(t||(null==Oe?void 0:Oe.event))}),{capture:!0}),ft(je,"mousemove",(function(t){return e._onMouseMove(t||(null==Oe?void 0:Oe.event))}),{capture:!0}),this.deadClicksCapture=new al(this.instance,ol,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}},{key:"_getProperties",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,t,n){for(var i=e;i&&Uo(i)&&!Vo(i,"body");){if(i===n)return!1;if(ht(t,null==Oe?void 0:Oe.getComputedStyle(i).position))return!0;i=es(i)}return!1}(Xo(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}},{key:"_onClick",value:function(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!jo(e.target)&&ul(e)){var r=this._getProperties(e,i);null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(t(t({},r),{},{type:"rageclick"})),this._capture(r)}}},{key:"_onMouseMove",value:function(e){var t=this;!jo(e.target)&&ul(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((function(){t._capture(t._getProperties(e,"mousemove"))}),500))}},{key:"_capture",value:function(e){if(Oe){var t=Oe.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}},{key:"flush",value:function(){this.buffer&&!xt(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),dl=function(){function e(t){var n=this;o(this,e),l(this,"_updateScrollData",(function(){var e,t,i,r;n.context||(n.context={});var o=n.scrollElement(),s=n.scrollY(),a=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=s+((null==o?void 0:o.clientHeight)||0),u=(null==o?void 0:o.scrollHeight)||0;n.context.lastScrollY=Math.ceil(s),n.context.maxScrollY=Math.max(s,null!==(e=n.context.maxScrollY)&&void 0!==e?e:0),n.context.maxScrollHeight=Math.max(a,null!==(t=n.context.maxScrollHeight)&&void 0!==t?t:0),n.context.lastContentY=l,n.context.maxContentY=Math.max(l,null!==(i=n.context.maxContentY)&&void 0!==i?i:0),n.context.maxContentHeight=Math.max(u,null!==(r=n.context.maxContentHeight)&&void 0!==r?r:0)})),this.instance=t}return a(e,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var e=this.context;return setTimeout(this._updateScrollData,0),e}},{key:"startMeasuringScrollPosition",value:function(){ft(Oe,"scroll",this._updateScrollData,{capture:!0}),ft(Oe,"scrollend",this._updateScrollData,{capture:!0}),ft(Oe,"resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return null==Oe?void 0:Oe.document.documentElement;var e,t=p(kt(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(t.s();!(e=t.n()).done;){var n=e.value,i=null==Oe?void 0:Oe.document.querySelector(n);if(i)return i}}catch(e){t.e(e)}finally{t.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Oe&&(Oe.scrollY||Oe.pageYOffset||Oe.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Oe&&(Oe.scrollX||Oe.pageXOffset||Oe.document.documentElement.scrollLeft)||0}}]),e}(),fl=Ot("[AutoCapture]");function hl(e,t){return t.length>e?t.slice(0,e)+"...":t}function pl(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Uo(t));return t}function vl(e,t,n,i){var r=e.tagName.toLowerCase(),o={tag_name:r};Ko.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?o.$el_text=hl(1024,ds(e)):o.$el_text=hl(1024,Jo(e)));var s=Qo(e);s.length>0&&(o.classes=s.filter((function(e){return""!==e}))),tt(e.attributes,(function(n){var r;if((!is(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&((null==i||!i.includes(n.name))&&!t&&cs(n.value)&&(r=n.name,!Ct(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var s=n.value;"class"===n.name&&(s=Go(s).join(" ")),o["attr__"+n.name]=hl(1024,s)}}));for(var a=1,l=1,u=e;u=pl(u);)a++,u.tagName===e.tagName&&l++;return o.nth_child=a,o.nth_of_type=l,o}function _l(e,t){for(var n,i,r=t.e,o=t.maskAllElementAttributes,s=t.maskAllText,a=t.elementAttributeIgnoreList,l=t.elementsChainAsString,u=[e],c=e;c.parentNode&&!Vo(c,"body");)zo(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var d,f=[],h={},p=!1,v=!1;if(tt(u,(function(e){var t=ns(e);"a"===e.tagName.toLowerCase()&&(p=e.getAttribute("href"),p=t&&p&&cs(p)&&p),ht(Qo(e),"ph-no-capture")&&(v=!0),f.push(vl(e,o,s,a));var n=function(e){if(!ns(e))return{};var t={};return tt(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&cs(i)&&(t[n]=i)}})),t}(e);nt(h,n)})),v)return{props:{},explicitNoCapture:v};if(s||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?f[0].$el_text=ds(e):f[0].$el_text=Jo(e)),p){var _,g;f[0].attr__href=p;var m=null===(_=ln(p))||void 0===_?void 0:_.host,y=null==Oe||null===(g=Oe.location)||void 0===g?void 0:g.host;m&&y&&m!==y&&(d=p)}return{props:nt({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:hs(f)},null!==(n=f[0])&&void 0!==n&&n.$el_text?{$el_text:null===(i=f[0])||void 0===i?void 0:i.$el_text}:{},d&&"click"===r.type?{$external_click_url:d}:{},h)}}var gl,ml=function(){function e(t){o(this,e),l(this,"_initialized",!1),l(this,"_isDisabledServerSide",null),l(this,"rageclicks",new il),l(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}return a(e,[{key:"config",get:function(){var e,t,n=St(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null===(e=n.url_allowlist)||void 0===e?void 0:e.map((function(e){return new RegExp(e)})),n.url_ignorelist=null===(t=n.url_ignorelist)||void 0===t?void 0:t.map((function(e){return new RegExp(e)})),n}},{key:"_addDomEventHandlers",value:function(){var e=this;if(this.isBrowserSupported()){if(Oe&&je){var t=function(t){t=t||(null==Oe?void 0:Oe.event);try{e._captureEvent(t)}catch(e){fl.error("Failed to capture event",e)}};if(ft(je,"submit",t,{capture:!0}),ft(je,"change",t,{capture:!0}),ft(je,"click",t,{capture:!0}),this.config.capture_copied_text){var n=function(t){t=t||(null==Oe?void 0:Oe.event),e._captureEvent(t,Ye)};ft(je,"copy",n,{capture:!0}),ft(je,"cut",n,{capture:!0})}}}else fl.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:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(l({},C,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this._elementSelectors=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((function(t){var i=null==je?void 0:je.querySelectorAll(t);null==i||i.forEach((function(i){e===i&&n.push(t)}))})),n}},{key:"isEnabled",get:function(){var e,t,n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C],i=this._isDisabledServerSide;if(Pt(i)&&!Rt(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:"_captureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var n,i=Xo(e);if(Wo(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this.instance.config.rageclick&&null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick");var r=t===Ye;if(i&&ts(i,e,this.config,r,r?["copy","cut"]:void 0)){var o=_l(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString}),s=o.props;if(o.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(s.$element_selectors=a),t===Ye){var l,u=Yo(null==Oe||null===(l=Oe.getSelection())||void 0===l?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=c}return this.instance.capture(t,s),!0}}}},{key:"isBrowserSupported",value:function(){return wt(null==je?void 0:je.querySelectorAll)}}]),e}(),yl=Ot("[TracingHeaders]"),bl=function(){function e(t){var n=this;o(this,e),l(this,"_restoreXHRPatch",void 0),l(this,"_restoreFetchPatch",void 0),l(this,"_startCapturing",(function(){var e,t,i,r;Et(n._restoreXHRPatch)&&(null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(n.instance.sessionManager));Et(n._restoreFetchPatch)&&(null===(i=Ze.__PosthogExtensions__)||void 0===i||null===(r=i.tracingHeadersPatchFns)||void 0===r||r._patchFetch(n.instance.sessionManager))})),this.instance=t}return a(e,[{key:"_loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"tracing-headers",(function(t){if(t)return yl.error("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}();!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(gl||(gl={}));var kl=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?gl.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===gl.DENIED||this.consent===gl.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?gl.GRANTED:"0"===e?gl.DENIED:gl.PENDING}},{key:"storage",get:function(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?Io:To;var t="localStorage"===e?To:Io;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&&!!dt([null==Be?void 0:Be.doNotTrack,null==Be?void 0:Be.msDoNotTrack,Ze.doNotTrack],(function(e){return ht([!0,1,"1","yes"],e)}))}}]),e}(),wl=Ot("[ExceptionAutocapture]"),Sl=function(){function e(t){var n,i=this;o(this,e),l(this,"startCapturing",(function(){var e,t,n,r;if(Oe&&i.isEnabled&&!i.hasHandlers){var o=null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.errorWrappingFunctions)||void 0===t?void 0:t.wrapOnError,s=null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(r=n.errorWrappingFunctions)||void 0===r?void 0:r.wrapUnhandledRejection;if(o&&s)try{i.unwrapOnError=o(i.captureException.bind(i)),i.unwrapUnhandledRejection=s(i.captureException.bind(i))}catch(e){wl.error("failed to start",e),i.stopCapturing()}else wl.error("failed to load error wrapping functions - cannot start")}})),this.instance=t,this.remoteEnabled=!(null===(n=this.instance.persistence)||void 0===n||!n.props[P]),this.startIfEnabled()}return a(e,[{key:"isEnabled",get:function(){var e;return Rt(this.instance.config.capture_exceptions)?this.instance.config.capture_exceptions:null!==(e=this.remoteEnabled)&&void 0!==e&&e}},{key:"hasHandlers",get:function(){return!Et(this.unwrapOnError)}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.hasHandlers&&(wl.info("enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(e){var t,n;this.hasHandlers&&e(),null===(t=Ze.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"exception-autocapture",(function(t){if(t)return wl.error("failed to load script",t);e()}))}},{key:"stopCapturing",value:function(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),this.unwrapOnError=void 0,null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this),this.unwrapUnhandledRejection=void 0}},{key:"onRemoteConfig",value:function(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register(l({},P,this.remoteEnabled)),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.instance.exceptions.sendExceptionEvent(e)}}]),e}(),xl=Ot("[Web Vitals]"),El=9e5,Cl=function(){function e(n){var i,r=this;o(this,e),l(this,"_enabledServerSide",!1),l(this,"_initialized",!1),l(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),l(this,"_flushToCapture",(function(){clearTimeout(r._delayedFlushTimer),0!==r.buffer.metrics.length&&(r.instance.capture("$web_vitals",r.buffer.metrics.reduce((function(e,n){var i;return t(t({},e),{},(l(i={},"$web_vitals_".concat(n.name,"_event"),t({},n)),l(i,"$web_vitals_".concat(n.name,"_value"),n.value),i))}),{})),r.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),l(this,"_addToBuffer",(function(e){var n,i=null===(n=r.instance.sessionManager)||void 0===n?void 0:n.checkAndGetSessionAndWindowId(!0);if(Et(i))xl.error("Could not read session ID. Dropping metrics!");else{r.buffer=r.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=r._currentURL();if(!Et(o))if(It(null==e?void 0:e.name)||It(null==e?void 0:e.value))xl.error("Invalid metric received",e);else if(r._maxAllowedValue&&e.value>=r._maxAllowedValue)xl.error("Ignoring metric with value >= "+r._maxAllowedValue,e);else r.buffer.url!==o&&(r._flushToCapture(),r._delayedFlushTimer=setTimeout(r._flushToCapture,r.flushToCaptureTimeoutMs)),Et(r.buffer.url)&&(r.buffer.url=o),r.buffer.firstMetricTimestamp=Et(r.buffer.firstMetricTimestamp)?Date.now():r.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),r.buffer.metrics.push(t(t({},e),{},{$current_url:o,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),r.buffer.metrics.length===r.allowedMetrics.length&&r._flushToCapture()}})),l(this,"_startCapturing",(function(){var e,t,n,i,o=Ze.__PosthogExtensions__;if(!Et(o)&&!Et(o.postHogWebVitalsCallbacks)){var s=o.postHogWebVitalsCallbacks;e=s.onLCP,t=s.onCLS,n=s.onFCP,i=s.onINP}e&&t&&n&&i?(r.allowedMetrics.indexOf("LCP")>-1&&e(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("CLS")>-1&&t(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("FCP")>-1&&n(r._addToBuffer.bind(r)),r.allowedMetrics.indexOf("INP")>-1&&i(r._addToBuffer.bind(r)),r._initialized=!0):xl.error("web vitals callbacks not loaded - not starting")})),this.instance=n,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[I]),this.startIfEnabled()}return a(e,[{key:"allowedMetrics",get:function(){var e,t,n=St(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Et(n)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[R])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(St(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"_maxAllowedValue",get:function(){var e=St(this.instance.config.capture_performance)&&Ft(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:El;return 0<e&&e<=6e4?El:e}},{key:"isEnabled",get:function(){var e=St(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Rt(e)?e:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(xl.info("enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"onRemoteConfig",value:function(e){var t=St(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=St(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register(l({},I,t)),this.instance.persistence.register(l({},R,n))),this._enabledServerSide=t,this.startIfEnabled()}},{key:"loadScript",value:function(e){var t,n,i;null!==(t=Ze.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(n=Ze.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"web-vitals",(function(t){t?xl.error("failed to load script",t):e()}))}},{key:"_currentURL",value:function(){var e=Oe?Oe.location.href:void 0;return e||xl.error("Could not determine current URL"),e}}]),e}(),Tl={icontains:function(e,t){return!!Oe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!Oe&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!Oe&&_t(t.href,e)},not_regex:function(e,t){return!!Oe&&!_t(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},Pl=function(){function e(t){var n=this;o(this,e),l(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];n.getWebExperiments((function(t){e.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,t.forEach((function(t){if(t.feature_flag_key){var i;if(n._flagToExperiments)e.logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=n._flagToExperiments)||void 0===i||i.set(t.feature_flag_key,t);var r=n.instance.getFeatureFlag(t.feature_flag_key);Ct(r)&&t.variants[r]&&n.applyTransforms(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var o in t.variants){var s=t.variants[o];e.matchesTestVariant(s)&&n.applyTransforms(t.name,o,s.transforms)}}))}),t)})),this.instance=t,this.instance.onFeatureFlags((function(e){n.onFeatureFlags(e)}))}return a(e,[{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(It(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.logInfo("applying feature flags",t),t.forEach((function(e){var t;if(n._flagToExperiments&&null!==(t=n._flagToExperiments)&&void 0!==t&&t.has(e)){var i,r=n.instance.getFeatureFlag(e),o=null===(i=n._flagToExperiments)||void 0===i?void 0:i.get(e);r&&null!=o&&o.variants[r]&&n.applyTransforms(o.name,r,o.variants[r].transforms)}}))}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=cn(null==n?void 0:n.search,"__experiment_id"),r=cn(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.logInfo("previewing web experiments ".concat(i," && ").concat(r)),this.getWebExperiments((function(e){t.showPreviewWebExperiment(parseInt(i),r,e)}),!1,!0))}}},{key:"loadIfEnabled",value:function(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.instance.config.disable_web_experiments&&!n)return e([]);var i=this.instance.get_property("$web_experiments");if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:function(t){if(200!==t.statusCode||!t.json)return e([]);var n=t.json.experiments||[];return e(n)}})}},{key:"showPreviewWebExperiment",value:function(t,n,i){var r=i.filter((function(e){return e.id===t}));r&&r.length>0&&(e.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(r[0].name,n,r[0].variants[n].transforms))}},{key:"applyTransforms",value:function(t,n,i){this._is_bot()?e.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==n?i.forEach((function(i){if(i.selector){var r;e.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var o=null===(r=document)||void 0===r?void 0:r.querySelectorAll(i.selector);null==o||o.forEach((function(e){var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):e.logInfo("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return Be&&this.instance?nl(Be,this.instance.config.custom_blocked_useragents):void 0}}],[{key:"matchesTestVariant",value:function(t){return!It(t.conditions)&&(e.matchUrlConditions(t)&&e.matchUTMConditions(t))}},{key:"matchUrlConditions",value:function(t){var n;if(It(t.conditions)||It(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;var i,r,o,s=e.getWindowLocation();return!!s&&(null===(i=t.conditions)||void 0===i||!i.url||Tl[null!==(r=null===(o=t.conditions)||void 0===o?void 0:o.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,s))}},{key:"getWindowLocation",value:function(){return null==Oe?void 0:Oe.location}},{key:"matchUTMConditions",value:function(e){var t;if(It(e.conditions)||It(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var n=fi.campaignParams();if(n.utm_source){var i,r,o,s,a,l,u,c,d,f,h,p,v,_,g,m,y=null===(i=e.conditions)||void 0===i||null===(r=i.utm)||void 0===r||!r.utm_campaign||(null===(o=e.conditions)||void 0===o||null===(s=o.utm)||void 0===s?void 0:s.utm_campaign)==n.utm_campaign,b=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(u=e.conditions)||void 0===u||null===(c=u.utm)||void 0===c?void 0:c.utm_source)==n.utm_source,k=null===(d=e.conditions)||void 0===d||null===(f=d.utm)||void 0===f||!f.utm_medium||(null===(h=e.conditions)||void 0===h||null===(p=h.utm)||void 0===p?void 0:p.utm_medium)==n.utm_medium,w=null===(v=e.conditions)||void 0===v||null===(_=v.utm)||void 0===_||!_.utm_term||(null===(g=e.conditions)||void 0===g||null===(m=g.utm)||void 0===m?void 0:m.utm_term)==n.utm_term;return y&&k&&w&&b}return!1}},{key:"logInfo",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];$t.info("[WebExperiments] ".concat(e),n)}}]),e}(),Il=function(){function e(t){o(this,e),this.instance=t}return a(e,[{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),e}(),Fl=["$set_once","$set"],Rl=Ot("[SiteApps]"),Ml=function(){function e(t){o(this,e),this.instance=t,this.bufferedInvocations=[],this.apps={}}return a(e,[{key:"isEnabled",get:function(){return!!this.instance.config.opt_in_site_apps}},{key:"eventCollector",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.bufferedInvocations.push(n),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}},{key:"siteAppLoaders",get:function(){var e,t;return null===(e=Ze._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.siteApps}},{key:"init",value:function(){var e=this;if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=function(){t(),e.bufferedInvocations=[],e.stopBuffering=void 0}}}},{key:"globalsForEvent",value:function(e){var n,i,r,o,s,a,l;if(!e)throw new Error("Event payload is required");for(var d={},f=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{},p=0,v=Object.entries(h);p<v.length;p++){var _=c(v[p],2),g=_[0],m=_[1];d[g]={id:f[g],type:g,properties:m}}var y=e.$set_once,b=e.$set;return{event:t(t({},u(e,Fl)),{},{properties:t(t(t({},e.properties),b?{$set:t(t({},null!==(n=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==n?n:{}),b)}:{}),y?{$set_once:t(t({},null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$set_once)&&void 0!==r?r:{}),y)}:{}),elements_chain:null!==(s=null===(a=e.properties)||void 0===a?void 0:a.$elements_chain)&&void 0!==s?s:"",distinct_id:null===(l=e.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:d}}},{key:"setupSiteApp",value:function(e){var t=this,n={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=n;var i=function(i){var r;t.apps[e.id].errored=!i,t.apps[e.id].loaded=!0,Rl.info("Site app with id ".concat(e.id," ").concat(i?"loaded":"errored")),i&&t.bufferedInvocations.length&&(Rl.info("Processing ".concat(t.bufferedInvocations.length," events for site app with id ").concat(e.id)),t.bufferedInvocations.forEach((function(e){var t;return null===(t=n.processEvent)||void 0===t?void 0:t.call(n,e)})));for(var o=0,s=Object.values(t.apps);o<s.length;o++){if(!s[o].loaded)return}null===(r=t.stopBuffering)||void 0===r||r.call(t)};try{var r=e.init({posthog:this.instance,callback:function(e){i(e)}}).processEvent;r&&(n.processEvent=r)}catch(t){Rl.error("Error while initializing PostHog app with config id ".concat(e.id),t),i(!1)}}},{key:"onCapturedEvent",value:function(e){if(0!==Object.keys(this.apps).length)for(var t=this.globalsForEvent(e),n=0,i=Object.values(this.apps);n<i.length;n++){var r=i[n];try{var o;null===(o=r.processEvent)||void 0===o||o.call(r,t)}catch(t){Rl.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),t)}}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r=this;if(null!==(t=this.siteAppLoaders)&&void 0!==t&&t.length){if(!this.isEnabled)return void Rl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');var o,s=p(this.siteAppLoaders);try{for(s.s();!(o=s.n()).done;){var a=o.value;this.setupSiteApp(a)}}catch(e){s.e(e)}finally{s.f()}this.instance.on("eventCaptured",(function(e){return r.onCapturedEvent(e)}))}else if(null===(n=this.stopBuffering)||void 0===n||n.call(this),null!==(i=e.siteApps)&&void 0!==i&&i.length)if(this.isEnabled){var l,u=p(e.siteApps);try{var c=function(){var e,t,n=l.value,i=n.id,o=n.url;Ze["__$$ph_site_app_".concat(i)]=r.instance,null===(e=Ze.__PosthogExtensions__)||void 0===e||null===(t=e.loadSiteApp)||void 0===t||t.call(e,r.instance,o,(function(e){if(e)return Rl.error("Error while initializing PostHog app with config id ".concat(i),e)}))};for(u.s();!(l=u.n()).done;)c()}catch(e){u.e(e)}finally{u.f()}}else Rl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}();function Ll(e,t,n){return qa({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ql={},$l=function(){},Ol="posthog",Al=!Ra&&-1===(null==Ge?void 0:Ge.indexOf("MSIE"))&&-1===(null==Ge?void 0:Ge.indexOf("Mozilla")),Dl=function(){var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:ct(null==je?void 0:je.location),persistence:"localStorage+cookie",persistence_name:"",loaded:$l,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Ue&&Ct(null==Ue?void 0:Ue.search)&&-1!==Ue.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Oe||null===(e=Oe.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:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],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;$t.error(t)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Pa},_onCapture:$l}},Nl=function(e){var t={};Et(e.process_person)||(t.person_profiles=e.process_person),Et(e.xhr_headers)||(t.request_headers=e.xhr_headers),Et(e.cookie_name)||(t.persistence_name=e.cookie_name),Et(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Et(e.store_google)||(t.save_campaign_params=e.store_google),Et(e.verbose)||(t.debug=e.verbose);var n=nt({},t,e);return kt(e.property_blacklist)&&(Et(e.property_denylist)?n.property_denylist=e.property_blacklist:kt(e.property_denylist)?n.property_denylist=[].concat(d(e.property_blacklist),d(e.property_denylist)):$t.error("Invalid value for property_denylist config: "+e.property_denylist)),n},Hl=function(){function e(){o(this,e),l(this,"__forceAllowLocalhost",!1)}return a(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){$t.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),Bl=function(){function e(){var t=this;o(this,e),l(this,"webPerformance",new Hl),l(this,"version",Qe.LIB_VERSION),l(this,"_internalEventEmitter",new hi),this.config=Dl(),this.SentryIntegration=za,this.sentryIntegration=function(e){return function(e,t){var n=Wa(e,t);return{name:Va,processEvent:function(e){return n(e)}}}(t,e)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedIdentify=null,this.featureFlags=new po(this),this.toolbar=new Ta(this),this.scrollManager=new dl(this),this.pageViewManager=new Qa(this),this.surveys=new Ei(this),this.experiments=new Pl(this),this.exceptions=new Il(this),this.rateLimiter=new Ja(this),this.requestRouter=new Ua(this),this.consent=new kl(this),this.people={set:function(e,n,i){var r=Ct(e)?l({},e,n):e;t.setPersonProperties(r),null==i||i({})},set_once:function(e,n,i){var r=Ct(e)?l({},e,n):e;t.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(function(e){return $t.info('send "'.concat(null==e?void 0:e.event,'"'),e)}))}return a(e,[{key:"decideEndpointWasHit",get:function(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"init",value:function(t,n,i){if(i&&i!==Ol){var r,o=null!==(r=ql[i])&&void 0!==r?r:new e;return o._init(t,n,i),ql[i]=o,ql[Ol][i]=o,o}return this._init(t,n,i)}},{key:"_init",value:function(e){var n,i,r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(Et(e)||Tt(e))return $t.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 $t.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],o.person_profiles&&(this._initialPersonProfilesConfig=o.person_profiles),this.set_config(nt({},Dl(),Nl(o),{name:s,token:e})),this.config.on_xhr_error&&$t.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=o.disable_compression?void 0:$e.GZipJS,this.persistence=new Ao(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ao(t(t({},this.config),{},{persistence:"sessionStorage"}));var a=t({},this.persistence.props),l=t({},this.sessionPersistence.props);if(this._requestQueue=new Ia((function(e){return r._send_retriable_request(e)}),this.config.request_queue_config),this._retryQueue=new Na(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new Ba(this),this.sessionPropsManager=new Ka(this,this.sessionManager,this.persistence)),new bl(this).startIfEnabledOrStop(),this.siteApps=new Ml(this),null===(n=this.siteApps)||void 0===n||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new ka(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ml(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new cl(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Cl(this),this.exceptionObserver=new Sl(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new al(this,sl),this.deadClicksAutocapture.startIfEnabled(),Qe.DEBUG=Qe.DEBUG||this.config.debug,Qe.DEBUG&&$t.info("Starting in debug mode",{this:this,config:o,thisC:t({},this.config),p:a,s:l}),this._sync_opt_out_with_persistence(),void 0!==(null===(i=o.bootstrap)||void 0===i?void 0:i.distinctID)){var u,c,d=this.config.get_device_id(ko()),f=null!==(u=o.bootstrap)&&void 0!==u&&u.isIdentifiedID?d:o.bootstrap.distinctID;this.persistence.set_property(Y,null!==(c=o.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:f})}if(this._hasBootstrappedFeatureFlags()){var h,p,v=Object.keys((null===(h=o.bootstrap)||void 0===h?void 0:h.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,i;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(i=n.featureFlags)||void 0===i?void 0:i[t])||!1,e}),{}),_=Object.keys((null===(p=o.bootstrap)||void 0===p?void 0:p.featureFlagPayloads)||{}).filter((function(e){return v[e]})).reduce((function(e,t){var n,i,r,s;null!==(n=o.bootstrap)&&void 0!==n&&null!==(i=n.featureFlagPayloads)&&void 0!==i&&i[t]&&(e[t]=null===(r=o.bootstrap)||void 0===r||null===(s=r.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:_})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:re,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(ko());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(Y,"anonymous")}return ft(Oe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),o.segment?Za(this,(function(){return r._loaded()})):this._loaded(),wt(this.config._onCapture)&&this.config._onCapture!==$l&&($t.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(function(e){return r.config._onCapture(e.event,e)}))),this}},{key:"_onRemoteConfig",value:function(e){var t,n,i,r,o,s,a,l,u=this;if(!je||!je.body)return $t.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){u._onRemoteConfig(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ht(e.supportedCompression,$e.GZipJS)?$e.GZipJS:ht(e.supportedCompression,$e.Base64)?$e.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),null===(n=this.siteApps)||void 0===n||n.onRemoteConfig(e),null===(i=this.sessionRecording)||void 0===i||i.onRemoteConfig(e),null===(r=this.autocapture)||void 0===r||r.onRemoteConfig(e),null===(o=this.heatmaps)||void 0===o||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null===(s=this.webVitalsAutocapture)||void 0===s||s.onRemoteConfig(e),null===(a=this.exceptionObserver)||void 0===a||a.onRemoteConfig(e),null===(l=this.deadClicksAutocapture)||void 0===l||l.onRemoteConfig(e)}},{key:"_loaded",value:function(){var e=this;try{this.config.loaded(this)}catch(e){$t.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((function(){e.consent.isOptedIn()&&e._captureInitialPageview()}),1),new Sa(this).load(),this.featureFlags.decide()}},{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()||et(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&&(Al?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=La(e.url,{ip:this.config.ip?1:0}),e.headers=t({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var n,i,r,o=t({},e);o.timeout=o.timeout||6e4,o.url=La(o.url,{_:(new Date).getTime().toString(),ver:Qe.LIB_VERSION,compression:o.compression});var s=null!==(n=o.transport)&&void 0!==n?n:"fetch",a=null!==(i=null===(r=dt(Oa,(function(e){return e.transport===s})))||void 0===r?void 0:r.method)&&void 0!==i?i:Oa[0].method;if(!a)throw new Error("No available transport method");a(o)}(t(t({},e),{},{callback:function(t){var i,r,o;(n.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(r=(o=n.config).on_request_error)||void 0===r||r.call(o,t));null===(i=e.callback)||void 0===i||i.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,i=[],r=[],o=[];et(e,(function(e){e&&(t=e[0],kt(t)?o.push(e):wt(e)?e.call(n):kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&wt(n[t])?o.push(e):r.push(e))}));var s=function(e,t){et(e,(function(e){if(kt(e[0])){var n=t;tt(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};s(i,this),s(r,this),s(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,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Et(e)&&Ct(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=(null==i?void 0:i.timestamp)||s,l=ko(),u={uuid:l,event:e,properties:this._calculate_event_properties(e,n||{},a,l)};o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==i?void 0:i.$set)&&(u.$set=null==i?void 0:i.$set);var c=this._calculate_set_once_properties(null==i?void 0:i.$set_once);c&&(u.$set_once=c),(u=lt(u,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,Et(null==i?void 0:i.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=s);var d=t(t({},u.properties.$set),u.$set);if(xt(d)||this.setPersonPropertiesForFlags(d),!It(this.config.before_send)){var f=this._runBeforeSend(u);if(!f)return;u=f}this._internalEventEmitter.emit("eventCaptured",u);var h={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(h):this._requestQueue.enqueue(h),u}$t.critical("This capture call is ignored due to client rate limiting.")}}else $t.error("No event name provided to posthog.capture")}else $t.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",(function(t){return e(t.event,t)}))}},{key:"_calculate_event_properties",value:function(e,n,i,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var o=this.persistence.remove_event_timer(e),s=t({},n);if(s.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),"$snapshot"===e){var a=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=a.distinct_id,(!Ct(s.distinct_id)&&!Ft(s.distinct_id)||Tt(s.distinct_id))&&$t.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var l,u=fi.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(),d=c.sessionId,f=c.windowId;s.$session_id=d,s.$window_id=f}if(this.sessionRecording&&(s.$recording_status=this.sessionRecording.status),this.requestRouter.region===Da.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),l="$pageview"===e?this.pageViewManager.doPageView(i,r):"$pageleave"===e?this.pageViewManager.doPageLeave(i):this.pageViewManager.doEvent(),s=nt(s,l),"$pageview"===e&&je&&(s.title=je.title),!Et(o)){var h=i.getTime()-o;s.$duration=parseFloat((h/1e3).toFixed(3))}Ge&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=nt({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),kt(this.config.property_denylist)?tt(this.config.property_denylist,(function(e){delete s[e]})):$t.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&($t.error("sanitize_properties is deprecated. Use before_send instead"),s=p(s,e));var v=this._hasPersonProcessing();return s.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),s}},{key:"_calculate_set_once_properties",value:function(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=nt({},this.persistence.get_initial_props(),e||{}),n=this.config.sanitize_properties;return n&&($t.error("sanitize_properties is deprecated. Use before_send instead"),t=n(t,"$set_once")),xt(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 i;null===(i=this.persistence)||void 0===i||i.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(l({},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:"renderSurvey",value:function(e,t){this.surveys.renderSurvey(e,t)}},{key:"canRenderSurvey",value:function(e){this.surveys.canRenderSurvey(e)}},{key:"getNextSurveyStep",value:function(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}},{key:"identify",value:function(e,n,i){if(!this.__loaded||!this.persistence)return $t.uninitializedWarning("posthog.identify");if(Ft(e)&&(e=e.toString(),$t.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()))$t.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(x)&&(this.unregister(x),this.register({distinct_id:e}));var s="anonymous"===(this.persistence.get_property(Y)||"anonymous");e!==r&&s?(this.persistence.set_property(Y,"identified"),this.setPersonPropertiesForFlags(t(t({},i||{}),n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:n||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(r),this._cachedIdentify=Ll(e,n,i)):(n||i)&&(this._cachedIdentify!==Ll(e,n,i)?(this.setPersonProperties(n,i),this._cachedIdentify=Ll(e,n,i)):$t.info("A duplicate posthog.identify call was made with the same properties. It has been ignored.")),e!==r&&(this.reloadFeatureFlags(),this.unregister(Q))}}else $t.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,n){(e||n)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(t(t({},n||{}),e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}))}},{key:"group",value:function(e,n,i){if(e&&n){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},r),{},l({},e,n))}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:i}),this.setGroupPropertiesForFlags(l({},e,i))),r[e]===n||i||this.reloadFeatureFlags()}}else $t.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,i,r;if($t.info("reset"),!this.__loaded)return $t.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.surveys.reset(),null===(i=this.persistence)||void 0===i||i.set_property(Y,"anonymous"),null===(r=this.sessionManager)||void 0===r||r.resetSessionId(),this._cachedIdentify=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:re,$device_id:null},"");else{var s=this.config.get_device_id(ko());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}},{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,i=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(null!=e&&e.withTimestamp&&i){var o,s=null!==(o=e.timestampLookBack)&&void 0!==o?o:10;if(!i)return r;var a=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0);r+="?t=".concat(a)}return r}},{key:"alias",value:function(e,t){return e===this.get_property(S)?($t.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(x,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($t.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var n,i,r,o,s=t({},this.config);St(e)&&(nt(this.config,Nl(e)),null===(n=this.persistence)||void 0===n||n.update_config(this.config,s),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ao(t(t({},this.config),{},{persistence:"sessionStorage"})),Io.is_supported()&&"true"===Io.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(Qe.DEBUG=!0,$t.info("set_config",{config:e,oldConfig:s,newConfig:t({},this.config)})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(r=this.autocapture)||void 0===r||r.startIfEnabled(),null===(o=this.heatmaps)||void 0===o||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(e){var t=!0===e,n={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(n).some(Boolean)){var i,r,o,s,a;if(null===(i=this.sessionManager)||void 0===i||i.checkAndGetSessionAndWindowId(),n.sampling)null===(r=this.sessionRecording)||void 0===r||r.overrideSampling();if(n.linked_flag)null===(o=this.sessionRecording)||void 0===o||o.overrideLinkedFlag();if(n.url_trigger)null===(s=this.sessionRecording)||void 0===s||s.overrideTrigger("url");if(n.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}},{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:"captureException",value:function(e,n){var i,r=new Error("PostHog syntheticException"),o=wt(null===(i=Ze.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?t(t({},Ze.__PosthogExtensions__.parseErrorAsProperties(Lt(e)?{error:e,event:e.message}:{event:e},{syntheticException:r})),n):t({$exception_level:"error",$exception_list:[{type:Lt(e)?e.name:"Error",value:Lt(e)?e.message:e,mechanism:{handled:!0,synthetic:!1}}]},n);this.exceptions.sendExceptionEvent(o)}},{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:Ol;return t!==Ol&&(t=Ol+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(Y))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(Y))}},{key:"_hasPersonProcessing",value:function(){var e,t,n,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&xt(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[x])&&(null===(n=this.persistence)||void 0===n||null===(i=n.props)||void 0===i||!i[ne]))}},{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?($t.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ne,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var e,t,n,i,r=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||r&&!!o;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==s&&(null===(n=this.persistence)||void 0===n||n.set_disabled(s));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==s&&(null===(i=this.sessionPersistence)||void 0===i||i.set_disabled(s))}},{key:"opt_in_capturing",value:function(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),Et(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}},{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:"_is_bot",value:function(){return Be?nl(Be,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){je&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:je.title},{send_instantly:!0}))}},{key:"debug",value:function(e){!1===e?(null==Oe||Oe.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==Oe||Oe.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}))}},{key:"_runBeforeSend",value:function(e){if(It(this.config.before_send))return e;var t,n=e,i=p(kt(this.config.before_send)?this.config.before_send:[this.config.before_send]);try{for(i.s();!(t=i.n()).done;){if(n=(0,t.value)(n),It(n)){var r="Event '".concat(e.event,"' was rejected in beforeSend function");return qt(e.event)?$t.warn("".concat(r,". This can cause unexpected behavior.")):$t.info(r),null}n.properties&&!xt(n.properties)||$t.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"getPageViewId",value:function(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}}]),e}();!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=st(e.prototype[t[n]])}(Bl,["identify"]);var jl,Ul;jl=ql[Ol]=new Bl,(Ul=Ze.posthog)&&tt(Ul._i,(function(e){if(e&&kt(e)){var t=jl.init(e[0],e[1],e[2]),n=Ul[e[2]]||Ul;t&&(t._execute_array.call(t.people,n.people),t._execute_array(n))}})),Ze.posthog=jl,function(){function e(){e.done||(e.done=!0,Al=!1,tt(ql,(function(e){e._dom_loaded()})))}null!=je&&je.addEventListener?"complete"===je.readyState?e():ft(je,"DOMContentLoaded",e,{capture:!1}):Oe&&$t.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
2
2
  //# sourceMappingURL=array.full.es5.js.map