@walkeros/web-destination-posthog 3.4.2 → 4.0.0-next-1777882869103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _array_like_to_array(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 _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,n,i,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,i,r,o,a,"next",e)}function a(e){asyncGeneratorStep(s,i,r,o,a,"throw",e)}o(void 0)})}}function _call_super(e,t,n){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,n||[],_get_prototype_of(e).constructor):t.apply(e,n))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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 _create_class(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(s.push(i.value),!t||s.length!==t);o=!0);}catch(e){a=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw r}}return s}}function _non_iterable_rest(){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 _non_iterable_spread(){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 _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){_define_property(e,t,n[t])})}return e}function ownKeys(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 _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _object_without_properties(e,t){if(null==e)return{};var n,i,r,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}if(s=_object_without_properties_loose(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}function _object_without_properties_loose(e,t){if(null==e)return{};var n,i,r={},s=Object.getOwnPropertyNames(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}function _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(e,t):void 0}}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}function _ts_generator(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(o,"next",{value:l(0)}),a(o,"throw",{value:l(1)}),a(o,"return",{value:l(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(e){return void 0!==e},n=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},i=function(e){return"string"==typeof e},r=function(e){return _e(e)?e:void 0},s=function(e,t,n){return function(){for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return _async_to_generator(function(){var i;return _ts_generator(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(r))];case 1:case 3:return[2,s.sent()];case 2:return i=s.sent(),t?[4,t(i)]:[2];case 4:return[4,null==n?void 0:n()];case 5:return s.sent(),[7];case 6:return[2]}})})()}},o=function(i){return _async_to_generator(function(i){var r,o,a,l,u,c,h,d,f,v,_,p,g,y=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(r=y.length>1&&void 0!==y[1]?y[1]:{},o=y.length>2&&void 0!==y[2]?y[2]:{},!t(i))return[2];l=n(i)&&i.consent||o.consent||(null===(a=o.collector)||void 0===a?void 0:a.consent),u=e(r)?r:[r],c=!0,h=!1,d=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),f=u[Symbol.iterator](),m.label=2;case 2:return(c=(v=f.next()).done)?[3,5]:(_=v.value,[4,s(pe)(i,_,_object_spread_props(_object_spread({},o),{consent:l}))]);case 3:if(p=m.sent(),t(p))return[2,p];m.label=4;case 4:return c=!0,[3,2];case 5:return[3,8];case 6:return g=m.sent(),h=!0,d=g,[3,8];case 7:try{c||null==f.return||f.return()}finally{if(h)throw d}return[7];case 8:return[2]}})}).apply(this,arguments)},a=function(e,t,n,i,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)},l=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){a(s,i,r,o,l,"next",e)}function l(e){a(s,i,r,o,l,"throw",e)}o(void 0)})}},u=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n},c=function(e,t){return-1!==e.indexOf(t)},h=function(e){return null===e||"object"!=(void 0===e?"undefined":_type_of(e))},d=function(e,t){return{}.toString.call(e)==="[object "+t+"]"},f=function(e){return"undefined"!=typeof Event&&function(e,t){try{return _instanceof(e,t)}catch(e){return!1}}(e,Event)},v=function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return ot&&n.length===st||(st=n.length,ot=n.reduce(function(n,i){rt||(rt={});var r=rt[i];if(r)n[r[0]]=r[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){n[l]=u,rt[i]=[l,u];break}}return n},{})),ot}},_=function(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?an:n,in_app:!0};return ze(i)||(s.lineno=i),ze(r)||(s.colno=r),s},p=function(e,t){void 0===t&&(t=40);var 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(t>=r.length)return i===n.length?r:r.length>t?r.slice(0,t)+"...":r}return""},g=function(e,t){qe(e)&&e.forEach(t)},y=function(e,t){if(!Ke(e))if(qe(e))e.forEach(t);else if(Ze(e))e.forEach(function(e,n){return t(e,n)});else for(var n in e)De.call(e,n)&&t(e[n],n)},m=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i},b=function(e){var t=null==e?void 0:e.hostname;if(!Be(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=$i[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){if(n===o.value)return!1}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return!0},k=function(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=void 0!==s&&s,a=r.passive,l=void 0===a||a;null==e||e.addEventListener(t,n,{capture:o,passive:l})},w=function(e){return"ph_toolbar_internal"===e.name},x=function(e,t){var n=void 0===t?{}:t,i=n.organization,r=n.projectId,s=n.prefix,o=n.severityAllowList,a=void 0===o?["error"]:o,l=n.sendExceptionsToPostHog,u=void 0===l||l;return function(t){var n,o,l,c,h;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+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,v=(null==(n=t.exception)?void 0:n.values)||[],_=v.map(function(e){return $e({},e,{stacktrace:e.stacktrace?$e({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return $e({},e,{platform:"web:javascript"})})}):void 0})}),p={$exception_message:(null==(o=v[0])?void 0:o.value)||t.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:t.level,$exception_list:_,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),u&&(null==(f=e.exceptions)||f.sendExceptionEvent(p)),t}},E=function(e,t,n){if(!be)return{};var i,r=t?_to_consumable_array(dr).concat(_to_consumable_array(n||[])):[],s=S(ur(be.URL,r,vr),e),o=(i={},y(_r,function(e){var t=zi.Wt(e);i[e]=t||null}),i);return Pi(o,s)},S=function(e,t){var n=fr.concat(t||[]),i={};return y(n,function(t){var n=lr(e,t);i[t]=n||null}),i},P=function(e){var t,n=(t=e)?0===t.search(hr+"google.([^/?]*)")?"google":0===t.search(hr+"bing.com")?"bing":0===t.search(hr+"yahoo.com")?"yahoo":0===t.search(hr+"duckduckgo.com")?"duckduckgo":null:null,i="yahoo"!=n?"q":"p",r={};if(!Ve(n)){r.$search_engine=n;var s=be?lr(be.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},R=function(){return navigator.language||navigator.userLanguage},O=function(){return(null==be?void 0:be.referrer)||pr},F=function(e,t){var n=e?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[],i=null==ke?void 0:ke.href.substring(0,1e3);return{r:O().substring(0,1e3),u:i?ur(i,n,vr):void 0}},$=function(e){var t,n=e.r,i=e.u,r={$referrer:n,$referring_domain:null==n?void 0:n==pr?pr:null==(t=ar(n))?void 0:t.host};if(i){r.$current_url=i;var s=ar(i);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var o=S(i);Pi(r,o)}if(n){var a=P(n);Pi(r,a)}return r},I=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},T=function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},C=function(e,t,n){return ys({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})},M=function(e,t){return!e||Object.entries(e).every(function(e){var n=_sliced_to_array(e,2),i=n[0],r=n[1],s=null==t?void 0:t[i];if(ze(s)||Ve(s))return!1;var o=[String(s)],a=Ms[r.operator];return!!a&&a(r.values,o)})},A=function(e){return _instanceof(e,Element)&&(e.id===hi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))},j=function(e){return!!e&&1===e.nodeType},L=function(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()},D=function(e){return!!e&&3===e.nodeType},N=function(e){return!!e&&11===e.nodeType},q=function(e){return e?Ae(e).split(/\s+/):[]},W=function(e){var t=null==ge?void 0:ge.location.href;return!!(t&&e&&e.some(function(e){return t.match(e)}))},H=function(e){var t="";switch(_type_of(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 q(t)},U=function(e){return Ke(e)?null:Ae(e).split(/(\s+)/).filter(function(e){return X(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)},z=function(e){var t="";return K(e)&&!Y(e)&&e.childNodes&&e.childNodes.length&&y(e.childNodes,function(e){var n;D(e)&&e.textContent&&(t+=null!==(n=U(e.textContent))&&void 0!==n?n:"")}),Ae(t)},B=function(e){return ze(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},G=function(e,t){if(ze(t))return!0;var n,i=function(e){if(t.some(function(t){return e.matches(t)}))return{v:!0}},r=!0,s=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){if(n=i(a.value))return n.v}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}return!1},V=function(e){var t=e.parentNode;return!(!t||!j(t))&&t},K=function(e){for(var t=e;t.parentNode&&!L(t,"body");t=t.parentNode){var n=H(t);if(c(n,"ph-sensitive")||c(n,"ph-no-capture"))return!1}if(c(H(e),"ph-include"))return!0;var i=e.type||"";if(Be(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Be(r)||!/^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,""))},Y=function(e){return!!(L(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||L(e,"select")||L(e,"textarea")||"true"===e.getAttribute("contenteditable"))},X=function(e,t){if(void 0===t&&(t=!0),Ke(e))return!1;if(Be(e)){if(e=Ae(e),(t?_o:po).test((e||"").replace(/[- ]/g,"")))return!1;if((t?yo:mo).test(e))return!1}return!0},J=function(e){var t=z(e);return X(t=(t+" "+bo(e)).trim())?t:""},Z=function(e){return e.replace(/"|\\"/g,'\\"')},Q=function(e){var t=e.attr__class;return t?qe(t)?t:q(t):void 0},ee=function(e,t){return t.length>e?t.slice(0,e)+"...":t},te=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!j(t));return t},ne=function(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return We(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(){}}},ie=function(e){return He(e)&&"clientX"in e&&"clientY"in e&&Ye(e.clientX)&&Ye(e.clientY)},re=function(e,t,n){if(Ke(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}},se=function(e){var t;return null!==(t=null==e?void 0:e.posthog)&&void 0!==t?t:Sa},oe=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,le=Object.getOwnPropertyNames,ue=Object.prototype.hasOwnProperty,ce={};!function(e,t){for(var n in t)oe(e,n,{get:t[n],enumerable:!0})}(ce,{DestinationPostHog:function(){return Pa},default:function(){return Oa},destinationPostHog:function(){return Ra}});var he=Object.defineProperty;!function(e,t){for(var n in t)he(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return fe}});var de,fe=((de=fe||{})[de.ERROR=0]="ERROR",de[de.WARN=1]="WARN",de[de.INFO=2]="INFO",de[de.DEBUG=3]="DEBUG",de);function ve(n){for(var i=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),s=n,o=0;o<r.length;o++){var a=r[o];if("*"===a&&e(s)){var l=r.slice(o+1).join("."),u=[],c=!0,h=!1,d=void 0;try{for(var f,v=s[Symbol.iterator]();!(c=(f=v.next()).done);c=!0){var _=ve(f.value,l,i);u.push(_)}}catch(e){h=!0,d=e}finally{try{c||null==v.return||v.return()}finally{if(h)throw d}}return u}if(void 0===(s=_instanceof(s,Object)?s[a]:void 0))break}return t(s)?s:i}function _e(r){return function(e){return"boolean"==typeof e}(r)||i(r)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(r)||!t(r)||e(r)&&r.every(_e)||n(r)&&Object.values(r).every(_e)}function pe(n,a){return _async_to_generator(function(n,a){var l,u,c,h=arguments;return _ts_generator(this,function(d){return u=(l=h.length>2&&void 0!==h[2]?h[2]:{}).collector,c=l.consent,[2,(e(a)?a:[a]).reduce(function(a,h){return _async_to_generator(function(){var d,f,v,_,p,g,y,m,b,k,w,x,E,S,P,R,O,F,$,I,T;return _ts_generator(this,function(C){switch(C.label){case 0:return[4,a];case 1:return(d=C.sent())?[2,d]:(f=i(h)?{key:h}:h,Object.keys(f).length?(v=f.condition,_=f.consent,p=f.fn,g=f.key,y=f.loop,m=f.map,b=f.set,k=f.validate,w=f.value,(x=v)?[4,s(v)(n,h,u)]:[3,3]):[2]);case 2:x=!C.sent(),C.label=3;case 3:return x?[2]:_&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n={},i=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(r){t[r]&&(n[r]=!0,e&&e[r]&&(i=!0))}),!!i&&n}(_,c)?[2,w]:(E=t(w)?w:n,p?[4,s(p)(n,h,l)]:[3,5]);case 4:E=C.sent(),C.label=5;case 5:return g&&(E=ve(n,g,w)),y?(S=_sliced_to_array(y,2),P=S[0],R=S[1],"this"!==P?[3,6]:(F=[n],[3,8])):[3,11];case 6:return[4,o(n,P,l)];case 7:F=C.sent(),C.label=8;case 8:return e(O=F)?[4,Promise.all(O.map(function(e){return o(e,R,l)}))]:[3,10];case 9:E=C.sent().filter(t),C.label=10;case 10:return[3,17];case 11:return m?[4,Object.entries(m).reduce(function(e,i){var r=_sliced_to_array(i,2),s=r[0],a=r[1];return _async_to_generator(function(){var i,r;return _ts_generator(this,function(u){switch(u.label){case 0:return[4,e];case 1:return i=u.sent(),[4,o(n,a,l)];case 2:return r=u.sent(),[2,(t(r)&&(i[s]=r),i)]}})})()},Promise.resolve({}))]:[3,13];case 12:return E=C.sent(),[3,16];case 13:return($=b)?[4,Promise.all(b.map(function(e){return pe(n,e,l)}))]:[3,15];case 14:$=E=C.sent(),C.label=15;case 15:C.label=16;case 16:C.label=17;case 17:return(I=k)?[4,s(k)(E)]:[3,19];case 18:I=!C.sent(),C.label=19;case 19:return I&&(E=void 0),T=r(E),[2,t(T)?T:r(w)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}var ge="undefined"!=typeof window?window:void 0,ye="undefined"!=typeof globalThis?globalThis:ge;"undefined"==typeof self&&(ye.self=ye),"undefined"==typeof File&&(ye.File=function(){});var me=null==ye?void 0:ye.navigator,be=null==ye?void 0:ye.document,ke=null==ye?void 0:ye.location,we=null==ye?void 0:ye.fetch,xe=null!=ye&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,Ee=null==ye?void 0:ye.AbortController,Se=null==ye?void 0:ye.CompressionStream,Pe=null==me?void 0:me.userAgent,Re=null!=ge?ge:{},Oe="1.367.0",Fe={DEBUG:!1,LIB_VERSION:Oe,LIB_NAME:"web",JS_SDK_VERSION:Oe};function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$e.apply(null,arguments)}function Ie(){return(Ie=l(function(e,t){var n,i;return _ts_generator(this,function(r){switch(r.label){case 0:void 0===t&&(t=!0),r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip")),[4,new Response(n).blob()];case 2:return[2,r.sent()];case 3:return i=r.sent(),[2,(t&&console.error("Failed to gzip compress data",i),null)];case 4:return[2]}})})).apply(this,arguments)}var Te=["$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"],Ce=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Me=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Ce.concat(t).some(function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)})},Ae=function(e){return e.trim()},je=function(e){return e.replace(/^\$/,"")},Le=Object.prototype,De=Le.hasOwnProperty,Ne=Le.toString,qe=Array.isArray||function(e){return"[object Array]"===Ne.call(e)},We=function(e){return"function"==typeof e},He=function(e){return e===Object(e)&&!qe(e)},Ue=function(e){if(He(e)){for(var t in e)if(De.call(e,t))return!1;return!0}return!1},ze=function(e){return void 0===e},Be=function(e){return"[object String]"==Ne.call(e)},Ge=function(e){return Be(e)&&0===e.trim().length},Ve=function(e){return null===e},Ke=function(e){return ze(e)||Ve(e)},Ye=function(e){return"[object Number]"==Ne.call(e)&&e==e},Xe=function(e){return Ye(e)&&e>0},Je=function(e){return"[object Boolean]"===Ne.call(e)},Ze=function(e){return _instanceof(e,FormData)},Qe=function(e){return c(Te,e)},et=[!0,"true",1,"1","yes"],tt=function(e){return c(et,e)},nt=[!1,"false",0,"0","no"];function it(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),Ye(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),it(r||n,t,n,i))}var rt,st,ot,at,lt=function(){function e(t){_class_call_check(this,e),this.Pt={},this.Dt=t.Dt,this.jt=it(t.bucketSize,0,100,t.qt),this.$t=it(t.refillRate,0,this.jt,t.qt),this.Ht=it(t.refillInterval,0,864e5,t.qt)}return _create_class(e,[{key:"Vt",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.Ht);n>0&&(e.tokens=Math.min(e.tokens+n*this.$t,this.jt),e.lastAccess=e.lastAccess+n*this.Ht)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.Pt[i];return r?this.Vt(r,n):this.Pt[i]=r={tokens:this.jt,lastAccess:n},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.Pt={}}}]),e}(),ut="Mobile",ct="iOS",ht="Android",dt="Tablet",ft=ht+" "+dt,vt="iPad",_t="Apple",pt=_t+" Watch",gt="Safari",yt="BlackBerry",mt="Samsung",bt=mt+"Browser",kt=mt+" Internet",wt="Chrome",xt=wt+" OS",Et=wt+" "+ct,St="Internet Explorer",Pt=St+" "+ut,Rt="Opera",Ot=Rt+" Mini",Ft="Edge",$t="Microsoft "+Ft,It="Firefox",Tt=It+" "+ct,Ct="Nintendo",Mt="PlayStation",At="Xbox",jt=ht+" "+ut,Lt=ut+" "+gt,Dt="Windows",Nt=Dt+" Phone",qt="Nokia",Wt="Ouya",Ht="Generic",Ut=Ht+" "+ut.toLowerCase(),zt=Ht+" "+dt.toLowerCase(),Bt="Konqueror",Gt="(\\d+(\\.\\d+)?)",Vt=new RegExp("Version/"+Gt),Kt=new RegExp(At,"i"),Yt=new RegExp(Mt+" \\w+","i"),Xt=new RegExp(Ct+" \\w+","i"),Jt=new RegExp(yt+"|PlayBook|BB10","i"),Zt={"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"},Qt=function(e,t){return t=t||"",c(e," OPR/")&&c(e,"Mini")?Ot:c(e," OPR/")?Rt:Jt.test(e)?yt:c(e,"IE"+ut)||c(e,"WPDesktop")?Pt:c(e,bt)?kt:c(e,Ft)||c(e,"Edg/")?$t:c(e,"FBIOS")?"Facebook "+ut:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?Et:c(e,"CrMo")||c(e,wt)?wt:c(e,ht)&&c(e,gt)?jt:c(e,"FxiOS")?Tt:c(e.toLowerCase(),Bt.toLowerCase())?Bt:(n=e,(i=t)&&c(i,_t)||c(r=n,gt)&&!c(r,wt)&&!c(r,ht)?c(e,ut)?Lt:gt:c(e,It)?It:c(e,"MSIE")||c(e,"Trident/")?St:c(e,"Gecko")?It:"");var n,i,r},en=(_define_property(at={},Pt,[new RegExp("rv:"+Gt)]),_define_property(at,$t,[new RegExp(Ft+"?\\/"+Gt)]),_define_property(at,wt,[new RegExp("("+wt+"|CrMo)\\/"+Gt)]),_define_property(at,Et,[new RegExp("CriOS\\/"+Gt)]),_define_property(at,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+Gt)]),_define_property(at,gt,[Vt]),_define_property(at,Lt,[Vt]),_define_property(at,Rt,[new RegExp("(Opera|OPR)\\/"+Gt)]),_define_property(at,It,[new RegExp(It+"\\/"+Gt)]),_define_property(at,Tt,[new RegExp("FxiOS\\/"+Gt)]),_define_property(at,Bt,[new RegExp("Konqueror[:/]?"+Gt,"i")]),_define_property(at,yt,[new RegExp(yt+" "+Gt),Vt]),_define_property(at,jt,[new RegExp("android\\s"+Gt,"i")]),_define_property(at,kt,[new RegExp(bt+"\\/"+Gt)]),_define_property(at,St,[new RegExp("(rv:|MSIE )"+Gt)]),_define_property(at,"Mozilla",[new RegExp("rv:"+Gt)]),at),tn=function(e,t){var n=Qt(e,t),i=en[n];if(ze(i))return null;for(var r=0;i.length>r;r++){var s=e.match(i[r]);if(s)return parseFloat(s[s.length-2])}return null},nn=[[new RegExp(At+"; "+At+" (.*?)[);]","i"),function(e){return[At,e&&e[1]||""]}],[new RegExp(Ct,"i"),[Ct,""]],[new RegExp(Mt,"i"),[Mt,""]],[Jt,[yt,""]],[new RegExp(Dt,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[Nt,""];if(new RegExp(ut).test(t)&&!/IEMobile\b/.test(t))return[Dt+" "+ut,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=Zt[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Dt,i]}return[Dt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?[ct,[e[3],e[4],e[5]||"0"].join(".")]:[ct,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=ze(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ht+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ht+")","i"),function(e){return e&&e[2]?[ht,[e[2],e[3],e[4]||"0"].join(".")]:[ht,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[xt,""]],[/Linux|debian/i,["Linux",""]]],rn=function(e){return Xt.test(e)?Ct:Yt.test(e)?Mt:Kt.test(e)?At:new RegExp(Wt,"i").test(e)?Wt:new RegExp("("+Nt+"|WPDesktop)","i").test(e)?Nt:/iPad/.test(e)?vt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?pt:Jt.test(e)?yt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(qt,"i").test(e)?qt:/(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(ut).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)?ht:ft:new RegExp("(pda|"+ut+")","i").test(e)?Ut:new RegExp(dt,"i").test(e)&&!new RegExp(dt+" pc","i").test(e)?zt:""},sn=function(e){return _instanceof(e,Error)},on=function(){function e(t,n,i){_class_call_check(this,e),void 0===i&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}return _create_class(e,[{key:"buildFromUnknown",value:function(e,t){void 0===t&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),r=this.buildParsingContext(t),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,n),$exception_level:"error"}}},{key:"modifyFrames",value:function(e){var t=this;return l(function(){var n,i,r,s,o,a,l,u;return _ts_generator(this,function(c){switch(c.label){case 0:n=!0,i=!1,r=void 0,c.label=1;case 1:c.trys.push([1,7,8,9]),s=e[Symbol.iterator](),c.label=2;case 2:return(n=(o=s.next()).done)?[3,6]:(a=o.value,a.stacktrace&&a.stacktrace.frames&&qe(a.stacktrace.frames)?(l=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)]):[3,4]);case 3:l.frames=c.sent(),c.label=4;case 4:c.label=5;case 5:return n=!0,[3,2];case 6:return[3,9];case 7:return u=c.sent(),i=!0,r=u,[3,9];case 8:try{n||null==s.return||s.return()}finally{if(i)throw r}return[7];case 9:return[2,e]}})})()}},{key:"coerceFallback",value:function(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}},{key:"parseStacktrace",value:function(e,t){var n,i;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),$e({},e,{cause:n,stack:i})}},{key:"applyChunkIds",value:function(e,t){return e.map(function(e){return e.filename&&t&&(e.chunk_id=t[e.filename]),e})}},{key:"applyCoercers",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=this.coercers[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(a.match(e))return a.coerce(e,t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return this.coerceFallback(t)}},{key:"applyModifiers",value:function(e){var t=this;return l(function(){var n,i,r,s,o,a,l;return _ts_generator(this,function(u){switch(u.label){case 0:n=e,i=!0,r=!1,s=void 0,u.label=1;case 1:u.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),u.label=2;case 2:return(i=(a=o.next()).done)?[3,5]:[4,(0,a.value)(n)];case 3:n=u.sent(),u.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return l=u.sent(),r=!0,s=l,[3,8];case 7:try{i||null==o.return||o.return()}finally{if(r)throw s}return[7];case 8:return[2,n]}})})()}},{key:"convertToExceptionList",value:function(e,t){var n,i,r,s,o={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&(n=a).push.apply(n,_to_consumable_array(this.convertToExceptionList(e.cause,$e({},t,{handled:!0})))),a}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:v(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}},{key:"buildCoercingContext",value:function(e,t,n){var i=this;void 0===n&&(n=0);var r=function(n,r){if(4>=r){var s=i.buildCoercingContext(e,t,r);return i.applyCoercers(n,s)}};return $e({},t,{syntheticException:0==n?t.syntheticException:void 0,mechanism:e,apply:function(e){return r(e,n)},next:function(e){return r(e,n+1)}})}}]),e}(),an="?",ln=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]:an,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},un=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hn=/\((\S*)(?::(\d+))(?::(\d+))\)/,dn=function(e,t){var n=un.exec(e);if(n){var i=_sliced_to_array(n,4),r=i[1],s=i[2],o=i[3];return _(t,r,an,+s,+o)}var a=cn.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var l=hn.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var u=_sliced_to_array(ln(a[1]||an,a[2]),2),c=u[0],h=u[1];return _(t,h,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},fn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_n=function(e,t){var n=fn.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=vn.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var r,s=n[3],o=n[1]||an;return o=(r=_sliced_to_array(ln(o,s),2))[0],s=r[1],_(t,s,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},pn=/\(error: (.*)\)/,gn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return this.isDOMException(e)||this.isDOMError(e)}},{key:"coerce",value:function(e,t){var n=Be(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return this.isDOMError(e)?"DOMError":"DOMException"}},{key:"getValue",value:function(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}},{key:"isDOMException",value:function(e){return d(e,"DOMException")}},{key:"isDOMError",value:function(e){return d(e,"DOMError")}}]),e}(),yn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return _instanceof(e,Error)}},{key:"coerce",value:function(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return e.name||e.constructor.name}},{key:"getMessage",value:function(e,t){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}},{key:"getStack",value:function(e){return e.stacktrace||e.stack||void 0}}]),e}(),mn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return d(e,"ErrorEvent")&&null!=e.error}},{key:"coerce",value:function(e,t){var n;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),bn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,kn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return"string"==typeof e}},{key:"coerce",value:function(e,t){var n,i=_sliced_to_array(this.getInfos(e),2),r=i[0],s=i[1];return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}},{key:"getInfos",value:function(e){var t="Error",n=e,i=e.match(bn);return i&&(t=i[1],n=i[2]),[t,n]}}]),e}(),wn=["fatal","error","warning","log","info","debug"],xn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e}},{key:"coerce",value:function(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(n=t.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}},{key:"getType",value:function(e){return f(e)?e.constructor.name:"Error"}},{key:"getValue",value:function(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+p(e)}},{key:"isSeverityLevel",value:function(e){return Be(e)&&!Ge(e)&&wn.indexOf(e)>=0}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(sn(n))return n}}},{key:"getObjectClassName",value:function(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}]),e}(),En=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return f(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+p(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Sn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return h(e)}},{key:"coerce",value:function(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Pn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return d(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!f(e))return!1;try{var t=e.detail;return null!=t&&"object"==(void 0===t?"undefined":_type_of(t))&&"reason"in t}catch(e){return!1}}},{key:"coerce",value:function(e,t){var n,i=this.getUnhandledRejectionReason(e);return h(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(i)}},{key:"getUnhandledRejectionReason",value:function(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==_type_of(e.detail)&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}]),e}(),Rn=function(e,t){var n=(void 0===t?{}:t).debugEnabled,i={C:function(t){if(ge&&(Fe.DEBUG||Re.POSTHOG_DEBUG||n)&&!ze(ge.console)&&ge.console){for(var i=("__rrweb_original__"in ge.console[t]?ge.console[t].__rrweb_original__:ge.console[t]),r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];i.apply(void 0,[e].concat(_to_consumable_array(s)))}},info:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["log"].concat(_to_consumable_array(n)))},warn:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["warn"].concat(_to_consumable_array(n)))},error:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["error"].concat(_to_consumable_array(n)))},critical:function(){for(var t,n=arguments.length,i=new Array(n),r=0;n>r;r++)i[r]=arguments[r];(t=console).error.apply(t,[e].concat(_to_consumable_array(i)))},uninitializedWarning:function(e){i.error("You must initialize PostHog before calling "+e)},createLogger:function(t,n){return Rn(e+" "+t,n)}};return i},On=Rn("[PostHog.js]"),Fn=On.createLogger,$n=Fn("[ExternalScriptsLoader]"),In=function(e,t,n){if(e.config.disable_external_dependency_loading)return $n.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==be?void 0:be.querySelectorAll("script");if(i)for(var r,s=function(){if(i[o].src===t){var e=i[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener("load",function(t){e.__posthog_loading_callback_fired=!0,n(void 0,t)}),e.onerror=function(e){return n(e)},{v:void 0})}},o=0;i.length>o;o++)if(r=s())return r.v;var a=function(){if(!be)return n("document not found");var i=be.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=function(e){i.__posthog_loading_callback_fired=!0,n(void 0,e)},i.onerror=function(e){return n(e)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)be.head.appendChild(i);else{var r,s=be.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):be.body.appendChild(i)}};null!=be&&be.body?a():null==be||be.addEventListener("DOMContentLoaded",a)};Re.__PosthogExtensions__=Re.__PosthogExtensions__||{},Re.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"!==t)if(e._resolvedSdkVersion){var i=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");In(e,i,n)}else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var o=e.requestRouter.endpointFor("assets",r);In(e,o,n)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");In(e,a,n)}},Re.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);In(e,i,n)};var Tn="$people_distinct_id",Cn="$device_id",Mn="__alias",An="__timers",jn="$autocapture_disabled_server_side",Ln="$heatmaps_enabled_server_side",Dn="$exception_capture_enabled_server_side",Nn="$error_tracking_suppression_rules",qn="$error_tracking_capture_extension_exceptions",Wn="$web_vitals_enabled_server_side",Hn="$dead_clicks_enabled_server_side",Un="$product_tours_enabled_server_side",zn="$web_vitals_allowed_metrics",Bn="$session_recording_remote_config",Gn="$sesid",Vn="$session_is_sampled",Kn="$enabled_feature_flags",Yn="$early_access_features",Xn="$feature_flag_details",Jn="$stored_person_properties",Zn="$stored_group_properties",Qn="$surveys",ei="$flag_call_reported",ti="$flag_call_reported_session_id",ni="$feature_flag_errors",ii="$feature_flag_evaluated_at",ri="$user_state",si="$client_session_props",oi="$capture_rate_limit",ai="$initial_campaign_params",li="$initial_referrer_info",ui="$initial_person_info",ci="$epp",hi="__POSTHOG_TOOLBAR__",di="$posthog_cookieless",fi=[Tn,Mn,"__cmpns",An,"$session_recording_enabled_server_side",Ln,Gn,Kn,Nn,ri,Yn,Xn,Zn,Jn,Qn,ei,ti,ni,ii,si,oi,ai,li,ci,ui],vi="PostHog loadExternalDependency extension not found.",_i="on_reject",pi="always",gi="anonymous",yi="identified",mi="identified_only",bi="visibilitychange",ki="beforeunload",wi="$pageview",xi="$pageleave",Ei="$identify",Si="$groupidentify",Pi=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];var r=!0,s=!1,o=void 0;try{for(var a,l=n[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;for(var c in u)void 0!==u[c]&&(e[c]=u[c])}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}return e},Ri=function(e){try{return e()}catch(e){return}},Oi=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){On.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),On.critical(e)}}},Fi=function(e){var t={};return y(e,function(e,n){(Be(e)&&e.length>0||Ye(e))&&(t[n]=e)}),t},$i=["herokuapp.com","vercel.app","netlify.app"];Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ye(e)&&isFinite(e)&&Math.floor(e)===e});var Ii,Ti=function(){function e(t){if(_class_call_check(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return _create_class(e,[{key:"toString",value:function(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}},{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;16>t;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)||0>t||0>n||0>i||0>r||t>0xffffffffffff||n>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new e(s)}}]),e}(),Ci=function(){function e(){_class_call_check(this,e),this.I=0,this.S=0,this.k=new Ni}return _create_class(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(ze(e)){this.I=0;var t=this.generateOrAbort();if(ze(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.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Ti.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}},{key:"A",value:function(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}]),e}(),Mi=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;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ge&&!ze(ge.crypto)&&crypto.getRandomValues&&(Mi=function(e){return crypto.getRandomValues(e)});var Ai,ji,Li,Di,Ni=function(){function e(){_class_call_check(this,e),this.T=new Uint32Array(8),this.N=1/0}return _create_class(e,[{key:"nextUint32",value:function(){return this.T.length>this.N||(Mi(this.T),this.N=0),this.T[this.N++]}}]),e}(),qi=function(){return Wi().toString()},Wi=function(){return(Ii||(Ii=new Ci)).generate()},Hi="",Ui=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,zi={Yt:function(){return!!be},Ut:function(e){On.error("cookieStore error: "+e)},Wt:function(e){if(be){try{for(var t=e+"=",n=be.cookie.split(";").filter(function(e){return e.length}),i=0;n.length>i;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}},Gt:function(e){var t;try{t=JSON.parse(zi.Wt(e))||{}}catch(e){}return t},Xt:function(e,t,n,i,r){if(be)try{var s="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=be),Hi)return Hi;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_"+qi();!Hi&&i--;){var s=n.slice(i).join("."),o=r+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",Hi=s)}return Hi}(e);if(!n){var i=(r=e.match(Ui))?r[0]:"";i!==n&&On.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}var r;return""}(be.location.hostname,i);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),s="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&On.warn("cookieStore warning: large cookie, len="+u.length),be.cookie=u,u}catch(e){return}},Jt:function(e,t){if(null!=be&&be.cookie)try{zi.Xt(e,"",-1,t)}catch(e){return}}},Bi=null,Gi={Yt:function(){if(!Ve(Bi))return Bi;var e=!0;if(ze(ge))e=!1;else try{var t="__mplssupport__";Gi.Xt(t,"xyz"),'"xyz"'!==Gi.Wt(t)&&(e=!1),Gi.Jt(t)}catch(t){e=!1}return e||On.error("localStorage unsupported; falling back to cookie store"),Bi=e,e},Ut:function(e){On.error("localStorage error: "+e)},Wt:function(e){try{return null==ge?void 0:ge.localStorage.getItem(e)}catch(e){Gi.Ut(e)}return null},Gt:function(e){try{return JSON.parse(Gi.Wt(e))||{}}catch(e){}return null},Xt:function(e,t){try{null==ge||ge.localStorage.setItem(e,JSON.stringify(t))}catch(e){Gi.Ut(e)}},Jt:function(e){try{null==ge||ge.localStorage.removeItem(e)}catch(e){Gi.Ut(e)}}},Vi=[Cn,"distinct_id",Gn,Vn,ci,ui,ri],Ki={},Yi={Yt:function(){return!0},Ut:function(e){On.error("memoryStorage error: "+e)},Wt:function(e){return Ki[e]||null},Gt:function(e){return Ki[e]||null},Xt:function(e,t){Ki[e]=t},Jt:function(e){delete Ki[e]}},Xi=null,Ji={Yt:function(){if(!Ve(Xi))return Xi;if(Xi=!0,ze(ge))Xi=!1;else try{var e="__support__";Ji.Xt(e,"xyz"),'"xyz"'!==Ji.Wt(e)&&(Xi=!1),Ji.Jt(e)}catch(e){Xi=!1}return Xi},Ut:function(e){On.error("sessionStorage error: ",e)},Wt:function(e){try{return null==ge?void 0:ge.sessionStorage.getItem(e)}catch(e){Ji.Ut(e)}return null},Gt:function(e){try{return JSON.parse(Ji.Wt(e))||null}catch(e){}return null},Xt:function(e,t){try{null==ge||ge.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Ji.Ut(e)}},Jt:function(e){try{null==ge||ge.sessionStorage.removeItem(e)}catch(e){Ji.Ut(e)}}},Zi=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.Kt()?0:this.Qt}},{key:"isOptedOut",value:function(){return this.Rt.cookieless_mode===pi||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===_i)}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"optInOut",value:function(e){this.tr.Xt(this.er,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}},{key:"reset",value:function(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}},{key:"er",get:function(){var e=this._instance.config,t=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+t:"__ph_opt_in_out_"+t)}},{key:"Qt",get:function(){var e=this.tr.Wt(this.er);return tt(e)?1:c(nt,e)?0:-1}},{key:"tr",get:function(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?Gi:zi;if(!this.rr||this.rr!==t){this.rr=t;var n="localStorage"===e?zi:Gi;n.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(tt(n.Wt(this.er))),n.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}},{key:"Kt",value:function(){return!!this.Rt.respect_dnt&&[null==me?void 0:me.doNotTrack,null==me?void 0:me.msDoNotTrack,Re.doNotTrack].some(function(e){return tt(e)})}}]),e}(),Qi=Fn("[Dead Clicks]"),er=function(){return!0},tr=function(e){var t,n=!(null==(t=e.instance.persistence)||!t.get_property(Hn)),i=e.instance.config.capture_dead_clicks;return Je(i)?i:!!He(i)||n},nr=function(){function e(t,n,i){_class_call_check(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}return _create_class(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this.ir}},{key:"onRemoteConfig",value:function(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register(_define_property({},Hn,e.captureDeadClicks)),this.startIfEnabledOrStop())}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.nr(function(){e.sr()}):this.stop()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",function(t){t?Qi.error("failed to load script",t):e()})}},{key:"sr",value:function(){var e;if(be){if(!this.ir&&null!=(e=Re.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=He(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ir=Re.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ir.start(be),Qi.info("starting...")}}else Qi.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.ir&&(this.ir.stop(),this.ir=void 0,Qi.info("stopping..."))}}]),e}(),ir=Fn("[SegmentIntegration]"),rr="posthog-js",sr=function e(t,n,i,r,s,o){_class_call_check(this,e),this.name=rr,this.setupOnce=function(e){e(x(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},or=function(){function e(t){var n=this;_class_call_check(this,e),this.ar=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(On.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.lr=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.ur()}return _create_class(e,[{key:"ur",value:function(){var e;this.hr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ar)}},{key:"destroy",value:function(){var e;null==(e=this.hr)||e.call(this),this.hr=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.cr(e,t);return this.lr={pathname:null!==(n=null==ge?void 0:ge.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.cr(e,null==(t=this.lr)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.lr)?void 0:e.pageViewId}}},{key:"cr",value:function(e,t){var n=this.lr;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 s=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,c=r.maxContentY;if(!(ze(s)||ze(o)||ze(a)||ze(l)||ze(u)||ze(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=s>1?it(o/s,0,1,On):1,d=s>1?it(a/s,0,1,On):1,f=l>1?it(u/l,0,1,On):1,v=l>1?it(c/l,0,1,On):1;i=Pi(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),ar=function(e){var t=null==be?void 0:be.createElement("a");return ze(t)?null:(t.href=e,t)},lr=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var s=i[r].split("=");if(s[0]===t){n=s;break}}if(!qe(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){On.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ur=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");qe(h)&&(t.includes(h[0])?u.push(h[0]+"="+n):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},cr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},hr="https?://(.*)",dr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat(_to_consumable_array(dr)),vr="<masked>",_r=["li_fat_id"],pr="$direct",gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yr=function(){function e(t,n){var i,r;_class_call_check(this,e),this.Rt=t,this.props={},this.dr=!1,this.vr=(r="",(i=t).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.tr=this.pr(t),this.load(),t.debug&&On.info("Persistence loaded",t.persistence,$e({},this.props)),this.update_config(t,t,n),this.save()}return _create_class(e,[{key:"isDisabled",value:function(){return!!this.gr}},{key:"pr",value:function(e){-1===gr.indexOf(e.persistence.toLowerCase())&&(On.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=_to_consumable_array(Vi).concat(_to_consumable_array(e));return $e({},Gi,{Gt:function(e){try{var t={};try{t=zi.Gt(e)||{}}catch(e){}var n=Pi(t,JSON.parse(Gi.Wt(e)||"{}"));return Gi.Xt(e,n),n}catch(e){}return null},Xt:function(e,n,i,r,s,o){try{Gi.Xt(e,n,void 0,void 0,o);var a={};t.forEach(function(e){n[e]&&(a[e]=n[e])}),Object.keys(a).length&&zi.Xt(e,a,i,r,s,o)}catch(e){Gi.Ut(e)}},Jt:function(e,t){try{null==ge||ge.localStorage.removeItem(e),zi.Jt(e,t)}catch(e){Gi.Ut(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&Gi.Yt()?Gi:"localstorage+cookie"===n&&t.Yt()?t:"sessionstorage"===n&&Ji.Yt()?Ji:"memory"===n?Yi:"cookie"===n?zi:t.Yt()?t:zi}},{key:"mr",value:function(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[ii];return!n||"number"!=typeof n||Date.now()-n>t}},{key:"properties",value:function(){var e=this,t={};return y(this.props,function(n,i){if(i===Kn&&He(n)){if(!e.mr())for(var r=Object.keys(n),s=0;r.length>s;s++)t["$feature/"+r[s]]=n[r[s]]}else-1===fi.indexOf(i)&&(t[i]=n)}),t}},{key:"load",value:function(){if(!this.gr){var e=this.tr.Gt(this.vr);e&&(this.props=Pi({},e))}}},{key:"save",value:function(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}},{key:"remove",value:function(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(He(e)){ze(t)&&(t="None"),this.yr=ze(n)?this._r:n;var r=!1;if(y(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(He(e)){this.yr=ze(t)?this._r:t;var i=!1;if(y(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.dr){var e=E(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);Ue(Fi(e))||this.register(e),this.dr=!0}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==be?void 0:be.referrer)?P(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:O(),$referring_domain:null!=be&&be.referrer&&(null==(e=ar(be.referrer))?void 0:e.host)||pr},void 0)}},{key:"set_initial_person_info",value:function(){this.props[ai]||this.props[li]||this.register_once(_define_property({},ui,F(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)),void 0)}},{key:"get_initial_props",value:function(){var e=this,t={};y([li,ai],function(n){var i=e.props[n];i&&y(i,function(e,n){t["$initial_"+je(n)]=e})});var n,i,r=this.props[ui];if(r){var s=(n=$(r),i={},y(n,function(e,t){i["$initial_"+je(t)]=e}),i);Pi(t,s)}return t}},{key:"safe_merge",value:function(e){return y(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){if(this._r=this.yr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!function(e,t){if(e.length!==t.length)return!1;var n=_to_consumable_array(e).sort(),i=_to_consumable_array(t).sort();return n.every(function(e,t){return e===i[t]})}(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.pr(e),r=this.props;this.clear(),this.tr=i,this.props=r,this.save()}}},{key:"set_disabled",value:function(e){this.gr=e,this.gr?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.br&&(this.br=e,this.remove(),this.save())}},{key:"set_secure",value:function(e){e!==this.wr&&(this.wr=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[An]||{};n[e]=t,this.props[An]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[An]||{})[e];return ze(t)||(delete this.props[An][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}(),mr="events",br="cancelEvents",kr="popover",wr="api",xr="widget",Er="survey shown",Sr="survey dismissed",Pr="survey sent",Rr="$survey_id",Or="$survey_iteration",Fr="$survey_last_seen_date",$r="popover",Ir="inline",Tr="product tour shown",Cr="$product_tour_last_seen_date",Mr="$product_tour_type",Ar=Fn("[RateLimiter]"),jr=function(){function e(t){var n=this;_class_call_check(this,e),this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(function(e){Ar.info((e||"events")+" is quota limited."),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ar.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return _create_class(e,[{key:"captureEventsPerSecond",get:function(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}},{key:"captureEventsBurstLimit",get:function(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}},{key:"clientRateLimitContext",value:function(e){var t,n,i;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(n=this.instance.persistence)?void 0:n.get_property(oi))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(oi,a),{isRateLimited:l,remainingTokens:a.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Lr=Fn("[RemoteConfig]"),Dr=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"remoteConfig",get:function(){var e;return null==(e=Re._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Ir",value:function(e){var t,n,i=this;null!=(t=Re.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",function(){return e(i.remoteConfig)}):e()}},{key:"Cr",value:function(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:function(t){e(t.json)}})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return Lr.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void Lr.warn("Remote config is disabled. Falling back to local config.");this.Ir(function(t){if(!t)return Lr.info("No config found after loading remote JS config. Falling back to JSON."),void e.Cr(function(t){e.Sr(t),e.kr()});e.Sr(t),e.kr()})}catch(e){Lr.error("Error loading remote config",e)}}},{key:"stop",value:function(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}},{key:"refresh",value:function(){this._instance.Tr()||"hidden"===(null==be?void 0:be.visibilityState)||this._instance.reloadFeatureFlags()}},{key:"kr",value:function(){var e,t=this;if(!this.Ar){var n=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==n&&(this.Ar=setInterval(function(){t.refresh()},n))}}},{key:"Sr",value:function(e){var t;e||Lr.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}]),e}(),Nr="gzip-js",qr="base64",Wr=Uint8Array,Hr=Uint16Array,Ur=Uint32Array,zr=new Wr([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]),Br=new Wr([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]),Gr=new Wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vr=function(e,t){for(var n=new Hr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new Ur(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},Kr=Vr(zr,2),Yr=Kr[1];for(Kr[0][28]=258,Yr[258]=28,ji=Vr(Br,0)[1],Li=new Hr(32768),Di=0;32768>Di;++Di)Ai=(43690&Di)>>>1|(21845&Di)<<1,Li[Di]=((65280&(Ai=(61680&(Ai=(52428&Ai)>>>2|(13107&Ai)<<2))>>>4|(3855&Ai)<<4))>>>8|(255&Ai)<<8)>>>1;var Xr=function(e,t,n){for(var i=e.length,r=0,s=new Hr(t);i>r;++r)++s[e[r]-1];var o,a=new Hr(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Hr(1<<t);var l=15-t;for(r=0;i>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Li[h]>>>l]=u}else for(o=new Hr(i),r=0;i>r;++r)o[r]=Li[a[e[r]-1]++]>>>15-e[r];return o},Jr=new Wr(288);for(Di=0;144>Di;++Di)Jr[Di]=8;for(Di=144;256>Di;++Di)Jr[Di]=9;for(Di=256;280>Di;++Di)Jr[Di]=7;for(Di=280;288>Di;++Di)Jr[Di]=8;var Zr=new Wr(32);for(Di=0;32>Di;++Di)Zr[Di]=5;var Qr,es=Xr(Jr,9,0),ts=Xr(Zr,5,0),ns=function(e){return(e/8|0)+(7&e&&1)},is=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(_instanceof(e,Hr)?Hr:_instanceof(e,Ur)?Ur:Wr)(n-t);return i.set(e.subarray(t,n)),i},rs=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},ss=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},os=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return[new Wr(0),0];if(1==r){var o=new Wr(n[0].s+1);return o[n[0].s]=1,[o,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,h=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[h].f>n[u].f?u++:h++],l=n[u!=c&&n[h].f>n[u].f?u++:h++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(i=1;r>i;++i)s[i].s>d&&(d=s[i].s);var f=new Hr(d+1),v=as(n[c-1],f,0);if(v>t){i=0;var _=0,p=v-t,g=1<<p;for(s.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=f[y])break;_+=g-(1<<v-f[y]),f[y]=t}for(_>>>=p;_>0;){var m=s[i].s;t>f[m]?_-=1<<t-f[m]++-1:++i}for(;i>=0&&_;--i){var b=s[i].s;f[b]==t&&(--f[b],++_)}v=t}return[new Wr(f),v]},as=function(e,t,n){return-1==e.s?Math.max(as(e.l,t,n+1),as(e.r,t,n+1)):t[e.s]=n},ls=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Hr(++t),i=0,r=e[0],s=1,o=function(e){n[i++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=e[a]}return[n.subarray(0,i),t]},us=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},cs=function(e,t,n){var i=n.length,r=ns(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 s=0;i>s;++s)e[r+s+4]=n[s];return 8*(r+4+i)},hs=function(e,t,n,i,r,s,o,a,l,u,c){rs(t,c++,n),++r[256];for(var h=os(r,15),d=h[0],f=h[1],v=os(s,15),_=v[0],p=v[1],g=ls(d),y=g[0],m=g[1],b=ls(_),k=b[0],w=b[1],x=new Hr(19),E=0;y.length>E;++E)x[31&y[E]]++;for(E=0;k.length>E;++E)x[31&k[E]]++;for(var S=os(x,7),P=S[0],R=S[1],O=19;O>4&&!P[Gr[O-1]];--O);var F,$,I,T,C=u+5<<3,M=us(r,Jr)+us(s,Zr)+o,A=us(r,d)+us(s,_)+o+14+3*O+us(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(M>=C&&A>=C)return cs(t,c,e.subarray(l,l+u));if(rs(t,c,1+(M>A)),c+=2,M>A){F=Xr(d,f,0),$=d,I=Xr(_,p,0),T=_;var j=Xr(P,R,0);for(rs(t,c,m-257),rs(t,c+5,w-1),rs(t,c+10,O-4),c+=14,E=0;O>E;++E)rs(t,c+3*E,P[Gr[E]]);c+=3*O;for(var L=[y,k],D=0;2>D;++D){var N=L[D];for(E=0;N.length>E;++E)rs(t,c,j[q=31&N[E]]),c+=P[q],q>15&&(rs(t,c,N[E]>>>5&127),c+=N[E]>>>12)}}else F=es,$=Jr,I=ts,T=Zr;for(E=0;a>E;++E)if(i[E]>255){var q;ss(t,c,F[257+(q=i[E]>>>18&31)]),c+=$[q+257],q>7&&(rs(t,c,i[E]>>>23&31),c+=zr[q]);var W=31&i[E];ss(t,c,I[W]),c+=T[W],W>3&&(ss(t,c,i[E]>>>5&8191),c+=Br[W])}else ss(t,c,F[i[E]]),c+=$[i[E]];return ss(t,c,F[256]),c+$[256]},ds=new Ur([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fs=function(){for(var e=new Ur(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),vs=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},_s=!!xe||!!we,ps="text/plain",gs=function(e,t,n){var i;void 0===n&&(n=!0);var r=_sliced_to_array(e.split("?"),2),s=r[0],o=r[1],a=$e({},t),l=null!==(i=null==o?void 0:o.split("&").map(function(e){var t,i=_sliced_to_array(e.split("="),2),r=i[0],s=i[1],o=n&&null!==(t=a[r])&&void 0!==t?t:s;return delete a[r],r+"="+o}))&&void 0!==i?i:[],u=function(e,t){var n,i;void 0===t&&(t="&");var r=[];return y(e,function(e,t){ze(e)||ze(t)||"undefined"===t||(n=encodeURIComponent(_instanceof(e,File)?e.name:e.toString()),i=encodeURIComponent(t),r[r.length]=i+"="+n)}),r.join(t)}(a);return u&&l.push(u),s+"?"+l.join("&")},ys=function(e,t){return JSON.stringify(e,function(e,t){return"bigint"==(void 0===t?"undefined":_type_of(t))?t.toString():t},t)},ms=function(e){if(e.zt)return e.zt;var t,n=e.data,i=e.compression;if(n){if(i===Nr){var r=function(e,t){void 0===t&&(t={});var n,i=(n=4294967295,{p:function(e){for(var t=n,i=0;e.length>i;++i)t=fs[255&t^e[i]]^t>>>8;n=t},d:function(){return 4294967295^n}}),r=e.length;i.p(e);var s,o,a,l,u=(l=10+((s=t).filename&&s.filename.length+1||0),function(e,t,n,i){var r=e.length,s=new Wr(i+r+5*(1+Math.floor(r/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=cs(o,a,e.subarray(l,u)):(o[l]=!0,a=cs(o,a,e.subarray(l,r)))}else{for(var c=ds[t-1],h=c>>>13,d=8191&c,f=(1<<n)-1,v=new Hr(32768),_=new Hr(f+1),p=Math.ceil(n/3),g=2*p,y=function(t){return(e[t]^e[t+1]<<p^e[t+2]<<g)&f},m=new Ur(25e3),b=new Hr(288),k=new Hr(32),w=0,x=0,E=(l=0,0),S=0,P=0;r>l;++l){var R=y(l),O=32767&l,F=_[R];if(v[O]=F,_[R]=O,l>=S){var $=r-l;if((w>7e3||E>24576)&&$>423){a=hs(e,o,0,m,b,k,x,E,P,l-P,a),E=w=x=0,P=l;for(var I=0;286>I;++I)b[I]=0;for(I=0;30>I;++I)k[I]=0}var T=2,C=0,M=d,A=O-F&32767;if($>2&&R==y(l-A))for(var j=Math.min(h,$)-1,L=Math.min(32767,l),D=Math.min(258,$);L>=A&&--M&&O!=F;){if(e[l+T]==e[l+T-A]){for(var N=0;D>N&&e[l+N]==e[l+N-A];++N);if(N>T){if(T=N,C=A,N>j)break;var q=Math.min(A,N-2),W=0;for(I=0;q>I;++I){var H=l-A+I+32768&32767,U=H-v[H]+32768&32767;U>W&&(W=U,F=H)}}}A+=(O=F)-(F=v[O])+32768&32767}if(C){m[E++]=268435456|Yr[T]<<18|ji[C];var z=31&Yr[T],B=31&ji[C];x+=zr[z]+Br[B],++b[257+z],++k[B],S=l+T,++w}else m[E++]=e[l],++b[e[l]]}}a=hs(e,o,!0,m,b,k,x,E,P,l-P,a)}return is(s,0,i+ns(a)+8)}(o=e,null==(a=t).level?6:a.level,null==a.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+a.mem,l)),c=u.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&vs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;n.length>=i;++i)e[i+10]=n.charCodeAt(i)}}(u,t),vs(u,c-8,i.d()),vs(u,c-4,r),u}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Wr(e.length+(e.length>>>1)),i=0,r=function(e){n[i++]=e},s=0;t>s;++s){if(i+5>n.length){var o=new Wr(i+8+(t-s<<1));o.set(n),n=o}var a=e.charCodeAt(s);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return is(n,0,i)}(ys(n)),{mtime:0});return{contentType:ps,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===qr){var s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:ys(e))}((t=ys(n))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})):t);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=ys(n);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},bs=(Qr=l(function(e){var t,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,function(e,t){return Ie.apply(this,arguments)}(ys(e.data),Fe.DEBUG)];case 1:return(t=i.sent())?[4,t.arrayBuffer()]:[2,e];case 2:return n=i.sent(),[2,$e({},e,{zt:{contentType:ps,body:n,estimatedSize:n.byteLength}})]}})}),function(e){return Qr.apply(this,arguments)}),ks=[];we&&ks.push({transport:"fetch",method:function(e){var t,n,i=null!==(t=ms(e))&&void 0!==t?t:{},r=i.contentType,s=i.body,o=i.estimatedSize,a=new Headers;y(e.headers,function(e,t){a.append(t,e)}),r&&a.append("Content-Type",r);var l=e.url,u=null;if(Ee){var c=new Ee;u={signal:c.signal,timeout:setTimeout(function(){return c.abort()},e.timeout)}}we(l,$e({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:s,signal:null==(n=u)?void 0:n.signal},e.fetchOptions)).then(function(t){return t.text().then(function(n){var i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(e){On.error(e)}null==e.callback||e.callback(i)})}).catch(function(t){On.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(function(){return u?clearTimeout(u.timeout):null})}}),xe&&ks.push({transport:"XHR",method:function(e){var t,n=new xe;n.open(e.method||"GET",e.url,!0);var i=null!==(t=ms(e))&&void 0!==t?t:{},r=i.contentType,s=i.body;y(e.headers,function(e,t){n.setRequestHeader(t,e)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=function(){if(4===n.readyState){var t={statusCode:n.status,text:n.responseText};if(200===n.status)try{t.json=JSON.parse(n.responseText)}catch(e){}null==e.callback||e.callback(t)}},n.send(s)}}),null!=me&&me.sendBeacon&&ks.push({transport:"sendBeacon",method:function(e){var t=gs(e.url,{beacon:"1"});try{var n,i=null!==(n=ms(e))&&void 0!==n?n:{},r=i.contentType,s=i.body;if(!s)return;var o=_instanceof(s,Blob)?s:new Blob([s],{type:r});me.sendBeacon(t,o)}catch(e){}}});var ws=3e3,xs=function(){function e(t,n){_class_call_check(this,e),this.Er=!0,this.Rr=[],this.Nr=it((null==n?void 0:n.flush_interval_ms)||ws,250,5e3,On.createLogger("flush interval"),ws),this.Mr=t}return _create_class(e,[{key:"enqueue",value:function(e){this.Rr.push(e),this.Fr||this.Or()}},{key:"unload",value:function(){var e=this;this.Pr();var t=this.Rr.length>0?this.Lr():{},n=Object.values(t);_to_consumable_array(n.filter(function(e){return 0===e.url.indexOf("/e")})).concat(_to_consumable_array(n.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(t){e.Mr($e({},t,{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.Er=!1,this.Or()}},{key:"Or",value:function(){var e=this,t=this;this.Er||(this.Fr=setTimeout(function(){if(e.Pr(),e.Rr.length>0){var n=e.Lr(),i=function(){var e=n[r],i=(new Date).getTime();e.data&&qe(e.data)&&y(e.data,function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),t.Mr(e)};for(var r in n)i()}},this.Nr))}},{key:"Pr",value:function(){clearTimeout(this.Fr),this.Fr=void 0}},{key:"Lr",value:function(){var e={};return y(this.Rr,function(t){var n,i=t,r=(i?i.batchKey:null)||i.url;ze(e[r])&&(e[r]=$e({},i,{data:[]})),null==(n=e[r].data)||n.push(i.data)}),this.Rr=[],e}}]),e}(),Es=["retriesPerformedSoFar"],Ss=function(){function e(t){var n=this;_class_call_check(this,e),this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=t,this.Rr=[],this.jr=!0,!ze(ge)&&"onLine"in ge.navigator&&(this.jr=ge.navigator.onLine,this.qr=function(){n.jr=!0,n.Zr()},this.$r=function(){n.jr=!1},k(ge,"online",this.qr),k(ge,"offline",this.$r))}return _create_class(e,[{key:"length",get:function(){return this.Rr.length}},{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=u(e,Es);Xe(n)&&(i.url=gs(i.url,{retry_count:n})),this._instance._send_request($e({},i,{callback:function(e){200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=n?n:0)>=10?null==i.callback||i.callback(e):t.Hr($e({retriesPerformedSoFar:n},i))}}))}},{key:"Hr",value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n,i,r,s,o,a=(n=t,i=3e3*Math.pow(2,n),r=i/2,s=Math.min(18e5,i),o=Math.random()-.5,Math.ceil(s+o*(s-r))),l=Date.now()+a;this.Rr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),On.warn(u),this.Dr||(this.Dr=!0,this.Vr())}},{key:"Vr",value:function(){var e=this;if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout(function(){e.jr&&e.Rr.length>0&&e.Zr(),e.Vr()},this.Br)}},{key:"Zr",value:function(){var e=Date.now(),t=[],n=this.Rr.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.Rr=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value.requestOptions;this.retriableRequest(l)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}}},{key:"unload",value:function(){var e=!0,t=!1,n=void 0;try{for(var i,r=(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,ze(ge)||(this.qr&&(ge.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(ge.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr)[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request($e({},s,{transport:"sendBeacon"}))}catch(e){On.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.Rr=[]}}]),e}(),Ps=function(){function e(t){var n=this;_class_call_check(this,e),this.Yr=function(){var e,t,i,r;n.Ur||(n.Ur={});var s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=o+((null==s?void 0:s.clientHeight)||0),u=(null==s?void 0:s.scrollHeight)||0;n.Ur.lastScrollY=Math.ceil(o),n.Ur.maxScrollY=Math.max(o,null!==(e=n.Ur.maxScrollY)&&void 0!==e?e:0),n.Ur.maxScrollHeight=Math.max(a,null!==(t=n.Ur.maxScrollHeight)&&void 0!==t?t:0),n.Ur.lastContentY=l,n.Ur.maxContentY=Math.max(l,null!==(i=n.Ur.maxContentY)&&void 0!==i?i:0),n.Ur.maxContentHeight=Math.max(u,null!==(r=n.Ur.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}return _create_class(e,[{key:"Wr",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.Ur}},{key:"resetContext",value:function(){var e=this.Ur;return setTimeout(this.Yr,0),e}},{key:"startMeasuringScrollPosition",value:function(){k(ge,"scroll",this.Yr,{capture:!0}),k(ge,"scrollend",this.Yr,{capture:!0}),k(ge,"resize",this.Yr)}},{key:"scrollElement",value:function(){if(!this.Wr)return null==ge?void 0:ge.document.documentElement;var e=qe(this.Wr)?this.Wr:[this.Wr],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value,a=null==ge?void 0:ge.document.querySelector(o);if(a)return a}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"scrollY",value:function(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollTop||0}return ge&&(ge.scrollY||ge.pageYOffset||ge.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollLeft||0}return ge&&(ge.scrollX||ge.pageXOffset||ge.document.documentElement.scrollLeft)||0}}]),e}(),Rs=function(e){return F(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties)},Os=function(){function e(t,n,i,r){var s=this;_class_call_check(this,e),this.Gr=function(e){var t=s.Xr();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.Jr(s._instance)};s.Kr.register(_define_property({},si,n))}},this._instance=t,this.Qr=n,this.Kr=i,this.Jr=r||Rs,this.Qr.onSessionId(this.Gr)}return _create_class(e,[{key:"Xr",value:function(){return this.Kr.props[si]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?$(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}},{key:"getSessionProps",value:function(){var e={};return y(Fi(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_"+je(n)]=t}),e}}]),e}(),Fs=function(){function e(){_class_call_check(this,e),this.ti={}}return _create_class(e,[{key:"on",value:function(e,t){var n=this;return this.ti[e]||(this.ti[e]=[]),this.ti[e].push(t),function(){n.ti[e]=n.ti[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=(this.ti[e]||[])[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){(0,s.value)(t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var a=!0,l=!1,u=void 0;try{for(var c,h=(this.ti["*"]||[])[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){(0,c.value)(e,t)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}}]),e}(),$s=Fn("[SessionId]"),Is=function(){function e(t,n,i){var r,s=this;if(_class_call_check(this,e),this.ri=[],this.ii=void 0,this.ei=new Fs,this.ni=function(e,t){return!(!Xe(e)||!Xe(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===pi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Kr=t.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=n||qi,this.li=i||qi;var o=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*it(this.Rt.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+o+"_window_id",this.ci="ph_"+o+"_primary_window_exists",this.di()){var a=Ji.Gt(this.hi),l=Ji.Gt(this.ci);a&&!l?this.si=a:Ji.Jt(this.hi),Ji.Xt(this.ci,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var u=function(){var e=s.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)}();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),u)}catch(e){$s.error("Invalid sessionID in bootstrap",e)}this.fi()}return _create_class(e,[{key:"on",value:function(e,t){return this.ei.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return ze(this.ri)&&(this.ri=[]),this.ri.push(e),this.oi&&e(this.oi,this.si),function(){t.ri=t.ri.filter(function(t){return t!==e})}}},{key:"di",value:function(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&Ji.Yt()}},{key:"pi",value:function(e){e!==this.si&&(this.si=e,this.di()&&Ji.Xt(this.hi,e))}},{key:"gi",value:function(){return this.si?this.si:this.di()?Ji.Gt(this.hi):null}},{key:"vi",value:function(e,t,n){e===this.oi&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.oi=e,this.Kr.register(_define_property({},Gn,[t,e,n])))}},{key:"mi",value:function(){var e=this.Kr.props[Gn];return qe(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.vi(null,null,null)}},{key:"destroy",value:function(){clearTimeout(this.yi),this.yi=void 0,this.ii&&ge&&(ge.removeEventListener(ki,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}},{key:"fi",value:function(){var e=this;this.ii=function(){e.di()&&Ji.Jt(e.ci)},k(ge,ki,this.ii,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===pi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),i=_sliced_to_array(this.mi(),3),r=i[0],s=i[1],o=i[2],a=this.gi(),l=Xe(o)&&Math.abs(n-o)>864e5,u=!1,c=!s,h=!c&&!e&&this.ni(n,r);c||h||l?(s=this.ai(),a=this.li(),$s.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=n,u=!0):a||(a=this.li(),u=!0);var d=Xe(r)&&e&&!l?r:n,f=Xe(o)?o:(new Date).getTime();return this.pi(a),this.vi(s,d,f),e||this.ui(),u&&this.ri.forEach(function(e){return e(s,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0)}),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}},{key:"ui",value:function(){var e=this;clearTimeout(this.yi),this.yi=setTimeout(function(){var t=_sliced_to_array(e.mi(),1)[0];if(e.ni((new Date).getTime(),t)){var n=e.oi;e.resetSessionId(),e.ei.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}]),e}(),Ts=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Me(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(function(e){return Me(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver},Cs=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}},Ms={exact:function(e,t){return t.some(function(t){return e.some(function(e){return t===e})})},is_not:function(e,t){return t.every(function(t){return e.every(function(e){return t!==e})})},regex:function(e,t){return t.some(function(t){return e.some(function(e){return Cs(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!Cs(t,e)})})},icontains:function(e,t){return t.map(As).some(function(t){return e.map(As).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(As).every(function(t){return e.map(As).every(function(e){return!t.includes(e)})})},gt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n>parseFloat(e)})})},lt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n<parseFloat(e)})})}},As=function(e){return e.toLowerCase()},js="custom",Ls="i.posthog.com",Ds=function(){function e(t){_class_call_check(this,e),this.bi={},this.instance=t}return _create_class(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:"flagsApiHost",get:function(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}},{key:"uiHost",get:function(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Ls,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this.bi[this.apiHost]||(this.bi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":js),this.bi[this.apiHost]}},{key:"endpointFor",value:function(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===js)return this.apiHost+t;var n=Ls+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}]),e}(),Ns=Fn("[Surveys]"),qs="seenSurvey_",Ws=function(e){return function(e,t){var n=""+qs+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+qs+t.id+"_"+t.current_iteration),n}(0,e)},Hs=[kr,xr,wr],Us={ignoreConditions:!1,ignoreDelay:!1,displayType:$r},zs=Fn("[PostHog ExternalIntegrations]"),Bs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Gs=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"nr",value:function(e,t){var n;null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,function(e){if(e)return zs.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=function(t){var n,i,r;!c||null!=(n=Re.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.nr(Bs[t],function(){var n;null==(n=Re.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!c&&null!=(i=Re.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]&&(null==(r=Re.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[t])||r.stop())},n=!0,i=!1,r=void 0;try{for(var s,o=Object.entries(null!==(a=this._instance.config.integrations)&&void 0!==a?a:{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a,l=_sliced_to_array(s.value,2),u=l[0],c=l[1];t(u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}]),e}(),Vs={},Ks=0,Ys=function(){},Xs='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Js="Surveys module not available",Zs="sanitize_properties is deprecated. Use before_send instead",Qs="Invalid value for property_denylist config: ",eo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,to="posthog",no=!_s&&-1===(null==Pe?void 0:Pe.indexOf("MSIE"))&&-1===(null==Pe?void 0:Pe.indexOf("Mozilla")),io=function(e){var t;return $e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:b(null==be?void 0:be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ys,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:ke&&Be(null==ke?void 0:ke.search)&&-1!==ke.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ge||null==(t=ge.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:function(e){On.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:mi,before_send:void 0,request_queue_config:{flush_interval_ms:ws},error_tracking:{},_onCapture:Ys,__preview_eager_load_replay:!1},function(e){return{rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}}(e))},ro=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],so=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=ro[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),l=a[0],u=a[1];ze(e[l])||(t[u]=e[l])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=Pi({},t,e);return qe(e.property_blacklist)&&(ze(e.property_denylist)?c.property_denylist=e.property_blacklist:qe(e.property_denylist)?c.property_denylist=_to_consumable_array(e.property_blacklist).concat(_to_consumable_array(e.property_denylist)):On.error(Qs+e.property_denylist)),c},oo=function(){function e(){_class_call_check(this,e),this.__forceAllowLocalhost=!1}return _create_class(e,[{key:"wi",get:function(){return this.__forceAllowLocalhost},set:function(e){On.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),ao=function(){function e(){var t,n=this;_class_call_check(this,e),this.webPerformance=new oo,this.Si=!1,this.version=Fe.LIB_VERSION,this.ki=new Fs,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=io(),this.SentryIntegration=sr,this.sentryIntegration=function(e){return function(e,t){var n=x(e,t);return{name:rr,processEvent:function(e){return n(e)}}}(n,e)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new Ps(this),this.pageViewManager=new or(this),this.rateLimiter=new jr(this),this.requestRouter=new Ds(this),this.consent=new Zi(this),this.externalIntegrations=new Gs(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:function(e,t,i){var r=Be(e)?_define_property({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=Be(e)?_define_property({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return On.info('send "'+(null==e?void 0:e.event)+'"',e)})}return _create_class(e,[{key:"Ii",value:function(e,t){if(e){var n=this.Ci.indexOf(e);-1!==n&&this.Ci.splice(n,1)}return this.Ci.push(t),null==t.initialize||t.initialize(),t}},{key:"decideEndpointWasHit",get:function(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"flagsEndpointWasHit",get:function(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"init",value:function(t,n,i){if(i&&i!==to){var r,s=null!==(r=Vs[i])&&void 0!==r?r:new e;return s._init(t,n,i),Vs[i]=s,Vs[to][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e,t,n){var i,r,s,o,a=this;if(void 0===t&&(t={}),ze(e)||Ge(e))return On.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Ri(t.debug),this.Ni=t,this.Mi=[],t.person_profiles?this.Ai=t.person_profiles:t.process_person&&(this.Ai=t.process_person),this.set_config(Pi({},io(t.defaults),so(t),{name:n,token:e})),this.config.on_xhr_error&&On.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Nr;var l=this.Fi();this.persistence=new yr(this.config,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr($e({},this.config,{persistence:"sessionStorage"}),l);var u=$e({},this.persistence.props),c=$e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new xs(function(e){return a.Pi(e)},this.config.request_queue_config),this.Li=new Ss(this),this.__request_queue=[];var h=this.config.cookieless_mode===pi||this.config.cookieless_mode===_i&&this.consent.isExplicitlyOptedOut();h||(this.sessionManager=new Is(this),this.sessionPropsManager=new Os(this,this.sessionManager,this.persistence));var d=null==(i=Re._POSTHOG_REMOTE_CONFIG)||null==(i=i[this.config.token])?void 0:i.config,f=null==d||null==(r=d.sdkVersion)?void 0:r.resolved;if(f&&(eo.test(f)?this._resolvedSdkVersion=f:On.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+f)),this.config.__preview_deferred_init_extensions?(On.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){a.Di(h)},0)):(On.info("Initializing extensions synchronously"),this.Di(h)),Fe.DEBUG=Fe.DEBUG||this.config.debug,Fe.DEBUG&&On.info("Starting in debug mode",{this:this,config:t,thisC:$e({},this.config),p:u,s:c}),!this.config.identity_distinct_id||null!=(s=t.bootstrap)&&s.distinctID||(t.bootstrap=$e({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var v=t.bootstrap.distinctID,_=this.get_distinct_id(),p=this.persistence.get_property(ri);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==v&&p===gi)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==v&&p===yi)On.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var g=this.config.get_device_id(qi()),y=t.bootstrap.isIdentifiedID?g:v;this.persistence.set_property(ri,t.bootstrap.isIdentifiedID?yi:gi),this.register({distinct_id:v,$device_id:y})}}if(h)this.register_once({distinct_id:di,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(qi());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(ri,gi)}return k(ge,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=function(n){var i=function(){return n.anonymousId()||qi()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(ri,yi)),t()},r=n.user();"then"in r&&We(r.then)?r.then(i):i(r)}(e,function(){n.register(function(e){Promise&&Promise.resolve||ir.warn("This browser does not have Promise support, and can not use the segment integration");var t=function(t,n){if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ir.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ir.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,wi)},identify:function(e){return t(e,Ei)},screen:function(e){return t(e,"$screen")}}}(e)).then(function(){t()})})}(this,function(){return a.Bi()}):this.Bi(),We(this.config._onCapture)&&this.config._onCapture!==Ys&&(On.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return a.config._onCapture(e.event,e)})),this.config.ip&&On.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}},{key:"Di",value:function(t){var n,i,r,s,o,a,l,u=this,c=performance.now(),h=$e({},e.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ci.push(this.featureFlags=null!==(n=this.featureFlags)&&void 0!==n?n:new h.featureFlags(this)),h.exceptions&&this.Ci.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.Ci.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ci.push(new h.tracingHeaders(this)),h.siteApps&&this.Ci.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push(function(){u.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Ci.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this)),h.logs&&this.Ci.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.conversations&&this.Ci.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ci.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ci.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ci.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,tr)),h.toolbar&&this.Ci.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ci.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ci.forEach(function(e){e.initialize&&d.push(function(){null==e.initialize||e.initialize()})}),d.push(function(){if(u.ji){var e=u.ji;u.ji=void 0,u.Sr(e)}}),this.qi(d,c)}},{key:"qi",value:function(e,t){for(var n=this;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(function(){n.qi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){On.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&On.info("PostHog extensions initialized ("+r+"ms)")}},{key:"Sr",value:function(e){var t,n=this;if(!be||!be.body)return On.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){n.Sr(e)},500);this.config.__preview_deferred_init_extensions&&(this.ji=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=c(e.supportedCompression,Nr)?Nr:c(e.supportedCompression,qr)?qr:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:mi}),this.Ci.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}},{key:"Bi",value:function(){var e=this;try{this.config.loaded(this)}catch(e){On.critical("`loaded` function failed",e)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=ke&&ke.hostname){var t=ke.hostname,n=this.config.internal_or_test_user_hostname;("string"==typeof n?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(function(){(e.consent.isOptedIn()||e.config.cookieless_mode===pi)&&e.$i()},1),this.Hi=new Dr(this),this.Hi.load()}},{key:"Zi",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Oi)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&g(this.__request_queue,function(t){return e.Pi(t)}),this.__request_queue=[],this.Zi()}},{key:"_handle_unload",value:function(){var e,t,n;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(xi),null==(t=this.Oi)||t.unload(),null==(n=this.Li)||n.unload()):this.Vi()&&this.capture(xi,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t=this;this.__loaded&&(no?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=gs(e.url,{ip:this.config.ip?1:0}),e.headers=$e({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var t,n,i,r=$e({},e);r.timeout=r.timeout||6e4,r.url=gs(r.url,{_:(new Date).getTime().toString(),ver:Fe.JS_SDK_VERSION,compression:r.compression});var s=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=ks.filter(function(e){return!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)}),a=null!==(n=null==(i=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===s)return e[t]}(o))?void 0:i.method)&&void 0!==n?n:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==s&&r.data&&r.compression===Nr&&Se?bs(r).then(function(e){a(e)}).catch(function(){a(r)}):a(r)}($e({},e,{callback:function(n){var i,r;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null==(i=(r=t.config).on_request_error)||i.call(r,n),null==e.callback||e.callback(n)}}))))}},{key:"Pi",value:function(e){this.Li?this.Li.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;Ks++;try{var n,i=[],r=[],s=[];g(e,function(e){e&&(qe(n=e[0])?s.push(e):We(e)?e.call(t):qe(e)&&"alias"===n?i.push(e):qe(e)&&-1!==n.indexOf("capture")&&We(t[n])?s.push(e):r.push(e))});var o=function(e,t){g(e,function(e){if(qe(e[0])){var n=t;y(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};o(i,this),o(r,this),o(s,this)}finally{Ks--}}},{key:"push",value:function(t){if(Ks>0&&qe(t)&&Be(t[0])){var n=e.prototype[t[0]];We(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}},{key:"capture",value:function(e,t,n){var i,r,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!ze(e)&&Be(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!Be(null==t?void 0:t.$current_url)&&(On.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=n&&n.zi||On.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==n?void 0:n.timestamp)||c,d=qi(),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===wi&&this.config.__preview_capture_bot_pageviews&&l&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==n?void 0:n.$set)&&(f.$set=null==n?void 0:n.$set);var v,_=this.Yi(null==n?void 0:n.$set_once,e!==Si,e===Ei);if(_&&(f.$set_once=_),null!=n&&n._noTruncate||(r=this.config.properties_string_max_length,s=f,o=function(e){return Be(e)?e.slice(0,r):e},a=new Set,f=function e(t,n){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),qe(t)?(i=[],g(t,function(t){i.push(e(t))})):(i={},y(t,function(t,n){a.has(t)||(i[n]=e(t,n))})),i);var i}(s)),f.timestamp=h,ze(null==n?void 0:n.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=c),e===Sr||e===Pr){var p=null==t?void 0:t[Rr],m=null==t?void 0:t[Or];v={id:p,current_iteration:m},localStorage.getItem(Ws(v))||localStorage.setItem(Ws(v),"true"),f.$set=$e({},f.$set,_define_property({},function(e,t){var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n}({id:p,current_iteration:m},e===Pr?"responded":"dismissed"),!0))}else e===Er&&(f.$set=$e({},f.$set,_define_property({},Fr,(new Date).toISOString())));if(e===Tr){var b=null==t?void 0:t[Mr];b&&(f.$set=$e({},f.$set,_define_property({},Cr+"/"+b,(new Date).toISOString())))}var k=$e({},f.properties.$set,f.$set);if(Ue(k)||this.setPersonPropertiesForFlags(k),!Ke(this.config.before_send)){var w=this.Ui(f);if(!w)return;f=w}this.ki.emit("eventCaptured",f);var x={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==n?void 0:n._batchKey};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Pi(x):this.Oi.enqueue(x),f}On.critical("This capture call is ignored due to client rate limiting.")}}else On.error("No event name provided to posthog.capture")}else On.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",function(t){return e(t.event,t)})}},{key:"calculateEventProperties",value:function(e,t,n,i,r){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var s=r?void 0:this.persistence.remove_event_timer(e),o=$e({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode==pi||this.config.cookieless_mode==_i&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=$e({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!Be(o.distinct_id)&&!Ye(o.distinct_id)||Ge(o.distinct_id))&&On.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var n,i,r,s;if(!Pe)return{};var o,a,l,u,c,h,d,f,v=e?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[],_=_sliced_to_array(function(e){for(var t=0;nn.length>t;t++){var n=_sliced_to_array(nn[t],2),i=n[0],r=n[1],s=i.exec(e),o=s&&(We(r)?r(s,e):r);if(o)return o}return["",""]}(Pe),2),p=_[0],g=_[1];return Pi(Fi({$os:p,$os_version:g,$browser:Qt(Pe,navigator.vendor),$device:rn(Pe),$device_type:(a=Pe,l={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(i=navigator)?void 0:i.maxTouchPoints,screenWidth:null==ge||null==(r=ge.screen)?void 0:r.width,screenHeight:null==ge||null==(s=ge.screen)?void 0:s.height,devicePixelRatio:null==ge?void 0:ge.devicePixelRatio},f=rn(a),f===vt||f===ft||"Kobo"===f||"Kindle Fire"===f||f===zt?dt:f===Ct||f===At||f===Mt||f===Wt?"Console":f===pt?"Wearable":f?ut:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?ut:dt:"Desktop"),$timezone:I(),$timezone_offset:T()}),{$current_url:ur(null==ke?void 0:ke.href,v,vr),$host:null==ke?void 0:ke.host,$pathname:null==ke?void 0:ke.pathname,$raw_user_agent:Pe.length>1e3?Pe.substring(0,997)+"...":Pe,$browser_version:tn(Pe,navigator.vendor),$browser_language:R(),$browser_language_prefix:(o=R(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==ge?void 0:ge.screen.height,$screen_width:null==ge?void 0:ge.screen.width,$viewport_height:null==ge?void 0:ge.innerHeight,$viewport_width:null==ge?void 0:ge.innerWidth,$lib:Fe.LIB_NAME,$lib_version:Fe.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(r,n.getTime()),h=c.sessionId,d=c.windowId;o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&Pi(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Pi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(f=this.Li)?void 0:f.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===js&&(o.$lib_custom_api_host=this.config.api_host),l=e!==wi||r?e!==xi||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=Pi(o,l),e===wi&&be&&(o.title=be.title),!ze(s)){var v=n.getTime()-s;o.$duration=parseFloat((v/1e3).toFixed(3))}Pe&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Pi({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),qe(this.config.property_denylist)?y(this.config.property_denylist,function(e){delete o[e]}):On.error(Qs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(On.error(Zs),o=_(o,e));var p=this.Wi();return o.$process_person_profile=p,p&&!r&&this.Gi("_calculate_event_properties"),o}},{key:"Yi",value:function(e,t,n){var i;if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.Wi())return e;if(this.Si&&!n)return e;var r=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Pi({},r,s||{},e||{}),a=this.config.sanitize_properties;return a&&(On.error(Zs),o=a(o,"$set_once")),t&&(this.Si=!0),Ue(o)?void 0:o}},{key:"register",value:function(e,t){var n;null==(n=this.persistence)||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var i;null==(i=this.persistence)||i.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.register(e)}},{key:"unregister",value:function(e){var t;null==(t=this.persistence)||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}},{key:"Xi",value:function(e,t){this.register(_define_property({},e,t))}},{key:"getFeatureFlag",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}},{key:"getFeatureFlagResult",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlagResult(e,t)}},{key:"isFeatureEnabled",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}},{key:"updateFlags",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,n)}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,n)}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,n)}},{key:"on",value:function(e,t){return this.ki.on(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),function(){})}},{key:"onSurveysLoaded",value:function(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Js}),function(){})}},{key:"onSessionId",value:function(e){var t,n;return null!==(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))&&void 0!==t?t:function(){}}},{key:"getSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Js})}},{key:"getActiveMatchingSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Js})}},{key:"renderSurvey",value:function(e,t){var n;null==(n=this.surveys)||n.renderSurvey(e,t)}},{key:"displaySurvey",value:function(e,t){var n;void 0===t&&(t=Us),null==(n=this.surveys)||n.displaySurvey(e,t)}},{key:"cancelPendingSurvey",value:function(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}},{key:"canRenderSurvey",value:function(e){var t,n;return null!==(t=null==(n=this.surveys)?void 0:n.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Js}}},{key:"canRenderSurveyAsync",value:function(e,t){var n,i;return void 0===t&&(t=!1),null!==(n=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==n?n:Promise.resolve({visible:!1,disabledReason:Js})}},{key:"Ji",value:function(e){return!e||Ge(e)?(On.critical("Unique user id has not been set in posthog.identify"),!1):e===di?(On.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(On.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}},{key:"identify",value:function(e,t,n){if(!this.__loaded||!this.persistence)return On.uninitializedWarning("posthog.identify");if(Ye(e)&&(e=e.toString(),On.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(e)&&this.Gi("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Cn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Mn)&&(this.unregister(Mn),this.register({distinct_id:e}));var r,s=(this.persistence.get_property(ri)||gi)===gi;e!==i&&s?(this.persistence.set_property(ri,yi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(Ei,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Ei=C(e,t,n),null==(r=this.featureFlags)||r.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(ei))}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.Gi("posthog.setPersonProperties")){var n=C(this.get_distinct_id(),e,t);this.Ei!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=n):On.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}},{key:"group",value:function(e,t,n){if(e&&t){var i=this.getGroups(),r=i[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:$e({},i,_define_property({},e,t))}),r||n){var s={$group_type:e,$group_key:t};n&&(s.$group_set=n),this.capture(Si,s)}n&&this.setGroupPropertiesForFlags(_define_property({},e,n)),r&&!n&&this.reloadFeatureFlags()}else On.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,t){var n;void 0===t&&(t=!0),null==(n=this.featureFlags)||n.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e,t){var n;void 0===t&&(t=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(n=this.featureFlags)||n.setGroupPropertiesForFlags(e,t))}},{key:"resetGroupPropertiesForFlags",value:function(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,i,r,s,o,a,l;if(On.info("reset"),!this.__loaded)return On.uninitializedWarning("posthog.reset");var u=this.get_property(Cn);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),null==(i=this.surveys)||i.reset(),null==(r=this.Hi)||r.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(ri,gi),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===pi)this.register_once({distinct_id:di,$device_id:null},"");else{var c=this.config.get_device_id(qi());this.register_once({distinct_id:c,$device_id:e?c:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}},{key:"setIdentity",value:function(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(n=this.conversations)||n.Ki()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qi()}},{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.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/"+this.config.token+"/replay/"+n);if(null!=e&&e.withTimestamp&&i){var s,o=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-o,0)}return r}},{key:"alias",value:function(e,t){return e===this.get_property(Tn)?(On.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(ze(t)&&(t=this.get_distinct_id()),e!==t?(this.Xi(Mn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(On.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=$e({},this.config);if(He(e)){var n,i,r,s,o,a,l,u,c;Pi(this.config,so(e));var h=this.Fi();null==(n=this.persistence)||n.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr($e({},this.config,{persistence:"sessionStorage"}),h);var d=this.Ri(this.config.debug);Je(d)&&(this.config.debug=d),Je(this.config.debug)&&(this.config.debug?(Fe.DEBUG=!0,Gi.Yt()&&Gi.Xt("ph_debug",!0),On.info("set_config",{config:e,oldConfig:t,newConfig:$e({},this.config)})):(Fe.DEBUG=!1,Gi.Yt()&&Gi.Jt("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}},{key:"_overrideSDKInfo",value:function(e,t){Fe.LIB_NAME=e,Fe.LIB_VERSION=t}},{key:"startSessionRecording",value:function(e){var t,n,i,r,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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)||!e.started)}},{key:"captureException",value:function(e,t){if(this.exceptions){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent($e({},i,t))}}},{key:"startExceptionAutocapture",value:function(e){this.set_config({capture_exceptions:null==e||e})}},{key:"stopExceptionAutocapture",value:function(){this.set_config({capture_exceptions:!1})}},{key:"loadToolbar",value:function(e){var t,n;return null!==(t=null==(n=this.toolbar)?void 0:n.loadToolbar(e))&&void 0!==t&&t}},{key:"get_property",value:function(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:to;return t!==to&&(t=to+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ri))===yi||(null==(t=this.sessionPersistence)?void 0:t.get_property(ri))===yi}},{key:"Wi",value:function(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===mi&&!this._isIdentified()&&Ue(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Mn])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ci]))}},{key:"Vi",value:function(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}},{key:"createPersonProfile",value:function(){this.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"Gi",value:function(e){return"never"===this.config.person_profiles?(On.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(ci,!0),!0)}},{key:"Fi",value:function(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==_i)}},{key:"tn",value:function(){var e,t,n,i,r=this.Fi();return(null==(e=this.persistence)?void 0:e.gr)!==r&&(null==(n=this.persistence)||n.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.gr)!==r&&(null==(i=this.sessionPersistence)||i.set_disabled(r)),r}},{key:"opt_in_capturing",value:function(t){var n;if(this.config.cookieless_mode!==pi){if(this.config.cookieless_mode===_i&&this.consent.isExplicitlyOptedOut()){var i,r,s,o,a;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Is(this),this.pageViewManager=new or(this),this.persistence&&(this.sessionPropsManager=new Os(this,this.sessionManager,this.persistence));var l=null!==(s=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==s?s:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ii(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),this.config.cookieless_mode==_i&&(null==(u=this.surveys)||u.loadIfEnabled()),(ze(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(c=null==t?void 0:t.captureEventName)&&void 0!==c?c:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else On.warn(Xs)}},{key:"opt_out_capturing",value:function(){var e,t,n;this.config.cookieless_mode!==pi?(this.config.cookieless_mode===_i&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===_i&&(this.register({distinct_id:di,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(n=this.sessionRecording)||n.stopRecording(),this.sessionRecording=void 0,this.$i())):On.warn(Xs)}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"get_explicit_consent_status",value:function(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}},{key:"is_capturing",value:function(){return this.config.cookieless_mode===pi||(this.config.cookieless_mode===_i?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this.tn()}},{key:"_is_bot",value:function(){return me?Ts(me,this.config.custom_blocked_useragents):void 0}},{key:"$i",value:function(){be&&("visible"===be.visibilityState?this.xi||(this.xi=!0,this.capture(wi,{title:be.title},{send_instantly:!0}),this.Ti&&(be.removeEventListener(bi,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),k(be,bi,this.Ti)))}},{key:"debug",value:function(e){!1===e?(null==ge||ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ge||ge.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}},{key:"Tr",value:function(){var e,t,n,i,r,s,o=this.Ni||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(On.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",i=On,r=(t="advanced_disable_flags")in(e=o)&&!Ke(e[t]),s=n in e&&!Ke(e[n]),r?e[t]:!!s&&(i&&i.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]))}},{key:"Ui",value:function(e){if(Ke(this.config.before_send))return e;var t=qe(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e,i=!0,r=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){if(n=(0,o.value)(n),Ke(n)){var l="Event '"+e.event+"' was rejected in beforeSend function";return Qe(e.event)?On.warn(l+". This can cause unexpected behavior."):On.info(l),null}n.properties&&!Ue(n.properties)||On.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}},{key:"getPageViewId",value:function(){var e;return null==(e=this.pageViewManager.lr)?void 0:e.pageViewId}},{key:"captureTraceFeedback",value:function(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}},{key:"captureTraceMetric",value:function(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}},{key:"Ri",value:function(e){var t=Je(e)&&!e,n=Gi.Yt()&&"true"===Gi.Wt("ph_debug");return!t&&(!!n||e)}}]),e}();ao.__defaultExtensionClasses={},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=Oi(e.prototype[t[n]])}(ao,["identify"]);var lo=["a","button","form","input","select","textarea","label"],uo=["next","previous","prev",">","<"],co=[".ph-no-rageclick",".ph-no-capture"],ho=function(e){return!e||L(e,"html")||!j(e)},fo=function(e,t){if(!ge||ho(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!L(r,"body");)if(N(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var s=V(r);if(!s)break;if(t||lo.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=ge.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}},vo="(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})",_o=new RegExp("^(?:"+vo+")$"),po=new RegExp(vo),go="\\d{3}-?\\d{2}-?\\d{4}",yo=new RegExp("^("+go+")$"),mo=new RegExp("("+go+")");function bo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&y(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var i=z(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+bo(e)).trim())}catch(e){On.error("[AutoCapture]",e)}}),t}var ko=function(){function e(t){_class_call_check(this,e),this.disabled=!1===t;var n=He(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}return _create_class(e,[{key:"isRageClick",value:function(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),wo="$copy_autocapture",xo=Fn("[AutoCapture]"),Eo=Fn("[ExceptionAutocapture]"),So=Fn("[TracingHeaders]"),Po=Fn("[Web Vitals]"),Ro=9e5,Oo="disabled",Fo="lazy_loading",$o="awaiting_config",Io="missing_config";Fn("[SessionRecording]");var To,Co="[SessionRecording]",Mo=Fn(Co),Ao=Fn("[Heatmaps]"),jo=Fn("[Product Tours]"),Lo="ph_product_tours",Do=["$set_once","$set"],No=Fn("[SiteApps]"),qo="Error while initializing PostHog app with config id ",Wo=function(){function e(t){var n=this;_class_call_check(this,e),this.en=new Fs,this.rn=function(e,t){return n.nn(e,t)&&n.sn(e,t)&&n.an(e,t)&&n.ln(e,t)},this.nn=function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)},this._instance=t,this.un=new Set,this.hn=new Set}return _create_class(e,[{key:"init",value:function(){var e,t,n=this;ze(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook(function(e,t){n.on(e,t)})}},{key:"register",value:function(e){var t,n,i=this;if(!ze(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(function(e){var t,n;null==(t=i.hn)||t.add(e),null==(n=e.steps)||n.forEach(function(e){var t;null==(t=i.un)||t.add((null==e?void 0:e.event)||"")})}),null!=(n=this._instance)&&n.autocapture)){var r,s=new Set;e.forEach(function(e){var t;null==(t=e.steps)||t.forEach(function(e){null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}},{key:"on",value:function(e,t){var n,i=this;null!=t&&0!=e.length&&(this.un.has(e)||this.un.has(null==t?void 0:t.event))&&this.hn&&(null==(n=this.hn)?void 0:n.size)>0&&this.hn.forEach(function(e){i.cn(t,e)&&i.en.emit("actionCaptured",e.name)})}},{key:"dn",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"cn",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n=!0,i=!1,r=void 0;try{for(var s,o=t.steps[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(this.rn(e,a))return!0}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return!1}},{key:"onAction",value:function(e,t){return this.en.on(e,t)}},{key:"sn",value:function(e,t){if(null!=t&&t.url){var n,i=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!i||"string"!=typeof i)return!1;if(!re(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"an",value:function(e,t){return!!this.vn(e,t)&&!!this.fn(e,t)&&!!this.pn(e,t)}},{key:"vn",value:function(e,t){var n;if(null==t||!t.href)return!0;var i=this.gn(e);if(i.length>0)return i.some(function(e){return re(e.href,t.href,t.href_matching||"exact")});var r,s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!s&&re((r=s.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}},{key:"fn",value:function(e,t){var n;if(null==t||!t.text)return!0;var i=this.gn(e);if(i.length>0)return i.some(function(e){return re(e.text,t.text,t.text_matching||"exact")||re(e.$el_text,t.text,t.text_matching||"exact")});var r,s,o,a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(r=function(e){for(var t,n=[],i=/(?::|")text="(.*?)"/g;!Ke(t=i.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),s=t.text,o=t.text_matching||"exact",r.some(function(e){return re(e,s,o)}))}},{key:"pn",value:function(e,t){var n,i;if(null==t||!t.selector)return!0;var r=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}},{key:"gn",value:function(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}},{key:"ln",value:function(e,t){return null==t||!t.properties||0===t.properties.length||M(t.properties.reduce(function(e,t){var n=qe(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}]),e}(),Ho=function(){function e(t){_class_call_check(this,e),this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}return _create_class(e,[{key:"wn",value:function(e,t){return!!e&&M(e.propertyFilters,null==t?void 0:t.properties)}},{key:"_n",value:function(e,t){var n=new Map;return e.forEach(function(e){var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(function(t){if(null!=t&&t.name){var i=n.get(t.name)||[];i.push(e.id),n.set(t.name,i)}})}),n}},{key:"In",value:function(e,t,n){var i=this,r=(n===mr?this.mn:this.yn).get(e),s=[];return this.Cn(function(e){s=e.filter(function(e){return null==r?void 0:r.includes(e.id)})}),s.filter(function(r){var s,o=null==(s=r.conditions)||null==(s=s[n])||null==(s=s.values)?void 0:s.find(function(t){return t.name===e});return i.wn(o,t)})}},{key:"register",value:function(e){var t;ze(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Sn(e),this.kn(e))}},{key:"kn",value:function(e){var t=this,n=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0});0!==n.length&&(null==this.xn&&(this.xn=new Wo(this._instance),this.xn.init(),this.xn.dn(function(e){t.onAction(e)})),n.forEach(function(e){var n,i,r,s,o;e.conditions&&null!=(n=e.conditions)&&n.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=t.xn)||s.register(e.conditions.actions.values),null==(o=e.conditions)||null==(o=o.actions)||null==(o=o.values)||o.forEach(function(n){if(n&&n.name){var i=t.bn.get(n.name);i&&i.push(e.id),t.bn.set(n.name,i||[e.id])}}))}))}},{key:"Sn",value:function(e){var t,n=this,i=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),r=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook(function(e,t){n.onEvent(e,t)}),this.mn=this._n(e,mr),this.yn=this._n(e,br))}},{key:"onEvent",value:function(e,t){var n,i=this,r=this.re(),s=this.Tn(),o=this.An(),a=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var l,u;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(null==t||null==(l=t.properties)?void 0:l.$survey_id)||(null==t||null==(u=t.properties)?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);0>h||(a.splice(h,1),this.En(a))}}else{if(this.yn.has(e)){var d=this.In(e,t,br);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(function(e){return e.id})}),d.forEach(function(e){var t=a.indexOf(e.id);0>t||a.splice(t,1),i.Rn(e.id)}),this.En(a))}if(this.mn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.mn.get(e)});var f=this.In(e,t,mr);this.En(a.concat(f.map(function(e){return e.id})||[]))}}}},{key:"onAction",value:function(e){var t,n=this.Tn(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.bn.has(e)&&this.En(i.concat(this.bn.get(e)||[]))}},{key:"En",value:function(e){var t,n=this,i=this.re(),r=this.Tn(),s=_to_consumable_array(new Set(e)).filter(function(e){return!n.Nn(e)});i.info("updating activated items",{activatedItems:s}),null==(t=this._instance)||null==(t=t.persistence)||t.register(_define_property({},r,s))}},{key:"getActivatedIds",value:function(){var e,t=this.Tn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"getEventToItemsMap",value:function(){return this.mn}},{key:"Mn",value:function(){return this.xn}}]),e}(),Uo=function(e){function t(e){return _class_call_check(this,t),_call_super(this,t,[e])}return _inherits(t,e),_create_class(t,[{key:"Tn",value:function(){return"$surveys_activated"}},{key:"An",value:function(){return Er}},{key:"Cn",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"Rn",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"re",value:function(){return Ns}},{key:"Nn",value:function(){return!1}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItemsMap()}}]),t}(Ho),zo="SDK is not enabled or survey functionality is not yet loaded",Bo="Disabled. Not loading surveys.",Go=null!=ge&&ge.location?cr(ge.location.hash,"__posthog")||cr(location.hash,"state"):null,Vo="_postHogToolbarParams",Ko=Fn("[Toolbar]"),Yo=Fn("[FeatureFlags]"),Xo=Fn("[FeatureFlags]",{debugEnabled:!0}),Jo="\" failed. Feature flags didn't load in time.",Zo="$active_feature_flags",Qo="$override_feature_flags",ea="$feature_flag_payloads",ta="$override_feature_flag_payloads",na="$feature_flag_request_id",ia=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},ra=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=m(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),l=a[0],u=a[1];u&&(t[l]=u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},sa=Fn("[Error tracking]"),oa="Refusing to render web experiment since the viewer is a likely bot",aa={icontains:function(e,t){return!!ge&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!ge&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!ge&&Cs(t.href,e)},not_regex:function(e,t){return!!ge&&!Cs(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},la=function(){function e(t){var n=this;_class_call_check(this,e);var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(function(t){e.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach(function(t){if(t.feature_flag_key){var n;i.On&&(e.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.On)||n.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);Be(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.Ln(o)&&i.Pn(t.name,s,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.Fn(oa);else if(!this.Rt.disable_web_experiments){if(Ke(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Fn("applying feature flags",t),t.forEach(function(e){var t;if(n.On&&null!=(t=n.On)&&t.has(e)){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.On)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&n.Pn(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=lr(null==n?void 0:n.search,"__experiment_id"),r=lr(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.Fn("previewing web experiments "+i+" && "+r),this.getWebExperiments(function(e){t.Dn(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.Rt.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="+this.Rt.token),method:"GET",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"Dn",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Pn(r[0].name,n,r[0].variants[n].transforms))}},{key:"Pn",value:function(t,n,i){this._is_bot()?e.Fn(oa):"control"!==n?i.forEach(function(i){if(i.selector){var r;e.Fn("applying transform of variant "+n+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(function(e){var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):e.Fn("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return me&&this._instance?Ts(me,this.Rt.custom_blocked_useragents):void 0}}],[{key:"Ln",value:function(t){return!Ke(t.conditions)&&e.Bn(t)&&e.jn(t)}},{key:"Bn",value:function(t){var n;if(Ke(t.conditions)||Ke(null==(n=t.conditions)?void 0:n.url))return!0;var i,r,s,o=e.getWindowLocation();return!!o&&(null==(i=t.conditions)||!i.url||aa[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,o))}},{key:"getWindowLocation",value:function(){return null==ge?void 0:ge.location}},{key:"jn",value:function(e){var t;if(Ke(e.conditions)||Ke(null==(t=e.conditions)?void 0:t.utm))return!0;var n=E();if(n.utm_source){var i,r,s,o,a,l,u,c,h=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==n.utm_campaign,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==n.utm_source,f=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==n.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==n.utm_term;return h&&f&&v&&d}return!1}},{key:"Fn",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];On.info("[WebExperiments] "+e,n)}}]),e}(),ua=Fn("[Conversations]"),ca="Conversations not available yet.",ha={featureFlags:function(){function e(t){_class_call_check(this,e),this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"Kr",get:function(){return this._instance.persistence}},{key:"Wn",value:function(e){return this._instance.get_property(e)}},{key:"Gn",value:function(){var e,t;return null!==(e=null==(t=this.Kr)?void 0:t.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}},{key:"Xn",value:function(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,Yo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"Jn",value:function(){var e,t=null!==(e=this.Rt.evaluation_contexts)&&void 0!==e?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(Yo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=t&&t.length?t.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Yo.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}},{key:"Kn",value:function(){return this.Jn().length>0}},{key:"initialize",value:function(){var e,t,n=this._instance.config,i=null!==(e=null==(t=n.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var r,s,o=null!==(r=null==(s=n.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(i).filter(function(e){return!!i[e]}).reduce(function(e,t){return e[t]=i[t]||!1,e},{}),l=Object.keys(o).filter(function(e){return a[e]}).reduce(function(e,t){return o[t]&&(e[t]=o[t]),e},{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}},{key:"updateFlags",value:function(e,t,n){var i=null!=n&&n.merge?this.getFlagVariants():{},r=null!=n&&n.merge?this.getFlagPayloads():{},s=$e({},i,e),o=$e({},r,t),a={},l=!0,u=!1,c=void 0;try{for(var h,d=Object.entries(s)[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var f=_sliced_to_array(h.value,2),v=f[0],_=f[1],p="string"==typeof _;a[v]={key:v,enabled:!!p||Boolean(_),variant:p?_:void 0,reason:void 0,metadata:ze(null==o?void 0:o[v])?void 0:{id:0,version:void 0,description:void 0,payload:o[v]}}}}catch(e){u=!0,c=e}finally{try{l||null==d.return||d.return()}finally{if(u)throw c}}this.receivedFeatureFlags({flags:a})}},{key:"hasLoadedFlags",get:function(){return this.Zn}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.Wn(Xn),t=this.Wn(Qo),n=this.Wn(ta);if(!n&&!t)return e||{};var i=Pi({},e||{}),r=_to_consumable_array(new Set(_to_consumable_array(Object.keys(n||{})).concat(_to_consumable_array(Object.keys(t||{}))))),s=!0,o=!1,a=void 0;try{for(var l,u=r[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){var c,h,d=l.value,f=i[d],v=null==t?void 0:t[d],_=ze(v)?null!==(c=null==f?void 0:f.enabled)&&void 0!==c&&c:!!v,p=ze(v)?f.variant:"string"==typeof v?v:void 0,g=null==n?void 0:n[d],y=$e({},f,{enabled:_,variant:_?null!=p?p:null==f?void 0:f.variant:void 0});_!==(null==f?void 0:f.enabled)&&(y.original_enabled=null==f?void 0:f.enabled),p!==(null==f?void 0:f.variant)&&(y.original_variant=null==f?void 0:f.variant),g&&(y.metadata=$e({},null==f?void 0:f.metadata,{payload:g,original_payload:null==f||null==(h=f.metadata)?void 0:h.payload})),i[d]=y}}catch(e){o=!0,a=e}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return this.qn||(Yo.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.qn=!0),i}},{key:"getFlagVariants",value:function(){var e=this.Wn(Kn),t=this.Wn(Qo);if(!t)return e||{};for(var n=Pi({},e),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.qn||(Yo.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.qn=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.Wn(ea),t=this.Wn(ta);if(!t)return e||{};for(var n=Pi({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.qn||(Yo.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.qn=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout(function(){e.ts()},5))}},{key:"es",value:function(){clearTimeout(this.Qn),this.Qn=void 0}},{key:"ensureFlagsLoaded",value:function(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.Hn=e}},{key:"ts",value:function(e){var t,n=this;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var i=this.Rt.token,r=this.Wn(Cn),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:$e({},(null==(t=this.Kr)?void 0:t.get_initial_props())||{},this.Wn(Jn)||{}),group_properties:this.Wn(Zn),timezone:I()};Ve(r)||ze(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Kn()&&(s.evaluation_contexts=this.Jn());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this.Rt.disable_compression?void 0:qr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:function(e){var t,i,r,o=!0;if(200===e.statusCode&&(n.Vn||(n.$anon_distinct_id=void 0),o=!1),n.$n=!1,!s.disable_flags||n.Vn){n.zn=!o;var a=[];e.error?_instanceof(e.error,Error)?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),null==(r=n.Kr)||r.register(_define_property({},ni,a)),u?Yo.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||n.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},o),n.Vn&&(n.Vn=!1,n.ts()))}}})}}},{key:"getFeatureFlag",value:function(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var i=this.getFeatureFlagResult(e,t);return null!==(n=null==i?void 0:i.variant)&&void 0!==n?n:null==i?void 0:i.enabled}}else Yo.warn('getFeatureFlag for key "'+e+Jo)}},{key:"getFeatureFlagDetails",value:function(e){return this.getFlagsWithDetails()[e]}},{key:"getFeatureFlagPayload",value:function(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}},{key:"getFeatureFlagResult",value:function(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var n=this.getFlagVariants(),i=e in n,r=n[e],s=this.getFlagPayloads()[e],o=String(r),a=this.Wn(na)||void 0,l=this.Wn(ii)||void 0,u=this.Wn(ei)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h,d=this._instance.get_session_id(),f=this.Wn(ti);d&&d!==f&&(u={},null==(c=this.Kr)||c.register((_define_property(h={},ei,u),_define_property(h,ti,d),h)))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var v,_,p,g,y,m,b,k,w,x;qe(u[e])?u[e].push(o):u[e]=[o],null==(v=this.Kr)||v.register(_define_property({},ei,u));var E=this.getFeatureFlagDetails(e),S=_to_consumable_array(null!==(_=this.Wn(ni))&&void 0!==_?_:[]);ze(r)&&S.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[e])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[e])||null,$used_bootstrap_value:!this.zn};ze(null==E||null==(y=E.metadata)?void 0:y.version)||(P.$feature_flag_version=E.metadata.version);var R,O=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(k=E.reason)?void 0:k.code;O&&(P.$feature_flag_reason=O),null!=E&&null!=(w=E.metadata)&&w.id&&(P.$feature_flag_id=E.metadata.id),ze(null==E?void 0:E.original_variant)&&ze(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=ze(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(P.$feature_flag_original_payload=null==E||null==(R=E.metadata)?void 0:R.original_payload),S.length&&(P.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",P)}if(i){var F=s;if(!ze(s))try{F=JSON.parse(s)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:F}}}}else Yo.warn('getFeatureFlagResult for key "'+e+Jo)}},{key:"getRemoteConfigPayload",value:function(e,t){var n=this.Rt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.Kn()&&(i.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Rt.disable_compression?void 0:qr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:function(n){var i,r=null==(i=n.json)?void 0:i.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}},{key:"isFeatureEnabled",value:function(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return ze(n)?void 0:!!n}Yo.warn('isFeatureEnabled for key "'+e+Jo)}}},{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,t){if(this.Kr){this.Zn=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,n,i,r){void 0===n&&(n={}),void 0===i&&(i={}),void 0===r&&(r={});var s,o,a=((o=(s=e).flags)?(s.featureFlags=Object.fromEntries(Object.keys(o).map(function(e){var t;return[e,null!==(t=o[e].variant)&&void 0!==t?t:o[e].enabled]})),s.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(function(e){return o[e].enabled}).filter(function(e){var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(function(e){var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):Yo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),s),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(qe(u)){Yo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f,v={};if(u)for(var _=0;u.length>_;_++)v[u[_]]=!0;t&&t.register((_define_property(f={},Zo,u),_define_property(f,Kn,v),f))}else{var p,g=u,y=c,m=l;if(e.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter(function(e){var t;return!(null!=(t=l[e])&&t.failed)}));g=$e({},n,Object.fromEntries(Object.entries(g).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)}))),y=$e({},i,Object.fromEntries(Object.entries(y||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)}))),m=$e({},r,Object.fromEntries(Object.entries(m||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)})))}else g=$e({},n,g),y=$e({},i,y),m=$e({},r,m);t&&t.register($e((_define_property(p={},Zo,Object.keys(ra(g))),_define_property(p,Kn,g||{}),_define_property(p,ea,y||{}),_define_property(p,Xn,m||{}),p),h?_define_property({},na,h):{},d?_define_property({},ii,d):{}))}}}(e,this.Kr,n,i,r),t||(this.Un=!1),this.rs(t)}}},{key:"override",value:function(e,t){void 0===t&&(t=!1),Yo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this._instance.__loaded||!this.Kr)return Yo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Kr.unregister(Qo),this.Kr.unregister(ta),this.rs(),Xo.info("All overrides cleared");if(qe(e)){var t=ia(e);return this.Kr.register(_define_property({},Qo,t)),this.rs(),Xo.info("Flag overrides set",{flags:e})}if(e&&"object"==(void 0===e?"undefined":_type_of(e))&&("flags"in e||"payloads"in e)){var n,i=e;if(this.qn=Boolean(null!==(n=i.suppressWarning)&&void 0!==n&&n),"flags"in i)if(!1===i.flags)this.Kr.unregister(Qo),Xo.info("Flag overrides cleared");else if(i.flags){if(qe(i.flags)){var r=ia(i.flags);this.Kr.register(_define_property({},Qo,r))}else this.Kr.register(_define_property({},Qo,i.flags));Xo.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this.Kr.unregister(ta),Xo.info("Payload overrides cleared")):i.payloads&&(this.Kr.register(_define_property({},ta,i.payloads)),Xo.info("Payload overrides set",{payloads:i.payloads}))),void this.rs()}if(e&&"object"==(void 0===e?"undefined":_type_of(e)))return this.Kr.register(_define_property({},Qo,e)),this.rs(),Xo.info("Flag overrides set",{flags:e});Yo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.Zn){var n=this.ns(),i=n.flags,r=n.flagVariants;e(i,r)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i,r=(this.Wn(Yn)||[]).find(function(t){return t.flagKey===e}),s=_define_property({},"$feature_enrollment/"+e,t),o={$feature_flag:e,$feature_enrollment:t,$set:s};r&&(o.$early_access_feature_name=r.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a,l=$e({},this.getFlagVariants(),_define_property({},e,t));null==(i=this.Kr)||i.register((_define_property(a={},Zo,Object.keys(ra(l))),_define_property(a,Kn,l),a)),this.rs()}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i=this;void 0===t&&(t=!1);var r=this.Wn(Yn),s=n?"&"+n.map(function(e){return"stage="+e}).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:function(t){var n,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(n=i.Kr)||n.unregister(Yn),null==(r=i.Kr)||r.register(_define_property({},Yn,s)),e(s)}}})}},{key:"ns",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:"rs",value:function(e){var t=this.ns(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach(function(t){return t(n,i,{errorsLoading:e})})}},{key:"setPersonPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.Wn(Jn)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,s={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in n||(s[o]=r[o]));this._instance.register(_define_property({},Jn,$e({},n,s,i))),t&&this._instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this._instance.unregister(Jn)}},{key:"setGroupPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.Wn(Zn)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(function(t){n[t]=$e({},n[t],e[t]),delete e[t]}),this._instance.register(_define_property({},Zn,$e({},n,e))),t&&this._instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.Wn(Zn)||{};this._instance.register(_define_property({},Zn,$e({},t,_define_property({},e,{}))))}else this._instance.unregister(Zn)}},{key:"reset",value:function(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}]),e}()},da={sessionRecording:function(){function e(t){if(_class_call_check(this,e),this._forceAllowLocalhostNetworkCapture=!1,this.os=Oo,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw Mo.error("started without valid sessionManager"),new Error(Co+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===pi)throw new Error(Co+' cannot be used with cookieless_mode="always"')}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"Kr",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!(null==(e=this.ss)||!e.isStarted)}},{key:"status",get:function(){var e,t;return this.os===$o||this.os===Io?this.os:null!==(e=null==(t=this.ss)?void 0:t.status)&&void 0!==e?e:this.os}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"us",get:function(){var e,t=!(null==(e=this._instance.get_property(Bn))||!e.enabled),n=!this.Rt.disable_session_recording,i=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return ge&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){var t;if(!this.us||null==(t=this.ss)||!t.isStarted){var n=!ze(Object.assign)&&!ze(Array.from);this.us&&n?(this.hs(e),Mo.info("starting")):(this.os=Oo,this.stopRecording())}}},{key:"hs",value:function(e){var t,n,i,r=this;this.us&&(this.os!==$o&&this.os!==Io&&(this.os=Fo),null!=Re&&null!=(t=Re.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=Re.__PosthogExtensions__)&&n.initSessionRecording?this.cs(e):null==(i=Re.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.ds,function(t){if(t)return Mo.error("could not load recorder",t);r.cs(e)}))}},{key:"stopRecording",value:function(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.stop()}},{key:"vs",value:function(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.discard()}},{key:"fs",value:function(){var e;null==(e=this.Kr)||e.unregister(Vn)}},{key:"ps",value:function(e,t){if(Ke(e))return null;var n,i=Ye(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Mo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}},{key:"gs",value:function(e){var t=this;if(this.Kr){var n,i,r=this.Kr,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.ps(null==(n=t.Rt.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.ps(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Ke(a)&&t.fs();var l=null==i?void 0:i.minimumDurationMilliseconds;r.register(_define_property({},Bn,$e({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:$e({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ze(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})))};s(),null==(n=this.ls)||n.call(this),this.ls=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.gs(e),void this.vs()):(this.gs(e),void this.startIfEnabledOrStop()):(this.os===$o&&(this.os=Io,Mo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}},{key:"log",value:function(e,t){var n;void 0===t&&(t="log"),null!=(n=this.ss)&&n.log?this.ss.log(e,t):Mo.warn("log called before recorder was ready")}},{key:"ds",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Bn);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"ys",value:function(){var e,t=this._instance.get_property(Bn);if(!t)return!1;var n=null!==(e=("object"==(void 0===t?"undefined":_type_of(t))?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-n}},{key:"cs",value:function(e){var t,n;if(null==(t=Re.__PosthogExtensions__)||!t.initSessionRecording)return Mo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ss||(this.ss=null==(n=Re.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Io||this.os===$o)return;return this.os=$o,Mo.info("persisted remote config is stale, requesting fresh config before starting"),void new Dr(this._instance).load()}this.os=Fo,this.ss.start(e)}},{key:"onRRwebEmit",value:function(e){var t;null==(t=this.ss)||null==t.onRRwebEmit||t.onRRwebEmit(e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_linked_flag:!0}),null==(e=this.ss)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_sampling:!0}),null==(e=this.ss)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.ss||null==(n=this.Kr)||n.register(_define_property({},"url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger",!0)),null==(t=this.ss)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.ss)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!(null==(n=this.ss)||!n.tryAddCustomEvent(e,t))}}]),e}()},fa={autocapture:function(){function e(t){_class_call_check(this,e),this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new ko(t.config.rageclick),this.Is=null}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"Rt",get:function(){var e,t,n=He(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null==(e=n.url_allowlist)?void 0:e.map(function(e){return new RegExp(e)}),n.url_ignorelist=null==(t=n.url_ignorelist)?void 0:t.map(function(e){return new RegExp(e)}),n}},{key:"Cs",value:function(){var e=this;if(this.isBrowserSupported()){if(ge&&be){var t=function(t){t=t||(null==ge?void 0:ge.event);try{e.Ss(t)}catch(e){xo.error("Failed to capture event",e)}};if(k(be,"submit",t,{capture:!0}),k(be,"change",t,{capture:!0}),k(be,"click",t,{capture:!0}),this.Rt.capture_copied_text){var n=function(t){e.Ss(t=t||(null==ge?void 0:ge.event),wo)};k(be,"copy",n,{capture:!0}),k(be,"cut",n,{capture:!0})}}}else xo.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}},{key:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this._s=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(_define_property({},jn,!!e.autocapture_opt_out)),this.ws=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this.Is=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null==(t=this.Is)||t.forEach(function(t){var i=null==be?void 0:be.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.props[jn];if(Ve(this.ws)&&!Je(n)&&!this.instance.Tr())return!1;var i=null!==(t=this.ws)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}},{key:"Ss",value:function(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=B(e);D(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&_instanceof(e,MouseEvent)&&this.instance.config.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!ge||ho(e))return!1;var n,i,r;if(Je(t)?(n=!!t&&co,i=void 0):(n=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:co,i=null==t?void 0:t.content_ignorelist),!1===n)return!1;var s=fo(e,!1).targetElementList;return!function(e,t){if(!1===e||ze(e))return!1;var n;if(!0===e)n=uo;else{if(!qe(e))return!1;if(e.length>10)return On.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(function(e){return e.toLowerCase()})}return t.some(function(e){var t=e.safeText,i=e.ariaLabel;return n.some(function(e){return t.includes(e)||i.includes(e)})})}(i,s.map(function(e){var t;return{safeText:z(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!G(s,n)}(i,this.instance.config.rageclick)&&this.Ss(e,"$rageclick");var r=t===wo;if(i&&function(e,t,n,i,r){var s,o,a,l;if(void 0===n&&(n=void 0),!ge||ho(e))return!1;if(null!=(s=n)&&s.url_allowlist&&!W(n.url_allowlist))return!1;if(null!=(o=n)&&o.url_ignorelist&&W(n.url_ignorelist))return!1;if(null!=(a=n)&&a.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(function(e){return t.type===e}))return!1}var c=fo(e,i),h=c.parentIsUsefulElement,d=c.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(ze(n))return!0;var i,r=function(e){if(n.some(function(t){return e.tagName.toLowerCase()===t}))return{v:!0}},s=!0,o=!1,a=void 0;try{for(var l,u=e[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){if(i=r(l.value))return i.v}}catch(e){o=!0,a=e}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return!1}(d,n))return!1;if(!G(d,null==(l=n)?void 0:l.css_selector_allowlist))return!1;var f=ge.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return h?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(lo.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.Rt,r,r?["copy","cut"]:void 0)){var s=function(e,t){for(var n,i,r=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,l=t.elementsChainAsString,u=[e],h=e;h.parentNode&&!L(h,"body");)N(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,f,v,_=[],p={},g=!1,b=!1;if(y(u,function(e){var t=K(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&X(g)&&g),c(H(e),"ph-no-capture")&&(b=!0),_.push(function(e,t,n,i){var r=e.tagName.toLowerCase(),s={tag_name:r};lo.indexOf(r)>-1&&!n&&(s.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?ee(1024,J(e)):ee(1024,z(e)));var o=H(e);o.length>0&&(s.classes=o.filter(function(e){return""!==e})),y(e.attributes,function(n){var r;if((!Y(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&X(n.value)&&(!Be(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=n.value;"class"===n.name&&(o=q(o).join(" ")),s["attr__"+n.name]=ee(1024,o)}});for(var a=1,l=1,u=e;u=te(u);)a++,u.tagName===e.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}(e,s,o,a));var n=function(e){if(!K(e))return{};var t={};return y(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&&X(i)&&(t[n]=i)}}),t}(e);Pi(p,n)}),b)return{props:{},explicitNoCapture:b};if(o||(_[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?J(e):z(e)),g){var k,w;_[0].attr__href=g;var x=null==(k=ar(g))?void 0:k.host,E=null==ge||null==(w=ge.location)?void 0:w.host;x&&E&&x!==E&&(d=g)}return{props:Pi({$event_type:r.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(f=_,function(e){return e.map(function(e){var t,n,i="",r=!0,s=!1,o=void 0;if(e.tag_name&&(i+=e.tag_name),e.attr_class)try{for(var a,l=(e.attr_class.sort(),e.attr_class)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)i+="."+a.value.replace(/"/g,"")}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}var u=$e({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),c={};return m(u).sort(function(e,t){var n=_sliced_to_array(e,1)[0],i=_sliced_to_array(t,1)[0];return n.localeCompare(i)}).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],i=t[1];return c[Z(n.toString())]=Z(i.toString())}),(i+=":")+m(c).map(function(e){var t=_sliced_to_array(e,2);return t[0]+'="'+t[1]+'"'}).join("")}).join(";")}((v=f,v.map(function(e){var t,n,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:Q(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return m(e).filter(function(e){return 0===_sliced_to_array(e,1)[0].indexOf("attr__")}).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=t[1];return i.attributes[n]=r}),i}))))},null!=(n=_[0])&&n.$el_text?{$el_text:null==(i=_[0])?void 0:i.$el_text}:{},d&&"click"===r.type?{$external_click_url:d}:{},p)}}(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===wo){var l,u=U(null==ge||null==(l=ge.getSelection())?void 0:l.toString()),h=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(t,o),!0}}}},{key:"isBrowserSupported",value:function(){return We(null==be?void 0:be.querySelectorAll)}}]),e}(),historyAutocapture:function(){function e(t){var n;_class_call_check(this,e),this._instance=t,this.ks=(null==ge||null==(n=ge.location)?void 0:n.pathname)||""}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"isEnabled",get:function(){return"history_change"===this._instance.config.capture_pageview}},{key:"startIfEnabled",value:function(){this.isEnabled&&(On.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"stop",value:function(){this.xs&&this.xs(),this.xs=void 0,On.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){var e,t;if(ge&&ge.history){var n=this;null!=(e=ge.history.pushState)&&e.__posthog_wrapped__||ne(ge.history,"pushState",function(e){return function(t,i,r){e.call(this,t,i,r),n.Ts("pushState")}}),null!=(t=ge.history.replaceState)&&t.__posthog_wrapped__||ne(ge.history,"replaceState",function(e){return function(t,i,r){e.call(this,t,i,r),n.Ts("replaceState")}}),this.As()}}},{key:"Ts",value:function(e){try{var t,n=null==ge||null==(t=ge.location)?void 0:t.pathname;if(!n)return;n!==this.ks&&this.isEnabled&&this._instance.capture(wi,{navigation_type:e}),this.ks=n}catch(t){On.error("Error capturing "+e+" pageview",t)}}},{key:"As",value:function(){var e=this;if(!this.xs){var t=function(){e.Ts("popstate")};k(ge,"popstate",t),this.xs=function(){ge&&ge.removeEventListener("popstate",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;_class_call_check(this,e),this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(n=this.instance.persistence)||!n.props[Ln]),this.rageclicks=new ko(t.config.rageclick)}return _create_class(e,[{key:"Rt",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return He(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return Ke(this.Rt.capture_heatmaps)?Ke(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this.bs)return;Ao.info("starting..."),this.Ns(),this.Tt()}else{var e;clearInterval(null!==(e=this.Rs)&&void 0!==e?e:void 0),this.Ms(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(_define_property({},Ln,t)),this.Es=t,this.startIfEnabled()}}},{key:"getAndClearBuffer",value:function(){var e=this.T;return this.T=void 0,e}},{key:"Fs",value:function(e){this.wt(e.originalEvent,"deadclick")}},{key:"Tt",value:function(){this.Rs&&clearInterval(this.Rs),this.Rs="visible"===(null==be?void 0:be.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}},{key:"Ns",value:function(){var e=this;ge&&be&&(this.Os=this.Zr.bind(this),k(ge,ki,this.Os),this.Ps=function(t){return e.wt(t||(null==ge?void 0:ge.event))},k(be,"click",this.Ps,{capture:!0}),this.Ls=function(t){return e.Ds(t||(null==ge?void 0:ge.event))},k(be,"mousemove",this.Ls,{capture:!0}),this.Bs=new nr(this.instance,er,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),k(be,bi,this.js),this.bs=!0)}},{key:"Ms",value:function(){var e;ge&&be&&(this.Os&&ge.removeEventListener(ki,this.Os),this.Ps&&be.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&be.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&be.removeEventListener(bi,this.js),clearTimeout(this.qs),null==(e=this.Bs)||e.stop(),this.bs=!1)}},{key:"Zs",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=function(e,t,n){for(var i=e;i&&j(i)&&!L(i,"body");){if(i===n)return!1;if(c(t,null==ge?void 0:ge.getComputedStyle(i).position))return!0;i=V(i)}return!1}(B(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"wt",value:function(e,t){var n;if(void 0===t&&(t="click"),!A(e.target)&&ie(e)){var i=this.Zs(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.$s($e({},i,{type:"rageclick"})),this.$s(i)}}},{key:"Ds",value:function(e){var t=this;!A(e.target)&&ie(e)&&(clearTimeout(this.qs),this.qs=setTimeout(function(){t.$s(t.Zs(e,"mousemove"))},500))}},{key:"$s",value:function(e){if(ge){var t=ge.location.href,n=this.Rt.custom_personal_data_properties,i=this.Rt.mask_personal_data_properties?_to_consumable_array(dr).concat(_to_consumable_array(n||[])):[],r=ur(t,i,vr);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}},{key:"Zr",value:function(){this.T&&!Ue(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:nr,webVitalsAutocapture:function(){function e(t){var n,i=this;_class_call_check(this,e),this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=function(){clearTimeout(i.Vs),0!==i.T.metrics.length&&(i._instance.capture("$web_vitals",i.T.metrics.reduce(function(e,t){var n;return $e({},e,(_define_property(n={},"$web_vitals_"+t.name+"_event",$e({},t)),_define_property(n,"$web_vitals_"+t.name+"_value",t.value),n))},{})),i.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=function(e){var t,n=null==(t=i._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(ze(n))Po.error("Could not read session ID. Dropping metrics!");else{i.T=i.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=i.zs();ze(r)||(Ke(null==e?void 0:e.name)||Ke(null==e?void 0:e.value)?Po.error("Invalid metric received",e):!i.Ys||i.Ys>e.value?(i.T.url!==r&&(i.Hs(),i.Vs=setTimeout(i.Hs,i.flushToCaptureTimeoutMs)),ze(i.T.url)&&(i.T.url=r),i.T.firstMetricTimestamp=ze(i.T.firstMetricTimestamp)?Date.now():i.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),i.T.metrics.push($e({},e,{$current_url:r,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),i.T.metrics.length===i.allowedMetrics.length&&i.Hs()):Po.error("Ignoring metric with value >= "+i.Ys,e))}},this.Us=function(){if(!i.bs){var e,t,n,r,s,o=Re.__PosthogExtensions__;ze(o)||ze(o.postHogWebVitalsCallbacks)||(e=(s=o.postHogWebVitalsCallbacks).onLCP,t=s.onCLS,n=s.onFCP,r=s.onINP),e&&t&&n&&r?(i.allowedMetrics.indexOf("LCP")>-1&&e(i.nt.bind(i)),i.allowedMetrics.indexOf("CLS")>-1&&t(i.nt.bind(i)),i.allowedMetrics.indexOf("FCP")>-1&&n(i.nt.bind(i)),i.allowedMetrics.indexOf("INP")>-1&&r(i.nt.bind(i)),i.bs=!0):Po.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(n=this._instance.persistence)||!n.props[Wn]),this.startIfEnabled()}return _create_class(e,[{key:"Ws",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=He(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return Ke(n)?(null==(t=this._instance.persistence)?void 0:t.props[zn])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(He(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"useAttribution",get:function(){var e=He(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}},{key:"Ys",get:function(){var e=He(this.Ws)&&Ye(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Ro;return e>0&&6e4>=e?Ro:e}},{key:"isEnabled",get:function(){var e=null==ke?void 0:ke.protocol;if("http:"!==e&&"https:"!==e)return Po.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=He(this.Ws)?this.Ws.web_vitals:Je(this.Ws)?this.Ws:void 0;return Je(t)?t:this.Es}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.bs&&(Po.info("enabled, starting..."),this.nr(this.Us))}},{key:"onRemoteConfig",value:function(e){if("capturePerformance"in e){var t=He(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=He(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register(_define_property({},Wn,t)),this._instance.persistence.register(_define_property({},zn,n))),this.Es=t,this.startIfEnabled()}}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",function(t){t?Po.error("failed to load script",t):e()})}},{key:"zs",value:function(){var e=ge?ge.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[];return ur(e,n,vr)}Po.error("Could not determine current URL")}}]),e}()},va={exceptionObserver:function(){function e(t){var n,i,r,s=this;_class_call_check(this,e),this.Us=function(){var e;if(ge&&s.isEnabled&&null!=(e=Re.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Re.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=Re.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Re.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!s.Gs&&s.Rt.capture_unhandled_errors&&(s.Gs=t(s.captureException.bind(s))),!s.Xs&&s.Rt.capture_unhandled_rejections&&(s.Xs=n(s.captureException.bind(s))),!s.Js&&s.Rt.capture_console_errors&&(s.Js=i(s.captureException.bind(s)))}catch(e){Eo.error("failed to start",e),s.Ks()}}},this._instance=t,this.Qs=!(null==(n=this._instance.persistence)||!n.props[Dn]),this.eo=new lt({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,qt:Eo}),this.Rt=this.ro(),this.startIfEnabledOrStop()}return _create_class(e,[{key:"ro",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return He(e)?t=$e({},t,e):(ze(e)?this.Qs:e)&&(t=$e({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(Eo.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",function(t){if(t)return Eo.error("failed to load script",t);e()})}},{key:"Ks",value:function(){var e,t,n;null==(e=this.Gs)||e.call(this),this.Gs=void 0,null==(t=this.Xs)||t.call(this),this.Xs=void 0,null==(n=this.Js)||n.call(this),this.Js=void 0}},{key:"onRemoteConfig",value:function(e){"autocaptureExceptions"in e&&(this.Qs=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register(_define_property({},Dn,this.Qs)),this.Rt=this.ro(),this.startIfEnabledOrStop())}},{key:"onConfigChange",value:function(){this.Rt=this.ro()}},{key:"captureException",value:function(e){var t,n,i,r=null!==(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)&&void 0!==t?t:"Exception";this.eo.consumeRateLimit(r)?Eo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}}]),e}(),exceptions:function(){function e(t){var n,i;_class_call_check(this,e),this.io=[],this.no=new on([new gn,new Pn,new mn,new yn,new En,new xn,new kn,new Sn],function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var r=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var l=pn.test(a)?a.replace(pn,"$1"):a;if(!l.match(/\S*Error: /)){var u=!0,c=!1,h=void 0;try{for(var d,f=n[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var v=(0,d.value)(l,e);if(v){r.push(v);break}}}catch(e){c=!0,h=e}finally{try{u||null==f.return||f.return()}finally{if(c)throw h}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(function(e){return $e({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||an});var n})}(r)}}("web:javascript",dn,_n)),this._instance=t,this.io=null!==(n=null==(i=this._instance.persistence)?void 0:i.get_property(Nn))&&void 0!==n?n:[]}return _create_class(e,[{key:"onRemoteConfig",value:function(e){var t,n,i;if("errorTracking"in e){var r,s=null!==(t=null==(n=e.errorTracking)?void 0:n.suppressionRules)&&void 0!==t?t:[],o=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this.io=s,this._instance.persistence&&this._instance.persistence.register((_define_property(r={},Nn,this.io),_define_property(r,qn,o),r))}}},{key:"so",get:function(){var e,t=!!this._instance.get_property(qn),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=n?n:t)&&void 0!==e&&e}},{key:"buildProperties",value:function(e,t){return this.no.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"sendExceptionEvent",value:function(e){var t=e.$exception_list;if(this.oo(t)){if(this.ao(t))return void sa.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(t))return void sa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(t))return void sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}},{key:"ao",value:function(e){if(0===e.length)return!1;var t=e.reduce(function(e,t){var n=t.type,i=t.value;return Be(n)&&n.length>0&&e.$exception_types.push(n),Be(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.io.some(function(e){var n=e.values.map(function(e){var n,i=Ms[e.operator],r=qe(e.value)?e.value:[e.value],s=null!==(n=t[e.key])&&void 0!==n?n:[];return r.length>0&&i(r,s)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}},{key:"lo",value:function(e){return e.flatMap(function(e){var t,n;return null!==(t=null==(n=e.stacktrace)?void 0:n.frames)&&void 0!==t?t:[]}).some(function(e){return e.filename&&e.filename.startsWith("chrome-extension://")})}},{key:"uo",value:function(e){if(e.length>0){var t,n,i,r,s=null!==(t=null==(n=e[0].stacktrace)?void 0:n.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==i&&i}return!1}},{key:"oo",value:function(e){return!Ke(e)&&qe(e)}}]),e}()},_a=$e({productTours:function(){function e(t){_class_call_check(this,e),this.ho=null,this.co=null,this._instance=t}return _create_class(e,[{key:"Kr",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){"productTours"in e&&(this.Kr&&this.Kr.register(_define_property({},Un,!!e.productTours)),this.loadIfEnabled())}},{key:"loadIfEnabled",value:function(){var e,t,n=this;this.ho||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Un)||this.nr(function(){return n.do()})}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",function(t){t?jo.error("Could not load product tours script",t):e()})}},{key:"do",value:function(){var e;!this.ho&&null!=(e=Re.__PosthogExtensions__)&&e.generateProductTours&&(this.ho=Re.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e,t){var n=this;if(void 0===t&&(t=!1),!qe(this.co)||t){var i=this.Kr;if(i){var r=i.props[Lo];if(qe(r)&&!t)return this.co=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:function(t){var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return jo.error(s),void e([],{isLoaded:!1,error:s})}var o=qe(t.json.product_tours)?t.json.product_tours:[];n.co=o,i&&i.register(_define_property({},Lo,o)),e(o,{isLoaded:!0})}})}else e(this.co,{isLoaded:!0})}},{key:"getActiveProductTours",value:function(e){Ke(this.ho)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.ho)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.ho?this.ho.previewTour(e):this.nr(function(){var n;t.do(),null==(n=t.ho)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.ho)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.ho)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.ho)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.co=null,null==(e=this.Kr)||e.unregister(Lo)}},{key:"resetTour",value:function(e){var t;null==(t=this.ho)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.ho)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.ho)||t.cancelPendingTour(e)}}]),e}()},ha),pa={siteApps:function(){function e(t){_class_call_check(this,e),this._instance=t,this.vo=[],this.apps={}}return _create_class(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"fo",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.vo.push(n),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=Re._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}},{key:"initialize",value:function(){var e=this;if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=function(){t(),e.vo=[],e.po=void 0}}}},{key:"globalsForEvent",value:function(e){var t,n,i,r,s,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{},d=!0,f=!1,v=void 0;try{for(var _,p=Object.entries(h)[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var g=_sliced_to_array(_.value,2),y=g[0],m=g[1];l[y]={id:c[y],type:y,properties:m}}}catch(e){f=!0,v=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw v}}var b=e.$set_once,k=e.$set;return{event:$e({},u(e,Do),{properties:$e({},e.properties,k?{$set:$e({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},k)}:{},b?{$set_once:$e({},null!==(i=null==(r=e.properties)?void 0:r.$set_once)&&void 0!==i?i:{},b)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.vo.length&&(No.info("Processing "+t.vo.length+" events for site app with id "+e.id),t.vo.forEach(function(e){return null==n.processEvent?void 0:n.processEvent(e)}),n.processedBuffer=!0),Object.values(t.apps).every(function(e){return e.processedBuffer||e.errored})&&(null==(i=t.po)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,No.info("Site app with id "+e.id+" "+(t?"loaded":"errored")),r&&i()};try{var o=e.init({posthog:this._instance,callback:function(e){s(e)}}).processEvent;o&&(n.processEvent=o),r=!0}catch(t){No.error(qo+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){No.error("Error while processing buffered events PostHog app with config id "+e.id,t),n.errored=!0}}},{key:"mo",value:function(){var e=this.siteAppLoaders||[],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.apps[o.id]={id:o.id,loaded:!1,errored:!1,processedBuffer:!1}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}var a=!0,l=!1,u=void 0;try{for(var c,h=e[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;this.setupSiteApp(d)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}},{key:"yo",value:function(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e),n=!0,i=!1,r=void 0;try{for(var s,o=Object.values(this.apps)[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;try{null==a.processEvent||a.processEvent(t)}catch(t){No.error("Error while processing event "+e.event+" for site app "+a.id,t)}}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r=this,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",function(e){return r.yo(e)})):void No.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.po)||n.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var o=function(e){var t;Re["__$$ph_site_app_"+e]=s._instance,null==(t=Re.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,v,function(t){if(t)return No.error(qo+e,t)})},a=!0,l=!1,u=void 0;try{for(var c,h=e.siteApps[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value,f=d.id,v=d.url;o(f)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}else No.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}()},ga={tracingHeaders:function(){function e(t){var n=this;_class_call_check(this,e),this.bo=void 0,this.wo=void 0,this.Us=function(){var e,t;ze(n.bo)&&(null==(e=Re.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(n._instance.config.__add_tracing_headers||[],n._instance.get_distinct_id(),n._instance.sessionManager)),ze(n.wo)&&(null==(t=Re.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(n._instance.config.__add_tracing_headers||[],n._instance.get_distinct_id(),n._instance.sessionManager))},this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",function(t){if(t)return So.error("failed to load script",t);e()})}},{key:"startIfEnabledOrStop",value:function(){var e,t;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(e=this.bo)||e.call(this),null==(t=this.wo)||t.call(this),this.bo=void 0,this.wo=void 0)}}]),e}()},ya=$e({surveys:function(){function e(t){_class_call_check(this,e),this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(Ke(t))return Ns.warn("Flags not loaded yet. Not loading surveys.");var n=qe(t);this._o=n?t.length>0:t,Ns.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}},{key:"reset",value:function(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(null!=n&&n.startsWith(qs)||null!=n&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(function(e){return localStorage.removeItem(e)})}},{key:"loadIfEnabled",value:function(){var e=this;if(!this._surveyManager)if(this.Io)Ns.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ns.info(Bo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ns.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Re?void 0:Re.__PosthogExtensions__;if(t){if(!ze(this._o)||this.Rt.advanced_enable_surveys){var n=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var i=t.generateSurveys;if(i)return void this.ko(i,n);var r=t.loadExternalDependency;if(!r)return void this.xo(vi);r(this._instance,"surveys",function(i){i||!t.generateSurveys?e.xo("Could not load surveys script",i):e.ko(t.generateSurveys,n)})}catch(e){throw this.xo("Error initializing surveys",e),e}finally{this.Io=!1}}}else Ns.error("PostHog Extensions not found.")}}},{key:"ko",value:function(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Uo(this._instance),Ns.info("Surveys loaded successfully"),this.To({isLoaded:!0})}},{key:"xo",value:function(e,t){Ns.error(e,t),this.To({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.Co.push(e),this._surveyManager&&this.To({isLoaded:!0}),function(){t.Co=t.Co.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e,t){var n=this;if(void 0===t&&(t=!1),this.Rt.disable_surveys)return Ns.info(Bo),e([]);var i,r=this._instance.get_property(Qn);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then(function(t){var n=t.surveys,i=t.context;return e(n,i)}):("undefined"!=typeof Promise&&(this.So=new Promise(function(e){i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:function(t){var r;n.So=null;var s=t.statusCode;if(200!==s||!t.json){var o="Surveys API could not be loaded, status: "+s;Ns.error(o);var a={isLoaded:!1,error:o};return e([],a),void(null==i||i({surveys:[],context:a}))}var l,u=t.json.surveys||[],c=u.filter(function(e){return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});c.length>0&&(null==(l=n._surveyEventReceiver)||l.register(c)),null==(r=n._instance.persistence)||r.register(_define_property({},Qn,u));var h={isLoaded:!0};e(u,h),null==i||i({surveys:u,context:h})}}))}},{key:"To",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.Co[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;try{if(!e.isLoaded)return o([],e);this.getSurveys(o)}catch(e){Ns.error("Error in survey callback",e)}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"getActiveMatchingSurveys",value:function(e,t){if(void 0===t&&(t=!1),!Ke(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ns.warn("init was not called")}},{key:"Ao",value:function(e){var t=null;return this.getSurveys(function(n){var i;t=null!==(i=n.find(function(t){return t.id===e}))&&void 0!==i?i:null}),t}},{key:"Eo",value:function(e){if(Ke(this._surveyManager))return{eligible:!1,reason:zo};var t="string"==typeof e?this.Ao(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(Ke(this._surveyManager))return Ns.warn("init was not called"),{visible:!1,disabledReason:zo};var t=this.Eo(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;return Ke(this._surveyManager)?(Ns.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:zo})):new Promise(function(i){n.getSurveys(function(t){var r,s=null!==(r=t.find(function(t){return t.id===e}))&&void 0!==r?r:null;if(s){var o=n.Eo(s);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}},{key:"renderSurvey",value:function(e,t,n){var i,r=this;if(Ke(this._surveyManager))Ns.warn("init was not called");else{var s="string"==typeof e?this.Ao(e):e;if(null!=s&&s.id)if(Hs.includes(s.type)){var o=null==be?void 0:be.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(Ns.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(function(){var e,t;Ns.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=r._surveyManager)||t.renderSurvey(s,o,n),Ns.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ns.warn("Survey element not found")}else Ns.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ns.warn("Survey not found")}}},{key:"displaySurvey",value:function(e,t){var n;if(Ke(this._surveyManager))Ns.warn("init was not called");else{var i=this.Ao(e);if(i){var r=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=$e({},i,{appearance:$e({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==$r&&t.initialResponses&&Ns.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.canRenderSurvey(i);if(!s.visible)return void Ns.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==Ir?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else Ns.warn("Survey not found")}}},{key:"cancelPendingSurvey",value:function(e){Ke(this._surveyManager)?Ns.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}]),e}()},ha),ma={toolbar:function(){function e(t){_class_call_check(this,e),this.instance=t}return _create_class(e,[{key:"Ro",value:function(e){Re.ph_toolbar_state=e}},{key:"No",value:function(){var e;return null!==(e=Re.ph_toolbar_state)&&void 0!==e?e:0}},{key:"initialize",value:function(){return this.maybeLoadToolbar()}},{key:"maybeLoadToolbar",value:function(e,t,n){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),w(this.instance.config))return!1;if(!ge||!be)return!1;e=null!=e?e:ge.location,n=null!=n?n:ge.history;try{if(!t){try{ge.localStorage.setItem("test","test"),ge.localStorage.removeItem("test")}catch(e){return!1}t=null==ge?void 0:ge.localStorage}var i,r=Go||cr(e.hash,"__posthog")||cr(e.hash,"state"),s=r?Ri(function(){return JSON.parse(atob(decodeURIComponent(r)))})||Ri(function(){return JSON.parse(decodeURIComponent(r))}):null;return s&&"ph_authorize"===s.action?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Vo)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}},{key:"Mo",value:function(e){var t=Re.ph_load_toolbar||Re.ph_load_editor;!Ke(t)&&We(t)?t(e,this.instance):Ko.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t=this,n=!(null==be||!be.getElementById(hi));if(!ge||n)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=$e({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(ge.localStorage.setItem(Vo,JSON.stringify($e({},r,{source:void 0}))),2===this.No())this.Mo(r);else if(0===this.No()){var s;this.Ro(1),null==(s=Re.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",function(e){if(e)return Ko.error("[Toolbar] Failed to load",e),void t.Ro(0);t.Ro(2),t.Mo(r)}),k(ge,"turbolinks:load",function(){t.Ro(0),t.loadToolbar(r)})}return!0}},{key:"Fo",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(e,t,n){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}]),e}()},ba=$e({experiments:la},ha),ka={conversations:function(){function e(t){_class_call_check(this,e),this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Ke(t)||(Je(t)?this.Oo=t:(this.Oo=t.enabled,this.Lo=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||w(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Re?void 0:Re.__PosthogExtensions__;if(t&&!ze(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var n=t.initConversations;if(n)return this.Do(n),void(this.Po=!1);var i=t.loadExternalDependency;if(!i)return void this.Bo(vi);i(this._instance,"conversations",function(n){n||!t.initConversations?e.Bo("Could not load conversations script",n):e.Do(t.initConversations),e.Po=!1})}catch(e){this.Bo("Error initializing conversations",e),this.Po=!1}}else ua.error("Conversations enabled but missing token in remote config.")}}},{key:"Do",value:function(e){if(this.Lo)try{this._conversationsManager=e(this.Lo,this._instance),ua.info("Conversations loaded successfully")}catch(e){this.Bo("Error completing conversations initialization",e)}else ua.error("Cannot complete initialization: remote config is null")}},{key:"Bo",value:function(e,t){ua.error(e,t),this._conversationsManager=null,this.Po=!1}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():ua.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Oo&&!Ve(this._conversationsManager)}},{key:"isVisible",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}},{key:"sendMessage",value:function(e,t,n){var i=this;return l(function(){return _ts_generator(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(ua.warn(ca),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return l(function(){return _ts_generator(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(ua.warn(ca),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(ua.warn(ca),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(ua.warn(ca),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ua.warn(ca),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ua.warn(ca),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return l(function(){return _ts_generator(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ua.warn(ca),null)]})})()}},{key:"getCurrentTicketId",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}},{key:"getWidgetSessionId",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}},{key:"Ki",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"Qi",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},wa={logs:function(){function e(t){var n;_class_call_check(this,e),this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(n=this._instance.config.logs)&&n.captureConsoleLogs&&(this.jo=!0)}return _create_class(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){var t,n=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Ke(n)&&n&&(this.jo=!0,this.loadIfEnabled())}},{key:"reset",value:function(){}},{key:"loadIfEnabled",value:function(){var e=this;if(this.jo&&!this.qo){var t=Fn("[logs]"),n=null==Re?void 0:Re.__PosthogExtensions__;if(n){var i=n.loadExternalDependency;i?i(this._instance,"logs",function(i){var r;i||null==(r=n.logs)||!r.initializeLogs?t.error("Could not load logs script",i):(n.logs.initializeLogs(e._instance),e.qo=!0)}):t.error(vi)}else t.error("PostHog Extensions not found.")}}}]),e}()},xa=$e({},ha,da,fa,va,_a,pa,ya,ga,ma,ba,ka,wa);ao.__defaultExtensionClasses=$e({},xa);var Ea,Sa=(To=Vs[to]=new ao,function(){function e(){e.done||(e.done=!0,no=!1,y(Vs,function(e){e._dom_loaded()}))}null!=be&&be.addEventListener?"complete"===be.readyState?e():k(be,"DOMContentLoaded",e,{capture:!1}):ge&&On.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),To),Pa={},Ra={type:"posthog",config:{},init:function(e){return _async_to_generator(function(e){var t,n,i,r,s,o,a,l,u;return _ts_generator(this,function(c){switch(c.label){case 0:return t=e.config,n=e.env,(null==(i=t.settings)?void 0:i.apiKey)?(r=se(n),s=i.apiKey,i.identify,i.group,i._state,o=_object_without_properties(i,["apiKey","identify","group","_state"]),a=_object_spread({autocapture:!1,capture_pageview:!1,capture_pageleave:!1},o),l=!1,r.init(s,_object_spread_props(_object_spread({},a),{loaded:function(){l=!0}})),l?[3,2]:[4,Promise.resolve()]):[2,!1];case 1:c.sent(),c.label=2;case 2:return u={lastIdentity:{},lastGroup:{}},[2,_object_spread_props(_object_spread({},t),{settings:_object_spread_props(_object_spread({},i),{_state:u})})]}})}).apply(this,arguments)},push:function(e,t){return _async_to_generator(function(e,t){var r,s,a,l,u,c,h,d,f,v,_,p,g,y,m,b,k,w;return _ts_generator(this,function(x){switch(x.label){case 0:return r=t.config,s=t.rule,a=t.env,l=t.data,u=t.collector,d=se(a),f=r.settings||{},v=(null==s?void 0:s.settings)||{},_=f._state||{},void 0===v.reset?[3,4]:"boolean"!=typeof v.reset?[3,1]:(p=v.reset,[3,3]);case 1:return[4,o(e,v.reset,{collector:u})];case 2:p=x.sent(),x.label=3;case 3:p&&(d.reset(),_.lastIdentity={},_.lastGroup={}),x.label=4;case 4:return void 0===(g=null!==(c=v.identify)&&void 0!==c?c:f.identify)?[3,6]:[4,o(e,g,{collector:u})];case 5:y=x.sent(),n(y)&&(_.lastIdentity=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=_object_spread({},r),o=t.distinctId,a=n(t.$set)?t.$set:void 0,l=n(t.$set_once)?t.$set_once:void 0;return i(o)&&""!==o?(o!==r.distinctId||a||l)&&(e.identify(o,a,l),s.distinctId=o):(a||l)&&e.setPersonProperties(a,l),s}(d,y,_.lastIdentity)),x.label=6;case 6:return void 0===(m=null!==(h=v.group)&&void 0!==h?h:f.group)?[3,8]:[4,o(e,m,{collector:u})];case 7:b=x.sent(),n(b)&&(_.lastGroup=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=_object_spread({},r),o=t.type,a=t.key,l=n(t.properties)?t.properties:void 0;return i(o)&&i(a)&&(o!==r.type||a!==r.key||l)&&(e.group(o,a,l),s.type=o,s.key=a),s}(d,b,_.lastGroup)),x.label=8;case 8:return!0!==(null==s?void 0:s.skip)&&(k=i(null==s?void 0:s.name)?s.name:e.name,w=n(l)?l:{},d.capture(k,w)),f._state=_,[2]}})}).apply(this,arguments)},on:function(e,t){var n;if("consent"===e&&(null==t?void 0:t.data)){var i=se(t.env),r=t.data,s=null===(n=t.config)||void 0===n?void 0:n.consent;if(s&&0!==Object.keys(s).length)Object.keys(s).every(function(e){return!0===r[e]})?i.opt_in_capturing():i.opt_out_capturing()}}},Oa=Ra;return Ea=ce,function(e,t,n,i){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var r=!0,s=!1,o=void 0;try{for(var a,l=function(){var r=a.value;ue.call(e,r)||r===n||oe(e,r,{get:function(){return t[r]},enumerable:!(i=ae(t,r))||i.enumerable})},u=le(t)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)l()}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}}return e}(oe({},"__esModule",{value:!0}),Ea)}();
1
+ "use strict";function _array_like_to_array(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 _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,n,i,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,i,r,o,a,"next",e)}function a(e){asyncGeneratorStep(s,i,r,o,a,"throw",e)}o(void 0)})}}function _call_super(e,t,n){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,n||[],_get_prototype_of(e).constructor):t.apply(e,n))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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 _create_class(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(s.push(i.value),!t||s.length!==t);o=!0);}catch(e){a=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw r}}return s}}function _non_iterable_rest(){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 _non_iterable_spread(){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 _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){_define_property(e,t,n[t])})}return e}function ownKeys(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 _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _object_without_properties(e,t){if(null==e)return{};var n,i,r,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}if(s=_object_without_properties_loose(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}function _object_without_properties_loose(e,t){if(null==e)return{};var n,i,r={},s=Object.getOwnPropertyNames(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}function _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(e,t):void 0}}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}function _ts_generator(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(o,"next",{value:l(0)}),a(o,"throw",{value:l(1)}),a(o,"return",{value:l(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(e){return void 0!==e},n=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},i=function(e){return"string"==typeof e},r=function(e){return _e(e)?e:void 0},s=function(e,t,n){return function(){for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return _async_to_generator(function(){var i;return _ts_generator(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(r))];case 1:case 3:return[2,s.sent()];case 2:return i=s.sent(),t?[4,t(i)]:[2];case 4:return[4,null==n?void 0:n()];case 5:return s.sent(),[7];case 6:return[2]}})})()}},o=function(i){return _async_to_generator(function(i){var r,o,a,l,u,c,h,d,f,v,_,p,g,y,m,b,k=arguments;return _ts_generator(this,function(w){switch(w.label){case 0:if(r=k.length>1&&void 0!==k[1]?k[1]:{},o=k.length>2&&void 0!==k[2]?k[2]:{},!t(i))return[2];if(u=n(i)&&i.consent||o.consent||(null===(l=o.collector)||void 0===l?void 0:l.consent),c=null!==(a=o.event)&&void 0!==a?a:n(i)?i:{},!o.collector)throw new Error("getMappingValue: context.collector is required");h={event:c,mapping:r,collector:o.collector,logger:o.collector.logger,consent:u},d=e(r)?r:[r],f=!0,v=!1,_=void 0,w.label=1;case 1:w.trys.push([1,6,7,8]),p=d[Symbol.iterator](),w.label=2;case 2:return(f=(g=p.next()).done)?[3,5]:(y=g.value,[4,s(pe)(i,y,_object_spread_props(_object_spread({},h),{mapping:y}))]);case 3:if(m=w.sent(),t(m))return[2,m];w.label=4;case 4:return f=!0,[3,2];case 5:return[3,8];case 6:return b=w.sent(),v=!0,_=b,[3,8];case 7:try{f||null==p.return||p.return()}finally{if(v)throw _}return[7];case 8:return[2]}})}).apply(this,arguments)},a=function(e,t,n,i,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)},l=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){a(s,i,r,o,l,"next",e)}function l(e){a(s,i,r,o,l,"throw",e)}o(void 0)})}},u=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n},c=function(e,t){return-1!==e.indexOf(t)},h=function(e){return null===e||"object"!=(void 0===e?"undefined":_type_of(e))},d=function(e,t){return{}.toString.call(e)==="[object "+t+"]"},f=function(e){return"undefined"!=typeof Event&&function(e,t){try{return _instanceof(e,t)}catch(e){return!1}}(e,Event)},v=function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return ot&&n.length===st||(st=n.length,ot=n.reduce(function(n,i){rt||(rt={});var r=rt[i];if(r)n[r[0]]=r[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){n[l]=u,rt[i]=[l,u];break}}return n},{})),ot}},_=function(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?an:n,in_app:!0};return ze(i)||(s.lineno=i),ze(r)||(s.colno=r),s},p=function(e,t){void 0===t&&(t=40);var 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(t>=r.length)return i===n.length?r:r.length>t?r.slice(0,t)+"...":r}return""},g=function(e,t){qe(e)&&e.forEach(t)},y=function(e,t){if(!Ke(e))if(qe(e))e.forEach(t);else if(Ze(e))e.forEach(function(e,n){return t(e,n)});else for(var n in e)De.call(e,n)&&t(e[n],n)},m=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i},b=function(e){var t=null==e?void 0:e.hostname;if(!Be(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=$i[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){if(n===o.value)return!1}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return!0},k=function(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=void 0!==s&&s,a=r.passive,l=void 0===a||a;null==e||e.addEventListener(t,n,{capture:o,passive:l})},w=function(e){return"ph_toolbar_internal"===e.name},x=function(e,t){var n=void 0===t?{}:t,i=n.organization,r=n.projectId,s=n.prefix,o=n.severityAllowList,a=void 0===o?["error"]:o,l=n.sendExceptionsToPostHog,u=void 0===l||l;return function(t){var n,o,l,c,h;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+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,v=(null==(n=t.exception)?void 0:n.values)||[],_=v.map(function(e){return $e({},e,{stacktrace:e.stacktrace?$e({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return $e({},e,{platform:"web:javascript"})})}):void 0})}),p={$exception_message:(null==(o=v[0])?void 0:o.value)||t.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:t.level,$exception_list:_,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),u&&(null==(f=e.exceptions)||f.sendExceptionEvent(p)),t}},E=function(e,t,n){if(!be)return{};var i,r=t?_to_consumable_array(dr).concat(_to_consumable_array(n||[])):[],s=S(ur(be.URL,r,vr),e),o=(i={},y(_r,function(e){var t=zi.Wt(e);i[e]=t||null}),i);return Pi(o,s)},S=function(e,t){var n=fr.concat(t||[]),i={};return y(n,function(t){var n=lr(e,t);i[t]=n||null}),i},P=function(e){var t,n=(t=e)?0===t.search(hr+"google.([^/?]*)")?"google":0===t.search(hr+"bing.com")?"bing":0===t.search(hr+"yahoo.com")?"yahoo":0===t.search(hr+"duckduckgo.com")?"duckduckgo":null:null,i="yahoo"!=n?"q":"p",r={};if(!Ve(n)){r.$search_engine=n;var s=be?lr(be.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},R=function(){return navigator.language||navigator.userLanguage},O=function(){return(null==be?void 0:be.referrer)||pr},F=function(e,t){var n=e?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[],i=null==ke?void 0:ke.href.substring(0,1e3);return{r:O().substring(0,1e3),u:i?ur(i,n,vr):void 0}},$=function(e){var t,n=e.r,i=e.u,r={$referrer:n,$referring_domain:null==n?void 0:n==pr?pr:null==(t=ar(n))?void 0:t.host};if(i){r.$current_url=i;var s=ar(i);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var o=S(i);Pi(r,o)}if(n){var a=P(n);Pi(r,a)}return r},I=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},T=function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},C=function(e,t,n){return ys({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})},M=function(e,t){return!e||Object.entries(e).every(function(e){var n=_sliced_to_array(e,2),i=n[0],r=n[1],s=null==t?void 0:t[i];if(ze(s)||Ve(s))return!1;var o=[String(s)],a=Ms[r.operator];return!!a&&a(r.values,o)})},A=function(e){return _instanceof(e,Element)&&(e.id===hi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))},j=function(e){return!!e&&1===e.nodeType},L=function(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()},D=function(e){return!!e&&3===e.nodeType},N=function(e){return!!e&&11===e.nodeType},q=function(e){return e?Ae(e).split(/\s+/):[]},W=function(e){var t=null==ge?void 0:ge.location.href;return!!(t&&e&&e.some(function(e){return t.match(e)}))},H=function(e){var t="";switch(_type_of(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 q(t)},U=function(e){return Ke(e)?null:Ae(e).split(/(\s+)/).filter(function(e){return X(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)},z=function(e){var t="";return K(e)&&!Y(e)&&e.childNodes&&e.childNodes.length&&y(e.childNodes,function(e){var n;D(e)&&e.textContent&&(t+=null!==(n=U(e.textContent))&&void 0!==n?n:"")}),Ae(t)},B=function(e){return ze(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},G=function(e,t){if(ze(t))return!0;var n,i=function(e){if(t.some(function(t){return e.matches(t)}))return{v:!0}},r=!0,s=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){if(n=i(a.value))return n.v}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}return!1},V=function(e){var t=e.parentNode;return!(!t||!j(t))&&t},K=function(e){for(var t=e;t.parentNode&&!L(t,"body");t=t.parentNode){var n=H(t);if(c(n,"ph-sensitive")||c(n,"ph-no-capture"))return!1}if(c(H(e),"ph-include"))return!0;var i=e.type||"";if(Be(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Be(r)||!/^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,""))},Y=function(e){return!!(L(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||L(e,"select")||L(e,"textarea")||"true"===e.getAttribute("contenteditable"))},X=function(e,t){if(void 0===t&&(t=!0),Ke(e))return!1;if(Be(e)){if(e=Ae(e),(t?_o:po).test((e||"").replace(/[- ]/g,"")))return!1;if((t?yo:mo).test(e))return!1}return!0},J=function(e){var t=z(e);return X(t=(t+" "+bo(e)).trim())?t:""},Z=function(e){return e.replace(/"|\\"/g,'\\"')},Q=function(e){var t=e.attr__class;return t?qe(t)?t:q(t):void 0},ee=function(e,t){return t.length>e?t.slice(0,e)+"...":t},te=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!j(t));return t},ne=function(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return We(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(){}}},ie=function(e){return He(e)&&"clientX"in e&&"clientY"in e&&Ye(e.clientX)&&Ye(e.clientY)},re=function(e,t,n){if(Ke(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}},se=function(e){var t;return null!==(t=null==e?void 0:e.posthog)&&void 0!==t?t:Sa},oe=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,le=Object.getOwnPropertyNames,ue=Object.prototype.hasOwnProperty,ce={};!function(e,t){for(var n in t)oe(e,n,{get:t[n],enumerable:!0})}(ce,{DestinationPostHog:function(){return Pa},default:function(){return Oa},destinationPostHog:function(){return Ra}});var he=Object.defineProperty;!function(e,t){for(var n in t)he(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return fe}});var de,fe=((de=fe||{})[de.ERROR=0]="ERROR",de[de.WARN=1]="WARN",de[de.INFO=2]="INFO",de[de.DEBUG=3]="DEBUG",de);function ve(n){for(var i=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),s=n,o=0;o<r.length;o++){var a=r[o];if("*"===a&&e(s)){var l=r.slice(o+1).join("."),u=[],c=!0,h=!1,d=void 0;try{for(var f,v=s[Symbol.iterator]();!(c=(f=v.next()).done);c=!0){var _=ve(f.value,l,i);u.push(_)}}catch(e){h=!0,d=e}finally{try{c||null==v.return||v.return()}finally{if(h)throw d}}return u}if(void 0===(s=_instanceof(s,Object)?s[a]:void 0))break}return t(s)?s:i}function _e(r){return function(e){return"boolean"==typeof e}(r)||i(r)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(r)||!t(r)||e(r)&&r.every(_e)||n(r)&&Object.values(r).every(_e)}function pe(n,a,l){return _async_to_generator(function(){return _ts_generator(this,function(u){return[2,(e(a)?a:[a]).reduce(function(a,u){return _async_to_generator(function(){var c,h,d,f,v,_,p,g,y,m,b,k,w,x,E,S,P,R,O,F,$,I;return _ts_generator(this,function(T){switch(T.label){case 0:return[4,a];case 1:return(c=T.sent())?[2,c]:(h=i(u)?{key:u}:u,Object.keys(h).length?(d=h.condition,f=h.consent,v=h.fn,_=h.key,p=h.loop,g=h.map,y=h.set,m=h.validate,b=h.value,k=_object_spread_props(_object_spread({},l),{mapping:u}),(w=d)?[4,s(d)(n,k)]:[3,3]):[2]);case 2:w=!T.sent(),T.label=3;case 3:return w?[2]:f&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n={},i=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(r){t[r]&&(n[r]=!0,e&&e[r]&&(i=!0))}),!!i&&n}(f,k.consent)?[2,b]:(x=t(b)?b:n,v?[4,s(v)(n,k)]:[3,5]);case 4:x=T.sent(),T.label=5;case 5:return _&&(x=ve(n,_,b)),p?(E=_sliced_to_array(p,2),S=E[0],P=E[1],"this"!==S?[3,6]:(O=[n],[3,8])):[3,11];case 6:return[4,o(n,S,k)];case 7:O=T.sent(),T.label=8;case 8:return e(R=O)?[4,Promise.all(R.map(function(e){return o(e,P,k)}))]:[3,10];case 9:x=T.sent().filter(t),T.label=10;case 10:return[3,17];case 11:return g?[4,Object.entries(g).reduce(function(e,i){var r=_sliced_to_array(i,2),s=r[0],a=r[1];return _async_to_generator(function(){var i,r;return _ts_generator(this,function(l){switch(l.label){case 0:return[4,e];case 1:return i=l.sent(),[4,o(n,a,k)];case 2:return r=l.sent(),[2,(t(r)&&(i[s]=r),i)]}})})()},Promise.resolve({}))]:[3,13];case 12:return x=T.sent(),[3,16];case 13:return(F=y)?[4,Promise.all(y.map(function(e){return pe(n,e,k)}))]:[3,15];case 14:F=x=T.sent(),T.label=15;case 15:T.label=16;case 16:T.label=17;case 17:return($=m)?[4,s(m)(x,k)]:[3,19];case 18:$=!T.sent(),T.label=19;case 19:return $&&(x=void 0),I=r(x),[2,t(I)?I:r(b)]}})})()},Promise.resolve(void 0))]})})()}var ge="undefined"!=typeof window?window:void 0,ye="undefined"!=typeof globalThis?globalThis:ge;"undefined"==typeof self&&(ye.self=ye),"undefined"==typeof File&&(ye.File=function(){});var me=null==ye?void 0:ye.navigator,be=null==ye?void 0:ye.document,ke=null==ye?void 0:ye.location,we=null==ye?void 0:ye.fetch,xe=null!=ye&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,Ee=null==ye?void 0:ye.AbortController,Se=null==ye?void 0:ye.CompressionStream,Pe=null==me?void 0:me.userAgent,Re=null!=ge?ge:{},Oe="1.367.0",Fe={DEBUG:!1,LIB_VERSION:Oe,LIB_NAME:"web",JS_SDK_VERSION:Oe};function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$e.apply(null,arguments)}function Ie(){return(Ie=l(function(e,t){var n,i;return _ts_generator(this,function(r){switch(r.label){case 0:void 0===t&&(t=!0),r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip")),[4,new Response(n).blob()];case 2:return[2,r.sent()];case 3:return i=r.sent(),[2,(t&&console.error("Failed to gzip compress data",i),null)];case 4:return[2]}})})).apply(this,arguments)}var Te=["$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"],Ce=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Me=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Ce.concat(t).some(function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)})},Ae=function(e){return e.trim()},je=function(e){return e.replace(/^\$/,"")},Le=Object.prototype,De=Le.hasOwnProperty,Ne=Le.toString,qe=Array.isArray||function(e){return"[object Array]"===Ne.call(e)},We=function(e){return"function"==typeof e},He=function(e){return e===Object(e)&&!qe(e)},Ue=function(e){if(He(e)){for(var t in e)if(De.call(e,t))return!1;return!0}return!1},ze=function(e){return void 0===e},Be=function(e){return"[object String]"==Ne.call(e)},Ge=function(e){return Be(e)&&0===e.trim().length},Ve=function(e){return null===e},Ke=function(e){return ze(e)||Ve(e)},Ye=function(e){return"[object Number]"==Ne.call(e)&&e==e},Xe=function(e){return Ye(e)&&e>0},Je=function(e){return"[object Boolean]"===Ne.call(e)},Ze=function(e){return _instanceof(e,FormData)},Qe=function(e){return c(Te,e)},et=[!0,"true",1,"1","yes"],tt=function(e){return c(et,e)},nt=[!1,"false",0,"0","no"];function it(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),Ye(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),it(r||n,t,n,i))}var rt,st,ot,at,lt=function(){function e(t){_class_call_check(this,e),this.Pt={},this.Dt=t.Dt,this.jt=it(t.bucketSize,0,100,t.qt),this.$t=it(t.refillRate,0,this.jt,t.qt),this.Ht=it(t.refillInterval,0,864e5,t.qt)}return _create_class(e,[{key:"Vt",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.Ht);n>0&&(e.tokens=Math.min(e.tokens+n*this.$t,this.jt),e.lastAccess=e.lastAccess+n*this.Ht)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.Pt[i];return r?this.Vt(r,n):this.Pt[i]=r={tokens:this.jt,lastAccess:n},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.Pt={}}}]),e}(),ut="Mobile",ct="iOS",ht="Android",dt="Tablet",ft=ht+" "+dt,vt="iPad",_t="Apple",pt=_t+" Watch",gt="Safari",yt="BlackBerry",mt="Samsung",bt=mt+"Browser",kt=mt+" Internet",wt="Chrome",xt=wt+" OS",Et=wt+" "+ct,St="Internet Explorer",Pt=St+" "+ut,Rt="Opera",Ot=Rt+" Mini",Ft="Edge",$t="Microsoft "+Ft,It="Firefox",Tt=It+" "+ct,Ct="Nintendo",Mt="PlayStation",At="Xbox",jt=ht+" "+ut,Lt=ut+" "+gt,Dt="Windows",Nt=Dt+" Phone",qt="Nokia",Wt="Ouya",Ht="Generic",Ut=Ht+" "+ut.toLowerCase(),zt=Ht+" "+dt.toLowerCase(),Bt="Konqueror",Gt="(\\d+(\\.\\d+)?)",Vt=new RegExp("Version/"+Gt),Kt=new RegExp(At,"i"),Yt=new RegExp(Mt+" \\w+","i"),Xt=new RegExp(Ct+" \\w+","i"),Jt=new RegExp(yt+"|PlayBook|BB10","i"),Zt={"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"},Qt=function(e,t){return t=t||"",c(e," OPR/")&&c(e,"Mini")?Ot:c(e," OPR/")?Rt:Jt.test(e)?yt:c(e,"IE"+ut)||c(e,"WPDesktop")?Pt:c(e,bt)?kt:c(e,Ft)||c(e,"Edg/")?$t:c(e,"FBIOS")?"Facebook "+ut:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?Et:c(e,"CrMo")||c(e,wt)?wt:c(e,ht)&&c(e,gt)?jt:c(e,"FxiOS")?Tt:c(e.toLowerCase(),Bt.toLowerCase())?Bt:(n=e,(i=t)&&c(i,_t)||c(r=n,gt)&&!c(r,wt)&&!c(r,ht)?c(e,ut)?Lt:gt:c(e,It)?It:c(e,"MSIE")||c(e,"Trident/")?St:c(e,"Gecko")?It:"");var n,i,r},en=(_define_property(at={},Pt,[new RegExp("rv:"+Gt)]),_define_property(at,$t,[new RegExp(Ft+"?\\/"+Gt)]),_define_property(at,wt,[new RegExp("("+wt+"|CrMo)\\/"+Gt)]),_define_property(at,Et,[new RegExp("CriOS\\/"+Gt)]),_define_property(at,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+Gt)]),_define_property(at,gt,[Vt]),_define_property(at,Lt,[Vt]),_define_property(at,Rt,[new RegExp("(Opera|OPR)\\/"+Gt)]),_define_property(at,It,[new RegExp(It+"\\/"+Gt)]),_define_property(at,Tt,[new RegExp("FxiOS\\/"+Gt)]),_define_property(at,Bt,[new RegExp("Konqueror[:/]?"+Gt,"i")]),_define_property(at,yt,[new RegExp(yt+" "+Gt),Vt]),_define_property(at,jt,[new RegExp("android\\s"+Gt,"i")]),_define_property(at,kt,[new RegExp(bt+"\\/"+Gt)]),_define_property(at,St,[new RegExp("(rv:|MSIE )"+Gt)]),_define_property(at,"Mozilla",[new RegExp("rv:"+Gt)]),at),tn=function(e,t){var n=Qt(e,t),i=en[n];if(ze(i))return null;for(var r=0;i.length>r;r++){var s=e.match(i[r]);if(s)return parseFloat(s[s.length-2])}return null},nn=[[new RegExp(At+"; "+At+" (.*?)[);]","i"),function(e){return[At,e&&e[1]||""]}],[new RegExp(Ct,"i"),[Ct,""]],[new RegExp(Mt,"i"),[Mt,""]],[Jt,[yt,""]],[new RegExp(Dt,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[Nt,""];if(new RegExp(ut).test(t)&&!/IEMobile\b/.test(t))return[Dt+" "+ut,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=Zt[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Dt,i]}return[Dt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?[ct,[e[3],e[4],e[5]||"0"].join(".")]:[ct,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=ze(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ht+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ht+")","i"),function(e){return e&&e[2]?[ht,[e[2],e[3],e[4]||"0"].join(".")]:[ht,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[xt,""]],[/Linux|debian/i,["Linux",""]]],rn=function(e){return Xt.test(e)?Ct:Yt.test(e)?Mt:Kt.test(e)?At:new RegExp(Wt,"i").test(e)?Wt:new RegExp("("+Nt+"|WPDesktop)","i").test(e)?Nt:/iPad/.test(e)?vt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?pt:Jt.test(e)?yt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(qt,"i").test(e)?qt:/(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(ut).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)?ht:ft:new RegExp("(pda|"+ut+")","i").test(e)?Ut:new RegExp(dt,"i").test(e)&&!new RegExp(dt+" pc","i").test(e)?zt:""},sn=function(e){return _instanceof(e,Error)},on=function(){function e(t,n,i){_class_call_check(this,e),void 0===i&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}return _create_class(e,[{key:"buildFromUnknown",value:function(e,t){void 0===t&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),r=this.buildParsingContext(t),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,n),$exception_level:"error"}}},{key:"modifyFrames",value:function(e){var t=this;return l(function(){var n,i,r,s,o,a,l,u;return _ts_generator(this,function(c){switch(c.label){case 0:n=!0,i=!1,r=void 0,c.label=1;case 1:c.trys.push([1,7,8,9]),s=e[Symbol.iterator](),c.label=2;case 2:return(n=(o=s.next()).done)?[3,6]:(a=o.value,a.stacktrace&&a.stacktrace.frames&&qe(a.stacktrace.frames)?(l=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)]):[3,4]);case 3:l.frames=c.sent(),c.label=4;case 4:c.label=5;case 5:return n=!0,[3,2];case 6:return[3,9];case 7:return u=c.sent(),i=!0,r=u,[3,9];case 8:try{n||null==s.return||s.return()}finally{if(i)throw r}return[7];case 9:return[2,e]}})})()}},{key:"coerceFallback",value:function(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}},{key:"parseStacktrace",value:function(e,t){var n,i;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),$e({},e,{cause:n,stack:i})}},{key:"applyChunkIds",value:function(e,t){return e.map(function(e){return e.filename&&t&&(e.chunk_id=t[e.filename]),e})}},{key:"applyCoercers",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=this.coercers[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(a.match(e))return a.coerce(e,t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return this.coerceFallback(t)}},{key:"applyModifiers",value:function(e){var t=this;return l(function(){var n,i,r,s,o,a,l;return _ts_generator(this,function(u){switch(u.label){case 0:n=e,i=!0,r=!1,s=void 0,u.label=1;case 1:u.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),u.label=2;case 2:return(i=(a=o.next()).done)?[3,5]:[4,(0,a.value)(n)];case 3:n=u.sent(),u.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return l=u.sent(),r=!0,s=l,[3,8];case 7:try{i||null==o.return||o.return()}finally{if(r)throw s}return[7];case 8:return[2,n]}})})()}},{key:"convertToExceptionList",value:function(e,t){var n,i,r,s,o={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&(n=a).push.apply(n,_to_consumable_array(this.convertToExceptionList(e.cause,$e({},t,{handled:!0})))),a}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:v(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}},{key:"buildCoercingContext",value:function(e,t,n){var i=this;void 0===n&&(n=0);var r=function(n,r){if(4>=r){var s=i.buildCoercingContext(e,t,r);return i.applyCoercers(n,s)}};return $e({},t,{syntheticException:0==n?t.syntheticException:void 0,mechanism:e,apply:function(e){return r(e,n)},next:function(e){return r(e,n+1)}})}}]),e}(),an="?",ln=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]:an,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},un=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hn=/\((\S*)(?::(\d+))(?::(\d+))\)/,dn=function(e,t){var n=un.exec(e);if(n){var i=_sliced_to_array(n,4),r=i[1],s=i[2],o=i[3];return _(t,r,an,+s,+o)}var a=cn.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var l=hn.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var u=_sliced_to_array(ln(a[1]||an,a[2]),2),c=u[0],h=u[1];return _(t,h,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},fn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_n=function(e,t){var n=fn.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=vn.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var r,s=n[3],o=n[1]||an;return o=(r=_sliced_to_array(ln(o,s),2))[0],s=r[1],_(t,s,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},pn=/\(error: (.*)\)/,gn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return this.isDOMException(e)||this.isDOMError(e)}},{key:"coerce",value:function(e,t){var n=Be(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return this.isDOMError(e)?"DOMError":"DOMException"}},{key:"getValue",value:function(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}},{key:"isDOMException",value:function(e){return d(e,"DOMException")}},{key:"isDOMError",value:function(e){return d(e,"DOMError")}}]),e}(),yn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return _instanceof(e,Error)}},{key:"coerce",value:function(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return e.name||e.constructor.name}},{key:"getMessage",value:function(e,t){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}},{key:"getStack",value:function(e){return e.stacktrace||e.stack||void 0}}]),e}(),mn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return d(e,"ErrorEvent")&&null!=e.error}},{key:"coerce",value:function(e,t){var n;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),bn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,kn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return"string"==typeof e}},{key:"coerce",value:function(e,t){var n,i=_sliced_to_array(this.getInfos(e),2),r=i[0],s=i[1];return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}},{key:"getInfos",value:function(e){var t="Error",n=e,i=e.match(bn);return i&&(t=i[1],n=i[2]),[t,n]}}]),e}(),wn=["fatal","error","warning","log","info","debug"],xn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e}},{key:"coerce",value:function(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(n=t.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}},{key:"getType",value:function(e){return f(e)?e.constructor.name:"Error"}},{key:"getValue",value:function(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+p(e)}},{key:"isSeverityLevel",value:function(e){return Be(e)&&!Ge(e)&&wn.indexOf(e)>=0}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(sn(n))return n}}},{key:"getObjectClassName",value:function(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}]),e}(),En=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return f(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+p(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Sn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return h(e)}},{key:"coerce",value:function(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Pn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return d(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!f(e))return!1;try{var t=e.detail;return null!=t&&"object"==(void 0===t?"undefined":_type_of(t))&&"reason"in t}catch(e){return!1}}},{key:"coerce",value:function(e,t){var n,i=this.getUnhandledRejectionReason(e);return h(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(i)}},{key:"getUnhandledRejectionReason",value:function(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==_type_of(e.detail)&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}]),e}(),Rn=function(e,t){var n=(void 0===t?{}:t).debugEnabled,i={C:function(t){if(ge&&(Fe.DEBUG||Re.POSTHOG_DEBUG||n)&&!ze(ge.console)&&ge.console){for(var i=("__rrweb_original__"in ge.console[t]?ge.console[t].__rrweb_original__:ge.console[t]),r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];i.apply(void 0,[e].concat(_to_consumable_array(s)))}},info:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["log"].concat(_to_consumable_array(n)))},warn:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["warn"].concat(_to_consumable_array(n)))},error:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).C.apply(e,["error"].concat(_to_consumable_array(n)))},critical:function(){for(var t,n=arguments.length,i=new Array(n),r=0;n>r;r++)i[r]=arguments[r];(t=console).error.apply(t,[e].concat(_to_consumable_array(i)))},uninitializedWarning:function(e){i.error("You must initialize PostHog before calling "+e)},createLogger:function(t,n){return Rn(e+" "+t,n)}};return i},On=Rn("[PostHog.js]"),Fn=On.createLogger,$n=Fn("[ExternalScriptsLoader]"),In=function(e,t,n){if(e.config.disable_external_dependency_loading)return $n.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==be?void 0:be.querySelectorAll("script");if(i)for(var r,s=function(){if(i[o].src===t){var e=i[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener("load",function(t){e.__posthog_loading_callback_fired=!0,n(void 0,t)}),e.onerror=function(e){return n(e)},{v:void 0})}},o=0;i.length>o;o++)if(r=s())return r.v;var a=function(){if(!be)return n("document not found");var i=be.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=function(e){i.__posthog_loading_callback_fired=!0,n(void 0,e)},i.onerror=function(e){return n(e)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)be.head.appendChild(i);else{var r,s=be.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):be.body.appendChild(i)}};null!=be&&be.body?a():null==be||be.addEventListener("DOMContentLoaded",a)};Re.__PosthogExtensions__=Re.__PosthogExtensions__||{},Re.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"!==t)if(e._resolvedSdkVersion){var i=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");In(e,i,n)}else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var o=e.requestRouter.endpointFor("assets",r);In(e,o,n)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");In(e,a,n)}},Re.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);In(e,i,n)};var Tn="$people_distinct_id",Cn="$device_id",Mn="__alias",An="__timers",jn="$autocapture_disabled_server_side",Ln="$heatmaps_enabled_server_side",Dn="$exception_capture_enabled_server_side",Nn="$error_tracking_suppression_rules",qn="$error_tracking_capture_extension_exceptions",Wn="$web_vitals_enabled_server_side",Hn="$dead_clicks_enabled_server_side",Un="$product_tours_enabled_server_side",zn="$web_vitals_allowed_metrics",Bn="$session_recording_remote_config",Gn="$sesid",Vn="$session_is_sampled",Kn="$enabled_feature_flags",Yn="$early_access_features",Xn="$feature_flag_details",Jn="$stored_person_properties",Zn="$stored_group_properties",Qn="$surveys",ei="$flag_call_reported",ti="$flag_call_reported_session_id",ni="$feature_flag_errors",ii="$feature_flag_evaluated_at",ri="$user_state",si="$client_session_props",oi="$capture_rate_limit",ai="$initial_campaign_params",li="$initial_referrer_info",ui="$initial_person_info",ci="$epp",hi="__POSTHOG_TOOLBAR__",di="$posthog_cookieless",fi=[Tn,Mn,"__cmpns",An,"$session_recording_enabled_server_side",Ln,Gn,Kn,Nn,ri,Yn,Xn,Zn,Jn,Qn,ei,ti,ni,ii,si,oi,ai,li,ci,ui],vi="PostHog loadExternalDependency extension not found.",_i="on_reject",pi="always",gi="anonymous",yi="identified",mi="identified_only",bi="visibilitychange",ki="beforeunload",wi="$pageview",xi="$pageleave",Ei="$identify",Si="$groupidentify",Pi=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];var r=!0,s=!1,o=void 0;try{for(var a,l=n[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;for(var c in u)void 0!==u[c]&&(e[c]=u[c])}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}return e},Ri=function(e){try{return e()}catch(e){return}},Oi=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){On.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),On.critical(e)}}},Fi=function(e){var t={};return y(e,function(e,n){(Be(e)&&e.length>0||Ye(e))&&(t[n]=e)}),t},$i=["herokuapp.com","vercel.app","netlify.app"];Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ye(e)&&isFinite(e)&&Math.floor(e)===e});var Ii,Ti=function(){function e(t){if(_class_call_check(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return _create_class(e,[{key:"toString",value:function(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}},{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;16>t;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)||0>t||0>n||0>i||0>r||t>0xffffffffffff||n>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new e(s)}}]),e}(),Ci=function(){function e(){_class_call_check(this,e),this.I=0,this.S=0,this.k=new Ni}return _create_class(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(ze(e)){this.I=0;var t=this.generateOrAbort();if(ze(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.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Ti.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}},{key:"A",value:function(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}]),e}(),Mi=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;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ge&&!ze(ge.crypto)&&crypto.getRandomValues&&(Mi=function(e){return crypto.getRandomValues(e)});var Ai,ji,Li,Di,Ni=function(){function e(){_class_call_check(this,e),this.T=new Uint32Array(8),this.N=1/0}return _create_class(e,[{key:"nextUint32",value:function(){return this.T.length>this.N||(Mi(this.T),this.N=0),this.T[this.N++]}}]),e}(),qi=function(){return Wi().toString()},Wi=function(){return(Ii||(Ii=new Ci)).generate()},Hi="",Ui=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,zi={Yt:function(){return!!be},Ut:function(e){On.error("cookieStore error: "+e)},Wt:function(e){if(be){try{for(var t=e+"=",n=be.cookie.split(";").filter(function(e){return e.length}),i=0;n.length>i;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}},Gt:function(e){var t;try{t=JSON.parse(zi.Wt(e))||{}}catch(e){}return t},Xt:function(e,t,n,i,r){if(be)try{var s="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=be),Hi)return Hi;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_"+qi();!Hi&&i--;){var s=n.slice(i).join("."),o=r+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",Hi=s)}return Hi}(e);if(!n){var i=(r=e.match(Ui))?r[0]:"";i!==n&&On.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}var r;return""}(be.location.hostname,i);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),s="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&On.warn("cookieStore warning: large cookie, len="+u.length),be.cookie=u,u}catch(e){return}},Jt:function(e,t){if(null!=be&&be.cookie)try{zi.Xt(e,"",-1,t)}catch(e){return}}},Bi=null,Gi={Yt:function(){if(!Ve(Bi))return Bi;var e=!0;if(ze(ge))e=!1;else try{var t="__mplssupport__";Gi.Xt(t,"xyz"),'"xyz"'!==Gi.Wt(t)&&(e=!1),Gi.Jt(t)}catch(t){e=!1}return e||On.error("localStorage unsupported; falling back to cookie store"),Bi=e,e},Ut:function(e){On.error("localStorage error: "+e)},Wt:function(e){try{return null==ge?void 0:ge.localStorage.getItem(e)}catch(e){Gi.Ut(e)}return null},Gt:function(e){try{return JSON.parse(Gi.Wt(e))||{}}catch(e){}return null},Xt:function(e,t){try{null==ge||ge.localStorage.setItem(e,JSON.stringify(t))}catch(e){Gi.Ut(e)}},Jt:function(e){try{null==ge||ge.localStorage.removeItem(e)}catch(e){Gi.Ut(e)}}},Vi=[Cn,"distinct_id",Gn,Vn,ci,ui,ri],Ki={},Yi={Yt:function(){return!0},Ut:function(e){On.error("memoryStorage error: "+e)},Wt:function(e){return Ki[e]||null},Gt:function(e){return Ki[e]||null},Xt:function(e,t){Ki[e]=t},Jt:function(e){delete Ki[e]}},Xi=null,Ji={Yt:function(){if(!Ve(Xi))return Xi;if(Xi=!0,ze(ge))Xi=!1;else try{var e="__support__";Ji.Xt(e,"xyz"),'"xyz"'!==Ji.Wt(e)&&(Xi=!1),Ji.Jt(e)}catch(e){Xi=!1}return Xi},Ut:function(e){On.error("sessionStorage error: ",e)},Wt:function(e){try{return null==ge?void 0:ge.sessionStorage.getItem(e)}catch(e){Ji.Ut(e)}return null},Gt:function(e){try{return JSON.parse(Ji.Wt(e))||null}catch(e){}return null},Xt:function(e,t){try{null==ge||ge.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Ji.Ut(e)}},Jt:function(e){try{null==ge||ge.sessionStorage.removeItem(e)}catch(e){Ji.Ut(e)}}},Zi=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.Kt()?0:this.Qt}},{key:"isOptedOut",value:function(){return this.Rt.cookieless_mode===pi||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===_i)}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"optInOut",value:function(e){this.tr.Xt(this.er,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}},{key:"reset",value:function(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}},{key:"er",get:function(){var e=this._instance.config,t=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+t:"__ph_opt_in_out_"+t)}},{key:"Qt",get:function(){var e=this.tr.Wt(this.er);return tt(e)?1:c(nt,e)?0:-1}},{key:"tr",get:function(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?Gi:zi;if(!this.rr||this.rr!==t){this.rr=t;var n="localStorage"===e?zi:Gi;n.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(tt(n.Wt(this.er))),n.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}},{key:"Kt",value:function(){return!!this.Rt.respect_dnt&&[null==me?void 0:me.doNotTrack,null==me?void 0:me.msDoNotTrack,Re.doNotTrack].some(function(e){return tt(e)})}}]),e}(),Qi=Fn("[Dead Clicks]"),er=function(){return!0},tr=function(e){var t,n=!(null==(t=e.instance.persistence)||!t.get_property(Hn)),i=e.instance.config.capture_dead_clicks;return Je(i)?i:!!He(i)||n},nr=function(){function e(t,n,i){_class_call_check(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}return _create_class(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this.ir}},{key:"onRemoteConfig",value:function(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register(_define_property({},Hn,e.captureDeadClicks)),this.startIfEnabledOrStop())}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.nr(function(){e.sr()}):this.stop()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",function(t){t?Qi.error("failed to load script",t):e()})}},{key:"sr",value:function(){var e;if(be){if(!this.ir&&null!=(e=Re.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=He(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ir=Re.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ir.start(be),Qi.info("starting...")}}else Qi.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.ir&&(this.ir.stop(),this.ir=void 0,Qi.info("stopping..."))}}]),e}(),ir=Fn("[SegmentIntegration]"),rr="posthog-js",sr=function e(t,n,i,r,s,o){_class_call_check(this,e),this.name=rr,this.setupOnce=function(e){e(x(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},or=function(){function e(t){var n=this;_class_call_check(this,e),this.ar=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(On.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.lr=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.ur()}return _create_class(e,[{key:"ur",value:function(){var e;this.hr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ar)}},{key:"destroy",value:function(){var e;null==(e=this.hr)||e.call(this),this.hr=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.cr(e,t);return this.lr={pathname:null!==(n=null==ge?void 0:ge.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.cr(e,null==(t=this.lr)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.lr)?void 0:e.pageViewId}}},{key:"cr",value:function(e,t){var n=this.lr;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 s=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,c=r.maxContentY;if(!(ze(s)||ze(o)||ze(a)||ze(l)||ze(u)||ze(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=s>1?it(o/s,0,1,On):1,d=s>1?it(a/s,0,1,On):1,f=l>1?it(u/l,0,1,On):1,v=l>1?it(c/l,0,1,On):1;i=Pi(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),ar=function(e){var t=null==be?void 0:be.createElement("a");return ze(t)?null:(t.href=e,t)},lr=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var s=i[r].split("=");if(s[0]===t){n=s;break}}if(!qe(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){On.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ur=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");qe(h)&&(t.includes(h[0])?u.push(h[0]+"="+n):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},cr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},hr="https?://(.*)",dr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat(_to_consumable_array(dr)),vr="<masked>",_r=["li_fat_id"],pr="$direct",gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yr=function(){function e(t,n){var i,r;_class_call_check(this,e),this.Rt=t,this.props={},this.dr=!1,this.vr=(r="",(i=t).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.tr=this.pr(t),this.load(),t.debug&&On.info("Persistence loaded",t.persistence,$e({},this.props)),this.update_config(t,t,n),this.save()}return _create_class(e,[{key:"isDisabled",value:function(){return!!this.gr}},{key:"pr",value:function(e){-1===gr.indexOf(e.persistence.toLowerCase())&&(On.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=_to_consumable_array(Vi).concat(_to_consumable_array(e));return $e({},Gi,{Gt:function(e){try{var t={};try{t=zi.Gt(e)||{}}catch(e){}var n=Pi(t,JSON.parse(Gi.Wt(e)||"{}"));return Gi.Xt(e,n),n}catch(e){}return null},Xt:function(e,n,i,r,s,o){try{Gi.Xt(e,n,void 0,void 0,o);var a={};t.forEach(function(e){n[e]&&(a[e]=n[e])}),Object.keys(a).length&&zi.Xt(e,a,i,r,s,o)}catch(e){Gi.Ut(e)}},Jt:function(e,t){try{null==ge||ge.localStorage.removeItem(e),zi.Jt(e,t)}catch(e){Gi.Ut(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&Gi.Yt()?Gi:"localstorage+cookie"===n&&t.Yt()?t:"sessionstorage"===n&&Ji.Yt()?Ji:"memory"===n?Yi:"cookie"===n?zi:t.Yt()?t:zi}},{key:"mr",value:function(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[ii];return!n||"number"!=typeof n||Date.now()-n>t}},{key:"properties",value:function(){var e=this,t={};return y(this.props,function(n,i){if(i===Kn&&He(n)){if(!e.mr())for(var r=Object.keys(n),s=0;r.length>s;s++)t["$feature/"+r[s]]=n[r[s]]}else-1===fi.indexOf(i)&&(t[i]=n)}),t}},{key:"load",value:function(){if(!this.gr){var e=this.tr.Gt(this.vr);e&&(this.props=Pi({},e))}}},{key:"save",value:function(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}},{key:"remove",value:function(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(He(e)){ze(t)&&(t="None"),this.yr=ze(n)?this._r:n;var r=!1;if(y(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(He(e)){this.yr=ze(t)?this._r:t;var i=!1;if(y(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.dr){var e=E(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);Ue(Fi(e))||this.register(e),this.dr=!0}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==be?void 0:be.referrer)?P(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:O(),$referring_domain:null!=be&&be.referrer&&(null==(e=ar(be.referrer))?void 0:e.host)||pr},void 0)}},{key:"set_initial_person_info",value:function(){this.props[ai]||this.props[li]||this.register_once(_define_property({},ui,F(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)),void 0)}},{key:"get_initial_props",value:function(){var e=this,t={};y([li,ai],function(n){var i=e.props[n];i&&y(i,function(e,n){t["$initial_"+je(n)]=e})});var n,i,r=this.props[ui];if(r){var s=(n=$(r),i={},y(n,function(e,t){i["$initial_"+je(t)]=e}),i);Pi(t,s)}return t}},{key:"safe_merge",value:function(e){return y(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){if(this._r=this.yr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!function(e,t){if(e.length!==t.length)return!1;var n=_to_consumable_array(e).sort(),i=_to_consumable_array(t).sort();return n.every(function(e,t){return e===i[t]})}(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.pr(e),r=this.props;this.clear(),this.tr=i,this.props=r,this.save()}}},{key:"set_disabled",value:function(e){this.gr=e,this.gr?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.br&&(this.br=e,this.remove(),this.save())}},{key:"set_secure",value:function(e){e!==this.wr&&(this.wr=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[An]||{};n[e]=t,this.props[An]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[An]||{})[e];return ze(t)||(delete this.props[An][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}(),mr="events",br="cancelEvents",kr="popover",wr="api",xr="widget",Er="survey shown",Sr="survey dismissed",Pr="survey sent",Rr="$survey_id",Or="$survey_iteration",Fr="$survey_last_seen_date",$r="popover",Ir="inline",Tr="product tour shown",Cr="$product_tour_last_seen_date",Mr="$product_tour_type",Ar=Fn("[RateLimiter]"),jr=function(){function e(t){var n=this;_class_call_check(this,e),this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(function(e){Ar.info((e||"events")+" is quota limited."),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ar.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return _create_class(e,[{key:"captureEventsPerSecond",get:function(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}},{key:"captureEventsBurstLimit",get:function(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}},{key:"clientRateLimitContext",value:function(e){var t,n,i;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(n=this.instance.persistence)?void 0:n.get_property(oi))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(oi,a),{isRateLimited:l,remainingTokens:a.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Lr=Fn("[RemoteConfig]"),Dr=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"remoteConfig",get:function(){var e;return null==(e=Re._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Ir",value:function(e){var t,n,i=this;null!=(t=Re.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",function(){return e(i.remoteConfig)}):e()}},{key:"Cr",value:function(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:function(t){e(t.json)}})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return Lr.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void Lr.warn("Remote config is disabled. Falling back to local config.");this.Ir(function(t){if(!t)return Lr.info("No config found after loading remote JS config. Falling back to JSON."),void e.Cr(function(t){e.Sr(t),e.kr()});e.Sr(t),e.kr()})}catch(e){Lr.error("Error loading remote config",e)}}},{key:"stop",value:function(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}},{key:"refresh",value:function(){this._instance.Tr()||"hidden"===(null==be?void 0:be.visibilityState)||this._instance.reloadFeatureFlags()}},{key:"kr",value:function(){var e,t=this;if(!this.Ar){var n=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==n&&(this.Ar=setInterval(function(){t.refresh()},n))}}},{key:"Sr",value:function(e){var t;e||Lr.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}]),e}(),Nr="gzip-js",qr="base64",Wr=Uint8Array,Hr=Uint16Array,Ur=Uint32Array,zr=new Wr([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]),Br=new Wr([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]),Gr=new Wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vr=function(e,t){for(var n=new Hr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new Ur(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},Kr=Vr(zr,2),Yr=Kr[1];for(Kr[0][28]=258,Yr[258]=28,ji=Vr(Br,0)[1],Li=new Hr(32768),Di=0;32768>Di;++Di)Ai=(43690&Di)>>>1|(21845&Di)<<1,Li[Di]=((65280&(Ai=(61680&(Ai=(52428&Ai)>>>2|(13107&Ai)<<2))>>>4|(3855&Ai)<<4))>>>8|(255&Ai)<<8)>>>1;var Xr=function(e,t,n){for(var i=e.length,r=0,s=new Hr(t);i>r;++r)++s[e[r]-1];var o,a=new Hr(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Hr(1<<t);var l=15-t;for(r=0;i>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Li[h]>>>l]=u}else for(o=new Hr(i),r=0;i>r;++r)o[r]=Li[a[e[r]-1]++]>>>15-e[r];return o},Jr=new Wr(288);for(Di=0;144>Di;++Di)Jr[Di]=8;for(Di=144;256>Di;++Di)Jr[Di]=9;for(Di=256;280>Di;++Di)Jr[Di]=7;for(Di=280;288>Di;++Di)Jr[Di]=8;var Zr=new Wr(32);for(Di=0;32>Di;++Di)Zr[Di]=5;var Qr,es=Xr(Jr,9,0),ts=Xr(Zr,5,0),ns=function(e){return(e/8|0)+(7&e&&1)},is=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(_instanceof(e,Hr)?Hr:_instanceof(e,Ur)?Ur:Wr)(n-t);return i.set(e.subarray(t,n)),i},rs=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},ss=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},os=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return[new Wr(0),0];if(1==r){var o=new Wr(n[0].s+1);return o[n[0].s]=1,[o,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,h=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[h].f>n[u].f?u++:h++],l=n[u!=c&&n[h].f>n[u].f?u++:h++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(i=1;r>i;++i)s[i].s>d&&(d=s[i].s);var f=new Hr(d+1),v=as(n[c-1],f,0);if(v>t){i=0;var _=0,p=v-t,g=1<<p;for(s.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=f[y])break;_+=g-(1<<v-f[y]),f[y]=t}for(_>>>=p;_>0;){var m=s[i].s;t>f[m]?_-=1<<t-f[m]++-1:++i}for(;i>=0&&_;--i){var b=s[i].s;f[b]==t&&(--f[b],++_)}v=t}return[new Wr(f),v]},as=function(e,t,n){return-1==e.s?Math.max(as(e.l,t,n+1),as(e.r,t,n+1)):t[e.s]=n},ls=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Hr(++t),i=0,r=e[0],s=1,o=function(e){n[i++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=e[a]}return[n.subarray(0,i),t]},us=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},cs=function(e,t,n){var i=n.length,r=ns(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 s=0;i>s;++s)e[r+s+4]=n[s];return 8*(r+4+i)},hs=function(e,t,n,i,r,s,o,a,l,u,c){rs(t,c++,n),++r[256];for(var h=os(r,15),d=h[0],f=h[1],v=os(s,15),_=v[0],p=v[1],g=ls(d),y=g[0],m=g[1],b=ls(_),k=b[0],w=b[1],x=new Hr(19),E=0;y.length>E;++E)x[31&y[E]]++;for(E=0;k.length>E;++E)x[31&k[E]]++;for(var S=os(x,7),P=S[0],R=S[1],O=19;O>4&&!P[Gr[O-1]];--O);var F,$,I,T,C=u+5<<3,M=us(r,Jr)+us(s,Zr)+o,A=us(r,d)+us(s,_)+o+14+3*O+us(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(M>=C&&A>=C)return cs(t,c,e.subarray(l,l+u));if(rs(t,c,1+(M>A)),c+=2,M>A){F=Xr(d,f,0),$=d,I=Xr(_,p,0),T=_;var j=Xr(P,R,0);for(rs(t,c,m-257),rs(t,c+5,w-1),rs(t,c+10,O-4),c+=14,E=0;O>E;++E)rs(t,c+3*E,P[Gr[E]]);c+=3*O;for(var L=[y,k],D=0;2>D;++D){var N=L[D];for(E=0;N.length>E;++E)rs(t,c,j[q=31&N[E]]),c+=P[q],q>15&&(rs(t,c,N[E]>>>5&127),c+=N[E]>>>12)}}else F=es,$=Jr,I=ts,T=Zr;for(E=0;a>E;++E)if(i[E]>255){var q;ss(t,c,F[257+(q=i[E]>>>18&31)]),c+=$[q+257],q>7&&(rs(t,c,i[E]>>>23&31),c+=zr[q]);var W=31&i[E];ss(t,c,I[W]),c+=T[W],W>3&&(ss(t,c,i[E]>>>5&8191),c+=Br[W])}else ss(t,c,F[i[E]]),c+=$[i[E]];return ss(t,c,F[256]),c+$[256]},ds=new Ur([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fs=function(){for(var e=new Ur(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),vs=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},_s=!!xe||!!we,ps="text/plain",gs=function(e,t,n){var i;void 0===n&&(n=!0);var r=_sliced_to_array(e.split("?"),2),s=r[0],o=r[1],a=$e({},t),l=null!==(i=null==o?void 0:o.split("&").map(function(e){var t,i=_sliced_to_array(e.split("="),2),r=i[0],s=i[1],o=n&&null!==(t=a[r])&&void 0!==t?t:s;return delete a[r],r+"="+o}))&&void 0!==i?i:[],u=function(e,t){var n,i;void 0===t&&(t="&");var r=[];return y(e,function(e,t){ze(e)||ze(t)||"undefined"===t||(n=encodeURIComponent(_instanceof(e,File)?e.name:e.toString()),i=encodeURIComponent(t),r[r.length]=i+"="+n)}),r.join(t)}(a);return u&&l.push(u),s+"?"+l.join("&")},ys=function(e,t){return JSON.stringify(e,function(e,t){return"bigint"==(void 0===t?"undefined":_type_of(t))?t.toString():t},t)},ms=function(e){if(e.zt)return e.zt;var t,n=e.data,i=e.compression;if(n){if(i===Nr){var r=function(e,t){void 0===t&&(t={});var n,i=(n=4294967295,{p:function(e){for(var t=n,i=0;e.length>i;++i)t=fs[255&t^e[i]]^t>>>8;n=t},d:function(){return 4294967295^n}}),r=e.length;i.p(e);var s,o,a,l,u=(l=10+((s=t).filename&&s.filename.length+1||0),function(e,t,n,i){var r=e.length,s=new Wr(i+r+5*(1+Math.floor(r/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=cs(o,a,e.subarray(l,u)):(o[l]=!0,a=cs(o,a,e.subarray(l,r)))}else{for(var c=ds[t-1],h=c>>>13,d=8191&c,f=(1<<n)-1,v=new Hr(32768),_=new Hr(f+1),p=Math.ceil(n/3),g=2*p,y=function(t){return(e[t]^e[t+1]<<p^e[t+2]<<g)&f},m=new Ur(25e3),b=new Hr(288),k=new Hr(32),w=0,x=0,E=(l=0,0),S=0,P=0;r>l;++l){var R=y(l),O=32767&l,F=_[R];if(v[O]=F,_[R]=O,l>=S){var $=r-l;if((w>7e3||E>24576)&&$>423){a=hs(e,o,0,m,b,k,x,E,P,l-P,a),E=w=x=0,P=l;for(var I=0;286>I;++I)b[I]=0;for(I=0;30>I;++I)k[I]=0}var T=2,C=0,M=d,A=O-F&32767;if($>2&&R==y(l-A))for(var j=Math.min(h,$)-1,L=Math.min(32767,l),D=Math.min(258,$);L>=A&&--M&&O!=F;){if(e[l+T]==e[l+T-A]){for(var N=0;D>N&&e[l+N]==e[l+N-A];++N);if(N>T){if(T=N,C=A,N>j)break;var q=Math.min(A,N-2),W=0;for(I=0;q>I;++I){var H=l-A+I+32768&32767,U=H-v[H]+32768&32767;U>W&&(W=U,F=H)}}}A+=(O=F)-(F=v[O])+32768&32767}if(C){m[E++]=268435456|Yr[T]<<18|ji[C];var z=31&Yr[T],B=31&ji[C];x+=zr[z]+Br[B],++b[257+z],++k[B],S=l+T,++w}else m[E++]=e[l],++b[e[l]]}}a=hs(e,o,!0,m,b,k,x,E,P,l-P,a)}return is(s,0,i+ns(a)+8)}(o=e,null==(a=t).level?6:a.level,null==a.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+a.mem,l)),c=u.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&vs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;n.length>=i;++i)e[i+10]=n.charCodeAt(i)}}(u,t),vs(u,c-8,i.d()),vs(u,c-4,r),u}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Wr(e.length+(e.length>>>1)),i=0,r=function(e){n[i++]=e},s=0;t>s;++s){if(i+5>n.length){var o=new Wr(i+8+(t-s<<1));o.set(n),n=o}var a=e.charCodeAt(s);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return is(n,0,i)}(ys(n)),{mtime:0});return{contentType:ps,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===qr){var s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:ys(e))}((t=ys(n))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})):t);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=ys(n);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},bs=(Qr=l(function(e){var t,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,function(e,t){return Ie.apply(this,arguments)}(ys(e.data),Fe.DEBUG)];case 1:return(t=i.sent())?[4,t.arrayBuffer()]:[2,e];case 2:return n=i.sent(),[2,$e({},e,{zt:{contentType:ps,body:n,estimatedSize:n.byteLength}})]}})}),function(e){return Qr.apply(this,arguments)}),ks=[];we&&ks.push({transport:"fetch",method:function(e){var t,n,i=null!==(t=ms(e))&&void 0!==t?t:{},r=i.contentType,s=i.body,o=i.estimatedSize,a=new Headers;y(e.headers,function(e,t){a.append(t,e)}),r&&a.append("Content-Type",r);var l=e.url,u=null;if(Ee){var c=new Ee;u={signal:c.signal,timeout:setTimeout(function(){return c.abort()},e.timeout)}}we(l,$e({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:s,signal:null==(n=u)?void 0:n.signal},e.fetchOptions)).then(function(t){return t.text().then(function(n){var i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(e){On.error(e)}null==e.callback||e.callback(i)})}).catch(function(t){On.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(function(){return u?clearTimeout(u.timeout):null})}}),xe&&ks.push({transport:"XHR",method:function(e){var t,n=new xe;n.open(e.method||"GET",e.url,!0);var i=null!==(t=ms(e))&&void 0!==t?t:{},r=i.contentType,s=i.body;y(e.headers,function(e,t){n.setRequestHeader(t,e)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=function(){if(4===n.readyState){var t={statusCode:n.status,text:n.responseText};if(200===n.status)try{t.json=JSON.parse(n.responseText)}catch(e){}null==e.callback||e.callback(t)}},n.send(s)}}),null!=me&&me.sendBeacon&&ks.push({transport:"sendBeacon",method:function(e){var t=gs(e.url,{beacon:"1"});try{var n,i=null!==(n=ms(e))&&void 0!==n?n:{},r=i.contentType,s=i.body;if(!s)return;var o=_instanceof(s,Blob)?s:new Blob([s],{type:r});me.sendBeacon(t,o)}catch(e){}}});var ws=3e3,xs=function(){function e(t,n){_class_call_check(this,e),this.Er=!0,this.Rr=[],this.Nr=it((null==n?void 0:n.flush_interval_ms)||ws,250,5e3,On.createLogger("flush interval"),ws),this.Mr=t}return _create_class(e,[{key:"enqueue",value:function(e){this.Rr.push(e),this.Fr||this.Or()}},{key:"unload",value:function(){var e=this;this.Pr();var t=this.Rr.length>0?this.Lr():{},n=Object.values(t);_to_consumable_array(n.filter(function(e){return 0===e.url.indexOf("/e")})).concat(_to_consumable_array(n.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(t){e.Mr($e({},t,{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.Er=!1,this.Or()}},{key:"Or",value:function(){var e=this,t=this;this.Er||(this.Fr=setTimeout(function(){if(e.Pr(),e.Rr.length>0){var n=e.Lr(),i=function(){var e=n[r],i=(new Date).getTime();e.data&&qe(e.data)&&y(e.data,function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),t.Mr(e)};for(var r in n)i()}},this.Nr))}},{key:"Pr",value:function(){clearTimeout(this.Fr),this.Fr=void 0}},{key:"Lr",value:function(){var e={};return y(this.Rr,function(t){var n,i=t,r=(i?i.batchKey:null)||i.url;ze(e[r])&&(e[r]=$e({},i,{data:[]})),null==(n=e[r].data)||n.push(i.data)}),this.Rr=[],e}}]),e}(),Es=["retriesPerformedSoFar"],Ss=function(){function e(t){var n=this;_class_call_check(this,e),this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=t,this.Rr=[],this.jr=!0,!ze(ge)&&"onLine"in ge.navigator&&(this.jr=ge.navigator.onLine,this.qr=function(){n.jr=!0,n.Zr()},this.$r=function(){n.jr=!1},k(ge,"online",this.qr),k(ge,"offline",this.$r))}return _create_class(e,[{key:"length",get:function(){return this.Rr.length}},{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=u(e,Es);Xe(n)&&(i.url=gs(i.url,{retry_count:n})),this._instance._send_request($e({},i,{callback:function(e){200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=n?n:0)>=10?null==i.callback||i.callback(e):t.Hr($e({retriesPerformedSoFar:n},i))}}))}},{key:"Hr",value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n,i,r,s,o,a=(n=t,i=3e3*Math.pow(2,n),r=i/2,s=Math.min(18e5,i),o=Math.random()-.5,Math.ceil(s+o*(s-r))),l=Date.now()+a;this.Rr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),On.warn(u),this.Dr||(this.Dr=!0,this.Vr())}},{key:"Vr",value:function(){var e=this;if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout(function(){e.jr&&e.Rr.length>0&&e.Zr(),e.Vr()},this.Br)}},{key:"Zr",value:function(){var e=Date.now(),t=[],n=this.Rr.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.Rr=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value.requestOptions;this.retriableRequest(l)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}}},{key:"unload",value:function(){var e=!0,t=!1,n=void 0;try{for(var i,r=(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,ze(ge)||(this.qr&&(ge.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(ge.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr)[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request($e({},s,{transport:"sendBeacon"}))}catch(e){On.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.Rr=[]}}]),e}(),Ps=function(){function e(t){var n=this;_class_call_check(this,e),this.Yr=function(){var e,t,i,r;n.Ur||(n.Ur={});var s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=o+((null==s?void 0:s.clientHeight)||0),u=(null==s?void 0:s.scrollHeight)||0;n.Ur.lastScrollY=Math.ceil(o),n.Ur.maxScrollY=Math.max(o,null!==(e=n.Ur.maxScrollY)&&void 0!==e?e:0),n.Ur.maxScrollHeight=Math.max(a,null!==(t=n.Ur.maxScrollHeight)&&void 0!==t?t:0),n.Ur.lastContentY=l,n.Ur.maxContentY=Math.max(l,null!==(i=n.Ur.maxContentY)&&void 0!==i?i:0),n.Ur.maxContentHeight=Math.max(u,null!==(r=n.Ur.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}return _create_class(e,[{key:"Wr",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.Ur}},{key:"resetContext",value:function(){var e=this.Ur;return setTimeout(this.Yr,0),e}},{key:"startMeasuringScrollPosition",value:function(){k(ge,"scroll",this.Yr,{capture:!0}),k(ge,"scrollend",this.Yr,{capture:!0}),k(ge,"resize",this.Yr)}},{key:"scrollElement",value:function(){if(!this.Wr)return null==ge?void 0:ge.document.documentElement;var e=qe(this.Wr)?this.Wr:[this.Wr],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value,a=null==ge?void 0:ge.document.querySelector(o);if(a)return a}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"scrollY",value:function(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollTop||0}return ge&&(ge.scrollY||ge.pageYOffset||ge.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollLeft||0}return ge&&(ge.scrollX||ge.pageXOffset||ge.document.documentElement.scrollLeft)||0}}]),e}(),Rs=function(e){return F(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties)},Os=function(){function e(t,n,i,r){var s=this;_class_call_check(this,e),this.Gr=function(e){var t=s.Xr();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.Jr(s._instance)};s.Kr.register(_define_property({},si,n))}},this._instance=t,this.Qr=n,this.Kr=i,this.Jr=r||Rs,this.Qr.onSessionId(this.Gr)}return _create_class(e,[{key:"Xr",value:function(){return this.Kr.props[si]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?$(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}},{key:"getSessionProps",value:function(){var e={};return y(Fi(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_"+je(n)]=t}),e}}]),e}(),Fs=function(){function e(){_class_call_check(this,e),this.ti={}}return _create_class(e,[{key:"on",value:function(e,t){var n=this;return this.ti[e]||(this.ti[e]=[]),this.ti[e].push(t),function(){n.ti[e]=n.ti[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=(this.ti[e]||[])[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){(0,s.value)(t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var a=!0,l=!1,u=void 0;try{for(var c,h=(this.ti["*"]||[])[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){(0,c.value)(e,t)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}}]),e}(),$s=Fn("[SessionId]"),Is=function(){function e(t,n,i){var r,s=this;if(_class_call_check(this,e),this.ri=[],this.ii=void 0,this.ei=new Fs,this.ni=function(e,t){return!(!Xe(e)||!Xe(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===pi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Kr=t.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=n||qi,this.li=i||qi;var o=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*it(this.Rt.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+o+"_window_id",this.ci="ph_"+o+"_primary_window_exists",this.di()){var a=Ji.Gt(this.hi),l=Ji.Gt(this.ci);a&&!l?this.si=a:Ji.Jt(this.hi),Ji.Xt(this.ci,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var u=function(){var e=s.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)}();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),u)}catch(e){$s.error("Invalid sessionID in bootstrap",e)}this.fi()}return _create_class(e,[{key:"on",value:function(e,t){return this.ei.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return ze(this.ri)&&(this.ri=[]),this.ri.push(e),this.oi&&e(this.oi,this.si),function(){t.ri=t.ri.filter(function(t){return t!==e})}}},{key:"di",value:function(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&Ji.Yt()}},{key:"pi",value:function(e){e!==this.si&&(this.si=e,this.di()&&Ji.Xt(this.hi,e))}},{key:"gi",value:function(){return this.si?this.si:this.di()?Ji.Gt(this.hi):null}},{key:"vi",value:function(e,t,n){e===this.oi&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.oi=e,this.Kr.register(_define_property({},Gn,[t,e,n])))}},{key:"mi",value:function(){var e=this.Kr.props[Gn];return qe(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.vi(null,null,null)}},{key:"destroy",value:function(){clearTimeout(this.yi),this.yi=void 0,this.ii&&ge&&(ge.removeEventListener(ki,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}},{key:"fi",value:function(){var e=this;this.ii=function(){e.di()&&Ji.Jt(e.ci)},k(ge,ki,this.ii,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===pi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),i=_sliced_to_array(this.mi(),3),r=i[0],s=i[1],o=i[2],a=this.gi(),l=Xe(o)&&Math.abs(n-o)>864e5,u=!1,c=!s,h=!c&&!e&&this.ni(n,r);c||h||l?(s=this.ai(),a=this.li(),$s.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=n,u=!0):a||(a=this.li(),u=!0);var d=Xe(r)&&e&&!l?r:n,f=Xe(o)?o:(new Date).getTime();return this.pi(a),this.vi(s,d,f),e||this.ui(),u&&this.ri.forEach(function(e){return e(s,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0)}),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}},{key:"ui",value:function(){var e=this;clearTimeout(this.yi),this.yi=setTimeout(function(){var t=_sliced_to_array(e.mi(),1)[0];if(e.ni((new Date).getTime(),t)){var n=e.oi;e.resetSessionId(),e.ei.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}]),e}(),Ts=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Me(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(function(e){return Me(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver},Cs=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}},Ms={exact:function(e,t){return t.some(function(t){return e.some(function(e){return t===e})})},is_not:function(e,t){return t.every(function(t){return e.every(function(e){return t!==e})})},regex:function(e,t){return t.some(function(t){return e.some(function(e){return Cs(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!Cs(t,e)})})},icontains:function(e,t){return t.map(As).some(function(t){return e.map(As).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(As).every(function(t){return e.map(As).every(function(e){return!t.includes(e)})})},gt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n>parseFloat(e)})})},lt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n<parseFloat(e)})})}},As=function(e){return e.toLowerCase()},js="custom",Ls="i.posthog.com",Ds=function(){function e(t){_class_call_check(this,e),this.bi={},this.instance=t}return _create_class(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:"flagsApiHost",get:function(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}},{key:"uiHost",get:function(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Ls,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this.bi[this.apiHost]||(this.bi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":js),this.bi[this.apiHost]}},{key:"endpointFor",value:function(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===js)return this.apiHost+t;var n=Ls+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}]),e}(),Ns=Fn("[Surveys]"),qs="seenSurvey_",Ws=function(e){return function(e,t){var n=""+qs+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+qs+t.id+"_"+t.current_iteration),n}(0,e)},Hs=[kr,xr,wr],Us={ignoreConditions:!1,ignoreDelay:!1,displayType:$r},zs=Fn("[PostHog ExternalIntegrations]"),Bs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Gs=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"nr",value:function(e,t){var n;null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,function(e){if(e)return zs.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=function(t){var n,i,r;!c||null!=(n=Re.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.nr(Bs[t],function(){var n;null==(n=Re.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!c&&null!=(i=Re.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]&&(null==(r=Re.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[t])||r.stop())},n=!0,i=!1,r=void 0;try{for(var s,o=Object.entries(null!==(a=this._instance.config.integrations)&&void 0!==a?a:{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a,l=_sliced_to_array(s.value,2),u=l[0],c=l[1];t(u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}]),e}(),Vs={},Ks=0,Ys=function(){},Xs='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Js="Surveys module not available",Zs="sanitize_properties is deprecated. Use before_send instead",Qs="Invalid value for property_denylist config: ",eo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,to="posthog",no=!_s&&-1===(null==Pe?void 0:Pe.indexOf("MSIE"))&&-1===(null==Pe?void 0:Pe.indexOf("Mozilla")),io=function(e){var t;return $e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:b(null==be?void 0:be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ys,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:ke&&Be(null==ke?void 0:ke.search)&&-1!==ke.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ge||null==(t=ge.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:function(e){On.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:mi,before_send:void 0,request_queue_config:{flush_interval_ms:ws},error_tracking:{},_onCapture:Ys,__preview_eager_load_replay:!1},function(e){return{rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}}(e))},ro=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],so=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=ro[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),l=a[0],u=a[1];ze(e[l])||(t[u]=e[l])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=Pi({},t,e);return qe(e.property_blacklist)&&(ze(e.property_denylist)?c.property_denylist=e.property_blacklist:qe(e.property_denylist)?c.property_denylist=_to_consumable_array(e.property_blacklist).concat(_to_consumable_array(e.property_denylist)):On.error(Qs+e.property_denylist)),c},oo=function(){function e(){_class_call_check(this,e),this.__forceAllowLocalhost=!1}return _create_class(e,[{key:"wi",get:function(){return this.__forceAllowLocalhost},set:function(e){On.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),ao=function(){function e(){var t,n=this;_class_call_check(this,e),this.webPerformance=new oo,this.Si=!1,this.version=Fe.LIB_VERSION,this.ki=new Fs,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=io(),this.SentryIntegration=sr,this.sentryIntegration=function(e){return function(e,t){var n=x(e,t);return{name:rr,processEvent:function(e){return n(e)}}}(n,e)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new Ps(this),this.pageViewManager=new or(this),this.rateLimiter=new jr(this),this.requestRouter=new Ds(this),this.consent=new Zi(this),this.externalIntegrations=new Gs(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:function(e,t,i){var r=Be(e)?_define_property({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=Be(e)?_define_property({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return On.info('send "'+(null==e?void 0:e.event)+'"',e)})}return _create_class(e,[{key:"Ii",value:function(e,t){if(e){var n=this.Ci.indexOf(e);-1!==n&&this.Ci.splice(n,1)}return this.Ci.push(t),null==t.initialize||t.initialize(),t}},{key:"decideEndpointWasHit",get:function(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"flagsEndpointWasHit",get:function(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}},{key:"init",value:function(t,n,i){if(i&&i!==to){var r,s=null!==(r=Vs[i])&&void 0!==r?r:new e;return s._init(t,n,i),Vs[i]=s,Vs[to][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e,t,n){var i,r,s,o,a=this;if(void 0===t&&(t={}),ze(e)||Ge(e))return On.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Ri(t.debug),this.Ni=t,this.Mi=[],t.person_profiles?this.Ai=t.person_profiles:t.process_person&&(this.Ai=t.process_person),this.set_config(Pi({},io(t.defaults),so(t),{name:n,token:e})),this.config.on_xhr_error&&On.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Nr;var l=this.Fi();this.persistence=new yr(this.config,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr($e({},this.config,{persistence:"sessionStorage"}),l);var u=$e({},this.persistence.props),c=$e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new xs(function(e){return a.Pi(e)},this.config.request_queue_config),this.Li=new Ss(this),this.__request_queue=[];var h=this.config.cookieless_mode===pi||this.config.cookieless_mode===_i&&this.consent.isExplicitlyOptedOut();h||(this.sessionManager=new Is(this),this.sessionPropsManager=new Os(this,this.sessionManager,this.persistence));var d=null==(i=Re._POSTHOG_REMOTE_CONFIG)||null==(i=i[this.config.token])?void 0:i.config,f=null==d||null==(r=d.sdkVersion)?void 0:r.resolved;if(f&&(eo.test(f)?this._resolvedSdkVersion=f:On.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+f)),this.config.__preview_deferred_init_extensions?(On.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){a.Di(h)},0)):(On.info("Initializing extensions synchronously"),this.Di(h)),Fe.DEBUG=Fe.DEBUG||this.config.debug,Fe.DEBUG&&On.info("Starting in debug mode",{this:this,config:t,thisC:$e({},this.config),p:u,s:c}),!this.config.identity_distinct_id||null!=(s=t.bootstrap)&&s.distinctID||(t.bootstrap=$e({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var v=t.bootstrap.distinctID,_=this.get_distinct_id(),p=this.persistence.get_property(ri);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==v&&p===gi)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==v&&p===yi)On.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var g=this.config.get_device_id(qi()),y=t.bootstrap.isIdentifiedID?g:v;this.persistence.set_property(ri,t.bootstrap.isIdentifiedID?yi:gi),this.register({distinct_id:v,$device_id:y})}}if(h)this.register_once({distinct_id:di,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(qi());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(ri,gi)}return k(ge,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=function(n){var i=function(){return n.anonymousId()||qi()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(ri,yi)),t()},r=n.user();"then"in r&&We(r.then)?r.then(i):i(r)}(e,function(){n.register(function(e){Promise&&Promise.resolve||ir.warn("This browser does not have Promise support, and can not use the segment integration");var t=function(t,n){if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ir.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ir.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,wi)},identify:function(e){return t(e,Ei)},screen:function(e){return t(e,"$screen")}}}(e)).then(function(){t()})})}(this,function(){return a.Bi()}):this.Bi(),We(this.config._onCapture)&&this.config._onCapture!==Ys&&(On.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return a.config._onCapture(e.event,e)})),this.config.ip&&On.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}},{key:"Di",value:function(t){var n,i,r,s,o,a,l,u=this,c=performance.now(),h=$e({},e.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ci.push(this.featureFlags=null!==(n=this.featureFlags)&&void 0!==n?n:new h.featureFlags(this)),h.exceptions&&this.Ci.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.Ci.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ci.push(new h.tracingHeaders(this)),h.siteApps&&this.Ci.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push(function(){u.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Ci.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this)),h.logs&&this.Ci.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.conversations&&this.Ci.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ci.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ci.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ci.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,tr)),h.toolbar&&this.Ci.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ci.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ci.forEach(function(e){e.initialize&&d.push(function(){null==e.initialize||e.initialize()})}),d.push(function(){if(u.ji){var e=u.ji;u.ji=void 0,u.Sr(e)}}),this.qi(d,c)}},{key:"qi",value:function(e,t){for(var n=this;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(function(){n.qi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){On.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&On.info("PostHog extensions initialized ("+r+"ms)")}},{key:"Sr",value:function(e){var t,n=this;if(!be||!be.body)return On.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){n.Sr(e)},500);this.config.__preview_deferred_init_extensions&&(this.ji=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=c(e.supportedCompression,Nr)?Nr:c(e.supportedCompression,qr)?qr:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:mi}),this.Ci.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}},{key:"Bi",value:function(){var e=this;try{this.config.loaded(this)}catch(e){On.critical("`loaded` function failed",e)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=ke&&ke.hostname){var t=ke.hostname,n=this.config.internal_or_test_user_hostname;("string"==typeof n?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(function(){(e.consent.isOptedIn()||e.config.cookieless_mode===pi)&&e.$i()},1),this.Hi=new Dr(this),this.Hi.load()}},{key:"Zi",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Oi)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&g(this.__request_queue,function(t){return e.Pi(t)}),this.__request_queue=[],this.Zi()}},{key:"_handle_unload",value:function(){var e,t,n;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(xi),null==(t=this.Oi)||t.unload(),null==(n=this.Li)||n.unload()):this.Vi()&&this.capture(xi,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t=this;this.__loaded&&(no?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=gs(e.url,{ip:this.config.ip?1:0}),e.headers=$e({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var t,n,i,r=$e({},e);r.timeout=r.timeout||6e4,r.url=gs(r.url,{_:(new Date).getTime().toString(),ver:Fe.JS_SDK_VERSION,compression:r.compression});var s=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=ks.filter(function(e){return!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)}),a=null!==(n=null==(i=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===s)return e[t]}(o))?void 0:i.method)&&void 0!==n?n:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==s&&r.data&&r.compression===Nr&&Se?bs(r).then(function(e){a(e)}).catch(function(){a(r)}):a(r)}($e({},e,{callback:function(n){var i,r;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null==(i=(r=t.config).on_request_error)||i.call(r,n),null==e.callback||e.callback(n)}}))))}},{key:"Pi",value:function(e){this.Li?this.Li.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;Ks++;try{var n,i=[],r=[],s=[];g(e,function(e){e&&(qe(n=e[0])?s.push(e):We(e)?e.call(t):qe(e)&&"alias"===n?i.push(e):qe(e)&&-1!==n.indexOf("capture")&&We(t[n])?s.push(e):r.push(e))});var o=function(e,t){g(e,function(e){if(qe(e[0])){var n=t;y(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};o(i,this),o(r,this),o(s,this)}finally{Ks--}}},{key:"push",value:function(t){if(Ks>0&&qe(t)&&Be(t[0])){var n=e.prototype[t[0]];We(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}},{key:"capture",value:function(e,t,n){var i,r,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!ze(e)&&Be(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!Be(null==t?void 0:t.$current_url)&&(On.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=n&&n.zi||On.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==n?void 0:n.timestamp)||c,d=qi(),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===wi&&this.config.__preview_capture_bot_pageviews&&l&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==n?void 0:n.$set)&&(f.$set=null==n?void 0:n.$set);var v,_=this.Yi(null==n?void 0:n.$set_once,e!==Si,e===Ei);if(_&&(f.$set_once=_),null!=n&&n._noTruncate||(r=this.config.properties_string_max_length,s=f,o=function(e){return Be(e)?e.slice(0,r):e},a=new Set,f=function e(t,n){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),qe(t)?(i=[],g(t,function(t){i.push(e(t))})):(i={},y(t,function(t,n){a.has(t)||(i[n]=e(t,n))})),i);var i}(s)),f.timestamp=h,ze(null==n?void 0:n.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=c),e===Sr||e===Pr){var p=null==t?void 0:t[Rr],m=null==t?void 0:t[Or];v={id:p,current_iteration:m},localStorage.getItem(Ws(v))||localStorage.setItem(Ws(v),"true"),f.$set=$e({},f.$set,_define_property({},function(e,t){var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n}({id:p,current_iteration:m},e===Pr?"responded":"dismissed"),!0))}else e===Er&&(f.$set=$e({},f.$set,_define_property({},Fr,(new Date).toISOString())));if(e===Tr){var b=null==t?void 0:t[Mr];b&&(f.$set=$e({},f.$set,_define_property({},Cr+"/"+b,(new Date).toISOString())))}var k=$e({},f.properties.$set,f.$set);if(Ue(k)||this.setPersonPropertiesForFlags(k),!Ke(this.config.before_send)){var w=this.Ui(f);if(!w)return;f=w}this.ki.emit("eventCaptured",f);var x={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==n?void 0:n._batchKey};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Pi(x):this.Oi.enqueue(x),f}On.critical("This capture call is ignored due to client rate limiting.")}}else On.error("No event name provided to posthog.capture")}else On.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",function(t){return e(t.event,t)})}},{key:"calculateEventProperties",value:function(e,t,n,i,r){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var s=r?void 0:this.persistence.remove_event_timer(e),o=$e({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode==pi||this.config.cookieless_mode==_i&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=$e({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!Be(o.distinct_id)&&!Ye(o.distinct_id)||Ge(o.distinct_id))&&On.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var n,i,r,s;if(!Pe)return{};var o,a,l,u,c,h,d,f,v=e?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[],_=_sliced_to_array(function(e){for(var t=0;nn.length>t;t++){var n=_sliced_to_array(nn[t],2),i=n[0],r=n[1],s=i.exec(e),o=s&&(We(r)?r(s,e):r);if(o)return o}return["",""]}(Pe),2),p=_[0],g=_[1];return Pi(Fi({$os:p,$os_version:g,$browser:Qt(Pe,navigator.vendor),$device:rn(Pe),$device_type:(a=Pe,l={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(i=navigator)?void 0:i.maxTouchPoints,screenWidth:null==ge||null==(r=ge.screen)?void 0:r.width,screenHeight:null==ge||null==(s=ge.screen)?void 0:s.height,devicePixelRatio:null==ge?void 0:ge.devicePixelRatio},f=rn(a),f===vt||f===ft||"Kobo"===f||"Kindle Fire"===f||f===zt?dt:f===Ct||f===At||f===Mt||f===Wt?"Console":f===pt?"Wearable":f?ut:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?ut:dt:"Desktop"),$timezone:I(),$timezone_offset:T()}),{$current_url:ur(null==ke?void 0:ke.href,v,vr),$host:null==ke?void 0:ke.host,$pathname:null==ke?void 0:ke.pathname,$raw_user_agent:Pe.length>1e3?Pe.substring(0,997)+"...":Pe,$browser_version:tn(Pe,navigator.vendor),$browser_language:R(),$browser_language_prefix:(o=R(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==ge?void 0:ge.screen.height,$screen_width:null==ge?void 0:ge.screen.width,$viewport_height:null==ge?void 0:ge.innerHeight,$viewport_width:null==ge?void 0:ge.innerWidth,$lib:Fe.LIB_NAME,$lib_version:Fe.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(r,n.getTime()),h=c.sessionId,d=c.windowId;o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&Pi(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Pi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(f=this.Li)?void 0:f.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===js&&(o.$lib_custom_api_host=this.config.api_host),l=e!==wi||r?e!==xi||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=Pi(o,l),e===wi&&be&&(o.title=be.title),!ze(s)){var v=n.getTime()-s;o.$duration=parseFloat((v/1e3).toFixed(3))}Pe&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Pi({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),qe(this.config.property_denylist)?y(this.config.property_denylist,function(e){delete o[e]}):On.error(Qs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(On.error(Zs),o=_(o,e));var p=this.Wi();return o.$process_person_profile=p,p&&!r&&this.Gi("_calculate_event_properties"),o}},{key:"Yi",value:function(e,t,n){var i;if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.Wi())return e;if(this.Si&&!n)return e;var r=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Pi({},r,s||{},e||{}),a=this.config.sanitize_properties;return a&&(On.error(Zs),o=a(o,"$set_once")),t&&(this.Si=!0),Ue(o)?void 0:o}},{key:"register",value:function(e,t){var n;null==(n=this.persistence)||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var i;null==(i=this.persistence)||i.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.register(e)}},{key:"unregister",value:function(e){var t;null==(t=this.persistence)||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}},{key:"Xi",value:function(e,t){this.register(_define_property({},e,t))}},{key:"getFeatureFlag",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}},{key:"getFeatureFlagResult",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlagResult(e,t)}},{key:"isFeatureEnabled",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}},{key:"updateFlags",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,n)}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,n)}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,n)}},{key:"on",value:function(e,t){return this.ki.on(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),function(){})}},{key:"onSurveysLoaded",value:function(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Js}),function(){})}},{key:"onSessionId",value:function(e){var t,n;return null!==(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))&&void 0!==t?t:function(){}}},{key:"getSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Js})}},{key:"getActiveMatchingSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Js})}},{key:"renderSurvey",value:function(e,t){var n;null==(n=this.surveys)||n.renderSurvey(e,t)}},{key:"displaySurvey",value:function(e,t){var n;void 0===t&&(t=Us),null==(n=this.surveys)||n.displaySurvey(e,t)}},{key:"cancelPendingSurvey",value:function(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}},{key:"canRenderSurvey",value:function(e){var t,n;return null!==(t=null==(n=this.surveys)?void 0:n.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Js}}},{key:"canRenderSurveyAsync",value:function(e,t){var n,i;return void 0===t&&(t=!1),null!==(n=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==n?n:Promise.resolve({visible:!1,disabledReason:Js})}},{key:"Ji",value:function(e){return!e||Ge(e)?(On.critical("Unique user id has not been set in posthog.identify"),!1):e===di?(On.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(On.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}},{key:"identify",value:function(e,t,n){if(!this.__loaded||!this.persistence)return On.uninitializedWarning("posthog.identify");if(Ye(e)&&(e=e.toString(),On.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(e)&&this.Gi("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Cn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Mn)&&(this.unregister(Mn),this.register({distinct_id:e}));var r,s=(this.persistence.get_property(ri)||gi)===gi;e!==i&&s?(this.persistence.set_property(ri,yi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(Ei,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Ei=C(e,t,n),null==(r=this.featureFlags)||r.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(ei))}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.Gi("posthog.setPersonProperties")){var n=C(this.get_distinct_id(),e,t);this.Ei!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=n):On.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}},{key:"group",value:function(e,t,n){if(e&&t){var i=this.getGroups(),r=i[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:$e({},i,_define_property({},e,t))}),r||n){var s={$group_type:e,$group_key:t};n&&(s.$group_set=n),this.capture(Si,s)}n&&this.setGroupPropertiesForFlags(_define_property({},e,n)),r&&!n&&this.reloadFeatureFlags()}else On.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,t){var n;void 0===t&&(t=!0),null==(n=this.featureFlags)||n.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e,t){var n;void 0===t&&(t=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(n=this.featureFlags)||n.setGroupPropertiesForFlags(e,t))}},{key:"resetGroupPropertiesForFlags",value:function(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,i,r,s,o,a,l;if(On.info("reset"),!this.__loaded)return On.uninitializedWarning("posthog.reset");var u=this.get_property(Cn);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),null==(i=this.surveys)||i.reset(),null==(r=this.Hi)||r.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(ri,gi),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===pi)this.register_once({distinct_id:di,$device_id:null},"");else{var c=this.config.get_device_id(qi());this.register_once({distinct_id:c,$device_id:e?c:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}},{key:"setIdentity",value:function(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(n=this.conversations)||n.Ki()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qi()}},{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.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/"+this.config.token+"/replay/"+n);if(null!=e&&e.withTimestamp&&i){var s,o=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-o,0)}return r}},{key:"alias",value:function(e,t){return e===this.get_property(Tn)?(On.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(ze(t)&&(t=this.get_distinct_id()),e!==t?(this.Xi(Mn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(On.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=$e({},this.config);if(He(e)){var n,i,r,s,o,a,l,u,c;Pi(this.config,so(e));var h=this.Fi();null==(n=this.persistence)||n.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr($e({},this.config,{persistence:"sessionStorage"}),h);var d=this.Ri(this.config.debug);Je(d)&&(this.config.debug=d),Je(this.config.debug)&&(this.config.debug?(Fe.DEBUG=!0,Gi.Yt()&&Gi.Xt("ph_debug",!0),On.info("set_config",{config:e,oldConfig:t,newConfig:$e({},this.config)})):(Fe.DEBUG=!1,Gi.Yt()&&Gi.Jt("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}},{key:"_overrideSDKInfo",value:function(e,t){Fe.LIB_NAME=e,Fe.LIB_VERSION=t}},{key:"startSessionRecording",value:function(e){var t,n,i,r,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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)||!e.started)}},{key:"captureException",value:function(e,t){if(this.exceptions){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent($e({},i,t))}}},{key:"startExceptionAutocapture",value:function(e){this.set_config({capture_exceptions:null==e||e})}},{key:"stopExceptionAutocapture",value:function(){this.set_config({capture_exceptions:!1})}},{key:"loadToolbar",value:function(e){var t,n;return null!==(t=null==(n=this.toolbar)?void 0:n.loadToolbar(e))&&void 0!==t&&t}},{key:"get_property",value:function(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:to;return t!==to&&(t=to+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ri))===yi||(null==(t=this.sessionPersistence)?void 0:t.get_property(ri))===yi}},{key:"Wi",value:function(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===mi&&!this._isIdentified()&&Ue(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Mn])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ci]))}},{key:"Vi",value:function(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}},{key:"createPersonProfile",value:function(){this.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"Gi",value:function(e){return"never"===this.config.person_profiles?(On.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(ci,!0),!0)}},{key:"Fi",value:function(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==_i)}},{key:"tn",value:function(){var e,t,n,i,r=this.Fi();return(null==(e=this.persistence)?void 0:e.gr)!==r&&(null==(n=this.persistence)||n.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.gr)!==r&&(null==(i=this.sessionPersistence)||i.set_disabled(r)),r}},{key:"opt_in_capturing",value:function(t){var n;if(this.config.cookieless_mode!==pi){if(this.config.cookieless_mode===_i&&this.consent.isExplicitlyOptedOut()){var i,r,s,o,a;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Is(this),this.pageViewManager=new or(this),this.persistence&&(this.sessionPropsManager=new Os(this,this.sessionManager,this.persistence));var l=null!==(s=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==s?s:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ii(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),this.config.cookieless_mode==_i&&(null==(u=this.surveys)||u.loadIfEnabled()),(ze(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(c=null==t?void 0:t.captureEventName)&&void 0!==c?c:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else On.warn(Xs)}},{key:"opt_out_capturing",value:function(){var e,t,n;this.config.cookieless_mode!==pi?(this.config.cookieless_mode===_i&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===_i&&(this.register({distinct_id:di,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(n=this.sessionRecording)||n.stopRecording(),this.sessionRecording=void 0,this.$i())):On.warn(Xs)}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"get_explicit_consent_status",value:function(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}},{key:"is_capturing",value:function(){return this.config.cookieless_mode===pi||(this.config.cookieless_mode===_i?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this.tn()}},{key:"_is_bot",value:function(){return me?Ts(me,this.config.custom_blocked_useragents):void 0}},{key:"$i",value:function(){be&&("visible"===be.visibilityState?this.xi||(this.xi=!0,this.capture(wi,{title:be.title},{send_instantly:!0}),this.Ti&&(be.removeEventListener(bi,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),k(be,bi,this.Ti)))}},{key:"debug",value:function(e){!1===e?(null==ge||ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ge||ge.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}},{key:"Tr",value:function(){var e,t,n,i,r,s,o=this.Ni||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(On.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",i=On,r=(t="advanced_disable_flags")in(e=o)&&!Ke(e[t]),s=n in e&&!Ke(e[n]),r?e[t]:!!s&&(i&&i.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]))}},{key:"Ui",value:function(e){if(Ke(this.config.before_send))return e;var t=qe(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e,i=!0,r=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){if(n=(0,o.value)(n),Ke(n)){var l="Event '"+e.event+"' was rejected in beforeSend function";return Qe(e.event)?On.warn(l+". This can cause unexpected behavior."):On.info(l),null}n.properties&&!Ue(n.properties)||On.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}},{key:"getPageViewId",value:function(){var e;return null==(e=this.pageViewManager.lr)?void 0:e.pageViewId}},{key:"captureTraceFeedback",value:function(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}},{key:"captureTraceMetric",value:function(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}},{key:"Ri",value:function(e){var t=Je(e)&&!e,n=Gi.Yt()&&"true"===Gi.Wt("ph_debug");return!t&&(!!n||e)}}]),e}();ao.__defaultExtensionClasses={},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=Oi(e.prototype[t[n]])}(ao,["identify"]);var lo=["a","button","form","input","select","textarea","label"],uo=["next","previous","prev",">","<"],co=[".ph-no-rageclick",".ph-no-capture"],ho=function(e){return!e||L(e,"html")||!j(e)},fo=function(e,t){if(!ge||ho(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!L(r,"body");)if(N(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var s=V(r);if(!s)break;if(t||lo.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=ge.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}},vo="(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})",_o=new RegExp("^(?:"+vo+")$"),po=new RegExp(vo),go="\\d{3}-?\\d{2}-?\\d{4}",yo=new RegExp("^("+go+")$"),mo=new RegExp("("+go+")");function bo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&y(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var i=z(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+bo(e)).trim())}catch(e){On.error("[AutoCapture]",e)}}),t}var ko=function(){function e(t){_class_call_check(this,e),this.disabled=!1===t;var n=He(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}return _create_class(e,[{key:"isRageClick",value:function(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),wo="$copy_autocapture",xo=Fn("[AutoCapture]"),Eo=Fn("[ExceptionAutocapture]"),So=Fn("[TracingHeaders]"),Po=Fn("[Web Vitals]"),Ro=9e5,Oo="disabled",Fo="lazy_loading",$o="awaiting_config",Io="missing_config";Fn("[SessionRecording]");var To,Co="[SessionRecording]",Mo=Fn(Co),Ao=Fn("[Heatmaps]"),jo=Fn("[Product Tours]"),Lo="ph_product_tours",Do=["$set_once","$set"],No=Fn("[SiteApps]"),qo="Error while initializing PostHog app with config id ",Wo=function(){function e(t){var n=this;_class_call_check(this,e),this.en=new Fs,this.rn=function(e,t){return n.nn(e,t)&&n.sn(e,t)&&n.an(e,t)&&n.ln(e,t)},this.nn=function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)},this._instance=t,this.un=new Set,this.hn=new Set}return _create_class(e,[{key:"init",value:function(){var e,t,n=this;ze(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook(function(e,t){n.on(e,t)})}},{key:"register",value:function(e){var t,n,i=this;if(!ze(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(function(e){var t,n;null==(t=i.hn)||t.add(e),null==(n=e.steps)||n.forEach(function(e){var t;null==(t=i.un)||t.add((null==e?void 0:e.event)||"")})}),null!=(n=this._instance)&&n.autocapture)){var r,s=new Set;e.forEach(function(e){var t;null==(t=e.steps)||t.forEach(function(e){null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}},{key:"on",value:function(e,t){var n,i=this;null!=t&&0!=e.length&&(this.un.has(e)||this.un.has(null==t?void 0:t.event))&&this.hn&&(null==(n=this.hn)?void 0:n.size)>0&&this.hn.forEach(function(e){i.cn(t,e)&&i.en.emit("actionCaptured",e.name)})}},{key:"dn",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"cn",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n=!0,i=!1,r=void 0;try{for(var s,o=t.steps[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(this.rn(e,a))return!0}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return!1}},{key:"onAction",value:function(e,t){return this.en.on(e,t)}},{key:"sn",value:function(e,t){if(null!=t&&t.url){var n,i=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!i||"string"!=typeof i)return!1;if(!re(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"an",value:function(e,t){return!!this.vn(e,t)&&!!this.fn(e,t)&&!!this.pn(e,t)}},{key:"vn",value:function(e,t){var n;if(null==t||!t.href)return!0;var i=this.gn(e);if(i.length>0)return i.some(function(e){return re(e.href,t.href,t.href_matching||"exact")});var r,s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!s&&re((r=s.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}},{key:"fn",value:function(e,t){var n;if(null==t||!t.text)return!0;var i=this.gn(e);if(i.length>0)return i.some(function(e){return re(e.text,t.text,t.text_matching||"exact")||re(e.$el_text,t.text,t.text_matching||"exact")});var r,s,o,a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(r=function(e){for(var t,n=[],i=/(?::|")text="(.*?)"/g;!Ke(t=i.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),s=t.text,o=t.text_matching||"exact",r.some(function(e){return re(e,s,o)}))}},{key:"pn",value:function(e,t){var n,i;if(null==t||!t.selector)return!0;var r=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}},{key:"gn",value:function(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}},{key:"ln",value:function(e,t){return null==t||!t.properties||0===t.properties.length||M(t.properties.reduce(function(e,t){var n=qe(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}]),e}(),Ho=function(){function e(t){_class_call_check(this,e),this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}return _create_class(e,[{key:"wn",value:function(e,t){return!!e&&M(e.propertyFilters,null==t?void 0:t.properties)}},{key:"_n",value:function(e,t){var n=new Map;return e.forEach(function(e){var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(function(t){if(null!=t&&t.name){var i=n.get(t.name)||[];i.push(e.id),n.set(t.name,i)}})}),n}},{key:"In",value:function(e,t,n){var i=this,r=(n===mr?this.mn:this.yn).get(e),s=[];return this.Cn(function(e){s=e.filter(function(e){return null==r?void 0:r.includes(e.id)})}),s.filter(function(r){var s,o=null==(s=r.conditions)||null==(s=s[n])||null==(s=s.values)?void 0:s.find(function(t){return t.name===e});return i.wn(o,t)})}},{key:"register",value:function(e){var t;ze(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Sn(e),this.kn(e))}},{key:"kn",value:function(e){var t=this,n=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0});0!==n.length&&(null==this.xn&&(this.xn=new Wo(this._instance),this.xn.init(),this.xn.dn(function(e){t.onAction(e)})),n.forEach(function(e){var n,i,r,s,o;e.conditions&&null!=(n=e.conditions)&&n.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=t.xn)||s.register(e.conditions.actions.values),null==(o=e.conditions)||null==(o=o.actions)||null==(o=o.values)||o.forEach(function(n){if(n&&n.name){var i=t.bn.get(n.name);i&&i.push(e.id),t.bn.set(n.name,i||[e.id])}}))}))}},{key:"Sn",value:function(e){var t,n=this,i=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),r=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook(function(e,t){n.onEvent(e,t)}),this.mn=this._n(e,mr),this.yn=this._n(e,br))}},{key:"onEvent",value:function(e,t){var n,i=this,r=this.re(),s=this.Tn(),o=this.An(),a=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var l,u;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(null==t||null==(l=t.properties)?void 0:l.$survey_id)||(null==t||null==(u=t.properties)?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);0>h||(a.splice(h,1),this.En(a))}}else{if(this.yn.has(e)){var d=this.In(e,t,br);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(function(e){return e.id})}),d.forEach(function(e){var t=a.indexOf(e.id);0>t||a.splice(t,1),i.Rn(e.id)}),this.En(a))}if(this.mn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.mn.get(e)});var f=this.In(e,t,mr);this.En(a.concat(f.map(function(e){return e.id})||[]))}}}},{key:"onAction",value:function(e){var t,n=this.Tn(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.bn.has(e)&&this.En(i.concat(this.bn.get(e)||[]))}},{key:"En",value:function(e){var t,n=this,i=this.re(),r=this.Tn(),s=_to_consumable_array(new Set(e)).filter(function(e){return!n.Nn(e)});i.info("updating activated items",{activatedItems:s}),null==(t=this._instance)||null==(t=t.persistence)||t.register(_define_property({},r,s))}},{key:"getActivatedIds",value:function(){var e,t=this.Tn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"getEventToItemsMap",value:function(){return this.mn}},{key:"Mn",value:function(){return this.xn}}]),e}(),Uo=function(e){function t(e){return _class_call_check(this,t),_call_super(this,t,[e])}return _inherits(t,e),_create_class(t,[{key:"Tn",value:function(){return"$surveys_activated"}},{key:"An",value:function(){return Er}},{key:"Cn",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"Rn",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"re",value:function(){return Ns}},{key:"Nn",value:function(){return!1}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItemsMap()}}]),t}(Ho),zo="SDK is not enabled or survey functionality is not yet loaded",Bo="Disabled. Not loading surveys.",Go=null!=ge&&ge.location?cr(ge.location.hash,"__posthog")||cr(location.hash,"state"):null,Vo="_postHogToolbarParams",Ko=Fn("[Toolbar]"),Yo=Fn("[FeatureFlags]"),Xo=Fn("[FeatureFlags]",{debugEnabled:!0}),Jo="\" failed. Feature flags didn't load in time.",Zo="$active_feature_flags",Qo="$override_feature_flags",ea="$feature_flag_payloads",ta="$override_feature_flag_payloads",na="$feature_flag_request_id",ia=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},ra=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=m(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),l=a[0],u=a[1];u&&(t[l]=u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},sa=Fn("[Error tracking]"),oa="Refusing to render web experiment since the viewer is a likely bot",aa={icontains:function(e,t){return!!ge&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!ge&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!ge&&Cs(t.href,e)},not_regex:function(e,t){return!!ge&&!Cs(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},la=function(){function e(t){var n=this;_class_call_check(this,e);var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(function(t){e.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach(function(t){if(t.feature_flag_key){var n;i.On&&(e.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.On)||n.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);Be(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.Ln(o)&&i.Pn(t.name,s,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.Fn(oa);else if(!this.Rt.disable_web_experiments){if(Ke(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Fn("applying feature flags",t),t.forEach(function(e){var t;if(n.On&&null!=(t=n.On)&&t.has(e)){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.On)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&n.Pn(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=lr(null==n?void 0:n.search,"__experiment_id"),r=lr(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.Fn("previewing web experiments "+i+" && "+r),this.getWebExperiments(function(e){t.Dn(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.Rt.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="+this.Rt.token),method:"GET",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"Dn",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Pn(r[0].name,n,r[0].variants[n].transforms))}},{key:"Pn",value:function(t,n,i){this._is_bot()?e.Fn(oa):"control"!==n?i.forEach(function(i){if(i.selector){var r;e.Fn("applying transform of variant "+n+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(function(e){var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):e.Fn("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return me&&this._instance?Ts(me,this.Rt.custom_blocked_useragents):void 0}}],[{key:"Ln",value:function(t){return!Ke(t.conditions)&&e.Bn(t)&&e.jn(t)}},{key:"Bn",value:function(t){var n;if(Ke(t.conditions)||Ke(null==(n=t.conditions)?void 0:n.url))return!0;var i,r,s,o=e.getWindowLocation();return!!o&&(null==(i=t.conditions)||!i.url||aa[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,o))}},{key:"getWindowLocation",value:function(){return null==ge?void 0:ge.location}},{key:"jn",value:function(e){var t;if(Ke(e.conditions)||Ke(null==(t=e.conditions)?void 0:t.utm))return!0;var n=E();if(n.utm_source){var i,r,s,o,a,l,u,c,h=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==n.utm_campaign,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==n.utm_source,f=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==n.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==n.utm_term;return h&&f&&v&&d}return!1}},{key:"Fn",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];On.info("[WebExperiments] "+e,n)}}]),e}(),ua=Fn("[Conversations]"),ca="Conversations not available yet.",ha={featureFlags:function(){function e(t){_class_call_check(this,e),this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"Kr",get:function(){return this._instance.persistence}},{key:"Wn",value:function(e){return this._instance.get_property(e)}},{key:"Gn",value:function(){var e,t;return null!==(e=null==(t=this.Kr)?void 0:t.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}},{key:"Xn",value:function(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,Yo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"Jn",value:function(){var e,t=null!==(e=this.Rt.evaluation_contexts)&&void 0!==e?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(Yo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=t&&t.length?t.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Yo.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}},{key:"Kn",value:function(){return this.Jn().length>0}},{key:"initialize",value:function(){var e,t,n=this._instance.config,i=null!==(e=null==(t=n.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var r,s,o=null!==(r=null==(s=n.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(i).filter(function(e){return!!i[e]}).reduce(function(e,t){return e[t]=i[t]||!1,e},{}),l=Object.keys(o).filter(function(e){return a[e]}).reduce(function(e,t){return o[t]&&(e[t]=o[t]),e},{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}},{key:"updateFlags",value:function(e,t,n){var i=null!=n&&n.merge?this.getFlagVariants():{},r=null!=n&&n.merge?this.getFlagPayloads():{},s=$e({},i,e),o=$e({},r,t),a={},l=!0,u=!1,c=void 0;try{for(var h,d=Object.entries(s)[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var f=_sliced_to_array(h.value,2),v=f[0],_=f[1],p="string"==typeof _;a[v]={key:v,enabled:!!p||Boolean(_),variant:p?_:void 0,reason:void 0,metadata:ze(null==o?void 0:o[v])?void 0:{id:0,version:void 0,description:void 0,payload:o[v]}}}}catch(e){u=!0,c=e}finally{try{l||null==d.return||d.return()}finally{if(u)throw c}}this.receivedFeatureFlags({flags:a})}},{key:"hasLoadedFlags",get:function(){return this.Zn}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.Wn(Xn),t=this.Wn(Qo),n=this.Wn(ta);if(!n&&!t)return e||{};var i=Pi({},e||{}),r=_to_consumable_array(new Set(_to_consumable_array(Object.keys(n||{})).concat(_to_consumable_array(Object.keys(t||{}))))),s=!0,o=!1,a=void 0;try{for(var l,u=r[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){var c,h,d=l.value,f=i[d],v=null==t?void 0:t[d],_=ze(v)?null!==(c=null==f?void 0:f.enabled)&&void 0!==c&&c:!!v,p=ze(v)?f.variant:"string"==typeof v?v:void 0,g=null==n?void 0:n[d],y=$e({},f,{enabled:_,variant:_?null!=p?p:null==f?void 0:f.variant:void 0});_!==(null==f?void 0:f.enabled)&&(y.original_enabled=null==f?void 0:f.enabled),p!==(null==f?void 0:f.variant)&&(y.original_variant=null==f?void 0:f.variant),g&&(y.metadata=$e({},null==f?void 0:f.metadata,{payload:g,original_payload:null==f||null==(h=f.metadata)?void 0:h.payload})),i[d]=y}}catch(e){o=!0,a=e}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return this.qn||(Yo.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.qn=!0),i}},{key:"getFlagVariants",value:function(){var e=this.Wn(Kn),t=this.Wn(Qo);if(!t)return e||{};for(var n=Pi({},e),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.qn||(Yo.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.qn=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.Wn(ea),t=this.Wn(ta);if(!t)return e||{};for(var n=Pi({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.qn||(Yo.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.qn=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout(function(){e.ts()},5))}},{key:"es",value:function(){clearTimeout(this.Qn),this.Qn=void 0}},{key:"ensureFlagsLoaded",value:function(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.Hn=e}},{key:"ts",value:function(e){var t,n=this;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var i=this.Rt.token,r=this.Wn(Cn),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:$e({},(null==(t=this.Kr)?void 0:t.get_initial_props())||{},this.Wn(Jn)||{}),group_properties:this.Wn(Zn),timezone:I()};Ve(r)||ze(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Kn()&&(s.evaluation_contexts=this.Jn());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this.Rt.disable_compression?void 0:qr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:function(e){var t,i,r,o=!0;if(200===e.statusCode&&(n.Vn||(n.$anon_distinct_id=void 0),o=!1),n.$n=!1,!s.disable_flags||n.Vn){n.zn=!o;var a=[];e.error?_instanceof(e.error,Error)?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),null==(r=n.Kr)||r.register(_define_property({},ni,a)),u?Yo.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||n.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},o),n.Vn&&(n.Vn=!1,n.ts()))}}})}}},{key:"getFeatureFlag",value:function(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var i=this.getFeatureFlagResult(e,t);return null!==(n=null==i?void 0:i.variant)&&void 0!==n?n:null==i?void 0:i.enabled}}else Yo.warn('getFeatureFlag for key "'+e+Jo)}},{key:"getFeatureFlagDetails",value:function(e){return this.getFlagsWithDetails()[e]}},{key:"getFeatureFlagPayload",value:function(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}},{key:"getFeatureFlagResult",value:function(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var n=this.getFlagVariants(),i=e in n,r=n[e],s=this.getFlagPayloads()[e],o=String(r),a=this.Wn(na)||void 0,l=this.Wn(ii)||void 0,u=this.Wn(ei)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h,d=this._instance.get_session_id(),f=this.Wn(ti);d&&d!==f&&(u={},null==(c=this.Kr)||c.register((_define_property(h={},ei,u),_define_property(h,ti,d),h)))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var v,_,p,g,y,m,b,k,w,x;qe(u[e])?u[e].push(o):u[e]=[o],null==(v=this.Kr)||v.register(_define_property({},ei,u));var E=this.getFeatureFlagDetails(e),S=_to_consumable_array(null!==(_=this.Wn(ni))&&void 0!==_?_:[]);ze(r)&&S.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[e])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[e])||null,$used_bootstrap_value:!this.zn};ze(null==E||null==(y=E.metadata)?void 0:y.version)||(P.$feature_flag_version=E.metadata.version);var R,O=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(k=E.reason)?void 0:k.code;O&&(P.$feature_flag_reason=O),null!=E&&null!=(w=E.metadata)&&w.id&&(P.$feature_flag_id=E.metadata.id),ze(null==E?void 0:E.original_variant)&&ze(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=ze(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(P.$feature_flag_original_payload=null==E||null==(R=E.metadata)?void 0:R.original_payload),S.length&&(P.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",P)}if(i){var F=s;if(!ze(s))try{F=JSON.parse(s)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:F}}}}else Yo.warn('getFeatureFlagResult for key "'+e+Jo)}},{key:"getRemoteConfigPayload",value:function(e,t){var n=this.Rt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.Kn()&&(i.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Rt.disable_compression?void 0:qr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:function(n){var i,r=null==(i=n.json)?void 0:i.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}},{key:"isFeatureEnabled",value:function(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return ze(n)?void 0:!!n}Yo.warn('isFeatureEnabled for key "'+e+Jo)}}},{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,t){if(this.Kr){this.Zn=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,n,i,r){void 0===n&&(n={}),void 0===i&&(i={}),void 0===r&&(r={});var s,o,a=((o=(s=e).flags)?(s.featureFlags=Object.fromEntries(Object.keys(o).map(function(e){var t;return[e,null!==(t=o[e].variant)&&void 0!==t?t:o[e].enabled]})),s.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(function(e){return o[e].enabled}).filter(function(e){var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(function(e){var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):Yo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),s),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(qe(u)){Yo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f,v={};if(u)for(var _=0;u.length>_;_++)v[u[_]]=!0;t&&t.register((_define_property(f={},Zo,u),_define_property(f,Kn,v),f))}else{var p,g=u,y=c,m=l;if(e.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter(function(e){var t;return!(null!=(t=l[e])&&t.failed)}));g=$e({},n,Object.fromEntries(Object.entries(g).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)}))),y=$e({},i,Object.fromEntries(Object.entries(y||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)}))),m=$e({},r,Object.fromEntries(Object.entries(m||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return b.has(t)})))}else g=$e({},n,g),y=$e({},i,y),m=$e({},r,m);t&&t.register($e((_define_property(p={},Zo,Object.keys(ra(g))),_define_property(p,Kn,g||{}),_define_property(p,ea,y||{}),_define_property(p,Xn,m||{}),p),h?_define_property({},na,h):{},d?_define_property({},ii,d):{}))}}}(e,this.Kr,n,i,r),t||(this.Un=!1),this.rs(t)}}},{key:"override",value:function(e,t){void 0===t&&(t=!1),Yo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this._instance.__loaded||!this.Kr)return Yo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Kr.unregister(Qo),this.Kr.unregister(ta),this.rs(),Xo.info("All overrides cleared");if(qe(e)){var t=ia(e);return this.Kr.register(_define_property({},Qo,t)),this.rs(),Xo.info("Flag overrides set",{flags:e})}if(e&&"object"==(void 0===e?"undefined":_type_of(e))&&("flags"in e||"payloads"in e)){var n,i=e;if(this.qn=Boolean(null!==(n=i.suppressWarning)&&void 0!==n&&n),"flags"in i)if(!1===i.flags)this.Kr.unregister(Qo),Xo.info("Flag overrides cleared");else if(i.flags){if(qe(i.flags)){var r=ia(i.flags);this.Kr.register(_define_property({},Qo,r))}else this.Kr.register(_define_property({},Qo,i.flags));Xo.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this.Kr.unregister(ta),Xo.info("Payload overrides cleared")):i.payloads&&(this.Kr.register(_define_property({},ta,i.payloads)),Xo.info("Payload overrides set",{payloads:i.payloads}))),void this.rs()}if(e&&"object"==(void 0===e?"undefined":_type_of(e)))return this.Kr.register(_define_property({},Qo,e)),this.rs(),Xo.info("Flag overrides set",{flags:e});Yo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.Zn){var n=this.ns(),i=n.flags,r=n.flagVariants;e(i,r)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i,r=(this.Wn(Yn)||[]).find(function(t){return t.flagKey===e}),s=_define_property({},"$feature_enrollment/"+e,t),o={$feature_flag:e,$feature_enrollment:t,$set:s};r&&(o.$early_access_feature_name=r.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a,l=$e({},this.getFlagVariants(),_define_property({},e,t));null==(i=this.Kr)||i.register((_define_property(a={},Zo,Object.keys(ra(l))),_define_property(a,Kn,l),a)),this.rs()}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i=this;void 0===t&&(t=!1);var r=this.Wn(Yn),s=n?"&"+n.map(function(e){return"stage="+e}).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:function(t){var n,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(n=i.Kr)||n.unregister(Yn),null==(r=i.Kr)||r.register(_define_property({},Yn,s)),e(s)}}})}},{key:"ns",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:"rs",value:function(e){var t=this.ns(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach(function(t){return t(n,i,{errorsLoading:e})})}},{key:"setPersonPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.Wn(Jn)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,s={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in n||(s[o]=r[o]));this._instance.register(_define_property({},Jn,$e({},n,s,i))),t&&this._instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this._instance.unregister(Jn)}},{key:"setGroupPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.Wn(Zn)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(function(t){n[t]=$e({},n[t],e[t]),delete e[t]}),this._instance.register(_define_property({},Zn,$e({},n,e))),t&&this._instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.Wn(Zn)||{};this._instance.register(_define_property({},Zn,$e({},t,_define_property({},e,{}))))}else this._instance.unregister(Zn)}},{key:"reset",value:function(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}]),e}()},da={sessionRecording:function(){function e(t){if(_class_call_check(this,e),this._forceAllowLocalhostNetworkCapture=!1,this.os=Oo,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw Mo.error("started without valid sessionManager"),new Error(Co+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===pi)throw new Error(Co+' cannot be used with cookieless_mode="always"')}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"Kr",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!(null==(e=this.ss)||!e.isStarted)}},{key:"status",get:function(){var e,t;return this.os===$o||this.os===Io?this.os:null!==(e=null==(t=this.ss)?void 0:t.status)&&void 0!==e?e:this.os}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"us",get:function(){var e,t=!(null==(e=this._instance.get_property(Bn))||!e.enabled),n=!this.Rt.disable_session_recording,i=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return ge&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){var t;if(!this.us||null==(t=this.ss)||!t.isStarted){var n=!ze(Object.assign)&&!ze(Array.from);this.us&&n?(this.hs(e),Mo.info("starting")):(this.os=Oo,this.stopRecording())}}},{key:"hs",value:function(e){var t,n,i,r=this;this.us&&(this.os!==$o&&this.os!==Io&&(this.os=Fo),null!=Re&&null!=(t=Re.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=Re.__PosthogExtensions__)&&n.initSessionRecording?this.cs(e):null==(i=Re.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.ds,function(t){if(t)return Mo.error("could not load recorder",t);r.cs(e)}))}},{key:"stopRecording",value:function(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.stop()}},{key:"vs",value:function(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.discard()}},{key:"fs",value:function(){var e;null==(e=this.Kr)||e.unregister(Vn)}},{key:"ps",value:function(e,t){if(Ke(e))return null;var n,i=Ye(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Mo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}},{key:"gs",value:function(e){var t=this;if(this.Kr){var n,i,r=this.Kr,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.ps(null==(n=t.Rt.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.ps(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Ke(a)&&t.fs();var l=null==i?void 0:i.minimumDurationMilliseconds;r.register(_define_property({},Bn,$e({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:$e({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ze(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})))};s(),null==(n=this.ls)||n.call(this),this.ls=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.gs(e),void this.vs()):(this.gs(e),void this.startIfEnabledOrStop()):(this.os===$o&&(this.os=Io,Mo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}},{key:"log",value:function(e,t){var n;void 0===t&&(t="log"),null!=(n=this.ss)&&n.log?this.ss.log(e,t):Mo.warn("log called before recorder was ready")}},{key:"ds",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Bn);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"ys",value:function(){var e,t=this._instance.get_property(Bn);if(!t)return!1;var n=null!==(e=("object"==(void 0===t?"undefined":_type_of(t))?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-n}},{key:"cs",value:function(e){var t,n;if(null==(t=Re.__PosthogExtensions__)||!t.initSessionRecording)return Mo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ss||(this.ss=null==(n=Re.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Io||this.os===$o)return;return this.os=$o,Mo.info("persisted remote config is stale, requesting fresh config before starting"),void new Dr(this._instance).load()}this.os=Fo,this.ss.start(e)}},{key:"onRRwebEmit",value:function(e){var t;null==(t=this.ss)||null==t.onRRwebEmit||t.onRRwebEmit(e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_linked_flag:!0}),null==(e=this.ss)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_sampling:!0}),null==(e=this.ss)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.ss||null==(n=this.Kr)||n.register(_define_property({},"url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger",!0)),null==(t=this.ss)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.ss)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!(null==(n=this.ss)||!n.tryAddCustomEvent(e,t))}}]),e}()},fa={autocapture:function(){function e(t){_class_call_check(this,e),this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new ko(t.config.rageclick),this.Is=null}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"Rt",get:function(){var e,t,n=He(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null==(e=n.url_allowlist)?void 0:e.map(function(e){return new RegExp(e)}),n.url_ignorelist=null==(t=n.url_ignorelist)?void 0:t.map(function(e){return new RegExp(e)}),n}},{key:"Cs",value:function(){var e=this;if(this.isBrowserSupported()){if(ge&&be){var t=function(t){t=t||(null==ge?void 0:ge.event);try{e.Ss(t)}catch(e){xo.error("Failed to capture event",e)}};if(k(be,"submit",t,{capture:!0}),k(be,"change",t,{capture:!0}),k(be,"click",t,{capture:!0}),this.Rt.capture_copied_text){var n=function(t){e.Ss(t=t||(null==ge?void 0:ge.event),wo)};k(be,"copy",n,{capture:!0}),k(be,"cut",n,{capture:!0})}}}else xo.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}},{key:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this._s=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(_define_property({},jn,!!e.autocapture_opt_out)),this.ws=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this.Is=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null==(t=this.Is)||t.forEach(function(t){var i=null==be?void 0:be.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.props[jn];if(Ve(this.ws)&&!Je(n)&&!this.instance.Tr())return!1;var i=null!==(t=this.ws)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}},{key:"Ss",value:function(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=B(e);D(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&_instanceof(e,MouseEvent)&&this.instance.config.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!ge||ho(e))return!1;var n,i,r;if(Je(t)?(n=!!t&&co,i=void 0):(n=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:co,i=null==t?void 0:t.content_ignorelist),!1===n)return!1;var s=fo(e,!1).targetElementList;return!function(e,t){if(!1===e||ze(e))return!1;var n;if(!0===e)n=uo;else{if(!qe(e))return!1;if(e.length>10)return On.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(function(e){return e.toLowerCase()})}return t.some(function(e){var t=e.safeText,i=e.ariaLabel;return n.some(function(e){return t.includes(e)||i.includes(e)})})}(i,s.map(function(e){var t;return{safeText:z(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!G(s,n)}(i,this.instance.config.rageclick)&&this.Ss(e,"$rageclick");var r=t===wo;if(i&&function(e,t,n,i,r){var s,o,a,l;if(void 0===n&&(n=void 0),!ge||ho(e))return!1;if(null!=(s=n)&&s.url_allowlist&&!W(n.url_allowlist))return!1;if(null!=(o=n)&&o.url_ignorelist&&W(n.url_ignorelist))return!1;if(null!=(a=n)&&a.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(function(e){return t.type===e}))return!1}var c=fo(e,i),h=c.parentIsUsefulElement,d=c.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(ze(n))return!0;var i,r=function(e){if(n.some(function(t){return e.tagName.toLowerCase()===t}))return{v:!0}},s=!0,o=!1,a=void 0;try{for(var l,u=e[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){if(i=r(l.value))return i.v}}catch(e){o=!0,a=e}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return!1}(d,n))return!1;if(!G(d,null==(l=n)?void 0:l.css_selector_allowlist))return!1;var f=ge.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return h?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(lo.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.Rt,r,r?["copy","cut"]:void 0)){var s=function(e,t){for(var n,i,r=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,l=t.elementsChainAsString,u=[e],h=e;h.parentNode&&!L(h,"body");)N(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,f,v,_=[],p={},g=!1,b=!1;if(y(u,function(e){var t=K(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&X(g)&&g),c(H(e),"ph-no-capture")&&(b=!0),_.push(function(e,t,n,i){var r=e.tagName.toLowerCase(),s={tag_name:r};lo.indexOf(r)>-1&&!n&&(s.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?ee(1024,J(e)):ee(1024,z(e)));var o=H(e);o.length>0&&(s.classes=o.filter(function(e){return""!==e})),y(e.attributes,function(n){var r;if((!Y(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&X(n.value)&&(!Be(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=n.value;"class"===n.name&&(o=q(o).join(" ")),s["attr__"+n.name]=ee(1024,o)}});for(var a=1,l=1,u=e;u=te(u);)a++,u.tagName===e.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}(e,s,o,a));var n=function(e){if(!K(e))return{};var t={};return y(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&&X(i)&&(t[n]=i)}}),t}(e);Pi(p,n)}),b)return{props:{},explicitNoCapture:b};if(o||(_[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?J(e):z(e)),g){var k,w;_[0].attr__href=g;var x=null==(k=ar(g))?void 0:k.host,E=null==ge||null==(w=ge.location)?void 0:w.host;x&&E&&x!==E&&(d=g)}return{props:Pi({$event_type:r.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(f=_,function(e){return e.map(function(e){var t,n,i="",r=!0,s=!1,o=void 0;if(e.tag_name&&(i+=e.tag_name),e.attr_class)try{for(var a,l=(e.attr_class.sort(),e.attr_class)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)i+="."+a.value.replace(/"/g,"")}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}var u=$e({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),c={};return m(u).sort(function(e,t){var n=_sliced_to_array(e,1)[0],i=_sliced_to_array(t,1)[0];return n.localeCompare(i)}).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],i=t[1];return c[Z(n.toString())]=Z(i.toString())}),(i+=":")+m(c).map(function(e){var t=_sliced_to_array(e,2);return t[0]+'="'+t[1]+'"'}).join("")}).join(";")}((v=f,v.map(function(e){var t,n,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:Q(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return m(e).filter(function(e){return 0===_sliced_to_array(e,1)[0].indexOf("attr__")}).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=t[1];return i.attributes[n]=r}),i}))))},null!=(n=_[0])&&n.$el_text?{$el_text:null==(i=_[0])?void 0:i.$el_text}:{},d&&"click"===r.type?{$external_click_url:d}:{},p)}}(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===wo){var l,u=U(null==ge||null==(l=ge.getSelection())?void 0:l.toString()),h=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(t,o),!0}}}},{key:"isBrowserSupported",value:function(){return We(null==be?void 0:be.querySelectorAll)}}]),e}(),historyAutocapture:function(){function e(t){var n;_class_call_check(this,e),this._instance=t,this.ks=(null==ge||null==(n=ge.location)?void 0:n.pathname)||""}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"isEnabled",get:function(){return"history_change"===this._instance.config.capture_pageview}},{key:"startIfEnabled",value:function(){this.isEnabled&&(On.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"stop",value:function(){this.xs&&this.xs(),this.xs=void 0,On.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){var e,t;if(ge&&ge.history){var n=this;null!=(e=ge.history.pushState)&&e.__posthog_wrapped__||ne(ge.history,"pushState",function(e){return function(t,i,r){e.call(this,t,i,r),n.Ts("pushState")}}),null!=(t=ge.history.replaceState)&&t.__posthog_wrapped__||ne(ge.history,"replaceState",function(e){return function(t,i,r){e.call(this,t,i,r),n.Ts("replaceState")}}),this.As()}}},{key:"Ts",value:function(e){try{var t,n=null==ge||null==(t=ge.location)?void 0:t.pathname;if(!n)return;n!==this.ks&&this.isEnabled&&this._instance.capture(wi,{navigation_type:e}),this.ks=n}catch(t){On.error("Error capturing "+e+" pageview",t)}}},{key:"As",value:function(){var e=this;if(!this.xs){var t=function(){e.Ts("popstate")};k(ge,"popstate",t),this.xs=function(){ge&&ge.removeEventListener("popstate",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;_class_call_check(this,e),this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(n=this.instance.persistence)||!n.props[Ln]),this.rageclicks=new ko(t.config.rageclick)}return _create_class(e,[{key:"Rt",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return He(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return Ke(this.Rt.capture_heatmaps)?Ke(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this.bs)return;Ao.info("starting..."),this.Ns(),this.Tt()}else{var e;clearInterval(null!==(e=this.Rs)&&void 0!==e?e:void 0),this.Ms(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(_define_property({},Ln,t)),this.Es=t,this.startIfEnabled()}}},{key:"getAndClearBuffer",value:function(){var e=this.T;return this.T=void 0,e}},{key:"Fs",value:function(e){this.wt(e.originalEvent,"deadclick")}},{key:"Tt",value:function(){this.Rs&&clearInterval(this.Rs),this.Rs="visible"===(null==be?void 0:be.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}},{key:"Ns",value:function(){var e=this;ge&&be&&(this.Os=this.Zr.bind(this),k(ge,ki,this.Os),this.Ps=function(t){return e.wt(t||(null==ge?void 0:ge.event))},k(be,"click",this.Ps,{capture:!0}),this.Ls=function(t){return e.Ds(t||(null==ge?void 0:ge.event))},k(be,"mousemove",this.Ls,{capture:!0}),this.Bs=new nr(this.instance,er,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),k(be,bi,this.js),this.bs=!0)}},{key:"Ms",value:function(){var e;ge&&be&&(this.Os&&ge.removeEventListener(ki,this.Os),this.Ps&&be.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&be.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&be.removeEventListener(bi,this.js),clearTimeout(this.qs),null==(e=this.Bs)||e.stop(),this.bs=!1)}},{key:"Zs",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=function(e,t,n){for(var i=e;i&&j(i)&&!L(i,"body");){if(i===n)return!1;if(c(t,null==ge?void 0:ge.getComputedStyle(i).position))return!0;i=V(i)}return!1}(B(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"wt",value:function(e,t){var n;if(void 0===t&&(t="click"),!A(e.target)&&ie(e)){var i=this.Zs(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.$s($e({},i,{type:"rageclick"})),this.$s(i)}}},{key:"Ds",value:function(e){var t=this;!A(e.target)&&ie(e)&&(clearTimeout(this.qs),this.qs=setTimeout(function(){t.$s(t.Zs(e,"mousemove"))},500))}},{key:"$s",value:function(e){if(ge){var t=ge.location.href,n=this.Rt.custom_personal_data_properties,i=this.Rt.mask_personal_data_properties?_to_consumable_array(dr).concat(_to_consumable_array(n||[])):[],r=ur(t,i,vr);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}},{key:"Zr",value:function(){this.T&&!Ue(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:nr,webVitalsAutocapture:function(){function e(t){var n,i=this;_class_call_check(this,e),this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=function(){clearTimeout(i.Vs),0!==i.T.metrics.length&&(i._instance.capture("$web_vitals",i.T.metrics.reduce(function(e,t){var n;return $e({},e,(_define_property(n={},"$web_vitals_"+t.name+"_event",$e({},t)),_define_property(n,"$web_vitals_"+t.name+"_value",t.value),n))},{})),i.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=function(e){var t,n=null==(t=i._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(ze(n))Po.error("Could not read session ID. Dropping metrics!");else{i.T=i.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=i.zs();ze(r)||(Ke(null==e?void 0:e.name)||Ke(null==e?void 0:e.value)?Po.error("Invalid metric received",e):!i.Ys||i.Ys>e.value?(i.T.url!==r&&(i.Hs(),i.Vs=setTimeout(i.Hs,i.flushToCaptureTimeoutMs)),ze(i.T.url)&&(i.T.url=r),i.T.firstMetricTimestamp=ze(i.T.firstMetricTimestamp)?Date.now():i.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),i.T.metrics.push($e({},e,{$current_url:r,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),i.T.metrics.length===i.allowedMetrics.length&&i.Hs()):Po.error("Ignoring metric with value >= "+i.Ys,e))}},this.Us=function(){if(!i.bs){var e,t,n,r,s,o=Re.__PosthogExtensions__;ze(o)||ze(o.postHogWebVitalsCallbacks)||(e=(s=o.postHogWebVitalsCallbacks).onLCP,t=s.onCLS,n=s.onFCP,r=s.onINP),e&&t&&n&&r?(i.allowedMetrics.indexOf("LCP")>-1&&e(i.nt.bind(i)),i.allowedMetrics.indexOf("CLS")>-1&&t(i.nt.bind(i)),i.allowedMetrics.indexOf("FCP")>-1&&n(i.nt.bind(i)),i.allowedMetrics.indexOf("INP")>-1&&r(i.nt.bind(i)),i.bs=!0):Po.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(n=this._instance.persistence)||!n.props[Wn]),this.startIfEnabled()}return _create_class(e,[{key:"Ws",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=He(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return Ke(n)?(null==(t=this._instance.persistence)?void 0:t.props[zn])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(He(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"useAttribution",get:function(){var e=He(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}},{key:"Ys",get:function(){var e=He(this.Ws)&&Ye(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Ro;return e>0&&6e4>=e?Ro:e}},{key:"isEnabled",get:function(){var e=null==ke?void 0:ke.protocol;if("http:"!==e&&"https:"!==e)return Po.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=He(this.Ws)?this.Ws.web_vitals:Je(this.Ws)?this.Ws:void 0;return Je(t)?t:this.Es}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.bs&&(Po.info("enabled, starting..."),this.nr(this.Us))}},{key:"onRemoteConfig",value:function(e){if("capturePerformance"in e){var t=He(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=He(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register(_define_property({},Wn,t)),this._instance.persistence.register(_define_property({},zn,n))),this.Es=t,this.startIfEnabled()}}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",function(t){t?Po.error("failed to load script",t):e()})}},{key:"zs",value:function(){var e=ge?ge.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?_to_consumable_array(dr).concat(_to_consumable_array(t||[])):[];return ur(e,n,vr)}Po.error("Could not determine current URL")}}]),e}()},va={exceptionObserver:function(){function e(t){var n,i,r,s=this;_class_call_check(this,e),this.Us=function(){var e;if(ge&&s.isEnabled&&null!=(e=Re.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Re.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=Re.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Re.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!s.Gs&&s.Rt.capture_unhandled_errors&&(s.Gs=t(s.captureException.bind(s))),!s.Xs&&s.Rt.capture_unhandled_rejections&&(s.Xs=n(s.captureException.bind(s))),!s.Js&&s.Rt.capture_console_errors&&(s.Js=i(s.captureException.bind(s)))}catch(e){Eo.error("failed to start",e),s.Ks()}}},this._instance=t,this.Qs=!(null==(n=this._instance.persistence)||!n.props[Dn]),this.eo=new lt({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,qt:Eo}),this.Rt=this.ro(),this.startIfEnabledOrStop()}return _create_class(e,[{key:"ro",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return He(e)?t=$e({},t,e):(ze(e)?this.Qs:e)&&(t=$e({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(Eo.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",function(t){if(t)return Eo.error("failed to load script",t);e()})}},{key:"Ks",value:function(){var e,t,n;null==(e=this.Gs)||e.call(this),this.Gs=void 0,null==(t=this.Xs)||t.call(this),this.Xs=void 0,null==(n=this.Js)||n.call(this),this.Js=void 0}},{key:"onRemoteConfig",value:function(e){"autocaptureExceptions"in e&&(this.Qs=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register(_define_property({},Dn,this.Qs)),this.Rt=this.ro(),this.startIfEnabledOrStop())}},{key:"onConfigChange",value:function(){this.Rt=this.ro()}},{key:"captureException",value:function(e){var t,n,i,r=null!==(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)&&void 0!==t?t:"Exception";this.eo.consumeRateLimit(r)?Eo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}}]),e}(),exceptions:function(){function e(t){var n,i;_class_call_check(this,e),this.io=[],this.no=new on([new gn,new Pn,new mn,new yn,new En,new xn,new kn,new Sn],function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var r=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var l=pn.test(a)?a.replace(pn,"$1"):a;if(!l.match(/\S*Error: /)){var u=!0,c=!1,h=void 0;try{for(var d,f=n[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var v=(0,d.value)(l,e);if(v){r.push(v);break}}}catch(e){c=!0,h=e}finally{try{u||null==f.return||f.return()}finally{if(c)throw h}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(function(e){return $e({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||an});var n})}(r)}}("web:javascript",dn,_n)),this._instance=t,this.io=null!==(n=null==(i=this._instance.persistence)?void 0:i.get_property(Nn))&&void 0!==n?n:[]}return _create_class(e,[{key:"onRemoteConfig",value:function(e){var t,n,i;if("errorTracking"in e){var r,s=null!==(t=null==(n=e.errorTracking)?void 0:n.suppressionRules)&&void 0!==t?t:[],o=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this.io=s,this._instance.persistence&&this._instance.persistence.register((_define_property(r={},Nn,this.io),_define_property(r,qn,o),r))}}},{key:"so",get:function(){var e,t=!!this._instance.get_property(qn),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=n?n:t)&&void 0!==e&&e}},{key:"buildProperties",value:function(e,t){return this.no.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"sendExceptionEvent",value:function(e){var t=e.$exception_list;if(this.oo(t)){if(this.ao(t))return void sa.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(t))return void sa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(t))return void sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}},{key:"ao",value:function(e){if(0===e.length)return!1;var t=e.reduce(function(e,t){var n=t.type,i=t.value;return Be(n)&&n.length>0&&e.$exception_types.push(n),Be(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.io.some(function(e){var n=e.values.map(function(e){var n,i=Ms[e.operator],r=qe(e.value)?e.value:[e.value],s=null!==(n=t[e.key])&&void 0!==n?n:[];return r.length>0&&i(r,s)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}},{key:"lo",value:function(e){return e.flatMap(function(e){var t,n;return null!==(t=null==(n=e.stacktrace)?void 0:n.frames)&&void 0!==t?t:[]}).some(function(e){return e.filename&&e.filename.startsWith("chrome-extension://")})}},{key:"uo",value:function(e){if(e.length>0){var t,n,i,r,s=null!==(t=null==(n=e[0].stacktrace)?void 0:n.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==i&&i}return!1}},{key:"oo",value:function(e){return!Ke(e)&&qe(e)}}]),e}()},_a=$e({productTours:function(){function e(t){_class_call_check(this,e),this.ho=null,this.co=null,this._instance=t}return _create_class(e,[{key:"Kr",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){"productTours"in e&&(this.Kr&&this.Kr.register(_define_property({},Un,!!e.productTours)),this.loadIfEnabled())}},{key:"loadIfEnabled",value:function(){var e,t,n=this;this.ho||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Un)||this.nr(function(){return n.do()})}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",function(t){t?jo.error("Could not load product tours script",t):e()})}},{key:"do",value:function(){var e;!this.ho&&null!=(e=Re.__PosthogExtensions__)&&e.generateProductTours&&(this.ho=Re.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e,t){var n=this;if(void 0===t&&(t=!1),!qe(this.co)||t){var i=this.Kr;if(i){var r=i.props[Lo];if(qe(r)&&!t)return this.co=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:function(t){var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return jo.error(s),void e([],{isLoaded:!1,error:s})}var o=qe(t.json.product_tours)?t.json.product_tours:[];n.co=o,i&&i.register(_define_property({},Lo,o)),e(o,{isLoaded:!0})}})}else e(this.co,{isLoaded:!0})}},{key:"getActiveProductTours",value:function(e){Ke(this.ho)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.ho)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.ho?this.ho.previewTour(e):this.nr(function(){var n;t.do(),null==(n=t.ho)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.ho)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.ho)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.ho)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.co=null,null==(e=this.Kr)||e.unregister(Lo)}},{key:"resetTour",value:function(e){var t;null==(t=this.ho)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.ho)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.ho)||t.cancelPendingTour(e)}}]),e}()},ha),pa={siteApps:function(){function e(t){_class_call_check(this,e),this._instance=t,this.vo=[],this.apps={}}return _create_class(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"fo",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.vo.push(n),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=Re._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}},{key:"initialize",value:function(){var e=this;if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=function(){t(),e.vo=[],e.po=void 0}}}},{key:"globalsForEvent",value:function(e){var t,n,i,r,s,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{},d=!0,f=!1,v=void 0;try{for(var _,p=Object.entries(h)[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var g=_sliced_to_array(_.value,2),y=g[0],m=g[1];l[y]={id:c[y],type:y,properties:m}}}catch(e){f=!0,v=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw v}}var b=e.$set_once,k=e.$set;return{event:$e({},u(e,Do),{properties:$e({},e.properties,k?{$set:$e({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},k)}:{},b?{$set_once:$e({},null!==(i=null==(r=e.properties)?void 0:r.$set_once)&&void 0!==i?i:{},b)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.vo.length&&(No.info("Processing "+t.vo.length+" events for site app with id "+e.id),t.vo.forEach(function(e){return null==n.processEvent?void 0:n.processEvent(e)}),n.processedBuffer=!0),Object.values(t.apps).every(function(e){return e.processedBuffer||e.errored})&&(null==(i=t.po)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,No.info("Site app with id "+e.id+" "+(t?"loaded":"errored")),r&&i()};try{var o=e.init({posthog:this._instance,callback:function(e){s(e)}}).processEvent;o&&(n.processEvent=o),r=!0}catch(t){No.error(qo+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){No.error("Error while processing buffered events PostHog app with config id "+e.id,t),n.errored=!0}}},{key:"mo",value:function(){var e=this.siteAppLoaders||[],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.apps[o.id]={id:o.id,loaded:!1,errored:!1,processedBuffer:!1}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}var a=!0,l=!1,u=void 0;try{for(var c,h=e[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;this.setupSiteApp(d)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}},{key:"yo",value:function(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e),n=!0,i=!1,r=void 0;try{for(var s,o=Object.values(this.apps)[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;try{null==a.processEvent||a.processEvent(t)}catch(t){No.error("Error while processing event "+e.event+" for site app "+a.id,t)}}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r=this,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",function(e){return r.yo(e)})):void No.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.po)||n.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var o=function(e){var t;Re["__$$ph_site_app_"+e]=s._instance,null==(t=Re.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,v,function(t){if(t)return No.error(qo+e,t)})},a=!0,l=!1,u=void 0;try{for(var c,h=e.siteApps[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value,f=d.id,v=d.url;o(f)}}catch(e){l=!0,u=e}finally{try{a||null==h.return||h.return()}finally{if(l)throw u}}}else No.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}()},ga={tracingHeaders:function(){function e(t){var n=this;_class_call_check(this,e),this.bo=void 0,this.wo=void 0,this.Us=function(){var e,t;ze(n.bo)&&(null==(e=Re.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(n._instance.config.__add_tracing_headers||[],n._instance.get_distinct_id(),n._instance.sessionManager)),ze(n.wo)&&(null==(t=Re.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(n._instance.config.__add_tracing_headers||[],n._instance.get_distinct_id(),n._instance.sessionManager))},this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"nr",value:function(e){var t,n;null!=(t=Re.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=Re.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",function(t){if(t)return So.error("failed to load script",t);e()})}},{key:"startIfEnabledOrStop",value:function(){var e,t;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(e=this.bo)||e.call(this),null==(t=this.wo)||t.call(this),this.bo=void 0,this.wo=void 0)}}]),e}()},ya=$e({surveys:function(){function e(t){_class_call_check(this,e),this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}return _create_class(e,[{key:"Rt",get:function(){return this._instance.config}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(Ke(t))return Ns.warn("Flags not loaded yet. Not loading surveys.");var n=qe(t);this._o=n?t.length>0:t,Ns.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}},{key:"reset",value:function(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(null!=n&&n.startsWith(qs)||null!=n&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(function(e){return localStorage.removeItem(e)})}},{key:"loadIfEnabled",value:function(){var e=this;if(!this._surveyManager)if(this.Io)Ns.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ns.info(Bo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ns.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Re?void 0:Re.__PosthogExtensions__;if(t){if(!ze(this._o)||this.Rt.advanced_enable_surveys){var n=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var i=t.generateSurveys;if(i)return void this.ko(i,n);var r=t.loadExternalDependency;if(!r)return void this.xo(vi);r(this._instance,"surveys",function(i){i||!t.generateSurveys?e.xo("Could not load surveys script",i):e.ko(t.generateSurveys,n)})}catch(e){throw this.xo("Error initializing surveys",e),e}finally{this.Io=!1}}}else Ns.error("PostHog Extensions not found.")}}},{key:"ko",value:function(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Uo(this._instance),Ns.info("Surveys loaded successfully"),this.To({isLoaded:!0})}},{key:"xo",value:function(e,t){Ns.error(e,t),this.To({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.Co.push(e),this._surveyManager&&this.To({isLoaded:!0}),function(){t.Co=t.Co.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e,t){var n=this;if(void 0===t&&(t=!1),this.Rt.disable_surveys)return Ns.info(Bo),e([]);var i,r=this._instance.get_property(Qn);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then(function(t){var n=t.surveys,i=t.context;return e(n,i)}):("undefined"!=typeof Promise&&(this.So=new Promise(function(e){i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:function(t){var r;n.So=null;var s=t.statusCode;if(200!==s||!t.json){var o="Surveys API could not be loaded, status: "+s;Ns.error(o);var a={isLoaded:!1,error:o};return e([],a),void(null==i||i({surveys:[],context:a}))}var l,u=t.json.surveys||[],c=u.filter(function(e){return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});c.length>0&&(null==(l=n._surveyEventReceiver)||l.register(c)),null==(r=n._instance.persistence)||r.register(_define_property({},Qn,u));var h={isLoaded:!0};e(u,h),null==i||i({surveys:u,context:h})}}))}},{key:"To",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.Co[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;try{if(!e.isLoaded)return o([],e);this.getSurveys(o)}catch(e){Ns.error("Error in survey callback",e)}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"getActiveMatchingSurveys",value:function(e,t){if(void 0===t&&(t=!1),!Ke(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ns.warn("init was not called")}},{key:"Ao",value:function(e){var t=null;return this.getSurveys(function(n){var i;t=null!==(i=n.find(function(t){return t.id===e}))&&void 0!==i?i:null}),t}},{key:"Eo",value:function(e){if(Ke(this._surveyManager))return{eligible:!1,reason:zo};var t="string"==typeof e?this.Ao(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(Ke(this._surveyManager))return Ns.warn("init was not called"),{visible:!1,disabledReason:zo};var t=this.Eo(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;return Ke(this._surveyManager)?(Ns.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:zo})):new Promise(function(i){n.getSurveys(function(t){var r,s=null!==(r=t.find(function(t){return t.id===e}))&&void 0!==r?r:null;if(s){var o=n.Eo(s);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}},{key:"renderSurvey",value:function(e,t,n){var i,r=this;if(Ke(this._surveyManager))Ns.warn("init was not called");else{var s="string"==typeof e?this.Ao(e):e;if(null!=s&&s.id)if(Hs.includes(s.type)){var o=null==be?void 0:be.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(Ns.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(function(){var e,t;Ns.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=r._surveyManager)||t.renderSurvey(s,o,n),Ns.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ns.warn("Survey element not found")}else Ns.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ns.warn("Survey not found")}}},{key:"displaySurvey",value:function(e,t){var n;if(Ke(this._surveyManager))Ns.warn("init was not called");else{var i=this.Ao(e);if(i){var r=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=$e({},i,{appearance:$e({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==$r&&t.initialResponses&&Ns.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.canRenderSurvey(i);if(!s.visible)return void Ns.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==Ir?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else Ns.warn("Survey not found")}}},{key:"cancelPendingSurvey",value:function(e){Ke(this._surveyManager)?Ns.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}]),e}()},ha),ma={toolbar:function(){function e(t){_class_call_check(this,e),this.instance=t}return _create_class(e,[{key:"Ro",value:function(e){Re.ph_toolbar_state=e}},{key:"No",value:function(){var e;return null!==(e=Re.ph_toolbar_state)&&void 0!==e?e:0}},{key:"initialize",value:function(){return this.maybeLoadToolbar()}},{key:"maybeLoadToolbar",value:function(e,t,n){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),w(this.instance.config))return!1;if(!ge||!be)return!1;e=null!=e?e:ge.location,n=null!=n?n:ge.history;try{if(!t){try{ge.localStorage.setItem("test","test"),ge.localStorage.removeItem("test")}catch(e){return!1}t=null==ge?void 0:ge.localStorage}var i,r=Go||cr(e.hash,"__posthog")||cr(e.hash,"state"),s=r?Ri(function(){return JSON.parse(atob(decodeURIComponent(r)))})||Ri(function(){return JSON.parse(decodeURIComponent(r))}):null;return s&&"ph_authorize"===s.action?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Vo)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}},{key:"Mo",value:function(e){var t=Re.ph_load_toolbar||Re.ph_load_editor;!Ke(t)&&We(t)?t(e,this.instance):Ko.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t=this,n=!(null==be||!be.getElementById(hi));if(!ge||n)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=$e({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(ge.localStorage.setItem(Vo,JSON.stringify($e({},r,{source:void 0}))),2===this.No())this.Mo(r);else if(0===this.No()){var s;this.Ro(1),null==(s=Re.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",function(e){if(e)return Ko.error("[Toolbar] Failed to load",e),void t.Ro(0);t.Ro(2),t.Mo(r)}),k(ge,"turbolinks:load",function(){t.Ro(0),t.loadToolbar(r)})}return!0}},{key:"Fo",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(e,t,n){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}]),e}()},ba=$e({experiments:la},ha),ka={conversations:function(){function e(t){_class_call_check(this,e),this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Ke(t)||(Je(t)?this.Oo=t:(this.Oo=t.enabled,this.Lo=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||w(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Re?void 0:Re.__PosthogExtensions__;if(t&&!ze(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var n=t.initConversations;if(n)return this.Do(n),void(this.Po=!1);var i=t.loadExternalDependency;if(!i)return void this.Bo(vi);i(this._instance,"conversations",function(n){n||!t.initConversations?e.Bo("Could not load conversations script",n):e.Do(t.initConversations),e.Po=!1})}catch(e){this.Bo("Error initializing conversations",e),this.Po=!1}}else ua.error("Conversations enabled but missing token in remote config.")}}},{key:"Do",value:function(e){if(this.Lo)try{this._conversationsManager=e(this.Lo,this._instance),ua.info("Conversations loaded successfully")}catch(e){this.Bo("Error completing conversations initialization",e)}else ua.error("Cannot complete initialization: remote config is null")}},{key:"Bo",value:function(e,t){ua.error(e,t),this._conversationsManager=null,this.Po=!1}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():ua.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Oo&&!Ve(this._conversationsManager)}},{key:"isVisible",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}},{key:"sendMessage",value:function(e,t,n){var i=this;return l(function(){return _ts_generator(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(ua.warn(ca),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return l(function(){return _ts_generator(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(ua.warn(ca),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(ua.warn(ca),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(ua.warn(ca),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ua.warn(ca),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return l(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ua.warn(ca),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return l(function(){return _ts_generator(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ua.warn(ca),null)]})})()}},{key:"getCurrentTicketId",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}},{key:"getWidgetSessionId",value:function(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}},{key:"Ki",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"Qi",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},wa={logs:function(){function e(t){var n;_class_call_check(this,e),this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(n=this._instance.config.logs)&&n.captureConsoleLogs&&(this.jo=!0)}return _create_class(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){var t,n=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Ke(n)&&n&&(this.jo=!0,this.loadIfEnabled())}},{key:"reset",value:function(){}},{key:"loadIfEnabled",value:function(){var e=this;if(this.jo&&!this.qo){var t=Fn("[logs]"),n=null==Re?void 0:Re.__PosthogExtensions__;if(n){var i=n.loadExternalDependency;i?i(this._instance,"logs",function(i){var r;i||null==(r=n.logs)||!r.initializeLogs?t.error("Could not load logs script",i):(n.logs.initializeLogs(e._instance),e.qo=!0)}):t.error(vi)}else t.error("PostHog Extensions not found.")}}}]),e}()},xa=$e({},ha,da,fa,va,_a,pa,ya,ga,ma,ba,ka,wa);ao.__defaultExtensionClasses=$e({},xa);var Ea,Sa=(To=Vs[to]=new ao,function(){function e(){e.done||(e.done=!0,no=!1,y(Vs,function(e){e._dom_loaded()}))}null!=be&&be.addEventListener?"complete"===be.readyState?e():k(be,"DOMContentLoaded",e,{capture:!1}):ge&&On.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),To),Pa={},Ra={type:"posthog",config:{},init:function(e){return _async_to_generator(function(e){var t,n,i,r,s,o,a,l,u;return _ts_generator(this,function(c){switch(c.label){case 0:return t=e.config,n=e.env,(null==(i=t.settings)?void 0:i.apiKey)?(r=se(n),s=i.apiKey,i.identify,i.group,i._state,o=_object_without_properties(i,["apiKey","identify","group","_state"]),a=_object_spread({autocapture:!1,capture_pageview:!1,capture_pageleave:!1},o),l=!1,r.init(s,_object_spread_props(_object_spread({},a),{loaded:function(){l=!0}})),l?[3,2]:[4,Promise.resolve()]):[2,!1];case 1:c.sent(),c.label=2;case 2:return u={lastIdentity:{},lastGroup:{}},[2,_object_spread_props(_object_spread({},t),{settings:_object_spread_props(_object_spread({},i),{_state:u})})]}})}).apply(this,arguments)},push:function(e,t){return _async_to_generator(function(e,t){var r,s,a,l,u,c,h,d,f,v,_,p,g,y,m,b,k,w;return _ts_generator(this,function(x){switch(x.label){case 0:return r=t.config,s=t.rule,a=t.env,l=t.data,u=t.collector,d=se(a),f=r.settings||{},v=(null==s?void 0:s.settings)||{},_=f._state||{},void 0===v.reset?[3,4]:"boolean"!=typeof v.reset?[3,1]:(p=v.reset,[3,3]);case 1:return[4,o(e,v.reset,{collector:u})];case 2:p=x.sent(),x.label=3;case 3:p&&(d.reset(),_.lastIdentity={},_.lastGroup={}),x.label=4;case 4:return void 0===(g=null!==(c=v.identify)&&void 0!==c?c:f.identify)?[3,6]:[4,o(e,g,{collector:u})];case 5:y=x.sent(),n(y)&&(_.lastIdentity=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=_object_spread({},r),o=t.distinctId,a=n(t.$set)?t.$set:void 0,l=n(t.$set_once)?t.$set_once:void 0;return i(o)&&""!==o?(o!==r.distinctId||a||l)&&(e.identify(o,a,l),s.distinctId=o):(a||l)&&e.setPersonProperties(a,l),s}(d,y,_.lastIdentity)),x.label=6;case 6:return void 0===(m=null!==(h=v.group)&&void 0!==h?h:f.group)?[3,8]:[4,o(e,m,{collector:u})];case 7:b=x.sent(),n(b)&&(_.lastGroup=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=_object_spread({},r),o=t.type,a=t.key,l=n(t.properties)?t.properties:void 0;return i(o)&&i(a)&&(o!==r.type||a!==r.key||l)&&(e.group(o,a,l),s.type=o,s.key=a),s}(d,b,_.lastGroup)),x.label=8;case 8:return!0!==(null==s?void 0:s.silent)&&(k=i(null==s?void 0:s.name)?s.name:e.name,w=n(l)?l:{},d.capture(k,w)),f._state=_,[2]}})}).apply(this,arguments)},on:function(e,t){var n;if("consent"===e&&(null==t?void 0:t.data)){var i=se(t.env),r=t.data,s=null===(n=t.config)||void 0===n?void 0:n.consent;if(s&&0!==Object.keys(s).length)Object.keys(s).every(function(e){return!0===r[e]})?i.opt_in_capturing():i.opt_out_capturing()}}},Oa=Ra;return Ea=ce,function(e,t,n,i){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var r=!0,s=!1,o=void 0;try{for(var a,l=function(){var r=a.value;ue.call(e,r)||r===n||oe(e,r,{get:function(){return t[r]},enumerable:!(i=ae(t,r))||i.enumerable})},u=le(t)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)l()}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}}return e}(oe({},"__esModule",{value:!0}),Ea)}();