@walkeros/web-destination-posthog 4.7.2 → 4.8.0-next-1791496487198

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),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).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 _construct(e,t,n){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&_set_prototype_of(r,n.prototype),r},_construct.apply(null,arguments)}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 _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}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 _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(n,e)},_wrap_native_super(e)}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:u(0)}),a(o,"throw",{value:u(1)}),a(o,"return",{value:u(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function u(a){return function(u){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,u])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var n=e.destinations[t];if(!n)throw new Error("Destination not found: ".concat(t));return n},n=function(e,t){var n=e.transformers[t];if(!n)throw new Error("Transformer not found: ".concat(t));return n},i=function(e,t){var n=e.sources[t];if(!n)throw new Error("Source not found: ".concat(t));return n},r=function(e,t){var n=e.stores[t];if(!n)throw new Error("Store not found: ".concat(t));return n},s=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(n){switch(n.label){case 0:return[4,e.get(t)];case 1:return[2,n.sent()]}})})()},o=function(e){return Array.isArray(e)},a=function(e){return void 0!==e},u=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!o(e)&&"[object Object]"===Object.prototype.toString.call(e)},l=function(e){return"string"==typeof e},c=function(e){return Pe(e)?e:void 0},d=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]}})})()}},f=function(e){return _async_to_generator(function(e){var t,n,i,r,s,u,l,c,f,h,_,p,v,g,y,m,b=arguments;return _ts_generator(this,function(k){switch(k.label){case 0:if(t=b.length>1&&void 0!==b[1]?b[1]:{},s=(n=b.length>2&&void 0!==b[2]?b[2]:{}).consent||(null===(r=n.collector)||void 0===r?void 0:r.consent),u=null!==(i=n.event)&&void 0!==i?i:{},!n.collector)throw new Error("getMappingValue: context.collector is required");l={event:u,mapping:t,collector:n.collector,logger:n.collector.logger,consent:s},c=o(t)?t:[t],f=!0,h=!1,_=void 0,k.label=1;case 1:k.trys.push([1,6,7,8]),p=c[Symbol.iterator](),k.label=2;case 2:return(f=(v=p.next()).done)?[3,5]:(g=v.value,[4,d(Oe,function(e){if(_instanceof(e,Fe))throw e;n.collector&&n.collector.status.failed++,l.logger.error("mapping processing failed",{event:u,error:e})})(e,g,_object_spread_props(_object_spread({},l),{mapping:g}))]);case 3:if(y=k.sent(),a(y))return[2,y];k.label=4;case 4:return f=!0,[3,2];case 5:return[3,8];case 6:return m=k.sent(),h=!0,_=m,[3,8];case 7:try{f||null==p.return||p.return()}finally{if(h)throw _}return[7];case 8:return[2]}})}).apply(this,arguments)},h=function(e){return _async_to_generator(function(e){var t,n,i,r,s,o,l=arguments;return _ts_generator(this,function(c){return t=l.length>1&&void 0!==l[1]?l[1]:{},n=l.length>2&&void 0!==l[2]?l[2]:{},a(e)?(s=u(e)&&e.consent||n.consent||(null===(r=n.collector)||void 0===r?void 0:r.consent),o=null!==(i=n.event)&&void 0!==i?i:u(e)?e:{},[2,f(e,t,_object_spread_props(_object_spread({},n),{consent:s,event:o}))]):[2]})}).apply(this,arguments)},_=function(e,t,n,i,r,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(i,r)},p=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){_(s,i,r,o,a,"next",e)}function a(e){_(s,i,r,o,a,"throw",e)}o(void 0)})}},v=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},g=function(e,t){return-1!==e.indexOf(t)},y=function(e){return null===e||"object"!=(void 0===e?"undefined":_type_of(e))},m=function(e,t){return{}.toString.call(e)==="[object "+t+"]"},b=function(e){return"undefined"!=typeof Event&&function(e,t){try{return _instanceof(e,t)}catch(e){return!1}}(e,Event)},k=function(e){var t=[];for(var n in e){var i=e[n];ht(i)||ct(i)||t.push({key:n,value:$n(i)})}return t},w=function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Pt&&n.length===St||(St=n.length,Pt=n.reduce(function(n,i){Et||(Et={});var r=Et[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],u=null==a?void 0:a.filename,l=t[i];if(u&&l){n[u]=l,Et[i]=[u,l];break}}return n},{})),Pt}},x=function(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?Rn:n,in_app:!0};return ct(i)||(s.lineno=i),ct(r)||(s.colno=r),s},E=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""},S=function(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ei.enabled,max_bytes:P(e.max_bytes,ei.max_bytes)}:Ue({},ei)},P=function(e,t){if(!pt(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n},F=function(e,t){ot(e)&&e.forEach(t)},O=function(e,t){if(!_t(e))if(ot(e))e.forEach(t);else if(yt(e))e.forEach(function(e,n){return t(e,n)});else for(var n in e)rt.call(e,n)&&t(e[n],n)},$=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},I=function(e){var t=null==e?void 0:e.hostname;if(!dt(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=yr[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},R=function(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=void 0!==s&&s,a=r.passive,u=void 0===a||a;null==e||e.addEventListener(t,n,{capture:o,passive:u})},M=function(e){return"ph_toolbar_internal"===e.name},C=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,u=n.sendExceptionsToPostHog,l=void 0===u||u;return function(t){var n,o,u,c,d;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var f=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h,_=(null==(n=t.exception)?void 0:n.values)||[],p=_.map(function(e){return Ue({},e,{stacktrace:e.stacktrace?Ue({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return Ue({},e,{platform:"web:javascript"})})}):void 0})}),v={$exception_message:(null==(o=_[0])?void 0:o.value)||t.message,$exception_type:null==(u=_[0])?void 0:u.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=_[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:t.tags};return i&&r&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),l&&(null==(h=e.exceptions)||h.sendExceptionEvent(v)),t}},T=function(e,t,n){if(!Ce)return{};var i,r=t?_to_consumable_array(is).concat(_to_consumable_array(n||[])):[],s=A(es(Ce.URL,r,ss),e),o=(i={},O(os,function(e){var t=Cr.A(e);i[e]=t||null}),i);return _r(o,s)},A=function(e,t){var n=rs.concat(t||[]),i={};return O(n,function(t){var n=Qr(e,t);i[t]=n||null}),i},q=function(e){var t,n=(t=e)?0===t.search(ns+"google.([^/?]*)")?"google":0===t.search(ns+"bing.com")?"bing":0===t.search(ns+"yahoo.com")?"yahoo":0===t.search(ns+"duckduckgo.com")?"duckduckgo":null:null,i="yahoo"!=n?"q":"p",r={};if(!ht(n)){r.$search_engine=n;var s=Ce?Qr(Ce.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},j=function(){return navigator.language||navigator.userLanguage},L=function(){return(null==Ce?void 0:Ce.referrer)||as},D=function(e,t){var n=e?_to_consumable_array(is).concat(_to_consumable_array(t||[])):[],i=null==Te?void 0:Te.href.substring(0,1e3);return{r:L().substring(0,1e3),u:i?es(i,n,ss):void 0}},N=function(e){var t,n=e.r,i=e.u,r={$referrer:n,$referring_domain:null==n?void 0:n==as?as:null==(t=Zr(n))?void 0:t.host};if(i){r.$current_url=i;var s=Zr(i);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var o=A(i);_r(r,o)}if(n){var a=q(n);_r(r,a)}return r},H=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},z=function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},U=function(e,t,n){return co({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})},B=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(ct(s)||ht(s))return!1;var o=[String(s)],a=Io[r.operator];return!!a&&a(r.values,o)})},V=function(e){return _instanceof(e,Element)&&(e.id===Ji||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))},G=function(e){return!!e&&e.nodeType===ia},W=function(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()},K=function(e){return!!e&&e.nodeType===ra},X=function(e){return!!e&&e.nodeType===sa&&G(e.host)},Y=function(e){return e?tt(e).split(/\s+/):[]},J=function(e){var t=null==$e?void 0:$e.location.href;return!!(t&&e&&e.some(function(e){return t.match(e)}))},Z=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 Y(t)},Q=function(e){return _t(e)?null:tt(e).split(/(\s+)/).filter(function(e){return oe(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)},ee=function(e){var t="";return re(e)&&!se(e)&&e.childNodes&&e.childNodes.length&&O(e.childNodes,function(e){var n;K(e)&&e.textContent&&(t+=null!==(n=Q(e.textContent))&&void 0!==n?n:"")}),tt(t)},te=function(e){return ct(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},ne=function(e,t){if(ct(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,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){if(n=i(a.value))return n.v}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return!1},ie=function(e){var t=e.parentNode;return!(!t||!G(t))&&t},re=function(e){for(var t=e;t.parentNode&&!W(t,"body");t=t.parentNode){var n=Z(t);if(g(n,"ph-sensitive")||g(n,"ph-no-capture"))return!1}if(g(Z(e),"ph-include"))return!0;var i=e.type||"";if(dt(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!dt(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,""))},se=function(e){return!!(W(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||W(e,"select")||W(e,"textarea")||"true"===e.getAttribute("contenteditable"))},oe=function(e,t){if(void 0===t&&(t=!0),_t(e))return!1;if(dt(e)){if(e=tt(e),(t?fa:ha).test((e||"").replace(/[- ]/g,"")))return!1;if((t?pa:va).test(e))return!1}return!0},ae=function(e){var t=ee(e);return oe(t=(t+" "+ga(e)).trim())?t:""},ue=function(e){return e.replace(/"|\\"/g,'\\"')},le=function(e){var t=e.attr__class;return t?ot(t)?t:Y(t):void 0},ce=function(e,t){return t.length>e?t.slice(0,e)+"...":t},de=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!G(t));return t},fe=function(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return at(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(){}}},he=function(e){return ut(e)&&"clientX"in e&&"clientY"in e&&pt(e.clientX)&&pt(e.clientY)},_e=function(e,t,n){if(_t(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}},pe=function(e){var t;return null!==(t=null==e?void 0:e.posthog)&&void 0!==t?t:vu},ve=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyNames,me=Object.prototype.hasOwnProperty,be={};!function(e,t){for(var n in t)ve(e,n,{get:t[n],enumerable:!0})}(be,{DestinationPostHog:function(){return gu},default:function(){return mu},destinationPostHog:function(){return yu}});var ke=Object.defineProperty,we=function(e,t){for(var n in t)ke(e,n,{get:t[n],enumerable:!0})};we({},{stepId:function(){return e}});we({},{getDestination:function(){return t}});we({},{Level:function(){return Ee}});var xe,Ee=((xe=Ee||{})[xe.ERROR=0]="ERROR",xe[xe.WARN=1]="WARN",xe[xe.INFO=2]="INFO",xe[xe.DEBUG=3]="DEBUG",xe);we({},{getTransformer:function(){return n}});we({},{getSource:function(){return i}});function Se(e){for(var t=arguments.length>2?arguments[2]:void 0,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),i=e,r=0;r<n.length;r++){var s=n[r];if("*"===s&&o(i)){var l=n.slice(r+1).join("."),c=[],d=!0,f=!1,h=void 0;try{for(var _,p=i[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var v=Se(_.value,l,t);c.push(v)}}catch(e){f=!0,h=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw h}}return c}if(void 0===(i=u(i)||o(i)?i[s]:void 0))break}return a(i)?i:t}function Pe(e){return function(e){return"boolean"==typeof e}(e)||l(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||o(e)&&e.every(Pe)||u(e)&&Object.values(e).every(Pe)}we({},{getStore:function(){return r},getStoreValue:function(){return s}});var Fe=function(){function e(t,n){var i;return _class_call_check(this,e),(i=_call_super(this,e,[t,n])).name="FatalError",Object.setPrototypeOf(i,e.prototype),i}return _inherits(e,_wrap_native_super(Error)),e}();function Oe(e,t,n){return _async_to_generator(function(){return _ts_generator(this,function(i){return[2,(o(t)?t:[t]).reduce(function(t,i){return _async_to_generator(function(){var r,s,u,h,_,p,v,g,y,m,b,k,w,x,E,S,P,F,O,$,I,R,M,C,T;return _ts_generator(this,function(A){switch(A.label){case 0:return[4,t];case 1:return(r=A.sent())?[2,r]:(s=l(i)?{key:i}:i,Object.keys(s).length?(u=s.condition,h=s.consent,_=s.fn,p=s.key,v=s.loop,g=s.map,y=s.set,m=s.validate,b=s.value,k=_object_spread_props(_object_spread({},n),{mapping:i}),(w=u)?[4,d(u,function(e){if(_instanceof(e,Fe))throw e;return k.logger.error("mapping condition failed",{event:k.event,error:e}),!1})(e,k)]:[3,3]):[2]);case 2:w=!A.sent(),A.label=3;case 3:return w?[2]:h&&!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}(h,k.consent)?[2,b]:(x=a(b)?b:e,v?(E=_sliced_to_array(v,2),S=E[0],P=E[1],"this"!==S?[3,4]:(O=[e],[3,6])):[3,10]);case 4:return[4,f(e,S,k)];case 5:O=A.sent(),A.label=6;case 6:return o(F=O)?[4,Promise.all(F.map(function(e){return a(e)?f(e,P,k):void 0}))]:[3,8];case 7:return $=A.sent().filter(a),[3,9];case 8:$=void 0,A.label=9;case 9:return x=$,[3,21];case 10:return g?[4,Object.entries(g).reduce(function(t,n){var i=_sliced_to_array(n,2),r=i[0],s=i[1];return _async_to_generator(function(){var n,i;return _ts_generator(this,function(o){switch(o.label){case 0:return[4,t];case 1:return n=o.sent(),[4,f(e,s,k)];case 2:return i=o.sent(),[2,(a(i)&&(n[r]=i),n)]}})})()},Promise.resolve({}))]:[3,12];case 11:return x=A.sent(),[3,20];case 12:return y?[4,Promise.all(y.map(function(t){return Oe(e,t,k)}))]:[3,14];case 13:return I=x=A.sent(),[3,19];case 14:return p?(R=x=Se(e,p,b),[3,18]):[3,15];case 15:return(M=_)?[4,d(_,function(e){if(_instanceof(e,Fe))throw e;k.logger.error("mapping fn failed",{event:k.event,error:e})})(e,k)]:[3,17];case 16:M=x=A.sent(),A.label=17;case 17:R=M,A.label=18;case 18:I=R,A.label=19;case 19:A.label=20;case 20:A.label=21;case 21:return(C=m)?[4,d(m,function(e){if(_instanceof(e,Fe))throw e;return k.logger.error("mapping validate failed",{event:k.event,error:e}),!1})(x,k)]:[3,23];case 22:C=!A.sent(),A.label=23;case 23:return C&&(x=void 0),T=c(x),[2,a(T)?T:c(b)]}})})()},Promise.resolve(void 0))]})})()}var $e="undefined"!=typeof window?window:void 0,Ie="undefined"!=typeof globalThis?globalThis:$e;"undefined"==typeof self&&(Ie.self=Ie),"undefined"==typeof File&&(Ie.File=function(){});var Re,Me=null==Ie?void 0:Ie.navigator,Ce=null==Ie?void 0:Ie.document,Te=null==Ie?void 0:Ie.location,Ae=null==Ie?void 0:Ie.fetch,qe=null!=Ie&&Ie.XMLHttpRequest&&"withCredentials"in new Ie.XMLHttpRequest?Ie.XMLHttpRequest:void 0,je=null==Ie?void 0:Ie.AbortController,Le=null==Ie?void 0:Ie.CompressionStream,De=null==Me?void 0:Me.userAgent,Ne=null!=$e?$e:{},He="1.376.4",ze={DEBUG:!1,LIB_VERSION:He,LIB_NAME:"web",JS_SDK_VERSION:He};function Ue(){return Ue=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},Ue.apply(null,arguments)}var Be,Ve=((Be={}).GZipJS="gzip-js",Be.Base64="base64",Be),Ge=["$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"],We="NativeGzipValidationError",Ke=function(e){return e.length>=2&&31===e[0]&&139===e[1]},Xe=function(e){return!(!e||"object"!=(void 0===e?"undefined":_type_of(e)))&&"NotReadableError"===("name"in e?String(e.name):"")},Ye=function(e){var t=new Error("Native gzip produced invalid output: "+e);throw t.name=We,t},Je=function(){var e=p(function(e,t){var n,i,r,s,o;return _ts_generator(this,function(a){switch(a.label){case 0:return 18>e.size&&Ye("too-short"),i=Uint8Array.bind,[4,e.slice(0,10).arrayBuffer()];case 1:return n=new(i.apply(Uint8Array,[void 0,a.sent()])),Ke(n)&&8===n[2]||Ye("invalid-header"),s=DataView.bind,[4,e.slice(e.size-8).arrayBuffer()];case 2:return(r=new(s.apply(DataView,[void 0,a.sent()]))).getUint32(0,!0)!==function(e){for(var t=function(){if(Re)return Re;Re=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;Re[e]=t>>>0}return Re}(),n=4294967295,i=0;e.length>i;i++)n=t[255&(n^e[i])]^n>>>8;return(4294967295^n)>>>0}(t)&&Ye("invalid-crc"),o=t.length>>>0,r.getUint32(4,!0)!==o&&Ye("invalid-size"),[2]}})});return function(t,n){return e.apply(this,arguments)}}();function Ze(){return Ze=p(function(e,t,n){var i,r,s,o,a,u,l,c;return _ts_generator(this,function(d){switch(d.label){case 0:void 0===t&&(t=!0),d.label=1;case 1:return d.trys.push([1,4,,5]),i=(new TextEncoder).encode(e),r=new CompressionStream("gzip"),s=r.writable.getWriter(),o=s.write(i).then(function(){return s.close()}).catch((f=p(function(e){return _ts_generator(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,s.abort(e)];case 1:case 2:return t.sent(),[3,3];case 3:throw e}})}),function(e){return f.apply(this,arguments)})),a=new Response(r.readable).blob(),[4,Promise.all([a,o])];case 2:return u=_sliced_to_array.apply(void 0,[d.sent(),1]),l=u[0],[4,Je(l,i)];case 3:return[2,(d.sent(),l)];case 4:if(c=d.sent(),null!=n&&n.rethrow)throw c;return[2,(t&&console.error("Failed to gzip compress data",c),null)];case 5:return[2]}var f})}),Ze.apply(this,arguments)}var Qe=["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"],et=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Qe.concat(t).some(function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)})},tt=function(e){return e.trim()},nt=function(e){return e.replace(/^\$/,"")},it=Object.prototype,rt=it.hasOwnProperty,st=it.toString,ot=Array.isArray||function(e){return"[object Array]"===st.call(e)},at=function(e){return"function"==typeof e},ut=function(e){return e===Object(e)&&!ot(e)},lt=function(e){if(ut(e)){for(var t in e)if(rt.call(e,t))return!1;return!0}return!1},ct=function(e){return void 0===e},dt=function(e){return"[object String]"==st.call(e)},ft=function(e){return dt(e)&&0===e.trim().length},ht=function(e){return null===e},_t=function(e){return ct(e)||ht(e)},pt=function(e){return"[object Number]"==st.call(e)&&e==e},vt=function(e){return pt(e)&&e>0},gt=function(e){return"[object Boolean]"===st.call(e)},yt=function(e){return _instanceof(e,FormData)},mt=function(e){return g(Ge,e)},bt=[!0,"true",1,"1","yes"],kt=function(e){return g(bt,e)},wt=[!1,"false",0,"0","no"];function xt(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),pt(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),xt(r||n,t,n,i))}var Et,St,Pt,Ft,Ot=function(){function e(t){_class_call_check(this,e),this.$t={},this.zt=t.zt,this.Zt=xt(t.bucketSize,0,100,t.Gt),this.Qt=xt(t.refillRate,0,this.Zt,t.Gt),this.Jt=xt(t.refillInterval,0,864e5,t.Gt)}return _create_class(e,[{key:"Kt",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.Jt);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qt,this.Zt),e.lastAccess=e.lastAccess+n*this.Jt)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.$t[i];return r?this.Kt(r,n):this.$t[i]=r={tokens:this.Zt,lastAccess:n},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.zt)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.$t={}}}]),e}(),$t="Mobile",It="iOS",Rt="Android",Mt="Tablet",Ct=Rt+" "+Mt,Tt="iPad",At="Apple",qt=At+" Watch",jt="Safari",Lt="BlackBerry",Dt="Samsung",Nt=Dt+"Browser",Ht=Dt+" Internet",zt="Chrome",Ut=zt+" OS",Bt=zt+" "+It,Vt="Internet Explorer",Gt=Vt+" "+$t,Wt="Opera",Kt=Wt+" Mini",Xt="Edge",Yt="Microsoft "+Xt,Jt="Firefox",Zt=Jt+" "+It,Qt="Nintendo",en="PlayStation",tn="Xbox",nn=Rt+" "+$t,rn=$t+" "+jt,sn="Windows",on=sn+" Phone",an="Nokia",un="Ouya",ln="Generic",cn=ln+" "+$t.toLowerCase(),dn=ln+" "+Mt.toLowerCase(),fn="Konqueror",hn="Oculus Browser",_n="(\\d+(\\.\\d+)?)",pn=new RegExp("Version/"+_n),vn=new RegExp(tn,"i"),gn=new RegExp(en+" \\w+","i"),yn=new RegExp(Qt+" \\w+","i"),mn=new RegExp(Lt+"|PlayBook|BB10","i"),bn={"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"},kn=function(e,t){return t=t||"",g(e," OPR/")&&g(e,"Mini")?Kt:g(e," OPR/")?Wt:mn.test(e)?Lt:g(e,"IE"+$t)||g(e,"WPDesktop")?Gt:g(e,"OculusBrowser")?hn:g(e,Nt)?Ht:g(e,Xt)||g(e,"Edg/")?Yt:g(e,"FBIOS")?"Facebook "+$t:g(e,"UCWEB")||g(e,"UCBrowser")?"UC Browser":g(e,"CriOS")?Bt:g(e,"CrMo")||g(e,zt)?zt:g(e,Rt)&&g(e,jt)?nn:g(e,"FxiOS")?Zt:g(e.toLowerCase(),fn.toLowerCase())?fn:(n=e,(i=t)&&g(i,At)||g(r=n,jt)&&!g(r,zt)&&!g(r,Rt)?g(e,$t)?rn:jt:g(e,Jt)?Jt:g(e,"MSIE")||g(e,"Trident/")?Vt:g(e,"Gecko")?Jt:"");var n,i,r},wn=(_define_property(Ft={},Gt,[new RegExp("rv:"+_n)]),_define_property(Ft,Yt,[new RegExp(Xt+"?\\/"+_n)]),_define_property(Ft,zt,[new RegExp("("+zt+"|CrMo)\\/"+_n)]),_define_property(Ft,Bt,[new RegExp("CriOS\\/"+_n)]),_define_property(Ft,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+_n)]),_define_property(Ft,jt,[pn]),_define_property(Ft,rn,[pn]),_define_property(Ft,Wt,[new RegExp("(Opera|OPR)\\/"+_n)]),_define_property(Ft,Jt,[new RegExp(Jt+"\\/"+_n)]),_define_property(Ft,Zt,[new RegExp("FxiOS\\/"+_n)]),_define_property(Ft,fn,[new RegExp("Konqueror[:/]?"+_n,"i")]),_define_property(Ft,Lt,[new RegExp(Lt+" "+_n),pn]),_define_property(Ft,nn,[new RegExp("android\\s"+_n,"i")]),_define_property(Ft,Ht,[new RegExp(Nt+"\\/"+_n)]),_define_property(Ft,hn,[new RegExp("OculusBrowser\\/"+_n)]),_define_property(Ft,Vt,[new RegExp("(rv:|MSIE )"+_n)]),_define_property(Ft,"Mozilla",[new RegExp("rv:"+_n)]),Ft),xn=function(e,t){var n=kn(e,t),i=wn[n];if(ct(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},En=[[new RegExp(tn+"; "+tn+" (.*?)[);]","i"),function(e){return[tn,e&&e[1]||""]}],[new RegExp(Qt,"i"),[Qt,""]],[new RegExp(en,"i"),[en,""]],[mn,[Lt,""]],[new RegExp(sn,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[on,""];if(new RegExp($t).test(t)&&!/IEMobile\b/.test(t))return[sn+" "+$t,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=bn[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[sn,i]}return[sn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?[It,[e[3],e[4],e[5]||"0"].join(".")]:[It,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=ct(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Rt+")","i"),function(e){return e&&e[2]?[Rt,[e[2],e[3],e[4]||"0"].join(".")]:[Rt,""]}],[/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/,[Ut,""]],[/Linux|debian/i,["Linux",""]]],Sn=function(e){return yn.test(e)?Qt:gn.test(e)?en:vn.test(e)?tn:new RegExp(un,"i").test(e)?un:new RegExp("("+on+"|WPDesktop)","i").test(e)?on:/iPad/.test(e)?Tt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?qt:mn.test(e)?Lt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(an,"i").test(e)?an:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp($t).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Rt:Ct:new RegExp("(pda|"+$t+")","i").test(e)?cn:new RegExp(Mt,"i").test(e)&&!new RegExp(Mt+" pc","i").test(e)?dn:""},Pn=function(e){return _instanceof(e,Error)},Fn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},On=Fn.info;function $n(e){if(gt(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(ot(e))return{arrayValue:{values:e.map(function(e){return $n(e)})}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}var In=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 p(function(){var n,i,r,s,o,a,u,l;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&&ot(a.stacktrace.frames)?(u=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)]):[3,4]);case 3:u.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 l=c.sent(),i=!0,r=l,[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)),Ue({},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 p(function(){var n,i,r,s,o,a,u;return _ts_generator(this,function(l){switch(l.label){case 0:n=e,i=!0,r=!1,s=void 0,l.label=1;case 1:l.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),l.label=2;case 2:return(i=(a=o.next()).done)?[3,5]:[4,(0,a.value)(n)];case 3:n=l.sent(),l.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=l.sent(),r=!0,s=u,[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,Ue({},t,{handled:!0})))),a}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:w(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 Ue({},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}(),Rn="?",Mn=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]:Rn,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Cn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,An=/\((\S*)(?::(\d+))(?::(\d+))\)/,qn=function(e,t){var n=Cn.exec(e);if(n){var i=_sliced_to_array(n,4),r=i[1],s=i[2],o=i[3];return x(t,r,Rn,+s,+o)}var a=Tn.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var u=An.exec(a[2]);u&&(a[2]=u[1],a[3]=u[2],a[4]=u[3])}var l=_sliced_to_array(Mn(a[1]||Rn,a[2]),2),c=l[0],d=l[1];return x(t,d,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},jn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ln=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dn=function(e,t){var n=jn.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=Ln.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]||Rn;return o=(r=_sliced_to_array(Mn(o,s),2))[0],s=r[1],x(t,s,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Nn=/\(error: (.*)\)/,Hn=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=dt(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 m(e,"DOMException")}},{key:"isDOMError",value:function(e){return m(e,"DOMError")}}]),e}(),zn=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}(),Un=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return m(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,Vn=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}(),Gn=["fatal","error","warning","log","info","debug"],Wn=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 b(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: "+E(e)}},{key:"isSeverityLevel",value:function(e){return dt(e)&&!ft(e)&&Gn.indexOf(e)>=0}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(Pn(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}(),Kn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return b(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+E(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Xn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return y(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}(),Yn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return m(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!b(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 y(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}(),Jn="$message",Zn="$timestamp",Qn=new Set([Jn,Zn]),ei={enabled:!0,max_bytes:32768},ti=function(){function e(t){_class_call_check(this,e),this.Yt=[],this.Xt=0,this.qt=S(t)}return _create_class(e,[{key:"setConfig",value:function(e){this.qt=S(e),this.er()}},{key:"add",value:function(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,function(e,n){if("bigint"==(void 0===n?"undefined":_type_of(n)))return n.toString();if("function"!=typeof n&&"symbol"!=(void 0===n?"undefined":_type_of(n))){if(_instanceof(n,Date))return n.toISOString();if(_instanceof(n,Error))return{name:n.name,message:n.message,stack:n.stack};if(n&&"object"==(void 0===n?"undefined":_type_of(n))){if(t.has(n))return"[Circular]";t.add(n)}return n}})}catch(e){return}}(e);if(t)try{var n=JSON.parse(t);if(!ut(n))return;var i=n,r=i[Jn],s=i[Zn];if(!dt(r)||0===r.trim().length)return;if(!dt(s)&&!pt(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var n=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),n=0,i=0;t.length>i;i++)"%"===t[i]?(n+=1,i+=2):n+=1;return n}(t.json);n>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:n}),this.Xt+=n,this.er())}}},{key:"getAttachable",value:function(){return this.Yt.map(function(e){return e.step})}},{key:"clear",value:function(){this.Yt=[],this.Xt=0}},{key:"size",value:function(){return this.Yt.length}},{key:"er",value:function(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}]),e}(),ni=function(e,t){var n=(void 0===t?{}:t).debugEnabled,i={k:function(t){if($e&&(ze.DEBUG||Ne.POSTHOG_DEBUG||n)&&!ct($e.console)&&$e.console){for(var i=("__rrweb_original__"in $e.console[t]?$e.console[t].__rrweb_original__:$e.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)))}},debug:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).k.apply(e,["debug"].concat(_to_consumable_array(n)))},info:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).k.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).k.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).k.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 ni(e+" "+t,n)}};return i},ii=ni("[PostHog.js]"),ri=ii.createLogger,si=ri("[ExternalScriptsLoader]"),oi=function(e,t,n){if(e.config.disable_external_dependency_loading)return si.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==Ce?void 0:Ce.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(!Ce)return n("document not found");var i=Ce.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)Ce.head.appendChild(i);else{var r,s=Ce.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):Ce.body.appendChild(i)}};null!=Ce&&Ce.body?a():null==Ce||Ce.addEventListener("DOMContentLoaded",a)};Ne.__PosthogExtensions__=Ne.__PosthogExtensions__||{},Ne.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"!==t){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}i=e.requestRouter.endpointFor("assets",r)}oi(e,i,n)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");oi(e,o,n)}},Ne.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);oi(e,i,n)};var ai="$people_distinct_id",ui="$device_id",li="__alias",ci="__timers",di="$autocapture_disabled_server_side",fi="$heatmaps_enabled_server_side",hi="$exception_capture_enabled_server_side",_i="$error_tracking_suppression_rules",pi="$error_tracking_capture_extension_exceptions",vi="$web_vitals_enabled_server_side",gi="$dead_clicks_enabled_server_side",yi="$product_tours_enabled_server_side",mi="$web_vitals_allowed_metrics",bi="$session_recording_remote_config",ki="$replay_override_sampling",wi="$replay_override_linked_flag",xi="$replay_override_url_trigger",Ei="$replay_override_event_trigger",Si="$sesid",Pi="$session_is_sampled",Fi="$enabled_feature_flags",Oi="$active_feature_flags",$i="$early_access_features",Ii="$feature_flag_details",Ri="$feature_flag_payloads",Mi="$feature_flag_request_id",Ci="$override_feature_flags",Ti="$override_feature_flag_payloads",Ai="$stored_person_properties",qi="$stored_group_properties",ji="$surveys",Li="$surveys_activated",Di="ph_product_tours",Ni="$flag_call_reported",Hi="$flag_call_reported_session_id",zi="$feature_flag_errors",Ui="$feature_flag_evaluated_at",Bi="$user_state",Vi="$client_session_props",Gi="$capture_rate_limit",Wi="$initial_campaign_params",Ki="$initial_referrer_info",Xi="$initial_person_info",Yi="$epp",Ji="__POSTHOG_TOOLBAR__",Zi="$posthog_cookieless",Qi="$sdk_debug_extensions_init_method",er="$sdk_debug_extensions_init_time_ms",tr="$sdk_debug_recording_script_not_loaded",nr="PostHog loadExternalDependency extension not found.",ir="on_reject",rr="always",sr="anonymous",or="identified",ar="identified_only",ur="visibilitychange",lr="beforeunload",cr="$pageview",dr="$pageleave",fr="$identify",hr="$groupidentify",_r=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,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;for(var c in l)void 0!==l[c]&&(e[c]=l[c])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return e},pr=function(e){try{return e()}catch(e){return}},vr=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){ii.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ii.critical(e)}}},gr=function(e){var t={};return O(e,function(e,n){(dt(e)&&e.length>0||pt(e))&&(t[n]=e)}),t},yr=["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 pt(e)&&isFinite(e)&&Math.floor(e)===e});var mr,br=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}(),kr=function(){function e(){_class_call_check(this,e),this.S=0,this.C=0,this.I=new Or}return _create_class(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(ct(e)){this.S=0;var t=this.generateOrAbort();if(ct(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.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return br.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}},{key:"T",value:function(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}]),e}(),wr=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};$e&&!ct($e.crypto)&&crypto.getRandomValues&&(wr=function(e){return crypto.getRandomValues(e)});var xr,Er,Sr,Pr,Fr,Or=function(){function e(){_class_call_check(this,e),this.M=new Uint32Array(8),this.O=1/0}return _create_class(e,[{key:"nextUint32",value:function(){return this.M.length>this.O||(wr(this.M),this.O=0),this.M[this.O++]}}]),e}(),$r=function(){return Ir().toString()},Ir=function(){return(mr||(mr=new kr)).generate()},Rr="",Mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Cr={R:function(){return!!Ce},D:function(e){ii.error("cookieStore error: "+e)},A:function(e){if(Ce){try{for(var t=e+"=",n=Ce.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}},F:function(e){var t;try{t=JSON.parse(Cr.A(e))||{}}catch(e){}return t},N:function(e,t,n,i,r){if(Ce)try{var s="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=Ce),Rr)return Rr;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_"+$r();!Rr&&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",Rr=s)}return Rr}(e);if(!n){var i=(r=e.match(Mr))?r[0]:"";i!==n&&ii.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}var r;return""}(Ce.location.hostname,i);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(o="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&ii.warn("cookieStore warning: large cookie, len="+l.length),Ce.cookie=l,l}catch(e){return}},q:function(e,t){if(null!=Ce&&Ce.cookie)try{Cr.N(e,"",-1,t)}catch(e){return}}},Tr=null,Ar={R:function(){if(!ht(Tr))return Tr;var e=!0;if(ct($e))e=!1;else try{var t="__mplssupport__";Ar.N(t,"xyz"),'"xyz"'!==Ar.A(t)&&(e=!1),Ar.q(t)}catch(t){e=!1}return e||ii.error("localStorage unsupported; falling back to cookie store"),Tr=e,e},D:function(e){ii.error("localStorage error: "+e)},A:function(e){try{return null==$e?void 0:$e.localStorage.getItem(e)}catch(e){Ar.D(e)}return null},F:function(e){try{return JSON.parse(Ar.A(e))||{}}catch(e){}return null},N:function(e,t){try{null==$e||$e.localStorage.setItem(e,JSON.stringify(t))}catch(e){Ar.D(e)}},q:function(e){try{null==$e||$e.localStorage.removeItem(e)}catch(e){Ar.D(e)}}},qr=[ui,"distinct_id",Si,Pi,Yi,Xi,Bi],jr={},Lr={R:function(){return!0},D:function(e){ii.error("memoryStorage error: "+e)},A:function(e){return jr[e]||null},F:function(e){return jr[e]||null},N:function(e,t){jr[e]=t},q:function(e){delete jr[e]}},Dr=null,Nr={R:function(){if(!ht(Dr))return Dr;if(Dr=!0,ct($e))Dr=!1;else try{var e="__support__";Nr.N(e,"xyz"),'"xyz"'!==Nr.A(e)&&(Dr=!1),Nr.q(e)}catch(e){Dr=!1}return Dr},D:function(e){ii.error("sessionStorage error: ",e)},A:function(e){try{return null==$e?void 0:$e.sessionStorage.getItem(e)}catch(e){Nr.D(e)}return null},F:function(e){try{return JSON.parse(Nr.A(e))||null}catch(e){}return null},N:function(e,t){try{null==$e||$e.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Nr.D(e)}},q:function(e){try{null==$e||$e.sessionStorage.removeItem(e)}catch(e){Nr.D(e)}}},Hr=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.rr()?0:this.ir}},{key:"isOptedOut",value:function(){return this.qt.cookieless_mode===rr||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===ir}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"isRejected",value:function(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}},{key:"optInOut",value:function(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}},{key:"reset",value:function(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}},{key:"sr",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:"ir",get:function(){var e=this.nr.A(this.sr);return kt(e)?1:g(wt,e)?0:-1}},{key:"nr",get:function(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?Ar:Cr;if(!this.ar||this.ar!==t){this.ar=t;var n="localStorage"===e?Cr:Ar;n.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(kt(n.A(this.sr))),n.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}},{key:"rr",value:function(){return!!this.qt.respect_dnt&&[null==Me?void 0:Me.doNotTrack,null==Me?void 0:Me.msDoNotTrack,Ne.doNotTrack].some(function(e){return kt(e)})}}]),e}(),zr=ri("[Dead Clicks]"),Ur=function(){return!0},Br=function(e){var t,n=!(null==(t=e.instance.persistence)||!t.get_property(gi)),i=e.instance.config.capture_dead_clicks;return gt(i)?i:!!ut(i)||n},Vr=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.ur}},{key:"onRemoteConfig",value:function(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register(_define_property({},gi,e.captureDeadClicks)),this.startIfEnabledOrStop())}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.lr(function(){e.hr()}):this.stop()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",function(t){t?zr.error("failed to load script",t):e()})}},{key:"hr",value:function(){var e;if(Ce){if(!this.ur&&null!=(e=Ne.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ut(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=Ne.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(Ce),zr.info("starting...")}}else zr.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.ur&&(this.ur.stop(),this.ur=void 0,zr.info("stopping..."))}}]),e}(),Gr=ri("[SegmentIntegration]"),Wr="posthog-js",Kr=function e(t,n,i,r,s,o){_class_call_check(this,e),this.name=Wr,this.setupOnce=function(e){e(C(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},Xr=function(){function e(t){var n=this;_class_call_check(this,e),this.cr=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(ii.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.dr=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.vr()}return _create_class(e,[{key:"vr",value:function(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}},{key:"destroy",value:function(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.gr(e,t);return this.dr={pathname:null!==(n=null==$e?void 0:$e.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}},{key:"gr",value:function(e,t){var n=this.dr;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,u=r.maxContentHeight,l=r.lastContentY,c=r.maxContentY;if(!(ct(s)||ct(o)||ct(a)||ct(u)||ct(l)||ct(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c);var d=s>1?xt(o/s,0,1,ii):1,f=s>1?xt(a/s,0,1,ii):1,h=u>1?xt(l/u,0,1,ii):1,_=u>1?xt(c/u,0,1,ii):1;i=_r(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),Yr=(_define_property(xr={},ai,{exposure:"hidden"}),_define_property(xr,li,{exposure:"hidden"}),_define_property(xr,"__cmpns",{exposure:"hidden"}),_define_property(xr,ci,{exposure:"hidden"}),_define_property(xr,di,{exposure:"event"}),_define_property(xr,fi,{exposure:"hidden"}),_define_property(xr,hi,{exposure:"event"}),_define_property(xr,_i,{exposure:"hidden"}),_define_property(xr,pi,{exposure:"event"}),_define_property(xr,vi,{exposure:"event"}),_define_property(xr,gi,{exposure:"event"}),_define_property(xr,yi,{exposure:"hidden"}),_define_property(xr,mi,{exposure:"event"}),_define_property(xr,bi,{exposure:"hidden"}),_define_property(xr,"$session_recording_enabled_server_side",{exposure:"hidden"}),_define_property(xr,Si,{exposure:"hidden"}),_define_property(xr,Pi,{exposure:"event"}),_define_property(xr,"$session_past_minimum_duration",{exposure:"event"}),_define_property(xr,"$session_recording_url_trigger_activated_session",{exposure:"event"}),_define_property(xr,"$session_recording_event_trigger_activated_session",{exposure:"event"}),_define_property(xr,"$debug_first_full_snapshot_timestamp",{exposure:"event"}),_define_property(xr,Fi,{exposure:"derived",shouldSkipFromEventProperties:function(e,t){return t()},transformToEventProperties:function(e){if(!ut(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}}),_define_property(xr,Oi,{exposure:"event"}),_define_property(xr,$i,{exposure:"hidden"}),_define_property(xr,Ii,{exposure:"hidden"}),_define_property(xr,Ri,{exposure:"event"}),_define_property(xr,Mi,{exposure:"event"}),_define_property(xr,Ci,{exposure:"event"}),_define_property(xr,Ti,{exposure:"hidden"}),_define_property(xr,Ai,{exposure:"hidden"}),_define_property(xr,qi,{exposure:"hidden"}),_define_property(xr,ji,{exposure:"hidden"}),_define_property(xr,Li,{exposure:"event"}),_define_property(xr,Di,{exposure:"hidden"}),_define_property(xr,"$product_tours_activated",{exposure:"hidden"}),_define_property(xr,"$conversations_widget_session_id",{exposure:"event"}),_define_property(xr,"$conversations_ticket_id",{exposure:"event"}),_define_property(xr,"$conversations_widget_state",{exposure:"event"}),_define_property(xr,"$conversations_user_traits",{exposure:"event"}),_define_property(xr,Ni,{exposure:"hidden"}),_define_property(xr,Hi,{exposure:"hidden"}),_define_property(xr,zi,{exposure:"hidden"}),_define_property(xr,Ui,{exposure:"hidden"}),_define_property(xr,Bi,{exposure:"hidden"}),_define_property(xr,Vi,{exposure:"hidden"}),_define_property(xr,Gi,{exposure:"hidden"}),_define_property(xr,Wi,{exposure:"hidden"}),_define_property(xr,Ki,{exposure:"hidden"}),_define_property(xr,Xi,{exposure:"hidden"}),_define_property(xr,Yi,{exposure:"hidden"}),_define_property(xr,ki,{exposure:"event"}),_define_property(xr,wi,{exposure:"event"}),_define_property(xr,xi,{exposure:"event"}),_define_property(xr,Ei,{exposure:"event"}),_define_property(xr,Qi,{exposure:"event"}),_define_property(xr,er,{exposure:"event"}),_define_property(xr,tr,{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_event_trigger_status",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_linked_flag_trigger_status",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_matched_recording_trigger_groups",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_remote_trigger_matching_config",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_trigger_groups_count",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_url_trigger_status",{exposure:"event"}),_define_property(xr,"$session_recording_start_reason",{exposure:"event"}),xr),Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Zr=function(e){var t=null==Ce?void 0:Ce.createElement("a");return ct(t)?null:(t.href=e,t)},Qr=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(!ot(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){ii.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},es=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],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var d=u[c].split("=");ot(d)&&(t.includes(d[0])?l.push(d[0]+"="+n):l.push(u[c]))}var f=a;return null!=o&&(f+="?"+l.join("&")),null!=r&&(f+="#"+r),f},ts=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ns="https?://(.*)",is=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat(_to_consumable_array(is)),ss="<masked>",os=["li_fat_id"],as="$direct",us=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ls=function(){function e(t,n){var i,r;_class_call_check(this,e),this.qt=t,this.props={},this.mr=!1,this.yr=(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.nr=this.br(t),this.load(),t.debug&&ii.info("Persistence loaded",t.persistence,Ue({},this.props)),this.update_config(t,t,n),this.save()}return _create_class(e,[{key:"isDisabled",value:function(){return!!this._r}},{key:"br",value:function(e){-1===us.indexOf(e.persistence.toLowerCase())&&(ii.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(qr).concat(_to_consumable_array(e));return Ue({},Ar,{F:function(e){try{var t={};try{t=Cr.F(e)||{}}catch(e){}var n=_r(t,JSON.parse(Ar.A(e)||"{}"));return Ar.N(e,n),n}catch(e){}return null},N:function(e,n,i,r,s,o){try{Ar.N(e,n,void 0,void 0,o);var a={};t.forEach(function(e){n[e]&&(a[e]=n[e])}),Object.keys(a).length&&Cr.N(e,a,i,r,s,o)}catch(e){Ar.D(e)}},q:function(e,t){try{null==$e||$e.localStorage.removeItem(e),Cr.q(e,t)}catch(e){Ar.D(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&Ar.R()?Ar:"localstorage+cookie"===n&&t.R()?t:"sessionstorage"===n&&Nr.R()?Nr:"memory"===n?Lr:"cookie"===n?Cr:t.R()?t:Cr}},{key:"wr",value:function(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[Ui];return!n||"number"!=typeof n||Date.now()-n>t}},{key:"properties",value:function(){var e=this,t={};return O(this.props,function(n,i){var r=function(e){var t=Yr[e];if(t)return t;var n=!0,i=!1,r=void 0;try{for(var s,o=Jr[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];if(0===e.indexOf(u))return l}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(n,i===Fi?function(){return e.wr()}:function(){return!1}))return;r.transformToEventProperties&&_r(t,r.transformToEventProperties(n))}else r&&"event"!==r.exposure||(t[i]=n)}),t}},{key:"load",value:function(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=_r({},e))}}},{key:"save",value:function(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}},{key:"remove",value:function(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(ut(e)){ct(t)&&(t="None"),this.Sr=ct(n)?this.Ir:n;var r=!1;if(O(e,function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i.Tr(n,e),r=!0)}),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(ut(e)){this.Sr=ct(t)?this.Ir:t;var i=!1;if(O(e,function(t,r){e.hasOwnProperty(r)&&n.props[r]!==t&&(n.Tr(r,t),i=!0)}),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(this.Er(e),this.save())}},{key:"update_campaign_params",value:function(){if(!this.mr){var e=T(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);lt(gr(e))||this.register(e),this.mr=!0}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==Ce?void 0:Ce.referrer)?q(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:L(),$referring_domain:null!=Ce&&Ce.referrer&&(null==(e=Zr(Ce.referrer))?void 0:e.host)||as},void 0)}},{key:"set_initial_person_info",value:function(){this.props[Wi]||this.props[Ki]||this.register_once(_define_property({},Xi,D(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)),void 0)}},{key:"get_initial_props",value:function(){var e=this,t={};O([Ki,Wi],function(n){var i=e.props[n];i&&O(i,function(e,n){t["$initial_"+nt(n)]=e})});var n,i,r=this.props[Xi];if(r){var s=(n=N(r),i={},O(n,function(e,t){i["$initial_"+nt(t)]=e}),i);_r(t,s)}return t}},{key:"safe_merge",value:function(e){return O(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){if(this.Ir=this.Sr=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.br(e),r=this.props;this.clear(),this.nr=i,this.props=r,this.save()}}},{key:"set_disabled",value:function(e){this._r=e,this._r?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}},{key:"set_secure",value:function(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[ci]||{};n[e]=t,this.Tr(ci,n),this.save()}},{key:"remove_event_timer",value:function(e){var t=this.props[ci]||{},n=t[e];return ct(n)||(delete t[e],this.Tr(ci,t),this.save()),n}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this.Tr(e,t),this.save()}},{key:"Tr",value:function(e,t){this.props[e]=t}},{key:"Er",value:function(e){delete this.props[e]}}]),e}(),cs="events",ds="cancelEvents",fs="popover",hs="api",_s="widget",ps="survey shown",vs="survey dismissed",gs="survey sent",ys="$survey_id",ms="$survey_iteration",bs="$survey_last_seen_date",ks="popover",ws="inline",xs="product tour shown",Es="$product_tour_last_seen_date",Ss="$product_tour_type",Ps=ri("[RateLimiter]"),Fs=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){Ps.info((e||"events")+" is quota limited."),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ps.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(Gi))&&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 u=1>a.tokens;return u||e||(a.tokens=Math.max(0,a.tokens-1)),!u||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=u,null==(i=this.instance.persistence)||i.set_property(Gi,a),{isRateLimited:u,remainingTokens:a.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Os=ri("[RemoteConfig]"),$s=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=Ne._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Mr",value:function(e){var t,n,i=this;null!=(t=Ne.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",function(){return e(i.remoteConfig)}):e()}},{key:"Pr",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 Os.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void Os.warn("Remote config is disabled. Falling back to local config.");this.Mr(function(t){if(!t)return Os.info("No config found after loading remote JS config. Falling back to JSON."),void e.Pr(function(t){e.Rr(t),e.Or()});e.Rr(t),e.Or()})}catch(e){Os.error("Error loading remote config",e)}}},{key:"stop",value:function(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}},{key:"refresh",value:function(){!this._instance.Lr()&&Ce&&"hidden"!==Ce.visibilityState&&this._instance.reloadFeatureFlags()}},{key:"Or",value:function(){var e,t=this;if(!this.Fr){var n=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==n&&(this.Fr=setInterval(function(){t.refresh()},n))}}},{key:"Rr",value:function(e){var t;e||Os.error("Failed to fetch remote config from PostHog."),this._instance.Rr(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}(),Is="gzip-js",Rs="base64",Ms=Uint8Array,Cs=Uint16Array,Ts=Uint32Array,As=new Ms([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]),qs=new Ms([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]),js=new Ms([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(e,t){for(var n=new Cs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new Ts(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]},Ds=Ls(As,2),Ns=Ds[1];for(Ds[0][28]=258,Ns[258]=28,Sr=Ls(qs,0)[1],Pr=new Cs(32768),Fr=0;32768>Fr;++Fr)Er=(43690&Fr)>>>1|(21845&Fr)<<1,Pr[Fr]=((65280&(Er=(61680&(Er=(52428&Er)>>>2|(13107&Er)<<2))>>>4|(3855&Er)<<4))>>>8|(255&Er)<<8)>>>1;var Hs=function(e,t,n){for(var i=e.length,r=0,s=new Cs(t);i>r;++r)++s[e[r]-1];var o,a=new Cs(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Cs(1<<t);var u=15-t;for(r=0;i>r;++r)if(e[r])for(var l=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,f=d|(1<<c)-1;f>=d;++d)o[Pr[d]>>>u]=l}else for(o=new Cs(i),r=0;i>r;++r)o[r]=Pr[a[e[r]-1]++]>>>15-e[r];return o},zs=new Ms(288);for(Fr=0;144>Fr;++Fr)zs[Fr]=8;for(Fr=144;256>Fr;++Fr)zs[Fr]=9;for(Fr=256;280>Fr;++Fr)zs[Fr]=7;for(Fr=280;288>Fr;++Fr)zs[Fr]=8;var Us=new Ms(32);for(Fr=0;32>Fr;++Fr)Us[Fr]=5;var Bs=Hs(zs,9,0),Vs=Hs(Us,5,0),Gs=function(e){return(e/8|0)+(7&e&&1)},Ws=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(_instanceof(e,Cs)?Cs:_instanceof(e,Ts)?Ts:Ms)(n-t);return i.set(e.subarray(t,n)),i},Ks=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Xs=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ys=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 Ms(0),0];if(1==r){var o=new Ms(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],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=r-1;)a=n[n[d].f>n[l].f?l++:d++],u=n[l!=c&&n[d].f>n[l].f?l++:d++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var f=s[0].s;for(i=1;r>i;++i)s[i].s>f&&(f=s[i].s);var h=new Cs(f+1),_=Js(n[c-1],h,0);if(_>t){i=0;var p=0,v=_-t,g=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=h[y])break;p+=g-(1<<_-h[y]),h[y]=t}for(p>>>=v;p>0;){var m=s[i].s;t>h[m]?p-=1<<t-h[m]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;h[b]==t&&(--h[b],++p)}_=t}return[new Ms(h),_]},Js=function(e,t,n){return-1==e.s?Math.max(Js(e.l,t,n+1),Js(e.r,t,n+1)):t[e.s]=n},Zs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Cs(++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]},Qs=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},eo=function(e,t,n){var i=n.length,r=Gs(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)},to=function(e,t,n,i,r,s,o,a,u,l,c){Ks(t,c++,n),++r[256];for(var d=Ys(r,15),f=d[0],h=d[1],_=Ys(s,15),p=_[0],v=_[1],g=Zs(f),y=g[0],m=g[1],b=Zs(p),k=b[0],w=b[1],x=new Cs(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=Ys(x,7),P=S[0],F=S[1],O=19;O>4&&!P[js[O-1]];--O);var $,I,R,M,C=l+5<<3,T=Qs(r,zs)+Qs(s,Us)+o,A=Qs(r,f)+Qs(s,p)+o+14+3*O+Qs(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(T>=C&&A>=C)return eo(t,c,e.subarray(u,u+l));if(Ks(t,c,1+(T>A)),c+=2,T>A){$=Hs(f,h,0),I=f,R=Hs(p,v,0),M=p;var q=Hs(P,F,0);for(Ks(t,c,m-257),Ks(t,c+5,w-1),Ks(t,c+10,O-4),c+=14,E=0;O>E;++E)Ks(t,c+3*E,P[js[E]]);c+=3*O;for(var j=[y,k],L=0;2>L;++L){var D=j[L];for(E=0;D.length>E;++E)Ks(t,c,q[N=31&D[E]]),c+=P[N],N>15&&(Ks(t,c,D[E]>>>5&127),c+=D[E]>>>12)}}else $=Bs,I=zs,R=Vs,M=Us;for(E=0;a>E;++E)if(i[E]>255){var N;Xs(t,c,$[257+(N=i[E]>>>18&31)]),c+=I[N+257],N>7&&(Ks(t,c,i[E]>>>23&31),c+=As[N]);var H=31&i[E];Xs(t,c,R[H]),c+=M[H],H>3&&(Xs(t,c,i[E]>>>5&8191),c+=qs[H])}else Xs(t,c,$[i[E]]),c+=I[i[E]];return Xs(t,c,$[256]),c+I[256]},no=new Ts([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),io=function(){for(var e=new Ts(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),ro=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},so=!!qe||!!Ae,oo="text/plain",ao=!1,uo=function(e,t){var n=_sliced_to_array(e.split("#"),2),i=n[0],r=n[1],s=_sliced_to_array(i.split("?"),2),o=s[0],a=s[1];if(!a)return e;var u=a.split("&").filter(function(e){return e.split("=")[0]!==t}).join("&");return o+(u?"?"+u:"")+(r?"#"+r:"")},lo=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=Ue({},t),u=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:[],l=function(e,t){var n,i;void 0===t&&(t="&");var r=[];return O(e,function(e,t){ct(e)||ct(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 l&&u.push(l),s+"?"+u.join("&")},co=function(e,t){return JSON.stringify(e,function(e,t){return"bigint"==(void 0===t?"undefined":_type_of(t))?t.toString():t},t)},fo=function(e){if(e.tr)return e.tr;var t,n=e.data,i=e.compression;if(n){if(i===Is){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=io[255&t^e[i]]^t>>>8;n=t},d:function(){return 4294967295^n}}),r=e.length;i.p(e);var s,o,a,u,l=(u=10+((s=t).filename&&s.filename.length+1||0),function(e,t,n,i){var r=e.length,s=new Ms(i+r+5*(1+Math.floor(r/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>r)for(var u=0;r>=u;u+=65535){var l=u+65535;r>l?a=eo(o,a,e.subarray(u,l)):(o[u]=!0,a=eo(o,a,e.subarray(u,r)))}else{for(var c=no[t-1],d=c>>>13,f=8191&c,h=(1<<n)-1,_=new Cs(32768),p=new Cs(h+1),v=Math.ceil(n/3),g=2*v,y=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<g)&h},m=new Ts(25e3),b=new Cs(288),k=new Cs(32),w=0,x=0,E=(u=0,0),S=0,P=0;r>u;++u){var F=y(u),O=32767&u,$=p[F];if(_[O]=$,p[F]=O,u>=S){var I=r-u;if((w>7e3||E>24576)&&I>423){a=to(e,o,0,m,b,k,x,E,P,u-P,a),E=w=x=0,P=u;for(var R=0;286>R;++R)b[R]=0;for(R=0;30>R;++R)k[R]=0}var M=2,C=0,T=f,A=O-$&32767;if(I>2&&F==y(u-A))for(var q=Math.min(d,I)-1,j=Math.min(32767,u),L=Math.min(258,I);j>=A&&--T&&O!=$;){if(e[u+M]==e[u+M-A]){for(var D=0;L>D&&e[u+D]==e[u+D-A];++D);if(D>M){if(M=D,C=A,D>q)break;var N=Math.min(A,D-2),H=0;for(R=0;N>R;++R){var z=u-A+R+32768&32767,U=z-_[z]+32768&32767;U>H&&(H=U,$=z)}}}A+=(O=$)-($=_[O])+32768&32767}if(C){m[E++]=268435456|Ns[M]<<18|Sr[C];var B=31&Ns[M],V=31&Sr[C];x+=As[B]+qs[V],++b[257+B],++k[V],S=u+M,++w}else m[E++]=e[u],++b[e[u]]}}a=to(e,o,!0,m,b,k,x,E,P,u-P,a)}return Ws(s,0,i+Gs(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,u)),c=l.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&&ro(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)}}(l,t),ro(l,c-8,i.d()),ro(l,c-4,r),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Ms(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 Ms(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 Ws(n,0,i)}(co(n)),{mtime:0});return{contentType:oo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Rs){var s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:co(e))}((t=co(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=co(n);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ho=function(e){var t,n,i,r=fo(e);return!r||(n=e.compression,i=Qr(e.url,"compression"),n!==Ve.GZipJS&&i!==Ve.GZipJS&&"gzip"!==i)||(_instanceof(t=r.body,ArrayBuffer)?Ke(new Uint8Array(t)):ArrayBuffer.isView(t)&&Ke(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:r}:(ao=!0,{url:uo(e.url,"compression"),encodedBody:fo(Ue({},e,{compression:void 0,tr:void 0}))})},_o=function(){var e=p(function(e){var t,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,function(e,t,n){return Ze.apply(this,arguments)}(co(e.data),ze.DEBUG,{rethrow:!0})];case 1:return(t=i.sent())?[4,t.arrayBuffer()]:[2,e];case 2:return n=i.sent(),[2,Ue({},e,{tr:{contentType:oo,body:n,estimatedSize:n.byteLength}})]}})});return function(t){return e.apply(this,arguments)}}(),po=function(e,t){return lo(e,{_:(new Date).getTime().toString(),ver:ze.JS_SDK_VERSION,compression:t})},vo=[];Ae&&vo.push({transport:"fetch",method:function(e){var t,n=ho(e),i=n.url,r=n.encodedBody,s=null!=r?r:{},o=s.contentType,a=s.body,u=s.estimatedSize,l=new Headers;O(e.headers,function(e,t){l.append(t,e)}),o&&l.append("Content-Type",o);var c=null;if(je){var d=new je;c={signal:d.signal,timeout:setTimeout(function(){return d.abort()},e.timeout)}}Ae(i,Ue({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(u||0),body:a,signal:null==(t=c)?void 0:t.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){ii.error(e)}null==e.callback||e.callback(i)})}).catch(function(t){ii.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(function(){return c?clearTimeout(c.timeout):null})}}),qe&&vo.push({transport:"XHR",method:function(e){var t=new qe,n=ho(e),i=n.url,r=n.encodedBody;t.open(e.method||"GET",i,!0);var s=null!=r?r:{},o=s.contentType,a=s.body;O(e.headers,function(e,n){t.setRequestHeader(n,e)}),o&&t.setRequestHeader("Content-Type",o),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=function(){if(4===t.readyState){var n={statusCode:t.status,text:t.responseText};if(200===t.status)try{n.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(n)}},t.send(a)}}),null!=Me&&Me.sendBeacon&&vo.push({transport:"sendBeacon",method:function(e){try{var t=ho(e),n=t.url,i=t.encodedBody,r=lo(n,{beacon:"1"}),s=null!=i?i:{},o=s.contentType,a=s.body;if(!a)return;var u=_instanceof(a,Blob)?a:new Blob([a],{type:o});Me.sendBeacon(r,u)}catch(e){}}});var go,yo=3e3,mo=function(){function e(t,n){_class_call_check(this,e),this.Ar=!0,this.Nr=[],this.$r=xt((null==n?void 0:n.flush_interval_ms)||yo,250,5e3,ii.createLogger("flush interval"),yo),this.Dr=t}return _create_class(e,[{key:"enqueue",value:function(e){this.Nr.push(e),this.qr||this.jr()}},{key:"unload",value:function(){var e=this;this.Hr();var t=this.Nr.length>0?this.Ur():{},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.Dr(Ue({},t,{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.Ar=!1,this.jr()}},{key:"jr",value:function(){var e=this,t=this;this.Ar||(this.qr=setTimeout(function(){if(e.Hr(),e.Nr.length>0){var n=e.Ur(),i=function(){var e=n[r],i=(new Date).getTime();e.data&&ot(e.data)&&O(e.data,function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),t.Dr(e)};for(var r in n)i()}},this.$r))}},{key:"Hr",value:function(){clearTimeout(this.qr),this.qr=void 0}},{key:"Ur",value:function(){var e={};return O(this.Nr,function(t){var n,i=t,r=(i?i.batchKey:null)||i.url;ct(e[r])&&(e[r]=Ue({},i,{data:[]})),null==(n=e[r].data)||n.push(i.data)}),this.Nr=[],e}}]),e}(),bo=["retriesPerformedSoFar"],ko=function(){function e(t){var n=this;_class_call_check(this,e),this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=t,this.Nr=[],this.Vr=!0,!ct($e)&&"onLine"in $e.navigator&&(this.Vr=$e.navigator.onLine,this.Wr=function(){n.Vr=!0,n.Zr()},this.Gr=function(){n.Vr=!1},R($e,"online",this.Wr),R($e,"offline",this.Gr))}return _create_class(e,[{key:"length",get:function(){return this.Nr.length}},{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=v(e,bo);vt(n)&&(i.url=lo(i.url,{retry_count:n})),this._instance._send_request(Ue({},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.Qr(Ue({retriesPerformedSoFar:n},i))}}))}},{key:"Qr",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))),u=Date.now()+a;this.Nr.push({retryAt:u,requestOptions:e});var l="Enqueued failed request for retry in "+a;navigator.onLine||(l+=" (Browser is offline)"),ii.warn(l),this.Br||(this.Br=!0,this.Jr())}},{key:"Jr",value:function(){var e=this;if(this.Kr&&clearTimeout(this.Kr),0===this.Nr.length)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout(function(){e.Vr&&e.Nr.length>0&&e.Zr(),e.Jr()},this.zr)}},{key:"Zr",value:function(){var e=Date.now(),t=[],n=this.Nr.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.Nr=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value.requestOptions;this.retriableRequest(u)}}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.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,ct($e)||(this.Wr&&($e.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&($e.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr)[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request(Ue({},s,{transport:"sendBeacon"}))}catch(e){ii.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.Nr=[]}}]),e}(),wo=function(){function e(t){var n=this;_class_call_check(this,e),this.Yr=function(){var e,t,i,r;n.Xr||(n.Xr={});var s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,u=o+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;n.Xr.lastScrollY=Math.ceil(o),n.Xr.maxScrollY=Math.max(o,null!==(e=n.Xr.maxScrollY)&&void 0!==e?e:0),n.Xr.maxScrollHeight=Math.max(a,null!==(t=n.Xr.maxScrollHeight)&&void 0!==t?t:0),n.Xr.lastContentY=u,n.Xr.maxContentY=Math.max(u,null!==(i=n.Xr.maxContentY)&&void 0!==i?i:0),n.Xr.maxContentHeight=Math.max(l,null!==(r=n.Xr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}return _create_class(e,[{key:"ei",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.Xr}},{key:"resetContext",value:function(){var e=this.Xr;return setTimeout(this.Yr,0),e}},{key:"startMeasuringScrollPosition",value:function(){R($e,"scroll",this.Yr,{capture:!0}),R($e,"scrollend",this.Yr,{capture:!0}),R($e,"resize",this.Yr)}},{key:"scrollElement",value:function(){if(!this.ei)return null==$e?void 0:$e.document.documentElement;var e=ot(this.ei)?this.ei:[this.ei],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==$e?void 0:$e.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.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return $e&&($e.scrollY||$e.pageYOffset||$e.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return $e&&($e.scrollX||$e.pageXOffset||$e.document.documentElement.scrollLeft)||0}}]),e}(),xo=function(e){return D(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties)},Eo=function(){function e(t,n,i,r){var s=this;_class_call_check(this,e),this.ti=function(e){var t=s.ri();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.ii(s._instance)};s.ni.register(_define_property({},Vi,n))}},this._instance=t,this.si=n,this.ni=i,this.ii=r||xo,this.si.onSessionId(this.ti)}return _create_class(e,[{key:"ri",value:function(){return this.ni.props[Vi]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.ri())?void 0:e.props;return t?"r"in t?N(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 O(gr(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_"+nt(n)]=t}),e}}]),e}(),So=function(){function e(){_class_call_check(this,e),this.oi={}}return _create_class(e,[{key:"on",value:function(e,t){var n=this;return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),function(){n.oi[e]=n.oi[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.oi[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,u=!1,l=void 0;try{for(var c,d=(this.oi["*"]||[])[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){(0,c.value)(e,t)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}}]),e}(),Po=ri("[SessionId]"),Fo=function(){function e(t,n,i){var r,s=this;if(_class_call_check(this,e),this.ui=[],this.li=void 0,this.ai=new So,this.hi=function(e,t){return!(!vt(e)||!vt(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===rr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.ni=t.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=n||$r,this.fi=i||$r;var o=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*xt(this.qt.session_idle_timeout_seconds||1800,60,36e3,Po.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+o+"_window_id",this.mi="ph_"+o+"_primary_window_exists",this.yi()){var a=Nr.F(this.gi),u=Nr.F(this.mi);a&&!u?this.ci=a:Nr.q(this.gi),Nr.N(this.mi,!0)}if(null!=(r=this.qt.bootstrap)&&r.sessionID)try{var l=function(){var e=s.qt.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.bi(this.qt.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){Po.error("Invalid sessionID in bootstrap",e)}this.wi()}return _create_class(e,[{key:"on",value:function(e,t){return this.ai.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return ct(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),function(){t.ui=t.ui.filter(function(t){return t!==e})}}},{key:"yi",value:function(){return"memory"!==this.qt.persistence&&!this.ni._r&&Nr.R()}},{key:"xi",value:function(e){e!==this.ci&&(this.ci=e,this.yi()&&Nr.N(this.gi,e))}},{key:"Si",value:function(){return this.ci?this.ci:this.yi()?Nr.F(this.gi):null}},{key:"bi",value:function(e,t,n){e===this.di&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.di=e,this.ni.register(_define_property({},Si,[t,e,n])))}},{key:"ki",value:function(){var e=this.ni.props[Si];return ot(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.bi(null,null,null)}},{key:"destroy",value:function(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&$e&&($e.removeEventListener(lr,this.li,{capture:!1}),this.li=void 0),this.ui=[]}},{key:"wi",value:function(){var e=this;this.li=function(){e.yi()&&Nr.q(e.mi)},R($e,lr,this.li,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===rr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),i=_sliced_to_array(this.ki(),3),r=i[0],s=i[1],o=i[2],a=this.Si(),u=vt(o)&&Math.abs(n-o)>864e5,l=!1,c=!s,d=!c&&!e&&this.hi(n,r);c||d||u?(s=this.vi(),a=this.fi(),Po.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}}),o=n,l=!0):a||(a=this.fi(),l=!0);var f=vt(r)&&e&&!u?r:n,h=vt(o)?o:(new Date).getTime();return this.xi(a),this.bi(s,f,h),e||this.pi(),l&&this.ui.forEach(function(e){return e(s,a,l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0)}),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0,lastActivityTimestamp:r}}},{key:"pi",value:function(){var e=this;clearTimeout(this.Ci),this.Ci=setTimeout(function(){var t=_sliced_to_array(e.ki(),1)[0];if(e.hi((new Date).getTime(),t)){var n=e.di;e.resetSessionId(),e.ai.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}]),e}(),Oo=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&et(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(function(e){return et(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver},$o=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}},Io={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 $o(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!$o(t,e)})})},icontains:function(e,t){return t.map(Ro).some(function(t){return e.map(Ro).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(Ro).every(function(t){return e.map(Ro).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)})})}},Ro=function(e){return e.toLowerCase()},Mo="custom",Co="i.posthog.com",To=/^\/static\//,Ao=function(){function e(t){_class_call_check(this,e),this.Ii={},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("."+Co,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this.Ii[this.apiHost]||(this.Ii[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":Mo),this.Ii[this.apiHost]}},{key:"Ti",value:function(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&To.test(e))return t.trim().replace(/\/$/,"")||void 0}},{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("assets"===e){var n=this.Ti(t);if(n)return""+n+t}if(this.region===Mo)return this.apiHost+t;var i=Co+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}]),e}(),qo=ri("[Surveys]"),jo="seenSurvey_",Lo=[fs,_s,hs],Do={ignoreConditions:!1,ignoreDelay:!1,displayType:ks},No=ri("[PostHog ExternalIntegrations]"),Ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},zo=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"lr",value:function(e,t){var n;null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,function(e){if(e)return No.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=function(t){var n,i,r;!c||null!=(n=Ne.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.lr(Ho[t],function(){var n;null==(n=Ne.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!c&&null!=(i=Ne.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]&&(null==(r=Ne.__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,u=_sliced_to_array(s.value,2),l=u[0],c=u[1];t(l)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}]),e}(),Uo={},Bo=0,Vo=function(){},Go='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wo="Surveys module not available",Ko="sanitize_properties is deprecated. Use before_send instead",Xo="Invalid value for property_denylist config: ",Yo="posthog",Jo=!so&&-1===(null==De?void 0:De.indexOf("MSIE"))&&-1===(null==De?void 0:De.indexOf("Mozilla")),Zo=function(e){var t;return Ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:I(null==Ce?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Vo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:Te&&dt(null==Te?void 0:Te.search)&&-1!==Te.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==$e||null==(t=$e.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){ii.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:ar,before_send:void 0,request_queue_config:{flush_interval_ms:yo},error_tracking:{},_onCapture:Vo,__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))},Qo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],ea=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=Qo[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];ct(e[u])||(t[l]=e[u])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=_r({},t,e);return ot(e.property_blacklist)&&(ct(e.property_denylist)?c.property_denylist=e.property_blacklist:ot(e.property_denylist)?c.property_denylist=_to_consumable_array(e.property_blacklist).concat(_to_consumable_array(e.property_denylist)):ii.error(Xo+e.property_denylist)),c},ta=function(){function e(){_class_call_check(this,e),this.__forceAllowLocalhost=!1}return _create_class(e,[{key:"Ei",get:function(){return this.__forceAllowLocalhost},set:function(e){ii.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),na=function(){function e(){var t,n=this;_class_call_check(this,e),this.webPerformance=new ta,this.Oi=!1,this.version=ze.LIB_VERSION,this.Li=new So,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zo(),this.SentryIntegration=Kr,this.sentryIntegration=function(e){return t=C(n,e),{name:Wr,processEvent:function(e){return t(e)}};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new wo(this),this.pageViewManager=new Xr(this),this.rateLimiter=new Fs(this),this.requestRouter=new Ao(this),this.consent=new Hr(this),this.externalIntegrations=new zo(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=dt(e)?_define_property({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=dt(e)?_define_property({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return ii.info('send "'+(null==e?void 0:e.event)+'"',e)})}return _create_class(e,[{key:"Mi",value:function(e,t){if(e){var n=this.Pi.indexOf(e);-1!==n&&this.Pi.splice(n,1)}return this.Pi.push(t),null==t.initialize||t.initialize(),t}},{key:"Ri",value:function(){return this.config.cookieless_mode===rr||this.config.cookieless_mode===ir&&this.consent.isRejected()}},{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!==Yo){var r,s=null!==(r=Uo[i])&&void 0!==r?r:new e;return s._init(t,n,i),Uo[i]=s,Uo[Yo][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e,t,n){var i,r,s=this;if(void 0===t&&(t={}),ct(e)||ft(e))return ii.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.Di(t.debug),this.qi=t,this.ji=[],t.person_profiles?this.Ni=t.person_profiles:t.process_person&&(this.Ni=t.process_person),this.set_config(_r({},Zo(t.defaults),ea(t),{name:n,token:e})),this.config.on_xhr_error&&ii.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Is;var o=this.Hi();this.persistence=new ls(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ls(Ue({},this.config,{persistence:"sessionStorage"}),o);var a=Ue({},this.persistence.props),u=Ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ui=new mo(function(e){return s.Bi(e)},this.config.request_queue_config),this.zi=new ko(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Fo(this),this.sessionPropsManager=new Eo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ii.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){s.Vi(l)},0)):(ii.info("Initializing extensions synchronously"),this.Vi(l)),ze.DEBUG=ze.DEBUG||this.config.debug,ze.DEBUG&&ii.info("Starting in debug mode",{this:this,config:t,thisC:Ue({},this.config),p:a,s:u}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=Ue({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(r=t.bootstrap)?void 0:r.distinctID)){var c=t.bootstrap.distinctID,d=this.get_distinct_id(),f=this.persistence.get_property(Bi);if(t.bootstrap.isIdentifiedID&&null!=d&&d!==c&&f===sr)this.identify(c);else if(t.bootstrap.isIdentifiedID&&null!=d&&d!==c&&f===or)ii.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 h=this.config.get_device_id($r()),_=t.bootstrap.isIdentifiedID?h:c;this.persistence.set_property(Bi,t.bootstrap.isIdentifiedID?or:sr),this.register({distinct_id:c,$device_id:_})}}if(l)this.register_once({distinct_id:Zi,$device_id:null},"");else if(!this.get_distinct_id()){var p=this.config.get_device_id($r());this.register_once({distinct_id:p,$device_id:p},""),this.persistence.set_property(Bi,sr)}return R($e,"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()||$r()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(Bi,or)),t()},r=n.user();"then"in r&&at(r.then)?r.then(i):i(r)}(e,function(){n.register(function(e){Promise&&Promise.resolve||Gr.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()||(Gr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Gr.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,cr)},identify:function(e){return t(e,fr)},screen:function(e){return t(e,"$screen")}}}(e)).then(function(){t()})})}(this,function(){return s.Wi()}):this.Wi(),at(this.config._onCapture)&&this.config._onCapture!==Vo&&(ii.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return s.config._onCapture(e.event,e)})),this.config.ip&&ii.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:"Vi",value:function(t){var n,i,r,s,o,a,u,l=this,c=performance.now(),d=Ue({},e.__defaultExtensionClasses,this.config.__extensionClasses),f=[];d.featureFlags&&this.Pi.push(this.featureFlags=null!==(n=this.featureFlags)&&void 0!==n?n:new d.featureFlags(this)),d.exceptions&&this.Pi.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new d.exceptions(this)),d.historyAutocapture&&this.Pi.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Pi.push(new d.tracingHeaders(this)),d.siteApps&&this.Pi.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||f.push(function(){l.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Pi.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Pi.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this)),d.logs&&this.Pi.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new d.logs(this)),d.conversations&&this.Pi.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new d.conversations(this)),d.productTours&&this.Pi.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Pi.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Pi.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.Pi.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new d.toolbar(this)),d.experiments&&this.Pi.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this.Pi.forEach(function(e){e.initialize&&f.push(function(){null==e.initialize||e.initialize()})}),f.push(function(){if(l.Zi){var e=l.Zi;l.Zi=void 0,l.Rr(e)}}),this.Gi(f,c)}},{key:"Gi",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.Gi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){ii.error("Error initializing extension:",e)}}var r,s=Math.round(performance.now()-t);this.register_for_session((_define_property(r={},Qi,this.config.__preview_deferred_init_extensions?"deferred":"synchronous"),_define_property(r,er,s),r)),this.config.__preview_deferred_init_extensions&&ii.info("PostHog extensions initialized ("+s+"ms)")}},{key:"Rr",value:function(e){var t,n=this;if(!Ce||!Ce.body)return ii.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){n.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Zi=e),this.Qi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=g(e.supportedCompression,Is)?Is:g(e.supportedCompression,Rs)?Rs:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:ar}),this.Pi.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}},{key:"Wi",value:function(){var e=this;try{this.config.loaded(this)}catch(e){ii.critical("`loaded` function failed",e)}if(this.Ji(),this.config.internal_or_test_user_hostname&&null!=Te&&Te.hostname){var t=Te.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.Ri())&&e.Ki()},1),this.Yi=new $s(this),this.Yi.load()}},{key:"Ji",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ui)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&F(this.__request_queue,function(t){return e.Bi(t)}),this.__request_queue=[],this.Ji()}},{key:"_handle_unload",value:function(){var e,t,n,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(dr),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(n=this.Ui)||n.unload(),null==(i=this.zi)||i.unload()):this.Xi()&&this.capture(dr,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t=this;this.__loaded&&(Jo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=lo(e.url,{ip:this.config.ip?1:0}),e.headers=Ue({},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=Ue({},e);r.timeout=r.timeout||6e4,r.url=po(r.url,r.compression);var s=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=vo.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===Is&&Le&&!ao?_o(r).then(function(e){a(e)}).catch(function(t){if(Xe(t))return ao=!0,void a(Ue({},r,{compression:void 0,url:po(e.url,void 0)}));(function(e){if(!e||"object"!=(void 0===e?"undefined":_type_of(e)))return!1;var t="name"in e?String(e.name):"";return Xe(e)||t===We})(t)&&(ao=!0),a(r)}):a(r)}(Ue({},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:"Bi",value:function(e){this.zi?this.zi.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;Bo++;try{var n,i=[],r=[],s=[];F(e,function(e){if(e)if(ot(n=e[0]))s.push(e);else if(at(e))try{e.call(t)}catch(t){ii.error("Error executing queued PostHog call",e,t)}else ot(e)&&"alias"===n?i.push(e):ot(e)&&-1!==n.indexOf("capture")&&at(t[n])?s.push(e):r.push(e)});var o=function(e,t){F(e,function(e){try{if(ot(e[0])){var n=t;O(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ii.error("Error executing queued PostHog call",e,t)}})};o(i,this),o(r,this),o(s,this)}finally{Bo--}}},{key:"push",value:function(t){if(Bo>0&&ot(t)&&dt(t[0])){var n=e.prototype[t[0]];at(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.Ui){if(this.is_capturing())if(!ct(e)&&dt(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var l=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=t&&t.$current_url&&!dt(null==t?void 0:t.$current_url)&&(ii.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.en||ii.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,d=(null==n?void 0:n.timestamp)||c,f=(null==n?void 0:n.uuid)||$r(),h={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},d,f)};e===cr&&this.config.__preview_capture_bot_pageviews&&u&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),l&&(h.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens),(null==n?void 0:n.$set)&&(h.$set=null==n?void 0:n.$set);var _,p,v,g=this.tn(null==n?void 0:n.$set_once,e!==hr,e===fr);if(g&&(h.$set_once=g),null!=n&&n._noTruncate||(r=this.config.properties_string_max_length,s=h,o=function(e){return dt(e)?e.slice(0,r):e},a=new Set,h=function e(t,n){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),ot(t)?(i=[],F(t,function(t){i.push(e(t))})):(i={},O(t,function(t,n){a.has(t)||(i[n]=e(t,n))})),i);var i}(s)),h.timestamp=d,ct(null==n?void 0:n.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=c),e===vs||e===gs){var y=null==t?void 0:t[ys],m=null==t?void 0:t[ms];(function(e){try{var t=(r=""+jo+(i=n=e).id,i.current_iteration&&i.current_iteration>0&&(r=""+jo+i.id+"_"+i.current_iteration),r);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){qo.error("Failed to persist survey seen state",n)}var n,i,r})({id:y,current_iteration:m}),h.$set=Ue({},h.$set,_define_property({},(v="$survey_"+(p=e===gs?"responded":"dismissed")+"/"+(_={id:y,current_iteration:m}).id,_.current_iteration&&_.current_iteration>0&&(v="$survey_"+p+"/"+_.id+"/"+_.current_iteration),v),!0))}else e===ps&&(h.$set=Ue({},h.$set,_define_property({},bs,(new Date).toISOString())));if(e===xs){var b=null==t?void 0:t[Ss];b&&(h.$set=Ue({},h.$set,_define_property({},Es+"/"+b,(new Date).toISOString())))}var k=Ue({},h.properties.$set,h.$set);if(lt(k)||this.setPersonPropertiesForFlags(k),!_t(this.config.before_send)){var w=this.rn(h);if(!w)return;h=w}this.Li.emit("eventCaptured",h);var x={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:h,compression:"best-available",batchKey:null==n?void 0:n._batchKey,transport:null==n?void 0:n.transport};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Bi(x):this.Ui.enqueue(x),h}ii.critical("This capture call is ignored due to client rate limiting.")}}else ii.error("No event name provided to posthog.capture")}else ii.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=Ue({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=Ue({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!dt(o.distinct_id)&&!pt(o.distinct_id)||ft(o.distinct_id))&&ii.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,l=function(e,t){var n,i,r,s;if(!De)return{};var o,a,u,l,c,d,f,h,_=e?_to_consumable_array(is).concat(_to_consumable_array(t||[])):[],p=_sliced_to_array(function(e){for(var t=0;En.length>t;t++){var n=_sliced_to_array(En[t],2),i=n[0],r=n[1],s=i.exec(e),o=s&&(at(r)?r(s,e):r);if(o)return o}return["",""]}(De),2),v=p[0],g=p[1];return _r(gr({$os:v,$os_version:g,$browser:kn(De,navigator.vendor),$device:Sn(De),$device_type:(a=De,u={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(i=navigator)?void 0:i.maxTouchPoints,screenWidth:null==$e||null==(r=$e.screen)?void 0:r.width,screenHeight:null==$e||null==(s=$e.screen)?void 0:s.height,devicePixelRatio:null==$e?void 0:$e.devicePixelRatio},h=Sn(a),h===Tt||h===Ct||"Kobo"===h||"Kindle Fire"===h||h===dn?Mt:h===Qt||h===tn||h===en||h===un?"Console":h===qt?"Wearable":h?$t:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(l=null==u?void 0:u.maxTouchPoints)&&void 0!==l?l:0)>0?600>Math.min(null!==(c=null==u?void 0:u.screenWidth)&&void 0!==c?c:0,null!==(d=null==u?void 0:u.screenHeight)&&void 0!==d?d:0)/(null!==(f=null==u?void 0:u.devicePixelRatio)&&void 0!==f?f:1)?$t:Mt:"Desktop"),$timezone:H(),$timezone_offset:z()}),{$current_url:es(null==Te?void 0:Te.href,_,ss),$host:null==Te?void 0:Te.host,$pathname:null==Te?void 0:Te.pathname,$raw_user_agent:De.length>1e3?De.substring(0,997)+"...":De,$browser_version:xn(De,navigator.vendor),$browser_language:j(),$browser_language_prefix:(o=j(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==$e?void 0:$e.screen.height,$screen_width:null==$e?void 0:$e.screen.width,$viewport_height:null==$e?void 0:$e.innerHeight,$viewport_width:null==$e?void 0:$e.innerWidth,$lib:ze.LIB_NAME,$lib_version:ze.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()),d=c.sessionId,f=c.windowId;o.$session_id=d,o.$window_id=f}this.sessionPropsManager&&_r(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&_r(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(h=this.zi)?void 0:h.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Mo&&(o.$lib_custom_api_host=this.config.api_host),u=e!==cr||r?e!==dr||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=_r(o,u),e===cr&&Ce&&(o.title=Ce.title),!ct(s)){var _=n.getTime()-s;o.$duration=parseFloat((_/1e3).toFixed(3))}De&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=_r({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),ot(this.config.property_denylist)?O(this.config.property_denylist,function(e){delete o[e]}):ii.error(Xo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(ii.error(Ko),o=p(o,e));var v=this.nn();return o.$process_person_profile=v,v&&!r&&this.sn("_calculate_event_properties"),o}},{key:"tn",value:function(e,t,n){var i;if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.nn())return e;if(this.Oi&&!n)return e;var r=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=_r({},r,s||{},e||{}),a=this.config.sanitize_properties;return a&&(ii.error(Ko),o=a(o,"$set_once")),t&&(this.Oi=!0),lt(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:"an",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.Li.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:Wo}),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:Wo})}},{key:"getActiveMatchingSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Wo})}},{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=Do),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:Wo}}},{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:Wo})}},{key:"un",value:function(e){return!e||ft(e)?(ii.critical("Unique user id has not been set in posthog.identify"),!1):e===Zi?(ii.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())||(ii.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 ii.uninitializedWarning("posthog.identify");if(pt(e)&&(e=e.toString(),ii.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(e)&&this.sn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ui)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(li)&&(this.unregister(li),this.register({distinct_id:e}));var r,s=(this.persistence.get_property(Bi)||sr)===sr;e!==i&&s?(this.persistence.set_property(Bi,or),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(fr,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.$i=U(e,t,n),null==(r=this.featureFlags)||r.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(Ni))}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.sn("posthog.setPersonProperties")){var n=U(this.get_distinct_id(),e,t);this.$i!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.$i=n):ii.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:Ue({},i,_define_property({},e,t))}),r||n){var s={$group_type:e,$group_key:t};n&&(s.$group_set=n),this.capture(hr,s)}n&&this.setGroupPropertiesForFlags(_define_property({},e,n)),r&&!n&&this.reloadFeatureFlags()}else ii.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.sn("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,u;if(ii.info("reset"),!this.__loaded)return ii.uninitializedWarning("posthog.reset");var l,c=this.get_property(ui),d=this.get_property(bi);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),ct(d)||null==(l=this.persistence)||l.register(_define_property({},bi,d)),null==(i=this.surveys)||i.reset(),null==(r=this.Yi)||r.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Bi,sr),null==(u=this.sessionManager)||u.resetSessionId(),this.$i=null,this.config.cookieless_mode===rr)this.register_once({distinct_id:Zi,$device_id:null},"");else{var f=this.config.get_device_id($r());this.register_once({distinct_id:f,$device_id:e?f:c},"")}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.ln()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.hn()}},{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(ai)?(ii.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(ct(t)&&(t=this.get_distinct_id()),e!==t?(this.an(li,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ii.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=Ue({},this.config);if(ut(e)){var n,i,r,s,o,a,u,l,c,d;_r(this.config,ea(e));var f=this.Hi();null==(n=this.persistence)||n.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ls(Ue({},this.config,{persistence:"sessionStorage"}),f);var h=this.Di(this.config.debug);gt(h)&&(this.config.debug=h),gt(this.config.debug)&&(this.config.debug?(ze.DEBUG=!0,Ar.R()&&Ar.N("ph_debug",!0),ii.info("set_config",{config:e,oldConfig:t,newConfig:Ue({},this.config)})):(ze.DEBUG=!1,Ar.R()&&Ar.q("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(r=this.exceptions)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.cn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}},{key:"_overrideSDKInfo",value:function(e,t){ze.LIB_NAME=e,ze.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(Ue({},i,t))}}},{key:"addExceptionStep",value:function(e,t){var n;null==(n=this.exceptions)||n.addExceptionStep(e,t)}},{key:"captureLog",value:function(e){var t;null==(t=this.logs)||t.captureLog(e)}},{key:"logger",get:function(){var t,n;return null!==(t=null==(n=this.logs)?void 0:n.logger)&&void 0!==t?t:e.dn}},{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:Yo;return t!==Yo&&(t=Yo+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(Bi))===or||(null==(t=this.sessionPersistence)?void 0:t.get_property(Bi))===or}},{key:"nn",value:function(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ar&&!this._isIdentified()&&lt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[li])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Yi]))}},{key:"Xi",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.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"sn",value:function(e){return"never"===this.config.person_profiles?(ii.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Yi,!0),!0)}},{key:"Hi",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!==ir)}},{key:"cn",value:function(){var e,t,n,i,r=this.Hi();return(null==(e=this.persistence)?void 0:e._r)!==r&&(null==(n=this.persistence)||n.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._r)!==r&&(null==(i=this.sessionPersistence)||i.set_disabled(r)),r}},{key:"opt_in_capturing",value:function(t){var n;if(this.config.cookieless_mode!==rr){if(this.Ri()){var i,r,s,o,a;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Fo(this),this.pageViewManager=new Xr(this),this.persistence&&(this.sessionPropsManager=new Eo(this,this.sessionManager,this.persistence));var u,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.Mi(this.sessionRecording,new l(this)),this.Qi&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Qi)))}var c,d;this.consent.optInOut(!0),this.cn(),this.Ji(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),this.config.cookieless_mode==ir&&(null==(c=this.surveys)||c.loadIfEnabled()),(ct(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else ii.warn(Go)}},{key:"opt_out_capturing",value:function(){var e,t,n;this.config.cookieless_mode!==rr?(this.config.cookieless_mode===ir&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===ir&&(this.register({distinct_id:Zi,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki(),this.Ji())):ii.warn(Go)}},{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===rr||(this.config.cookieless_mode===ir?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this.cn()}},{key:"_is_bot",value:function(){return Me?Oo(Me,this.config.custom_blocked_useragents):void 0}},{key:"Ki",value:function(){Ce&&("visible"===Ce.visibilityState?this.Fi||(this.Fi=!0,this.capture(cr,{title:Ce.title},{send_instantly:!0}),this.Ai&&(Ce.removeEventListener(ur,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),R(Ce,ur,this.Ai)))}},{key:"debug",value:function(e){!1===e?(null==$e||$e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==$e||$e.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:"Lr",value:function(){var e,t,n,i,r,s,o=this.qi||{};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?(ii.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=ii,r=(t="advanced_disable_flags")in(e=o)&&!_t(e[t]),s=n in e&&!_t(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:"rn",value:function(e){if(_t(this.config.before_send))return e;var t=ot(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),_t(n)){var u="Event '"+e.event+"' was rejected in beforeSend function";return mt(e.event)?ii.warn(u+". This can cause unexpected behavior."):ii.info(u),null}n.properties&&!lt(n.properties)||ii.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.dr)?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:"Di",value:function(e){var t=gt(e)&&!e,n=Ar.R()&&"true"===Ar.A("ph_debug");return!t&&(!!n||e)}}]),e}();na.__defaultExtensionClasses={},na.dn={trace:go=function(){},debug:go,info:go,warn:go,error:go,fatal:go},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=vr(e.prototype[t[n]])}(na,["identify"]);var ia=1,ra=3,sa=11,oa=["a","button","form","input","select","textarea","label"],aa=["next","previous","prev",">","<"],ua=[".ph-no-rageclick",".ph-no-capture"],la=function(e){return!e||W(e,"html")||!G(e)},ca=function(e,t){if(!$e||la(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!W(r,"body");)if(X(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var s=ie(r);if(!s)break;if(t||oa.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=$e.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}},da="(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})",fa=new RegExp("^(?:"+da+")$"),ha=new RegExp(da),_a="\\d{3}-?\\d{2}-?\\d{4}",pa=new RegExp("^("+_a+")$"),va=new RegExp("("+_a+")");function ga(e){var t="";return e&&e.childNodes&&e.childNodes.length&&O(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var i=ee(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ga(e)).trim())}catch(e){ii.error("[AutoCapture]",e)}}),t}var ya=function(){function e(t){_class_call_check(this,e),this.disabled=!1===t;var n=ut(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}(),ma="$copy_autocapture",ba=ri("[AutoCapture]"),ka=ri("[ExceptionAutocapture]"),wa=ri("[TracingHeaders]"),xa=ri("[Web Vitals]"),Ea=9e5,Sa="disabled",Pa="lazy_loading",Fa="awaiting_config",Oa="missing_config";ri("[SessionRecording]"),ri("[SessionRecording]");var $a,Ia="[SessionRecording]",Ra=ri(Ia),Ma=ri("[Heatmaps]"),Ca=ri("[Product Tours]"),Ta=["$set_once","$set"],Aa=ri("[SiteApps]"),qa="Error while initializing PostHog app with config id ",ja=function(){function e(t){var n=this;_class_call_check(this,e),this.vn=new So,this.fn=function(e,t){return n.pn(e,t)&&n.gn(e,t)&&n.mn(e,t)&&n.yn(e,t)},this.pn=function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)},this._instance=t,this.bn=new Set,this._n=new Set}return _create_class(e,[{key:"init",value:function(){var e,t,n=this;ct(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(!ct(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(function(e){var t,n;null==(t=i._n)||t.add(e),null==(n=e.steps)||n.forEach(function(e){var t;null==(t=i.bn)||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.bn.has(e)||this.bn.has(null==t?void 0:t.event))&&this._n&&(null==(n=this._n)?void 0:n.size)>0&&this._n.forEach(function(e){i.wn(t,e)&&i.vn.emit("actionCaptured",e.name)})}},{key:"xn",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"wn",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.fn(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.vn.on(e,t)}},{key:"gn",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(!_e(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"mn",value:function(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}},{key:"Sn",value:function(e,t){var n;if(null==t||!t.href)return!0;var i=this.In(e);if(i.length>0)return i.some(function(e){return _e(e.href,t.href,t.href_matching||"exact")});var r,s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!s&&_e((r=s.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}},{key:"kn",value:function(e,t){var n;if(null==t||!t.text)return!0;var i=this.In(e);if(i.length>0)return i.some(function(e){return _e(e.text,t.text,t.text_matching||"exact")||_e(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;!_t(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 _e(e,s,o)}))}},{key:"Cn",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:"In",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:"yn",value:function(e,t){return null==t||!t.properties||0===t.properties.length||B(t.properties.reduce(function(e,t){var n=ot(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}(),La=function(){function e(t){_class_call_check(this,e),this._instance=t,this.Tn=new Map,this.En=new Map,this.Mn=new Map}return _create_class(e,[{key:"Pn",value:function(e,t){return!!e&&B(e.propertyFilters,null==t?void 0:t.properties)}},{key:"Rn",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:"On",value:function(e,t,n){var i=this,r=(n===cs?this.Tn:this.En).get(e),s=[];return this.Ln(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.Pn(o,t)})}},{key:"register",value:function(e){var t;ct(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}},{key:"An",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.Nn&&(this.Nn=new ja(this._instance),this.Nn.init(),this.Nn.xn(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.Nn)||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.Mn.get(n.name);i&&i.push(e.id),t.Mn.set(n.name,i||[e.id])}}))}))}},{key:"Fn",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.Tn=this.Rn(e,cs),this.En=this.Rn(e,ds))}},{key:"onEvent",value:function(e,t){var n,i=this,r=this.le(),s=this.$n(),o=this.Dn(),a=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var u,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(null==t||null==(u=t.properties)?void 0:u.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var d=a.indexOf(c);0>d||(a.splice(d,1),this.qn(a))}}else{if(this.En.has(e)){var f=this.On(e,t,ds);f.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(function(e){return e.id})}),f.forEach(function(e){var t=a.indexOf(e.id);0>t||a.splice(t,1),i.jn(e.id)}),this.qn(a))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var h=this.On(e,t,cs);this.qn(a.concat(h.map(function(e){return e.id})||[]))}}}},{key:"onAction",value:function(e){var t,n=this.$n(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.Mn.has(e)&&this.qn(i.concat(this.Mn.get(e)||[]))}},{key:"qn",value:function(e){var t=this,n=this.le(),i=_to_consumable_array(new Set(e)).filter(function(e){return!t.Hn(e)});n.info("updating activated items",{activatedItems:i}),this.Un(i)}},{key:"getActivatedIds",value:function(){var e,t=this.$n();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"getEventToItemsMap",value:function(){return this.Tn}},{key:"Bn",value:function(){return this.Nn}}]),e}(),Da=function(e){function t(e){return _class_call_check(this,t),_call_super(this,t,[e])}return _inherits(t,e),_create_class(t,[{key:"$n",value:function(){return Li}},{key:"Dn",value:function(){return ps}},{key:"Ln",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"jn",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"le",value:function(){return qo}},{key:"Un",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register(_define_property({},Li,e))}},{key:"Hn",value:function(){return!1}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItemsMap()}}]),t}(La),Na="SDK is not enabled or survey functionality is not yet loaded",Ha="Disabled. Not loading surveys.",za=null!=$e&&$e.location?ts($e.location.hash,"__posthog")||ts(location.hash,"state"):null,Ua="_postHogToolbarParams",Ba=ri("[Toolbar]"),Va=ri("[FeatureFlags]"),Ga=ri("[FeatureFlags]",{debugEnabled:!0}),Wa="\" failed. Feature flags didn't load in time.",Ka=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Xa=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=$(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];l&&(t[u]=l)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},Ya=ri("[Error tracking]"),Ja="Refusing to render web experiment since the viewer is a likely bot",Za={icontains:function(e,t){return!!$e&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!$e&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!$e&&$o(t.href,e)},not_regex:function(e,t){return!!$e&&!$o(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},Qa=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.zn("retrieved web experiments from the server"),i.Vn=new Map,t.forEach(function(t){if(t.feature_flag_key){var n;i.Vn&&(e.zn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.Vn)||n.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);dt(r)&&t.variants[r]&&i.Wn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.Zn(o)&&i.Wn(t.name,s,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.zn(Ja);else if(!this.qt.disable_web_experiments){if(_t(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.zn("applying feature flags",t),t.forEach(function(e){var t;if(n.Vn&&null!=(t=n.Vn)&&t.has(e)){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.Vn)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&n.Wn(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=Qr(null==n?void 0:n.search,"__experiment_id"),r=Qr(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments(function(e){t.Gn(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.qt.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.qt.token),method:"GET",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"Gn",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.zn("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Wn(r[0].name,n,r[0].variants[n].transforms))}},{key:"Wn",value:function(t,n,i){this._is_bot()?e.zn(Ja):"control"!==n?i.forEach(function(i){if(i.selector){var r;e.zn("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.zn("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return Me&&this._instance?Oo(Me,this.qt.custom_blocked_useragents):void 0}}],[{key:"Zn",value:function(t){return!_t(t.conditions)&&e.Qn(t)&&e.Jn(t)}},{key:"Qn",value:function(t){var n;if(_t(t.conditions)||_t(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||Za[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==$e?void 0:$e.location}},{key:"Jn",value:function(e){var t;if(_t(e.conditions)||_t(null==(t=e.conditions)?void 0:t.utm))return!0;var n=T();if(n.utm_source){var i,r,s,o,a,u,l,c,d=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,f=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,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_medium)==n.utm_medium,_=null==(l=e.conditions)||null==(l=l.utm)||!l.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==n.utm_term;return d&&h&&_&&f}return!1}},{key:"zn",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];ii.info("[WebExperiments] "+e,n)}}]),e}(),eu=ri("[Conversations]"),tu="Conversations not available yet.",nu={featureFlags:function(){function e(t){_class_call_check(this,e),this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"ni",get:function(){return this._instance.persistence}},{key:"os",value:function(e){return this._instance.get_property(e)}},{key:"us",value:function(){var e,t;return null!==(e=null==(t=this.ni)?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}},{key:"ls",value:function(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,Va.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"hs",value:function(){var e,t=null!==(e=this.qt.evaluation_contexts)&&void 0!==e?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(Va.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=t&&t.length?t.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Va.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}},{key:"cs",value:function(){return this.hs().length>0}},{key:"ds",value:function(){var e=this.qt.flag_keys;if(!ct(e)){if(ot(e))return e.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Va.error("Invalid flag key found:",e,"Expected non-empty string"),t});Va.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}},{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},{}),u=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:u})}}},{key:"updateFlags",value:function(e,t,n){var i=null!=n&&n.merge?this.getFlagVariants():{},r=null!=n&&n.merge?this.getFlagPayloads():{},s=Ue({},i,e),o=Ue({},r,t),a={},u=!0,l=!1,c=void 0;try{for(var d,f=Object.entries(s)[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var h=_sliced_to_array(d.value,2),_=h[0],p=h[1],v="string"==typeof p;a[_]={key:_,enabled:!!v||Boolean(p),variant:v?p:void 0,reason:void 0,metadata:ct(null==o?void 0:o[_])?void 0:{id:0,version:void 0,description:void 0,payload:o[_]}}}}catch(e){l=!0,c=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw c}}this.receivedFeatureFlags({flags:a})}},{key:"hasLoadedFlags",get:function(){return this.Yn}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.os(Ii),t=this.os(Ci),n=this.os(Ti);if(!n&&!t)return e||{};var i=_r({},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 u,l=r[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c,d,f=u.value,h=i[f],_=null==t?void 0:t[f],p=ct(_)?null!==(c=null==h?void 0:h.enabled)&&void 0!==c&&c:!!_,v=ct(_)?h.variant:"string"==typeof _?_:void 0,g=null==n?void 0:n[f],y=Ue({},h,{enabled:p,variant:p?null!=v?v:null==h?void 0:h.variant:void 0});p!==(null==h?void 0:h.enabled)&&(y.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(y.original_variant=null==h?void 0:h.variant),g&&(y.metadata=Ue({},null==h?void 0:h.metadata,{payload:g,original_payload:null==h||null==(d=h.metadata)?void 0:d.payload})),i[f]=y}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return this.Kn||(Va.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Kn=!0),i}},{key:"getFlagVariants",value:function(){var e=this.os(Fi),t=this.os(Ci);if(!t)return e||{};for(var n=_r({},e),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Kn||(Va.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Kn=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.os(Ri),t=this.os(Ti);if(!t)return e||{};for(var n=_r({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Kn||(Va.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Kn=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this.es||this.qt.advanced_disable_feature_flags||this.vs||(this._instance.Li.emit("featureFlagsReloading",!0),this.vs=setTimeout(function(){e.fs()},5))}},{key:"ps",value:function(){clearTimeout(this.vs),this.vs=void 0}},{key:"ensureFlagsLoaded",value:function(){this.Yn||this.Xn||this.vs||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.es=e}},{key:"fs",value:function(e){var t,n=this;if(this.ps(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(ui),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ue({},(null==(t=this.ni)?void 0:t.get_initial_props())||{},this.os(Ai)||{}),group_properties:this.os(qi),timezone:H()};ht(r)||ct(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var o=this.ds();ct(o)||(s.flag_keys=o);var a=!!this.qt.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:u,data:s,compression:this.qt.disable_compression?void 0:Rs,timeout:this.qt.feature_flag_request_timeout_ms,callback:function(e){var t,i,r,o=!0;if(200===e.statusCode&&(n.ts||(n.$anon_distinct_id=void 0),o=!1),n.Xn=!1,!s.disable_flags||n.ts){n.rs=!o;var u=[];e.error?_instanceof(e.error,Error)?u.push("AbortError"===e.error.name?"timeout":"connection_error"):u.push("unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var l,c=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),null==(r=n.ni)||r.register(_define_property({},zi,u)),c?Va.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,{partialResponse:a}),n.ts&&(n.ts=!1,n.fs()))}}})}}},{key:"getFeatureFlag",value:function(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){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 Va.warn('getFeatureFlag for key "'+e+Wa)}},{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.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),i=e in n,r=n[e],s=this.getFlagPayloads()[e],o=String(r),a=this.os(Mi)||void 0,u=this.os(Ui)||void 0,l=this.os(Ni)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var c,d,f=this._instance.get_session_id(),h=this.os(Hi);f&&f!==h&&(l={},null==(c=this.ni)||c.register((_define_property(d={},Ni,l),_define_property(d,Hi,f),d)))}if((t.send_event||!("send_event"in t))&&(!(e in l)||!l[e].includes(o))){var _,p,v,g,y,m,b,k,w,x;ot(l[e])?l[e].push(o):l[e]=[o],null==(_=this.ni)||_.register(_define_property({},Ni,l));var E=this.getFeatureFlagDetails(e),S=_to_consumable_array(null!==(p=this.os(zi))&&void 0!==p?p:[]);ct(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:u,$feature_flag_bootstrapped_response:(null==(v=this.qt.bootstrap)||null==(v=v.featureFlags)?void 0:v[e])||null,$feature_flag_bootstrapped_payload:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[e])||null,$used_bootstrap_value:!this.rs};ct(null==E||null==(y=E.metadata)?void 0:y.version)||(P.$feature_flag_version=E.metadata.version);var F,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),ct(null==E?void 0:E.original_variant)&&ct(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=ct(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==(F=E.metadata)?void 0:F.original_payload),S.length&&(P.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",P)}if(i){var $=s;if(!ct(s))try{$=JSON.parse(s)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:$}}}}else Va.warn('getFeatureFlagResult for key "'+e+Wa)}},{key:"getRemoteConfigPayload",value:function(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.cs()&&(i.evaluation_contexts=this.hs());var r=this.ds();ct(r)||(i.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.qt.disable_compression?void 0:Rs,timeout:this.qt.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.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return ct(n)?void 0:!!n}Va.warn('isFeatureEnabled for key "'+e+Wa)}}},{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,n){if(this.ni){this.Yn=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,n,i,r,s){void 0===n&&(n={}),void 0===i&&(i={}),void 0===r&&(r={});var o,a,u=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(function(e){var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(function(e){return a[e].enabled}).filter(function(e){var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(function(e){var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):Va.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),l=u.flags,c=u.featureFlags,d=u.featureFlagPayloads;if(c){var f=e.requestId,h=e.evaluatedAt;if(ot(c)){Va.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _,p={};if(c)for(var v=0;c.length>v;v++)p[c[v]]=!0;t&&t.register((_define_property(_={},Oi,c),_define_property(_,Fi,p),_))}else{var g,y=c,m=d,b=l;if(null!=s&&s.partialResponse)y=Ue({},n,y),m=Ue({},i,m),b=Ue({},r,b);else if(e.errorsWhileComputingFlags)if(l){var k=new Set(Object.keys(l).filter(function(e){var t;return!(null!=(t=l[e])&&t.failed)}));y=Ue({},n,Object.fromEntries(Object.entries(y).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)}))),m=Ue({},i,Object.fromEntries(Object.entries(m||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)}))),b=Ue({},r,Object.fromEntries(Object.entries(b||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)})))}else y=Ue({},n,y),m=Ue({},i,m),b=Ue({},r,b);t&&t.register(Ue((_define_property(g={},Oi,Object.keys(Xa(y))),_define_property(g,Fi,y||{}),_define_property(g,Ri,m||{}),_define_property(g,Ii,b||{}),g),f?_define_property({},Mi,f):{},h?_define_property({},Ui,h):{}))}}}(e,this.ni,i,r,s,n),t||(this.ss=!1),this.gs(t)}}},{key:"override",value:function(e,t){void 0===t&&(t=!1),Va.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this._instance.__loaded||!this.ni)return Va.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ni.unregister(Ci),this.ni.unregister(Ti),this.gs(),Ga.info("All overrides cleared");if(ot(e)){var t=Ka(e);return this.ni.register(_define_property({},Ci,t)),this.gs(),Ga.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.Kn=Boolean(null!==(n=i.suppressWarning)&&void 0!==n&&n),"flags"in i)if(!1===i.flags)this.ni.unregister(Ci),Ga.info("Flag overrides cleared");else if(i.flags){if(ot(i.flags)){var r=Ka(i.flags);this.ni.register(_define_property({},Ci,r))}else this.ni.register(_define_property({},Ci,i.flags));Ga.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this.ni.unregister(Ti),Ga.info("Payload overrides cleared")):i.payloads&&(this.ni.register(_define_property({},Ti,i.payloads)),Ga.info("Payload overrides set",{payloads:i.payloads}))),void this.gs()}if(e&&"object"==(void 0===e?"undefined":_type_of(e)))return this.ni.register(_define_property({},Ci,e)),this.gs(),Ga.info("Flag overrides set",{flags:e});Va.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.Yn){var n=this.ys(),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.os($i)||[]).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,u=Ue({},this.getFlagVariants(),_define_property({},e,t));null==(i=this.ni)||i.register((_define_property(a={},Oi,Object.keys(Xa(u))),_define_property(a,Fi,u),a)),this.gs()}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i=this;void 0===t&&(t=!1);var r=this.os($i),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.qt.token+s),method:"GET",callback:function(t){var n,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(n=i.ni)||n.unregister($i),null==(r=i.ni)||r.register(_define_property({},$i,s)),e(s)}}})}},{key:"ys",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:"gs",value:function(e){var t=this.ys(),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.os(Ai)||{},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({},Ai,Ue({},n,s,i))),t&&this._instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this._instance.unregister(Ai)}},{key:"setGroupPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.os(qi)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(function(t){n[t]=Ue({},n[t],e[t]),delete e[t]}),this._instance.register(_define_property({},qi,Ue({},n,e))),t&&this._instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.os(qi)||{};this._instance.register(_define_property({},qi,Ue({},t,_define_property({},e,{}))))}else this._instance.unregister(qi)}},{key:"reset",value:function(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.ps(),this.Kn=!1}}]),e}()},iu={sessionRecording:function(){function e(t){if(_class_call_check(this,e),this._forceAllowLocalhostNetworkCapture=!1,this._s=Sa,this.ws=void 0,this._instance=t,!this._instance.sessionManager)throw Ra.error("started without valid sessionManager"),new Error(Ia+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===rr)throw new Error(Ia+' cannot be used with cookieless_mode="always"')}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"ni",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!(null==(e=this.bs)||!e.isStarted)}},{key:"status",get:function(){var e,t;return this._s===Fa||this._s===Oa?this._s:null!==(e=null==(t=this.bs)?void 0:t.status)&&void 0!==e?e:this._s}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"xs",get:function(){var e,t=!(null==(e=this._instance.get_property(bi))||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return $e&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){var t;if(!this.xs||null==(t=this.bs)||!t.isStarted){var n=!ct(Object.assign)&&!ct(Array.from);this.xs&&n?(this.Ss(e),Ra.info("starting")):(this._s=Sa,this.stopRecording())}}},{key:"Ss",value:function(e){var t,n,i,r=this;this.xs&&(this._s!==Fa&&this._s!==Oa&&(this._s=Pa),null!=Ne&&null!=(t=Ne.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=Ne.__PosthogExtensions__)&&n.initSessionRecording?this.ks(e):null==(i=Ne.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Cs,function(t){if(t)return Ra.error("could not load recorder",t);r.ks(e)}))}},{key:"stopRecording",value:function(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.stop()}},{key:"Is",value:function(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.discard()}},{key:"Ts",value:function(){var e;null==(e=this.ni)||e.unregister(Pi)}},{key:"Es",value:function(e,t){if(_t(e))return null;var n,i=pt(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Ra.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}},{key:"Ms",value:function(e){var t=this;if(this.ni){var n,i,r=this.ni,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.Es(null==(n=t.qt.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.Es(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;_t(a)&&t.Ts();var u=null==i?void 0:i.minimumDurationMilliseconds;r.register(_define_property({},bi,Ue({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:Ue({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:ct(u)?null:u,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})))};s(),null==(n=this.ws)||n.call(this),this.ws=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ms(e),void this.Is()):(this.Ms(e),void this.startIfEnabledOrStop()):(this._s===Fa&&(this._s=Oa,Ra.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.bs)&&n.log?this.bs.log(e,t):Ra.warn("log called before recorder was ready")}},{key:"Cs",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(bi);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"Ps",value:function(){var e,t,n=this._instance.get_property(bi);if(!n)return!1;try{t="object"==(void 0===n?"undefined":_type_of(n))?n:JSON.parse(n)}catch(e){return Ra.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var i=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}},{key:"ks",value:function(e){var t,n;if(null==(t=Ne.__PosthogExtensions__)||!t.initSessionRecording)return Ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session(_define_property({},tr,!0));if(this.bs||(this.bs=null==(n=Ne.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ps()){if(this._s===Oa||this._s===Fa)return;return this._s=Fa,Ra.info("persisted remote config is stale, requesting fresh config before starting"),void new $s(this._instance).load()}this._s=Pa,this.bs.start(e)}},{key:"onRRwebEmit",value:function(e){var t;null==(t=this.bs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.bs||null==(t=this.ni)||t.register(_define_property({},wi,!0)),null==(e=this.bs)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.bs||null==(t=this.ni)||t.register(_define_property({},ki,!0)),null==(e=this.bs)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.bs||null==(n=this.ni)||n.register(_define_property({},"url"===e?xi:Ei,!0)),null==(t=this.bs)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.bs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!(null==(n=this.bs)||!n.tryAddCustomEvent(e,t))}}]),e}()},ru={autocapture:function(){function e(t){_class_call_check(this,e),this.Rs=!1,this.Os=null,this.Ls=!1,this.instance=t,this.rageclicks=new ya(t.config.rageclick),this.Fs=null}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"qt",get:function(){var e,t,n=ut(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:"As",value:function(){var e=this;if(this.isBrowserSupported()){if($e&&Ce){var t=function(t){t=t||(null==$e?void 0:$e.event);try{e.Ns(t)}catch(e){ba.error("Failed to capture event",e)}};if(R(Ce,"submit",t,{capture:!0}),R(Ce,"change",t,{capture:!0}),R(Ce,"click",t,{capture:!0}),this.qt.capture_copied_text){var n=function(t){t=t||(null==$e?void 0:$e.event);try{e.Ns(t,ma)}catch(e){ba.error("Failed to capture copy/cut event",e)}};R(Ce,"copy",n,{capture:!0}),R(Ce,"cut",n,{capture:!0})}}}else ba.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.Rs&&(this.As(),this.Rs=!0)}},{key:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this.Ls=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(_define_property({},di,!!e.autocapture_opt_out)),this.Os=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this.Fs=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null==(t=this.Fs)||t.forEach(function(t){var i=null==Ce?void 0:Ce.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[di];if(ht(this.Os)&&!gt(n)&&!this.instance.Lr())return!1;var i=null!==(t=this.Os)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}},{key:"Ns",value:function(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=te(e);K(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(!$e||la(e))return!1;var n,i,r;if(gt(t)?(n=!!t&&ua,i=void 0):(n=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:ua,i=null==t?void 0:t.content_ignorelist),!1===n)return!1;var s=ca(e,!1).targetElementList;return!function(e,t){if(!1===e||ct(e))return!1;var n;if(!0===e)n=aa;else{if(!ot(e))return!1;if(e.length>10)return ii.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:ee(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!ne(s,n)}(i,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var r=t===ma;if(i&&function(e,t,n,i,r){var s,o,a,u;if(void 0===n&&(n=void 0),!$e||la(e))return!1;if(null!=(s=n)&&s.url_allowlist&&!J(n.url_allowlist))return!1;if(null!=(o=n)&&o.url_ignorelist&&J(n.url_ignorelist))return!1;if(null!=(a=n)&&a.dom_event_allowlist){var l=n.dom_event_allowlist;if(l&&!l.some(function(e){return t.type===e}))return!1}var c=ca(e,i),d=c.parentIsUsefulElement,f=c.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(ct(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 u,l=e[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){if(i=r(u.value))return i.v}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return!1}(f,n))return!1;if(!ne(f,null==(u=n)?void 0:u.css_selector_allowlist))return!1;var h=$e.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var _=e.tagName.toLowerCase();switch(_){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 d?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(oa.indexOf(_)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.qt,r,r?["copy","cut"]:void 0)){var s=function(e,t){var n,i,r=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,u=t.elementsChainAsString;if(!G(e))return{props:{}};for(var l=[e],c=e;c.parentNode&&!W(c,"body");)if(X(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!G(c.parentNode))break;l.push(c.parentNode),c=c.parentNode}var d,f,h,_=[],p={},v=!1,y=!1;if(O(l,function(e){var t=re(e);if(W(e,"a")){var n=e.getAttribute("href");v=t&&!!n&&oe(n)&&n}g(Z(e),"ph-no-capture")&&(y=!0),_.push(function(e,t,n,i){var r=e.tagName.toLowerCase(),s={tag_name:r};oa.indexOf(r)>-1&&!n&&(s.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?ce(1024,ae(e)):ce(1024,ee(e)));var o=Z(e);o.length>0&&(s.classes=o.filter(function(e){return""!==e})),O(e.attributes,function(n){var r;if((!se(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&oe(n.value)&&(!dt(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=n.value;"class"===n.name&&(o=Y(o).join(" ")),s["attr__"+n.name]=ce(1024,o)}});for(var a=1,u=1,l=e;l=de(l);)a++,l.tagName===e.tagName&&u++;return s.nth_child=a,s.nth_of_type=u,s}(e,s,o,a));var i=function(e){if(!re(e))return{};var t={};return O(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&&oe(i)&&(t[n]=i)}}),t}(e);_r(p,i)}),y)return{props:{},explicitNoCapture:y};if(o||(_[0].$el_text=W(e,"a")||W(e,"button")?ae(e):ee(e)),v){var m,b;_[0].attr__href=v;var k=null==(m=Zr(v))?void 0:m.host,w=null==$e||null==(b=$e.location)?void 0:b.host;k&&w&&k!==w&&(d=v)}return{props:_r({$event_type:r.type,$ce_version:1},u?{}:{$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,u=(e.attr_class.sort(),e.attr_class)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)i+="."+a.value.replace(/"/g,"")}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}var l=Ue({},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 $(l).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[ue(n.toString())]=ue(i.toString())}),(i+=":")+$(c).map(function(e){var t=_sliced_to_array(e,2);return t[0]+'="'+t[1]+'"'}).join("")}).join(";")}((h=f,h.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:le(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return $(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.qt.element_attribute_ignorelist,elementsChainAsString:this.Ls}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===ma){var u,l=Q(null==$e||null==(u=$e.getSelection())?void 0:u.toString()),c=e.type||"clipboard";if(!l)return!1;o.$selected_content=l,o.$copy_type=c}return this.instance.capture(t,o),!0}}}},{key:"isBrowserSupported",value:function(){return at(null==Ce?void 0:Ce.querySelectorAll)}}]),e}(),historyAutocapture:function(){function e(t){var n;_class_call_check(this,e),this._instance=t,this.$s=(null==$e||null==(n=$e.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&&(ii.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"stop",value:function(){this.Ds&&this.Ds(),this.Ds=void 0,ii.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){var e,t;if($e&&$e.history){var n=this;null!=(e=$e.history.pushState)&&e.__posthog_wrapped__||fe($e.history,"pushState",function(e){return function(t,i,r){e.call(this,t,i,r),n.qs("pushState")}}),null!=(t=$e.history.replaceState)&&t.__posthog_wrapped__||fe($e.history,"replaceState",function(e){return function(t,i,r){e.call(this,t,i,r),n.qs("replaceState")}}),this.js()}}},{key:"qs",value:function(e){try{var t,n=null==$e||null==(t=$e.location)?void 0:t.pathname;if(!n)return;n!==this.$s&&this.isEnabled&&this._instance.capture(cr,{navigation_type:e}),this.$s=n}catch(t){ii.error("Error capturing "+e+" pageview",t)}}},{key:"js",value:function(){var e=this;if(!this.Ds){var t=function(){e.qs("popstate")};R($e,"popstate",t),this.Ds=function(){$e&&$e.removeEventListener("popstate",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;_class_call_check(this,e),this.Hs=!1,this.Rs=!1,this.Us=null,this.instance=t,this.Hs=!(null==(n=this.instance.persistence)||!n.props[fi]),this.rageclicks=new ya(t.config.rageclick)}return _create_class(e,[{key:"qt",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return ut(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return _t(this.qt.capture_heatmaps)?_t(this.qt.enable_heatmaps)?this.Hs:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this.Rs)return;Ma.info("starting..."),this.Bs(),this.At()}else{var e;clearInterval(null!==(e=this.Us)&&void 0!==e?e:void 0),this.zs(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(_define_property({},fi,t)),this.Hs=t,this.startIfEnabled()}}},{key:"getAndClearBuffer",value:function(){var e=this.M;return this.M=void 0,e}},{key:"Vs",value:function(e){this.Mt(e.originalEvent,"deadclick")}},{key:"At",value:function(){this.Us&&clearInterval(this.Us),this.Us="visible"===(null==Ce?void 0:Ce.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}},{key:"Bs",value:function(){var e=this;$e&&Ce&&(this.Ws=this.Zr.bind(this),R($e,lr,this.Ws),this.Zs=function(t){return e.Mt(t||(null==$e?void 0:$e.event))},R(Ce,"click",this.Zs,{capture:!0}),this.Gs=function(t){return e.Qs(t||(null==$e?void 0:$e.event))},R(Ce,"mousemove",this.Gs,{capture:!0}),this.Js=new Vr(this.instance,Ur,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ks=this.At.bind(this),R(Ce,ur,this.Ks),this.Rs=!0)}},{key:"zs",value:function(){var e;$e&&Ce&&(this.Ws&&$e.removeEventListener(lr,this.Ws),this.Zs&&Ce.removeEventListener("click",this.Zs,{capture:!0}),this.Gs&&Ce.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Ks&&Ce.removeEventListener(ur,this.Ks),clearTimeout(this.Ys),null==(e=this.Js)||e.stop(),this.Rs=!1)}},{key:"Xs",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&&G(i)&&!W(i,"body");){if(i===n)return!1;if(g(t,null==$e?void 0:$e.getComputedStyle(i).position))return!0;i=ie(i)}return!1}(te(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"Mt",value:function(e,t){var n;if(void 0===t&&(t="click"),!V(e.target)&&he(e)){var i=this.Xs(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.eo(Ue({},i,{type:"rageclick"})),this.eo(i)}}},{key:"Qs",value:function(e){var t=this;!V(e.target)&&he(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(function(){t.eo(t.Xs(e,"mousemove"))},500))}},{key:"eo",value:function(e){if($e){var t=$e.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?_to_consumable_array(is).concat(_to_consumable_array(n||[])):[],r=es(t,i,ss);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}},{key:"Zr",value:function(){this.M&&!lt(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:Vr,webVitalsAutocapture:function(){function e(t){var n,i=this;_class_call_check(this,e),this.Hs=!1,this.Rs=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=function(){clearTimeout(i.io),0!==i.M.metrics.length&&(i._instance.capture("$web_vitals",i.M.metrics.reduce(function(e,t){var n;return Ue({},e,(_define_property(n={},"$web_vitals_"+t.name+"_event",Ue({},t)),_define_property(n,"$web_vitals_"+t.name+"_value",t.value),n))},{})),i.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=function(e){var t;i.M=i.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=i.no();if(!ct(n))if(_t(null==e?void 0:e.name)||_t(null==e?void 0:e.value))xa.error("Invalid metric received",e);else if(!i.so||i.so>e.value){i.M.url!==n&&(i.ro(),i.io=setTimeout(i.ro,i.flushToCaptureTimeoutMs)),ct(i.M.url)&&(i.M.url=n),i.M.firstMetricTimestamp=ct(i.M.firstMetricTimestamp)?Date.now():i.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=i._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=Ue({},e,{$current_url:n,timestamp:Date.now()});ct(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),i.M.metrics.push(s),i.M.metrics.length===i.allowedMetrics.length&&i.ro()}else xa.error("Ignoring metric with value >= "+i.so,e)},this.oo=function(){if(!i.Rs){var e,t,n,r,s,o=Ne.__PosthogExtensions__;ct(o)||ct(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.ht.bind(i)),i.allowedMetrics.indexOf("CLS")>-1&&t(i.ht.bind(i)),i.allowedMetrics.indexOf("FCP")>-1&&n(i.ht.bind(i)),i.allowedMetrics.indexOf("INP")>-1&&r(i.ht.bind(i)),i.Rs=!0):xa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Hs=!(null==(n=this._instance.persistence)||!n.props[vi]),this.startIfEnabled()}return _create_class(e,[{key:"ao",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=ut(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return _t(n)?(null==(t=this._instance.persistence)?void 0:t.props[mi])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(ut(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"useAttribution",get:function(){var e=ut(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}},{key:"so",get:function(){var e=ut(this.ao)&&pt(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:Ea;return e>0&&6e4>=e?Ea:e}},{key:"isEnabled",get:function(){var e=null==Te?void 0:Te.protocol;if("http:"!==e&&"https:"!==e)return xa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ut(this.ao)?this.ao.web_vitals:gt(this.ao)?this.ao:void 0;return gt(t)?t:this.Hs}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.Rs&&(xa.info("enabled, starting..."),this.lr(this.oo))}},{key:"onRemoteConfig",value:function(e){if("capturePerformance"in e){var t=ut(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=ut(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register(_define_property({},vi,t)),this._instance.persistence.register(_define_property({},mi,n))),this.Hs=t,this.startIfEnabled()}}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",function(t){t?xa.error("failed to load script",t):e()})}},{key:"no",value:function(){var e=$e?$e.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(is).concat(_to_consumable_array(t||[])):[];return es(e,n,ss)}xa.error("Could not determine current URL")}}]),e}()},su={exceptionObserver:function(){function e(t){var n,i,r,s=this;_class_call_check(this,e),this.oo=function(){var e;if($e&&s.isEnabled&&null!=(e=Ne.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!s.uo&&s.qt.capture_unhandled_errors&&(s.uo=t(s.captureException.bind(s))),!s.lo&&s.qt.capture_unhandled_rejections&&(s.lo=n(s.captureException.bind(s))),!s.ho&&s.qt.capture_console_errors&&(s.ho=i(s.captureException.bind(s)))}catch(e){ka.error("failed to start",e),s.co()}}},this._instance=t,this.do=!(null==(n=this._instance.persistence)||!n.props[hi]),this.vo=new Ot({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,Gt:ka}),this.qt=this.fo(),this.startIfEnabledOrStop()}return _create_class(e,[{key:"fo",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ut(e)?t=Ue({},t,e):(ct(e)?this.do:e)&&(t=Ue({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(ka.info("enabled"),this.co(),this.lr(this.oo)):this.co()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",function(t){if(t)return ka.error("failed to load script",t);e()})}},{key:"co",value:function(){var e,t,n;null==(e=this.uo)||e.call(this),this.uo=void 0,null==(t=this.lo)||t.call(this),this.lo=void 0,null==(n=this.ho)||n.call(this),this.ho=void 0}},{key:"onRemoteConfig",value:function(e){"autocaptureExceptions"in e&&(this.do=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register(_define_property({},hi,this.do)),this.qt=this.fo(),this.startIfEnabledOrStop())}},{key:"onConfigChange",value:function(){this.qt=this.fo()}},{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.vo.consumeRateLimit(r)?ka.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.po=[],this.mo=new In([new Hn,new Yn,new Un,new zn,new Kn,new Wn,new Vn,new Xn],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 u=Nn.test(a)?a.replace(Nn,"$1"):a;if(!u.match(/\S*Error: /)){var l=!0,c=!1,d=void 0;try{for(var f,h=n[Symbol.iterator]();!(l=(f=h.next()).done);l=!0){var _=(0,f.value)(u,e);if(_){r.push(_);break}}}catch(e){c=!0,d=e}finally{try{l||null==h.return||h.return()}finally{if(c)throw d}}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 Ue({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||Rn});var n})}(r)}}("web:javascript",qn,Dn)),this._instance=t,this.po=null!==(n=null==(i=this._instance.persistence)?void 0:i.get_property(_i))&&void 0!==n?n:[],this.yo=S(this.bo()),this._o=new ti(this.yo)}return _create_class(e,[{key:"onConfigChange",value:function(){this.yo=S(this.bo()),this._o.setConfig(this.yo)}},{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.po=s,this._instance.persistence&&this._instance.persistence.register((_define_property(r={},_i,this.po),_define_property(r,pi,o),r))}}},{key:"wo",get:function(){var e,t=!!this._instance.get_property(pi),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.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"addExceptionStep",value:function(e,t){if(this.yo.enabled)try{if(!dt(e)||0===e.trim().length)return void Ya.warn("Ignoring exception step because message must be a non-empty string");var n,i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(function(n,i){return Qn.has(i)?(t.push(i),n):(n[i]=e[i],n)},{}),droppedKeys:t}}(this.xo(t)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&Ya.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(Ue((_define_property(n={},Jn,e),_define_property(n,Zn,(new Date).toISOString()),n),r))}catch(e){Ya.error("Failed to add exception step. Ignoring breadcrumb.",e)}}},{key:"sendExceptionEvent",value:function(e){try{var t=e.$exception_list;if(this.So(t)){if(this.ko(t))return this.Co("Exception dropped: matched a suppression rule"),void Ya.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void Ya.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Ya.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.yo.enabled&&_t(e.$exception_steps)?this.Eo(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return i&&this._o.clear(),i}catch(e){return Ya.error("Failed to capture exception event. Dropping this exception.",e),void this._o.clear()}}catch(e){return void Ya.error("Failed to process exception event. Ignoring this exception.",e)}}},{key:"Eo",value:function(e){try{var t=this._o.getAttachable();return 0===t.length?e:Ue({},e,{$exception_steps:t})}catch(t){return Ya.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}},{key:"Co",value:function(e){var t;this.yo.enabled&&this._o.add((_define_property(t={},Jn,e),_define_property(t,Zn,(new Date).toISOString()),t))}},{key:"xo",value:function(e){return ut(e)?Ue({},e):{}}},{key:"bo",value:function(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}},{key:"ko",value:function(e){if(0===e.length)return!1;var t=e.reduce(function(e,t){var n=t.type,i=t.value;return dt(n)&&n.length>0&&e.$exception_types.push(n),dt(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.po.some(function(e){var n=e.values.map(function(e){var n,i=Io[e.operator],r=ot(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:"Io",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:"To",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:"So",value:function(e){return!_t(e)&&ot(e)}}]),e}()},ou=Ue({productTours:function(){function e(t){_class_call_check(this,e),this.Mo=null,this.Po=null,this._instance=t}return _create_class(e,[{key:"ni",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){"productTours"in e&&(this.ni&&this.ni.register(_define_property({},yi,!!e.productTours)),this.loadIfEnabled())}},{key:"loadIfEnabled",value:function(){var e,t,n=this;this.Mo||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(yi)||this.lr(function(){return n.Ro()})}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",function(t){t?Ca.error("Could not load product tours script",t):e()})}},{key:"Ro",value:function(){var e;!this.Mo&&null!=(e=Ne.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=Ne.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e,t){var n=this;if(void 0===t&&(t=!1),!ot(this.Po)||t){var i=this.ni;if(i){var r=i.props[Di];if(ot(r)&&!t)return this.Po=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 Ca.error(s),void e([],{isLoaded:!1,error:s})}var o=ot(t.json.product_tours)?t.json.product_tours:[];n.Po=o,i&&i.register(_define_property({},Di,o)),e(o,{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}},{key:"getActiveProductTours",value:function(e){_t(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.Mo)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.Mo?this.Mo.previewTour(e):this.lr(function(){var n;t.Ro(),null==(n=t.Mo)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.Mo)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.Mo)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.Po=null,null==(e=this.ni)||e.unregister(Di)}},{key:"resetTour",value:function(e){var t;null==(t=this.Mo)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.Mo)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}]),e}()},nu),au={siteApps:function(){function e(t){_class_call_check(this,e),this._instance=t,this.Oo=[],this.apps={}}return _create_class(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"Lo",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.Oo.push(n),this.Oo.length>1e3&&(this.Oo=this.Oo.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=Ne._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.Lo.bind(this));this.Fo=function(){t(),e.Oo=[],e.Fo=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 u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{},d=!0,f=!1,h=void 0;try{for(var _,p=Object.entries(c)[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var g=_sliced_to_array(_.value,2),y=g[0],m=g[1];u[y]={id:l[y],type:y,properties:m}}}catch(e){f=!0,h=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw h}}var b=e.$set_once,k=e.$set;return{event:Ue({},v(e,Ta),{properties:Ue({},e.properties,k?{$set:Ue({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},k)}:{},b?{$set_once:Ue({},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:u}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.Oo.length&&(Aa.info("Processing "+t.Oo.length+" events for site app with id "+e.id),t.Oo.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.Fo)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,Aa.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){Aa.error(qa+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){Aa.error("Error while processing buffered events PostHog app with config id "+e.id,t),n.errored=!0}}},{key:"Ao",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,u=!1,l=void 0;try{for(var c,d=e[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value;this.setupSiteApp(f)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}},{key:"No",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){Aa.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.Ao(),void this._instance.on("eventCaptured",function(e){return r.No(e)})):void Aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.Fo)||n.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var o=function(e){var t;Ne["__$$ph_site_app_"+e]=s._instance,null==(t=Ne.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,_,function(t){if(t)return Aa.error(qa+e,t)})},a=!0,u=!1,l=void 0;try{for(var c,d=e.siteApps[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value,h=f.id,_=f.url;o(h)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}else Aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}()},uu={tracingHeaders:function(){function e(t){var n=this;_class_call_check(this,e),this.$o=void 0,this.Do=void 0,this.oo=function(){var e,t,i=n.qo()||[];ct(n.$o)&&(null==(e=Ne.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,n._instance.get_distinct_id(),n._instance.sessionManager)),ct(n.Do)&&(null==(t=Ne.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,n._instance.get_distinct_id(),n._instance.sessionManager))},this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",function(t){if(t)return wa.error("failed to load script",t);e()})}},{key:"qo",value:function(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}},{key:"startIfEnabledOrStop",value:function(){var e,t;this.qo()?this.lr(this.oo):(null==(e=this.$o)||e.call(this),null==(t=this.Do)||t.call(this),this.$o=void 0,this.Do=void 0)}}]),e}()},lu=Ue({surveys:function(){function e(t){_class_call_check(this,e),this.jo=void 0,this._surveyManager=null,this.Ho=!1,this.Uo=[],this.Bo=null,this._instance=t,this._surveyEventReceiver=null}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this.qt.disable_surveys){var t=e.surveys;if(_t(t))return qo.warn("Flags not loaded yet. Not loading surveys.");var n=ot(t);this.jo=n?t.length>0:t,qo.info("flags response received, isSurveysEnabled: "+this.jo),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(jo)||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.Ho)qo.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)qo.info(Ha);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())qo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t){if(!ct(this.jo)||this.qt.advanced_enable_surveys){var n=this.jo||this.qt.advanced_enable_surveys;this.Ho=!0;try{var i=t.generateSurveys;if(i)return void this.zo(i,n);var r=t.loadExternalDependency;if(!r)return void this.Vo(nr);r(this._instance,"surveys",function(i){i||!t.generateSurveys?e.Vo("Could not load surveys script",i):e.zo(t.generateSurveys,n)})}catch(e){throw this.Vo("Error initializing surveys",e),e}finally{this.Ho=!1}}}else qo.error("PostHog Extensions not found.")}}},{key:"zo",value:function(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Da(this._instance),qo.info("Surveys loaded successfully"),this.Wo({isLoaded:!0})}},{key:"Vo",value:function(e,t){qo.error(e,t),this.Wo({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.Uo.push(e),this._surveyManager&&this.Wo({isLoaded:!0}),function(){t.Uo=t.Uo.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e,t){var n=this;if(void 0===t&&(t=!1),this.qt.disable_surveys)return qo.info(Ha),e([]);var i,r=this._instance.get_property(ji);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Bo?this.Bo.then(function(t){var n=t.surveys,i=t.context;return e(n,i)}):("undefined"!=typeof Promise&&(this.Bo=new Promise(function(e){i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:function(t){var r;n.Bo=null;var s=t.statusCode;if(200!==s||!t.json){var o="Surveys API could not be loaded, status: "+s;qo.error(o);var a={isLoaded:!1,error:o};return e([],a),void(null==i||i({surveys:[],context:a}))}var u,l=t.json.surveys||[],c=l.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==(u=n._surveyEventReceiver)||u.register(c)),null==(r=n._instance.persistence)||r.register(_define_property({},ji,l));var d={isLoaded:!0};e(l,d),null==i||i({surveys:l,context:d})}}))}},{key:"Wo",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.Uo[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){qo.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),!_t(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qo.warn("init was not called")}},{key:"Zo",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:"Go",value:function(e){if(_t(this._surveyManager))return{eligible:!1,reason:Na};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(_t(this._surveyManager))return qo.warn("init was not called"),{visible:!1,disabledReason:Na};var t=this.Go(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;return _t(this._surveyManager)?(qo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Na})):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.Go(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(_t(this._surveyManager))qo.warn("init was not called");else{var s="string"==typeof e?this.Zo(e):e;if(null!=s&&s.id)if(Lo.includes(s.type)){var o=null==Ce?void 0:Ce.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(qo.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(function(){var e,t;qo.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),qo.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);qo.warn("Survey element not found")}else qo.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qo.warn("Survey not found")}}},{key:"displaySurvey",value:function(e,t){var n;if(_t(this._surveyManager))qo.warn("init was not called");else{var i=this.Zo(e);if(i){var r=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=Ue({},i,{appearance:Ue({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ks&&t.initialResponses&&qo.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 qo.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==ws?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else qo.warn("Survey not found")}}},{key:"cancelPendingSurvey",value:function(e){_t(this._surveyManager)?qo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}]),e}()},nu),cu={toolbar:function(){function e(t){_class_call_check(this,e),this.instance=t}return _create_class(e,[{key:"Qo",value:function(e){Ne.ph_toolbar_state=e}},{key:"Jo",value:function(){var e;return null!==(e=Ne.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),M(this.instance.config))return!1;if(!$e||!Ce)return!1;e=null!=e?e:$e.location,n=null!=n?n:$e.history;try{if(!t){try{$e.localStorage.setItem("test","test"),$e.localStorage.removeItem("test")}catch(e){return!1}t=null==$e?void 0:$e.localStorage}var i,r=za||ts(e.hash,"__posthog")||ts(e.hash,"state"),s=r?pr(function(){return JSON.parse(atob(decodeURIComponent(r)))})||pr(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(Ua)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}},{key:"Ko",value:function(e){var t=Ne.ph_load_toolbar||Ne.ph_load_editor;!_t(t)&&at(t)?t(e,this.instance):Ba.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t=this,n=!(null==Ce||!Ce.getElementById(Ji));if(!$e||n)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=Ue({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if($e.localStorage.setItem(Ua,JSON.stringify(Ue({},r,{source:void 0}))),2===this.Jo())this.Ko(r);else if(0===this.Jo()){var s;this.Qo(1),null==(s=Ne.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",function(e){if(e)return Ba.error("[Toolbar] Failed to load",e),void t.Qo(0);t.Qo(2),t.Ko(r)}),R($e,"turbolinks:load",function(){t.Qo(0),t.loadToolbar(r)})}return!0}},{key:"Yo",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}()},du=Ue({experiments:Qa},nu),fu={conversations:function(){function e(t){_class_call_check(this,e),this.Xo=void 0,this._conversationsManager=null,this.ea=!1,this.ta=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;_t(t)||(gt(t)?this.Xo=t:(this.Xo=t.enabled,this.ta=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Xo=void 0,this.ta=null}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.ea||this._instance.config.disable_conversations||M(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t&&!ct(this.Xo)&&this.Xo)if(this.ta&&this.ta.token){this.ea=!0;try{var n=t.initConversations;if(n)return this.ra(n),void(this.ea=!1);var i=t.loadExternalDependency;if(!i)return void this.ia(nr);i(this._instance,"conversations",function(n){n||!t.initConversations?e.ia("Could not load conversations script",n):e.ra(t.initConversations),e.ea=!1})}catch(e){this.ia("Error initializing conversations",e),this.ea=!1}}else eu.error("Conversations enabled but missing token in remote config.")}}},{key:"ra",value:function(e){if(this.ta)try{this._conversationsManager=e(this.ta,this._instance),eu.info("Conversations loaded successfully")}catch(e){this.ia("Error completing conversations initialization",e)}else eu.error("Cannot complete initialization: remote config is null")}},{key:"ia",value:function(e,t){eu.error(e,t),this._conversationsManager=null,this.ea=!1}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():eu.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Xo&&!ht(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 p(function(){return _ts_generator(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(eu.warn(tu),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return p(function(){return _ts_generator(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(eu.warn(tu),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(eu.warn(tu),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(eu.warn(tu),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(eu.warn(tu),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(eu.warn(tu),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return p(function(){return _ts_generator(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(eu.warn(tu),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:"ln",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"hn",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},hu={logs:function(){function e(t){var n;_class_call_check(this,e),this.na=!1,this.sa=!1,this.Gt=ri("[logs]"),this.oa=[],this.aa=0,this.ua=0,this.la=!1,this._instance=t,this._instance&&null!=(n=this._instance.config.logs)&&n.captureConsoleLogs&&(this.na=!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;!_t(n)&&n&&(this.na=!0,this.loadIfEnabled())}},{key:"reset",value:function(){this.oa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.aa=0,this.ua=0,this.la=!1}},{key:"loadIfEnabled",value:function(){var e=this;if(this.na&&!this.sa){var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",function(n){var i;n||null==(i=t.logs)||!i.initializeLogs?e.Gt.error("Could not load logs script",n):(t.logs.initializeLogs(e._instance),e.sa=!0)}):this.Gt.error(nr)}else this.Gt.error("PostHog Extensions not found.")}}},{key:"captureLog",value:function(e){var t,n,i,r,s,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!==(t=null==(n=this._instance.config.logs)?void 0:n.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(i=null==(r=this._instance.config.logs)?void 0:r.maxLogsPerInterval)&&void 0!==i?i:1e3,l=Date.now();if(a>l-this.ua||(this.ua=l,this.aa=0,this.la=!1),u>this.aa){this.aa++;var c=function(e,t){var n=e.level||"info",i=Fn[n]||On,r=i.text,s=i.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var u=Ue({},a,e.attributes||{}),l={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:r,body:{stringValue:e.body},attributes:k(u)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),ct(e.trace_flags)||(l.flags=e.trace_flags),l}(e,this.ha());this.oa.push({record:c}),(null!==(s=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==s?s:100)>this.oa.length?this.ca():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+u+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}},{key:"logger",get:function(){var e=this;return this.da||(this.da={trace:function(t,n){return e.captureLog({body:t,level:"trace",attributes:n})},debug:function(t,n){return e.captureLog({body:t,level:"debug",attributes:n})},info:function(t,n){return e.captureLog({body:t,level:"info",attributes:n})},warn:function(t,n){return e.captureLog({body:t,level:"warn",attributes:n})},error:function(t,n){return e.captureLog({body:t,level:"error",attributes:n})},fatal:function(t,n){return e.captureLog({body:t,level:"fatal",attributes:n})}}),this.da}},{key:"flushLogs",value:function(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),0!==this.oa.length){var t=this.oa;this.oa=[];var n=this._instance.config.logs,i=Ue({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),r=(o=t.map(function(e){return e.record}),a=i,u=ze.LIB_NAME,l=ze.LIB_VERSION,{resourceLogs:[{resource:{attributes:k(a)},scopeLogs:[{scope:{name:u,version:l},logRecords:o}]}]}),s=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:s,data:r,compression:"best-available",batchKey:"logs",transport:e})}var o,a,u,l}},{key:"ca",value:function(){var e,t,n=this;this.qr||(this.qr=setTimeout(function(){n.qr=void 0,n.flushLogs()},null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}},{key:"ha",value:function(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId;t.sessionId=n}if(null!=Ne&&null!=(e=Ne.location)&&e.href&&(t.currentUrl=Ne.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}]),e}()},_u=Ue({},nu,iu,ru,su,ou,au,lu,uu,cu,du,fu,hu);na.__defaultExtensionClasses=Ue({},_u);var pu,vu=($a=Uo[Yo]=new na,function(){function e(){e.done||(e.done=!0,Jo=!1,O(Uo,function(e){e._dom_loaded()}))}null!=Ce&&Ce.addEventListener?"complete"===Ce.readyState?e():R(Ce,"DOMContentLoaded",e,{capture:!1}):$e&&ii.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$a),gu={},yu={type:"posthog",config:{},init:function(e){return _async_to_generator(function(e){var t,n,i,r,s,o,a,u,l;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=pe(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),u=!1,r.init(s,_object_spread_props(_object_spread({},a),{loaded:function(){u=!0}})),u?[3,2]:[4,Promise.resolve()]):[2,!1];case 1:c.sent(),c.label=2;case 2:return l={lastIdentity:{},lastGroup:{}},[2,_object_spread_props(_object_spread({},t),{settings:_object_spread_props(_object_spread({},i),{_state:l})})]}})}).apply(this,arguments)},push:function(e,t){return _async_to_generator(function(e,t){var n,i,r,s,o,a,c,d,f,_,p,v,g,y,m,b,k,w;return _ts_generator(this,function(x){switch(x.label){case 0:return n=t.config,i=t.rule,r=t.env,s=t.data,o=t.collector,d=pe(r),f=n.settings||{},_=(null==i?void 0:i.settings)||{},p=f._state||{},void 0===_.reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3]);case 1:return[4,h(e,_.reset,{collector:o})];case 2:v=x.sent(),x.label=3;case 3:v&&(d.reset(),p.lastIdentity={},p.lastGroup={}),x.label=4;case 4:return void 0===(g=null!==(a=_.identify)&&void 0!==a?a:f.identify)?[3,6]:[4,h(e,g,{collector:o})];case 5:y=x.sent(),u(y)&&(p.lastIdentity=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_object_spread({},n),r=t.distinctId,s=u(t.$set)?t.$set:void 0,o=u(t.$set_once)?t.$set_once:void 0;return l(r)&&""!==r?(r!==n.distinctId||s||o)&&(e.identify(r,s,o),i.distinctId=r):(s||o)&&e.setPersonProperties(s,o),i}(d,y,p.lastIdentity)),x.label=6;case 6:return void 0===(m=null!==(c=_.group)&&void 0!==c?c:f.group)?[3,8]:[4,h(e,m,{collector:o})];case 7:b=x.sent(),u(b)&&(p.lastGroup=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_object_spread({},n),r=t.type,s=t.key,o=u(t.properties)?t.properties:void 0;return l(r)&&l(s)&&(r!==n.type||s!==n.key||o)&&(e.group(r,s,o),i.type=r,i.key=s),i}(d,b,p.lastGroup)),x.label=8;case 8:return!0!==(null==i?void 0:i.silent)&&(k=l(null==i?void 0:i.name)?i.name:e.name,w=u(s)?s:{},d.capture(k,w)),f._state=p,[2]}})}).apply(this,arguments)},on:function(e,t){var n;if("consent"===e&&(null==t?void 0:t.data)){var i=pe(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()}}},mu=yu;return pu=be,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,u=function(){var r=a.value;me.call(e,r)||r===n||ve(e,r,{get:function(){return t[r]},enumerable:!(i=ge(t,r))||i.enumerable})},l=ye(t)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)u()}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}}return e}(ve({},"__esModule",{value:!0}),pu)}();
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),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).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 _construct(e,t,n){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&_set_prototype_of(r,n.prototype),r},_construct.apply(null,arguments)}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 _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}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 _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(n,e)},_wrap_native_super(e)}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:u(0)}),a(o,"throw",{value:u(1)}),a(o,"return",{value:u(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function u(a){return function(u){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,u])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var n=e.destinations[t];if(!n)throw new Error("Destination not found: ".concat(t));return n},n=function(e,t){var n=e.transformers[t];if(!n)throw new Error("Transformer not found: ".concat(t));return n},i=function(e,t){var n=e.sources[t];if(!n)throw new Error("Source not found: ".concat(t));return n},r=function(e,t){var n=e.stores[t];if(!n)throw new Error("Store not found: ".concat(t));return n},s=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(n){switch(n.label){case 0:return[4,e.get(t)];case 1:return[2,n.sent()]}})})()},o=function(e){return Array.isArray(e)},a=function(e){return void 0!==e},u=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!o(e)&&"[object Object]"===Object.prototype.toString.call(e)},l=function(e){return"string"==typeof e},c=function(e){return Pe(e)?e:void 0},d=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]}})})()}},f=function(e,t){return _async_to_generator(function(e){var t,n,i,r,s,u,l,c,f,h,_,p,v,g,y,m=arguments;return _ts_generator(this,function(b){switch(b.label){case 0:if(t=m.length>1&&void 0!==m[1]?m[1]:{},!(n=m.length>2?m[2]:void 0).collector)throw new Error("getMappingValue: context.collector is required");r=n.consent||n.collector.consent,s=null!==(i=n.event)&&void 0!==i?i:{},u={event:s,mapping:t,collector:n.collector,logger:n.collector.logger,consent:r},l=o(t)?t:[t],c=!0,f=!1,h=void 0,b.label=1;case 1:b.trys.push([1,6,7,8]),_=l[Symbol.iterator](),b.label=2;case 2:return(c=(p=_.next()).done)?[3,5]:(v=p.value,[4,d(Oe,function(e){if(_instanceof(e,Fe))throw e;n.collector.status.failed++,u.logger.error("mapping processing failed",{event:s,error:e})})(e,v,_object_spread_props(_object_spread({},u),{mapping:v}))]);case 3:if(g=b.sent(),a(g))return[2,g];b.label=4;case 4:return c=!0,[3,2];case 5:return[3,8];case 6:return y=b.sent(),f=!0,h=y,[3,8];case 7:try{c||null==_.return||_.return()}finally{if(f)throw h}return[7];case 8:return[2]}})}).apply(this,arguments)},h=function(e,t){return _async_to_generator(function(e){var t,n,i,r,s,o,l=arguments;return _ts_generator(this,function(c){return t=l.length>1&&void 0!==l[1]?l[1]:{},n=l.length>2?l[2]:void 0,a(e)?(s=u(e)&&e.consent||(null==n?void 0:n.consent)||(null==n||null===(r=n.collector)||void 0===r?void 0:r.consent),o=null!==(i=null==n?void 0:n.event)&&void 0!==i?i:u(e)?e:{},[2,f(e,t,_object_spread_props(_object_spread({},n),{consent:s,event:o}))]):[2]})}).apply(this,arguments)},_=function(e,t,n,i,r,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(i,r)},p=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){_(s,i,r,o,a,"next",e)}function a(e){_(s,i,r,o,a,"throw",e)}o(void 0)})}},v=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},g=function(e,t){return-1!==e.indexOf(t)},y=function(e){return null===e||"object"!=(void 0===e?"undefined":_type_of(e))},m=function(e,t){return{}.toString.call(e)==="[object "+t+"]"},b=function(e){return"undefined"!=typeof Event&&function(e,t){try{return _instanceof(e,t)}catch(e){return!1}}(e,Event)},k=function(e){var t=[];for(var n in e){var i=e[n];ht(i)||ct(i)||t.push({key:n,value:$n(i)})}return t},w=function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Pt&&n.length===St||(St=n.length,Pt=n.reduce(function(n,i){Et||(Et={});var r=Et[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],u=null==a?void 0:a.filename,l=t[i];if(u&&l){n[u]=l,Et[i]=[u,l];break}}return n},{})),Pt}},x=function(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?Rn:n,in_app:!0};return ct(i)||(s.lineno=i),ct(r)||(s.colno=r),s},E=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""},S=function(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ei.enabled,max_bytes:P(e.max_bytes,ei.max_bytes)}:Ue({},ei)},P=function(e,t){if(!pt(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n},F=function(e,t){ot(e)&&e.forEach(t)},O=function(e,t){if(!_t(e))if(ot(e))e.forEach(t);else if(yt(e))e.forEach(function(e,n){return t(e,n)});else for(var n in e)rt.call(e,n)&&t(e[n],n)},$=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},I=function(e){var t=null==e?void 0:e.hostname;if(!dt(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=yr[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},R=function(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=void 0!==s&&s,a=r.passive,u=void 0===a||a;null==e||e.addEventListener(t,n,{capture:o,passive:u})},M=function(e){return"ph_toolbar_internal"===e.name},C=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,u=n.sendExceptionsToPostHog,l=void 0===u||u;return function(t){var n,o,u,c,d;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var f=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h,_=(null==(n=t.exception)?void 0:n.values)||[],p=_.map(function(e){return Ue({},e,{stacktrace:e.stacktrace?Ue({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return Ue({},e,{platform:"web:javascript"})})}):void 0})}),v={$exception_message:(null==(o=_[0])?void 0:o.value)||t.message,$exception_type:null==(u=_[0])?void 0:u.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=_[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:t.tags};return i&&r&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),l&&(null==(h=e.exceptions)||h.sendExceptionEvent(v)),t}},T=function(e,t,n){if(!Ce)return{};var i,r=t?_to_consumable_array(is).concat(_to_consumable_array(n||[])):[],s=A(es(Ce.URL,r,ss),e),o=(i={},O(os,function(e){var t=Cr.A(e);i[e]=t||null}),i);return _r(o,s)},A=function(e,t){var n=rs.concat(t||[]),i={};return O(n,function(t){var n=Qr(e,t);i[t]=n||null}),i},q=function(e){var t,n=(t=e)?0===t.search(ns+"google.([^/?]*)")?"google":0===t.search(ns+"bing.com")?"bing":0===t.search(ns+"yahoo.com")?"yahoo":0===t.search(ns+"duckduckgo.com")?"duckduckgo":null:null,i="yahoo"!=n?"q":"p",r={};if(!ht(n)){r.$search_engine=n;var s=Ce?Qr(Ce.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},j=function(){return navigator.language||navigator.userLanguage},L=function(){return(null==Ce?void 0:Ce.referrer)||as},D=function(e,t){var n=e?_to_consumable_array(is).concat(_to_consumable_array(t||[])):[],i=null==Te?void 0:Te.href.substring(0,1e3);return{r:L().substring(0,1e3),u:i?es(i,n,ss):void 0}},N=function(e){var t,n=e.r,i=e.u,r={$referrer:n,$referring_domain:null==n?void 0:n==as?as:null==(t=Zr(n))?void 0:t.host};if(i){r.$current_url=i;var s=Zr(i);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var o=A(i);_r(r,o)}if(n){var a=q(n);_r(r,a)}return r},H=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},z=function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},U=function(e,t,n){return co({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})},B=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(ct(s)||ht(s))return!1;var o=[String(s)],a=Io[r.operator];return!!a&&a(r.values,o)})},V=function(e){return _instanceof(e,Element)&&(e.id===Ji||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))},G=function(e){return!!e&&e.nodeType===ia},W=function(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()},K=function(e){return!!e&&e.nodeType===ra},X=function(e){return!!e&&e.nodeType===sa&&G(e.host)},Y=function(e){return e?tt(e).split(/\s+/):[]},J=function(e){var t=null==$e?void 0:$e.location.href;return!!(t&&e&&e.some(function(e){return t.match(e)}))},Z=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 Y(t)},Q=function(e){return _t(e)?null:tt(e).split(/(\s+)/).filter(function(e){return oe(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)},ee=function(e){var t="";return re(e)&&!se(e)&&e.childNodes&&e.childNodes.length&&O(e.childNodes,function(e){var n;K(e)&&e.textContent&&(t+=null!==(n=Q(e.textContent))&&void 0!==n?n:"")}),tt(t)},te=function(e){return ct(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},ne=function(e,t){if(ct(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,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){if(n=i(a.value))return n.v}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return!1},ie=function(e){var t=e.parentNode;return!(!t||!G(t))&&t},re=function(e){for(var t=e;t.parentNode&&!W(t,"body");t=t.parentNode){var n=Z(t);if(g(n,"ph-sensitive")||g(n,"ph-no-capture"))return!1}if(g(Z(e),"ph-include"))return!0;var i=e.type||"";if(dt(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!dt(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,""))},se=function(e){return!!(W(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||W(e,"select")||W(e,"textarea")||"true"===e.getAttribute("contenteditable"))},oe=function(e,t){if(void 0===t&&(t=!0),_t(e))return!1;if(dt(e)){if(e=tt(e),(t?fa:ha).test((e||"").replace(/[- ]/g,"")))return!1;if((t?pa:va).test(e))return!1}return!0},ae=function(e){var t=ee(e);return oe(t=(t+" "+ga(e)).trim())?t:""},ue=function(e){return e.replace(/"|\\"/g,'\\"')},le=function(e){var t=e.attr__class;return t?ot(t)?t:Y(t):void 0},ce=function(e,t){return t.length>e?t.slice(0,e)+"...":t},de=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!G(t));return t},fe=function(e,t,n){try{if(!(t in e))return function(){};var i=e[t],r=n(i);return at(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(){}}},he=function(e){return ut(e)&&"clientX"in e&&"clientY"in e&&pt(e.clientX)&&pt(e.clientY)},_e=function(e,t,n){if(_t(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}},pe=function(e){var t;return null!==(t=null==e?void 0:e.posthog)&&void 0!==t?t:vu},ve=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyNames,me=Object.prototype.hasOwnProperty,be={};!function(e,t){for(var n in t)ve(e,n,{get:t[n],enumerable:!0})}(be,{DestinationPostHog:function(){return gu},default:function(){return mu},destinationPostHog:function(){return yu}});var ke=Object.defineProperty,we=function(e,t){for(var n in t)ke(e,n,{get:t[n],enumerable:!0})};we({},{stepId:function(){return e}});we({},{getDestination:function(){return t}});we({},{Level:function(){return Ee}});var xe,Ee=((xe=Ee||{})[xe.ERROR=0]="ERROR",xe[xe.WARN=1]="WARN",xe[xe.INFO=2]="INFO",xe[xe.DEBUG=3]="DEBUG",xe);we({},{getTransformer:function(){return n}});we({},{getSource:function(){return i}});function Se(e){for(var t=arguments.length>2?arguments[2]:void 0,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),i=e,r=0;r<n.length;r++){var s=n[r];if("*"===s&&o(i)){var l=n.slice(r+1).join("."),c=[],d=!0,f=!1,h=void 0;try{for(var _,p=i[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var v=Se(_.value,l,t);c.push(v)}}catch(e){f=!0,h=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw h}}return c}if(void 0===(i=u(i)||o(i)?i[s]:void 0))break}return a(i)?i:t}function Pe(e){return function(e){return"boolean"==typeof e}(e)||l(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||o(e)&&e.every(Pe)||u(e)&&Object.values(e).every(Pe)}we({},{getStore:function(){return r},getStoreValue:function(){return s}});var Fe=function(){function e(t,n){var i;return _class_call_check(this,e),(i=_call_super(this,e,[t,n])).name="FatalError",Object.setPrototypeOf(i,e.prototype),i}return _inherits(e,_wrap_native_super(Error)),e}();function Oe(e,t,n){return _async_to_generator(function(){return _ts_generator(this,function(i){return[2,(o(t)?t:[t]).reduce(function(t,i){return _async_to_generator(function(){var r,s,u,h,_,p,v,g,y,m,b,k,w,x,E,S,P,F,O,$,I,R,M,C,T;return _ts_generator(this,function(A){switch(A.label){case 0:return[4,t];case 1:return(r=A.sent())?[2,r]:(s=l(i)?{key:i}:i,Object.keys(s).length?(u=s.condition,h=s.consent,_=s.fn,p=s.key,v=s.loop,g=s.map,y=s.set,m=s.validate,b=s.value,k=_object_spread_props(_object_spread({},n),{mapping:i}),(w=u)?[4,d(u,function(e){if(_instanceof(e,Fe))throw e;return k.logger.error("mapping condition failed",{event:k.event,error:e}),!1})(e,k)]:[3,3]):[2]);case 2:w=!A.sent(),A.label=3;case 3:return w?[2]:h&&!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}(h,k.consent)?[2,b]:(x=a(b)?b:e,v?(E=_sliced_to_array(v,2),S=E[0],P=E[1],"this"!==S?[3,4]:(O=[e],[3,6])):[3,10]);case 4:return[4,f(e,S,k)];case 5:O=A.sent(),A.label=6;case 6:return o(F=O)?[4,Promise.all(F.map(function(e){return a(e)?f(e,P,k):void 0}))]:[3,8];case 7:return $=A.sent().filter(a),[3,9];case 8:$=void 0,A.label=9;case 9:return x=$,[3,21];case 10:return g?[4,Object.entries(g).reduce(function(t,n){var i=_sliced_to_array(n,2),r=i[0],s=i[1];return _async_to_generator(function(){var n,i;return _ts_generator(this,function(o){switch(o.label){case 0:return[4,t];case 1:return n=o.sent(),[4,f(e,s,k)];case 2:return i=o.sent(),[2,(a(i)&&(n[r]=i),n)]}})})()},Promise.resolve({}))]:[3,12];case 11:return x=A.sent(),[3,20];case 12:return y?[4,Promise.all(y.map(function(t){return Oe(e,t,k)}))]:[3,14];case 13:return I=x=A.sent(),[3,19];case 14:return p?(R=x=Se(e,p,b),[3,18]):[3,15];case 15:return(M=_)?[4,d(_,function(e){if(_instanceof(e,Fe))throw e;k.logger.error("mapping fn failed",{event:k.event,error:e})})(e,k)]:[3,17];case 16:M=x=A.sent(),A.label=17;case 17:R=M,A.label=18;case 18:I=R,A.label=19;case 19:A.label=20;case 20:A.label=21;case 21:return(C=m)?[4,d(m,function(e){if(_instanceof(e,Fe))throw e;return k.logger.error("mapping validate failed",{event:k.event,error:e}),!1})(x,k)]:[3,23];case 22:C=!A.sent(),A.label=23;case 23:return C&&(x=void 0),T=c(x),[2,a(T)?T:c(b)]}})})()},Promise.resolve(void 0))]})})()}var $e="undefined"!=typeof window?window:void 0,Ie="undefined"!=typeof globalThis?globalThis:$e;"undefined"==typeof self&&(Ie.self=Ie),"undefined"==typeof File&&(Ie.File=function(){});var Re,Me=null==Ie?void 0:Ie.navigator,Ce=null==Ie?void 0:Ie.document,Te=null==Ie?void 0:Ie.location,Ae=null==Ie?void 0:Ie.fetch,qe=null!=Ie&&Ie.XMLHttpRequest&&"withCredentials"in new Ie.XMLHttpRequest?Ie.XMLHttpRequest:void 0,je=null==Ie?void 0:Ie.AbortController,Le=null==Ie?void 0:Ie.CompressionStream,De=null==Me?void 0:Me.userAgent,Ne=null!=$e?$e:{},He="1.376.4",ze={DEBUG:!1,LIB_VERSION:He,LIB_NAME:"web",JS_SDK_VERSION:He};function Ue(){return Ue=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},Ue.apply(null,arguments)}var Be,Ve=((Be={}).GZipJS="gzip-js",Be.Base64="base64",Be),Ge=["$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"],We="NativeGzipValidationError",Ke=function(e){return e.length>=2&&31===e[0]&&139===e[1]},Xe=function(e){return!(!e||"object"!=(void 0===e?"undefined":_type_of(e)))&&"NotReadableError"===("name"in e?String(e.name):"")},Ye=function(e){var t=new Error("Native gzip produced invalid output: "+e);throw t.name=We,t},Je=function(){var e=p(function(e,t){var n,i,r,s,o;return _ts_generator(this,function(a){switch(a.label){case 0:return 18>e.size&&Ye("too-short"),i=Uint8Array.bind,[4,e.slice(0,10).arrayBuffer()];case 1:return n=new(i.apply(Uint8Array,[void 0,a.sent()])),Ke(n)&&8===n[2]||Ye("invalid-header"),s=DataView.bind,[4,e.slice(e.size-8).arrayBuffer()];case 2:return(r=new(s.apply(DataView,[void 0,a.sent()]))).getUint32(0,!0)!==function(e){for(var t=function(){if(Re)return Re;Re=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;Re[e]=t>>>0}return Re}(),n=4294967295,i=0;e.length>i;i++)n=t[255&(n^e[i])]^n>>>8;return(4294967295^n)>>>0}(t)&&Ye("invalid-crc"),o=t.length>>>0,r.getUint32(4,!0)!==o&&Ye("invalid-size"),[2]}})});return function(t,n){return e.apply(this,arguments)}}();function Ze(){return Ze=p(function(e,t,n){var i,r,s,o,a,u,l,c;return _ts_generator(this,function(d){switch(d.label){case 0:void 0===t&&(t=!0),d.label=1;case 1:return d.trys.push([1,4,,5]),i=(new TextEncoder).encode(e),r=new CompressionStream("gzip"),s=r.writable.getWriter(),o=s.write(i).then(function(){return s.close()}).catch((f=p(function(e){return _ts_generator(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,s.abort(e)];case 1:case 2:return t.sent(),[3,3];case 3:throw e}})}),function(e){return f.apply(this,arguments)})),a=new Response(r.readable).blob(),[4,Promise.all([a,o])];case 2:return u=_sliced_to_array.apply(void 0,[d.sent(),1]),l=u[0],[4,Je(l,i)];case 3:return[2,(d.sent(),l)];case 4:if(c=d.sent(),null!=n&&n.rethrow)throw c;return[2,(t&&console.error("Failed to gzip compress data",c),null)];case 5:return[2]}var f})}),Ze.apply(this,arguments)}var Qe=["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"],et=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Qe.concat(t).some(function(e){var t=e.toLowerCase();return-1!==n.indexOf(t)})},tt=function(e){return e.trim()},nt=function(e){return e.replace(/^\$/,"")},it=Object.prototype,rt=it.hasOwnProperty,st=it.toString,ot=Array.isArray||function(e){return"[object Array]"===st.call(e)},at=function(e){return"function"==typeof e},ut=function(e){return e===Object(e)&&!ot(e)},lt=function(e){if(ut(e)){for(var t in e)if(rt.call(e,t))return!1;return!0}return!1},ct=function(e){return void 0===e},dt=function(e){return"[object String]"==st.call(e)},ft=function(e){return dt(e)&&0===e.trim().length},ht=function(e){return null===e},_t=function(e){return ct(e)||ht(e)},pt=function(e){return"[object Number]"==st.call(e)&&e==e},vt=function(e){return pt(e)&&e>0},gt=function(e){return"[object Boolean]"===st.call(e)},yt=function(e){return _instanceof(e,FormData)},mt=function(e){return g(Ge,e)},bt=[!0,"true",1,"1","yes"],kt=function(e){return g(bt,e)},wt=[!1,"false",0,"0","no"];function xt(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),pt(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),xt(r||n,t,n,i))}var Et,St,Pt,Ft,Ot=function(){function e(t){_class_call_check(this,e),this.$t={},this.zt=t.zt,this.Zt=xt(t.bucketSize,0,100,t.Gt),this.Qt=xt(t.refillRate,0,this.Zt,t.Gt),this.Jt=xt(t.refillInterval,0,864e5,t.Gt)}return _create_class(e,[{key:"Kt",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.Jt);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qt,this.Zt),e.lastAccess=e.lastAccess+n*this.Jt)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.$t[i];return r?this.Kt(r,n):this.$t[i]=r={tokens:this.Zt,lastAccess:n},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.zt)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.$t={}}}]),e}(),$t="Mobile",It="iOS",Rt="Android",Mt="Tablet",Ct=Rt+" "+Mt,Tt="iPad",At="Apple",qt=At+" Watch",jt="Safari",Lt="BlackBerry",Dt="Samsung",Nt=Dt+"Browser",Ht=Dt+" Internet",zt="Chrome",Ut=zt+" OS",Bt=zt+" "+It,Vt="Internet Explorer",Gt=Vt+" "+$t,Wt="Opera",Kt=Wt+" Mini",Xt="Edge",Yt="Microsoft "+Xt,Jt="Firefox",Zt=Jt+" "+It,Qt="Nintendo",en="PlayStation",tn="Xbox",nn=Rt+" "+$t,rn=$t+" "+jt,sn="Windows",on=sn+" Phone",an="Nokia",un="Ouya",ln="Generic",cn=ln+" "+$t.toLowerCase(),dn=ln+" "+Mt.toLowerCase(),fn="Konqueror",hn="Oculus Browser",_n="(\\d+(\\.\\d+)?)",pn=new RegExp("Version/"+_n),vn=new RegExp(tn,"i"),gn=new RegExp(en+" \\w+","i"),yn=new RegExp(Qt+" \\w+","i"),mn=new RegExp(Lt+"|PlayBook|BB10","i"),bn={"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"},kn=function(e,t){return t=t||"",g(e," OPR/")&&g(e,"Mini")?Kt:g(e," OPR/")?Wt:mn.test(e)?Lt:g(e,"IE"+$t)||g(e,"WPDesktop")?Gt:g(e,"OculusBrowser")?hn:g(e,Nt)?Ht:g(e,Xt)||g(e,"Edg/")?Yt:g(e,"FBIOS")?"Facebook "+$t:g(e,"UCWEB")||g(e,"UCBrowser")?"UC Browser":g(e,"CriOS")?Bt:g(e,"CrMo")||g(e,zt)?zt:g(e,Rt)&&g(e,jt)?nn:g(e,"FxiOS")?Zt:g(e.toLowerCase(),fn.toLowerCase())?fn:(n=e,(i=t)&&g(i,At)||g(r=n,jt)&&!g(r,zt)&&!g(r,Rt)?g(e,$t)?rn:jt:g(e,Jt)?Jt:g(e,"MSIE")||g(e,"Trident/")?Vt:g(e,"Gecko")?Jt:"");var n,i,r},wn=(_define_property(Ft={},Gt,[new RegExp("rv:"+_n)]),_define_property(Ft,Yt,[new RegExp(Xt+"?\\/"+_n)]),_define_property(Ft,zt,[new RegExp("("+zt+"|CrMo)\\/"+_n)]),_define_property(Ft,Bt,[new RegExp("CriOS\\/"+_n)]),_define_property(Ft,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+_n)]),_define_property(Ft,jt,[pn]),_define_property(Ft,rn,[pn]),_define_property(Ft,Wt,[new RegExp("(Opera|OPR)\\/"+_n)]),_define_property(Ft,Jt,[new RegExp(Jt+"\\/"+_n)]),_define_property(Ft,Zt,[new RegExp("FxiOS\\/"+_n)]),_define_property(Ft,fn,[new RegExp("Konqueror[:/]?"+_n,"i")]),_define_property(Ft,Lt,[new RegExp(Lt+" "+_n),pn]),_define_property(Ft,nn,[new RegExp("android\\s"+_n,"i")]),_define_property(Ft,Ht,[new RegExp(Nt+"\\/"+_n)]),_define_property(Ft,hn,[new RegExp("OculusBrowser\\/"+_n)]),_define_property(Ft,Vt,[new RegExp("(rv:|MSIE )"+_n)]),_define_property(Ft,"Mozilla",[new RegExp("rv:"+_n)]),Ft),xn=function(e,t){var n=kn(e,t),i=wn[n];if(ct(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},En=[[new RegExp(tn+"; "+tn+" (.*?)[);]","i"),function(e){return[tn,e&&e[1]||""]}],[new RegExp(Qt,"i"),[Qt,""]],[new RegExp(en,"i"),[en,""]],[mn,[Lt,""]],[new RegExp(sn,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[on,""];if(new RegExp($t).test(t)&&!/IEMobile\b/.test(t))return[sn+" "+$t,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=bn[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[sn,i]}return[sn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?[It,[e[3],e[4],e[5]||"0"].join(".")]:[It,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=ct(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Rt+")","i"),function(e){return e&&e[2]?[Rt,[e[2],e[3],e[4]||"0"].join(".")]:[Rt,""]}],[/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/,[Ut,""]],[/Linux|debian/i,["Linux",""]]],Sn=function(e){return yn.test(e)?Qt:gn.test(e)?en:vn.test(e)?tn:new RegExp(un,"i").test(e)?un:new RegExp("("+on+"|WPDesktop)","i").test(e)?on:/iPad/.test(e)?Tt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?qt:mn.test(e)?Lt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(an,"i").test(e)?an:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp($t).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Rt:Ct:new RegExp("(pda|"+$t+")","i").test(e)?cn:new RegExp(Mt,"i").test(e)&&!new RegExp(Mt+" pc","i").test(e)?dn:""},Pn=function(e){return _instanceof(e,Error)},Fn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},On=Fn.info;function $n(e){if(gt(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(ot(e))return{arrayValue:{values:e.map(function(e){return $n(e)})}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}var In=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 p(function(){var n,i,r,s,o,a,u,l;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&&ot(a.stacktrace.frames)?(u=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)]):[3,4]);case 3:u.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 l=c.sent(),i=!0,r=l,[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)),Ue({},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 p(function(){var n,i,r,s,o,a,u;return _ts_generator(this,function(l){switch(l.label){case 0:n=e,i=!0,r=!1,s=void 0,l.label=1;case 1:l.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),l.label=2;case 2:return(i=(a=o.next()).done)?[3,5]:[4,(0,a.value)(n)];case 3:n=l.sent(),l.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=l.sent(),r=!0,s=u,[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,Ue({},t,{handled:!0})))),a}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:w(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 Ue({},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}(),Rn="?",Mn=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]:Rn,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Cn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,An=/\((\S*)(?::(\d+))(?::(\d+))\)/,qn=function(e,t){var n=Cn.exec(e);if(n){var i=_sliced_to_array(n,4),r=i[1],s=i[2],o=i[3];return x(t,r,Rn,+s,+o)}var a=Tn.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var u=An.exec(a[2]);u&&(a[2]=u[1],a[3]=u[2],a[4]=u[3])}var l=_sliced_to_array(Mn(a[1]||Rn,a[2]),2),c=l[0],d=l[1];return x(t,d,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},jn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ln=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dn=function(e,t){var n=jn.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=Ln.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]||Rn;return o=(r=_sliced_to_array(Mn(o,s),2))[0],s=r[1],x(t,s,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Nn=/\(error: (.*)\)/,Hn=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=dt(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 m(e,"DOMException")}},{key:"isDOMError",value:function(e){return m(e,"DOMError")}}]),e}(),zn=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}(),Un=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return m(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,Vn=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}(),Gn=["fatal","error","warning","log","info","debug"],Wn=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 b(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: "+E(e)}},{key:"isSeverityLevel",value:function(e){return dt(e)&&!ft(e)&&Gn.indexOf(e)>=0}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(Pn(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}(),Kn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return b(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+E(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),Xn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return y(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}(),Yn=function(){function e(){_class_call_check(this,e)}return _create_class(e,[{key:"match",value:function(e){return m(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!b(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 y(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}(),Jn="$message",Zn="$timestamp",Qn=new Set([Jn,Zn]),ei={enabled:!0,max_bytes:32768},ti=function(){function e(t){_class_call_check(this,e),this.Yt=[],this.Xt=0,this.qt=S(t)}return _create_class(e,[{key:"setConfig",value:function(e){this.qt=S(e),this.er()}},{key:"add",value:function(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,function(e,n){if("bigint"==(void 0===n?"undefined":_type_of(n)))return n.toString();if("function"!=typeof n&&"symbol"!=(void 0===n?"undefined":_type_of(n))){if(_instanceof(n,Date))return n.toISOString();if(_instanceof(n,Error))return{name:n.name,message:n.message,stack:n.stack};if(n&&"object"==(void 0===n?"undefined":_type_of(n))){if(t.has(n))return"[Circular]";t.add(n)}return n}})}catch(e){return}}(e);if(t)try{var n=JSON.parse(t);if(!ut(n))return;var i=n,r=i[Jn],s=i[Zn];if(!dt(r)||0===r.trim().length)return;if(!dt(s)&&!pt(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var n=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),n=0,i=0;t.length>i;i++)"%"===t[i]?(n+=1,i+=2):n+=1;return n}(t.json);n>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:n}),this.Xt+=n,this.er())}}},{key:"getAttachable",value:function(){return this.Yt.map(function(e){return e.step})}},{key:"clear",value:function(){this.Yt=[],this.Xt=0}},{key:"size",value:function(){return this.Yt.length}},{key:"er",value:function(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}]),e}(),ni=function(e,t){var n=(void 0===t?{}:t).debugEnabled,i={k:function(t){if($e&&(ze.DEBUG||Ne.POSTHOG_DEBUG||n)&&!ct($e.console)&&$e.console){for(var i=("__rrweb_original__"in $e.console[t]?$e.console[t].__rrweb_original__:$e.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)))}},debug:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).k.apply(e,["debug"].concat(_to_consumable_array(n)))},info:function(){for(var e,t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];(e=i).k.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).k.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).k.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 ni(e+" "+t,n)}};return i},ii=ni("[PostHog.js]"),ri=ii.createLogger,si=ri("[ExternalScriptsLoader]"),oi=function(e,t,n){if(e.config.disable_external_dependency_loading)return si.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==Ce?void 0:Ce.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(!Ce)return n("document not found");var i=Ce.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)Ce.head.appendChild(i);else{var r,s=Ce.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):Ce.body.appendChild(i)}};null!=Ce&&Ce.body?a():null==Ce||Ce.addEventListener("DOMContentLoaded",a)};Ne.__PosthogExtensions__=Ne.__PosthogExtensions__||{},Ne.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"!==t){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}i=e.requestRouter.endpointFor("assets",r)}oi(e,i,n)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");oi(e,o,n)}},Ne.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);oi(e,i,n)};var ai="$people_distinct_id",ui="$device_id",li="__alias",ci="__timers",di="$autocapture_disabled_server_side",fi="$heatmaps_enabled_server_side",hi="$exception_capture_enabled_server_side",_i="$error_tracking_suppression_rules",pi="$error_tracking_capture_extension_exceptions",vi="$web_vitals_enabled_server_side",gi="$dead_clicks_enabled_server_side",yi="$product_tours_enabled_server_side",mi="$web_vitals_allowed_metrics",bi="$session_recording_remote_config",ki="$replay_override_sampling",wi="$replay_override_linked_flag",xi="$replay_override_url_trigger",Ei="$replay_override_event_trigger",Si="$sesid",Pi="$session_is_sampled",Fi="$enabled_feature_flags",Oi="$active_feature_flags",$i="$early_access_features",Ii="$feature_flag_details",Ri="$feature_flag_payloads",Mi="$feature_flag_request_id",Ci="$override_feature_flags",Ti="$override_feature_flag_payloads",Ai="$stored_person_properties",qi="$stored_group_properties",ji="$surveys",Li="$surveys_activated",Di="ph_product_tours",Ni="$flag_call_reported",Hi="$flag_call_reported_session_id",zi="$feature_flag_errors",Ui="$feature_flag_evaluated_at",Bi="$user_state",Vi="$client_session_props",Gi="$capture_rate_limit",Wi="$initial_campaign_params",Ki="$initial_referrer_info",Xi="$initial_person_info",Yi="$epp",Ji="__POSTHOG_TOOLBAR__",Zi="$posthog_cookieless",Qi="$sdk_debug_extensions_init_method",er="$sdk_debug_extensions_init_time_ms",tr="$sdk_debug_recording_script_not_loaded",nr="PostHog loadExternalDependency extension not found.",ir="on_reject",rr="always",sr="anonymous",or="identified",ar="identified_only",ur="visibilitychange",lr="beforeunload",cr="$pageview",dr="$pageleave",fr="$identify",hr="$groupidentify",_r=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,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;for(var c in l)void 0!==l[c]&&(e[c]=l[c])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return e},pr=function(e){try{return e()}catch(e){return}},vr=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){ii.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ii.critical(e)}}},gr=function(e){var t={};return O(e,function(e,n){(dt(e)&&e.length>0||pt(e))&&(t[n]=e)}),t},yr=["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 pt(e)&&isFinite(e)&&Math.floor(e)===e});var mr,br=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}(),kr=function(){function e(){_class_call_check(this,e),this.S=0,this.C=0,this.I=new Or}return _create_class(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(ct(e)){this.S=0;var t=this.generateOrAbort();if(ct(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.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return br.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}},{key:"T",value:function(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}]),e}(),wr=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};$e&&!ct($e.crypto)&&crypto.getRandomValues&&(wr=function(e){return crypto.getRandomValues(e)});var xr,Er,Sr,Pr,Fr,Or=function(){function e(){_class_call_check(this,e),this.M=new Uint32Array(8),this.O=1/0}return _create_class(e,[{key:"nextUint32",value:function(){return this.M.length>this.O||(wr(this.M),this.O=0),this.M[this.O++]}}]),e}(),$r=function(){return Ir().toString()},Ir=function(){return(mr||(mr=new kr)).generate()},Rr="",Mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Cr={R:function(){return!!Ce},D:function(e){ii.error("cookieStore error: "+e)},A:function(e){if(Ce){try{for(var t=e+"=",n=Ce.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}},F:function(e){var t;try{t=JSON.parse(Cr.A(e))||{}}catch(e){}return t},N:function(e,t,n,i,r){if(Ce)try{var s="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=Ce),Rr)return Rr;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_"+$r();!Rr&&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",Rr=s)}return Rr}(e);if(!n){var i=(r=e.match(Mr))?r[0]:"";i!==n&&ii.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}var r;return""}(Ce.location.hostname,i);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(o="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&ii.warn("cookieStore warning: large cookie, len="+l.length),Ce.cookie=l,l}catch(e){return}},q:function(e,t){if(null!=Ce&&Ce.cookie)try{Cr.N(e,"",-1,t)}catch(e){return}}},Tr=null,Ar={R:function(){if(!ht(Tr))return Tr;var e=!0;if(ct($e))e=!1;else try{var t="__mplssupport__";Ar.N(t,"xyz"),'"xyz"'!==Ar.A(t)&&(e=!1),Ar.q(t)}catch(t){e=!1}return e||ii.error("localStorage unsupported; falling back to cookie store"),Tr=e,e},D:function(e){ii.error("localStorage error: "+e)},A:function(e){try{return null==$e?void 0:$e.localStorage.getItem(e)}catch(e){Ar.D(e)}return null},F:function(e){try{return JSON.parse(Ar.A(e))||{}}catch(e){}return null},N:function(e,t){try{null==$e||$e.localStorage.setItem(e,JSON.stringify(t))}catch(e){Ar.D(e)}},q:function(e){try{null==$e||$e.localStorage.removeItem(e)}catch(e){Ar.D(e)}}},qr=[ui,"distinct_id",Si,Pi,Yi,Xi,Bi],jr={},Lr={R:function(){return!0},D:function(e){ii.error("memoryStorage error: "+e)},A:function(e){return jr[e]||null},F:function(e){return jr[e]||null},N:function(e,t){jr[e]=t},q:function(e){delete jr[e]}},Dr=null,Nr={R:function(){if(!ht(Dr))return Dr;if(Dr=!0,ct($e))Dr=!1;else try{var e="__support__";Nr.N(e,"xyz"),'"xyz"'!==Nr.A(e)&&(Dr=!1),Nr.q(e)}catch(e){Dr=!1}return Dr},D:function(e){ii.error("sessionStorage error: ",e)},A:function(e){try{return null==$e?void 0:$e.sessionStorage.getItem(e)}catch(e){Nr.D(e)}return null},F:function(e){try{return JSON.parse(Nr.A(e))||null}catch(e){}return null},N:function(e,t){try{null==$e||$e.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Nr.D(e)}},q:function(e){try{null==$e||$e.sessionStorage.removeItem(e)}catch(e){Nr.D(e)}}},Hr=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.rr()?0:this.ir}},{key:"isOptedOut",value:function(){return this.qt.cookieless_mode===rr||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===ir}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"isRejected",value:function(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}},{key:"optInOut",value:function(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}},{key:"reset",value:function(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}},{key:"sr",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:"ir",get:function(){var e=this.nr.A(this.sr);return kt(e)?1:g(wt,e)?0:-1}},{key:"nr",get:function(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?Ar:Cr;if(!this.ar||this.ar!==t){this.ar=t;var n="localStorage"===e?Cr:Ar;n.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(kt(n.A(this.sr))),n.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}},{key:"rr",value:function(){return!!this.qt.respect_dnt&&[null==Me?void 0:Me.doNotTrack,null==Me?void 0:Me.msDoNotTrack,Ne.doNotTrack].some(function(e){return kt(e)})}}]),e}(),zr=ri("[Dead Clicks]"),Ur=function(){return!0},Br=function(e){var t,n=!(null==(t=e.instance.persistence)||!t.get_property(gi)),i=e.instance.config.capture_dead_clicks;return gt(i)?i:!!ut(i)||n},Vr=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.ur}},{key:"onRemoteConfig",value:function(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register(_define_property({},gi,e.captureDeadClicks)),this.startIfEnabledOrStop())}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.lr(function(){e.hr()}):this.stop()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",function(t){t?zr.error("failed to load script",t):e()})}},{key:"hr",value:function(){var e;if(Ce){if(!this.ur&&null!=(e=Ne.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ut(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=Ne.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(Ce),zr.info("starting...")}}else zr.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.ur&&(this.ur.stop(),this.ur=void 0,zr.info("stopping..."))}}]),e}(),Gr=ri("[SegmentIntegration]"),Wr="posthog-js",Kr=function e(t,n,i,r,s,o){_class_call_check(this,e),this.name=Wr,this.setupOnce=function(e){e(C(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},Xr=function(){function e(t){var n=this;_class_call_check(this,e),this.cr=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(ii.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.dr=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.vr()}return _create_class(e,[{key:"vr",value:function(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}},{key:"destroy",value:function(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.gr(e,t);return this.dr={pathname:null!==(n=null==$e?void 0:$e.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}},{key:"gr",value:function(e,t){var n=this.dr;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,u=r.maxContentHeight,l=r.lastContentY,c=r.maxContentY;if(!(ct(s)||ct(o)||ct(a)||ct(u)||ct(l)||ct(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c);var d=s>1?xt(o/s,0,1,ii):1,f=s>1?xt(a/s,0,1,ii):1,h=u>1?xt(l/u,0,1,ii):1,_=u>1?xt(c/u,0,1,ii):1;i=_r(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),Yr=(_define_property(xr={},ai,{exposure:"hidden"}),_define_property(xr,li,{exposure:"hidden"}),_define_property(xr,"__cmpns",{exposure:"hidden"}),_define_property(xr,ci,{exposure:"hidden"}),_define_property(xr,di,{exposure:"event"}),_define_property(xr,fi,{exposure:"hidden"}),_define_property(xr,hi,{exposure:"event"}),_define_property(xr,_i,{exposure:"hidden"}),_define_property(xr,pi,{exposure:"event"}),_define_property(xr,vi,{exposure:"event"}),_define_property(xr,gi,{exposure:"event"}),_define_property(xr,yi,{exposure:"hidden"}),_define_property(xr,mi,{exposure:"event"}),_define_property(xr,bi,{exposure:"hidden"}),_define_property(xr,"$session_recording_enabled_server_side",{exposure:"hidden"}),_define_property(xr,Si,{exposure:"hidden"}),_define_property(xr,Pi,{exposure:"event"}),_define_property(xr,"$session_past_minimum_duration",{exposure:"event"}),_define_property(xr,"$session_recording_url_trigger_activated_session",{exposure:"event"}),_define_property(xr,"$session_recording_event_trigger_activated_session",{exposure:"event"}),_define_property(xr,"$debug_first_full_snapshot_timestamp",{exposure:"event"}),_define_property(xr,Fi,{exposure:"derived",shouldSkipFromEventProperties:function(e,t){return t()},transformToEventProperties:function(e){if(!ut(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}}),_define_property(xr,Oi,{exposure:"event"}),_define_property(xr,$i,{exposure:"hidden"}),_define_property(xr,Ii,{exposure:"hidden"}),_define_property(xr,Ri,{exposure:"event"}),_define_property(xr,Mi,{exposure:"event"}),_define_property(xr,Ci,{exposure:"event"}),_define_property(xr,Ti,{exposure:"hidden"}),_define_property(xr,Ai,{exposure:"hidden"}),_define_property(xr,qi,{exposure:"hidden"}),_define_property(xr,ji,{exposure:"hidden"}),_define_property(xr,Li,{exposure:"event"}),_define_property(xr,Di,{exposure:"hidden"}),_define_property(xr,"$product_tours_activated",{exposure:"hidden"}),_define_property(xr,"$conversations_widget_session_id",{exposure:"event"}),_define_property(xr,"$conversations_ticket_id",{exposure:"event"}),_define_property(xr,"$conversations_widget_state",{exposure:"event"}),_define_property(xr,"$conversations_user_traits",{exposure:"event"}),_define_property(xr,Ni,{exposure:"hidden"}),_define_property(xr,Hi,{exposure:"hidden"}),_define_property(xr,zi,{exposure:"hidden"}),_define_property(xr,Ui,{exposure:"hidden"}),_define_property(xr,Bi,{exposure:"hidden"}),_define_property(xr,Vi,{exposure:"hidden"}),_define_property(xr,Gi,{exposure:"hidden"}),_define_property(xr,Wi,{exposure:"hidden"}),_define_property(xr,Ki,{exposure:"hidden"}),_define_property(xr,Xi,{exposure:"hidden"}),_define_property(xr,Yi,{exposure:"hidden"}),_define_property(xr,ki,{exposure:"event"}),_define_property(xr,wi,{exposure:"event"}),_define_property(xr,xi,{exposure:"event"}),_define_property(xr,Ei,{exposure:"event"}),_define_property(xr,Qi,{exposure:"event"}),_define_property(xr,er,{exposure:"event"}),_define_property(xr,tr,{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_event_trigger_status",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_linked_flag_trigger_status",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_matched_recording_trigger_groups",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_remote_trigger_matching_config",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_trigger_groups_count",{exposure:"event"}),_define_property(xr,"$sdk_debug_replay_url_trigger_status",{exposure:"event"}),_define_property(xr,"$session_recording_start_reason",{exposure:"event"}),xr),Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Zr=function(e){var t=null==Ce?void 0:Ce.createElement("a");return ct(t)?null:(t.href=e,t)},Qr=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(!ot(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){ii.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},es=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],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var d=u[c].split("=");ot(d)&&(t.includes(d[0])?l.push(d[0]+"="+n):l.push(u[c]))}var f=a;return null!=o&&(f+="?"+l.join("&")),null!=r&&(f+="#"+r),f},ts=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ns="https?://(.*)",is=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat(_to_consumable_array(is)),ss="<masked>",os=["li_fat_id"],as="$direct",us=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ls=function(){function e(t,n){var i,r;_class_call_check(this,e),this.qt=t,this.props={},this.mr=!1,this.yr=(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.nr=this.br(t),this.load(),t.debug&&ii.info("Persistence loaded",t.persistence,Ue({},this.props)),this.update_config(t,t,n),this.save()}return _create_class(e,[{key:"isDisabled",value:function(){return!!this._r}},{key:"br",value:function(e){-1===us.indexOf(e.persistence.toLowerCase())&&(ii.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(qr).concat(_to_consumable_array(e));return Ue({},Ar,{F:function(e){try{var t={};try{t=Cr.F(e)||{}}catch(e){}var n=_r(t,JSON.parse(Ar.A(e)||"{}"));return Ar.N(e,n),n}catch(e){}return null},N:function(e,n,i,r,s,o){try{Ar.N(e,n,void 0,void 0,o);var a={};t.forEach(function(e){n[e]&&(a[e]=n[e])}),Object.keys(a).length&&Cr.N(e,a,i,r,s,o)}catch(e){Ar.D(e)}},q:function(e,t){try{null==$e||$e.localStorage.removeItem(e),Cr.q(e,t)}catch(e){Ar.D(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&Ar.R()?Ar:"localstorage+cookie"===n&&t.R()?t:"sessionstorage"===n&&Nr.R()?Nr:"memory"===n?Lr:"cookie"===n?Cr:t.R()?t:Cr}},{key:"wr",value:function(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[Ui];return!n||"number"!=typeof n||Date.now()-n>t}},{key:"properties",value:function(){var e=this,t={};return O(this.props,function(n,i){var r=function(e){var t=Yr[e];if(t)return t;var n=!0,i=!1,r=void 0;try{for(var s,o=Jr[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];if(0===e.indexOf(u))return l}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(n,i===Fi?function(){return e.wr()}:function(){return!1}))return;r.transformToEventProperties&&_r(t,r.transformToEventProperties(n))}else r&&"event"!==r.exposure||(t[i]=n)}),t}},{key:"load",value:function(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=_r({},e))}}},{key:"save",value:function(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}},{key:"remove",value:function(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(ut(e)){ct(t)&&(t="None"),this.Sr=ct(n)?this.Ir:n;var r=!1;if(O(e,function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i.Tr(n,e),r=!0)}),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(ut(e)){this.Sr=ct(t)?this.Ir:t;var i=!1;if(O(e,function(t,r){e.hasOwnProperty(r)&&n.props[r]!==t&&(n.Tr(r,t),i=!0)}),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(this.Er(e),this.save())}},{key:"update_campaign_params",value:function(){if(!this.mr){var e=T(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);lt(gr(e))||this.register(e),this.mr=!0}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==Ce?void 0:Ce.referrer)?q(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:L(),$referring_domain:null!=Ce&&Ce.referrer&&(null==(e=Zr(Ce.referrer))?void 0:e.host)||as},void 0)}},{key:"set_initial_person_info",value:function(){this.props[Wi]||this.props[Ki]||this.register_once(_define_property({},Xi,D(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)),void 0)}},{key:"get_initial_props",value:function(){var e=this,t={};O([Ki,Wi],function(n){var i=e.props[n];i&&O(i,function(e,n){t["$initial_"+nt(n)]=e})});var n,i,r=this.props[Xi];if(r){var s=(n=N(r),i={},O(n,function(e,t){i["$initial_"+nt(t)]=e}),i);_r(t,s)}return t}},{key:"safe_merge",value:function(e){return O(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){if(this.Ir=this.Sr=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.br(e),r=this.props;this.clear(),this.nr=i,this.props=r,this.save()}}},{key:"set_disabled",value:function(e){this._r=e,this._r?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}},{key:"set_secure",value:function(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[ci]||{};n[e]=t,this.Tr(ci,n),this.save()}},{key:"remove_event_timer",value:function(e){var t=this.props[ci]||{},n=t[e];return ct(n)||(delete t[e],this.Tr(ci,t),this.save()),n}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this.Tr(e,t),this.save()}},{key:"Tr",value:function(e,t){this.props[e]=t}},{key:"Er",value:function(e){delete this.props[e]}}]),e}(),cs="events",ds="cancelEvents",fs="popover",hs="api",_s="widget",ps="survey shown",vs="survey dismissed",gs="survey sent",ys="$survey_id",ms="$survey_iteration",bs="$survey_last_seen_date",ks="popover",ws="inline",xs="product tour shown",Es="$product_tour_last_seen_date",Ss="$product_tour_type",Ps=ri("[RateLimiter]"),Fs=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){Ps.info((e||"events")+" is quota limited."),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ps.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(Gi))&&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 u=1>a.tokens;return u||e||(a.tokens=Math.max(0,a.tokens-1)),!u||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=u,null==(i=this.instance.persistence)||i.set_property(Gi,a),{isRateLimited:u,remainingTokens:a.tokens}}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Os=ri("[RemoteConfig]"),$s=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=Ne._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Mr",value:function(e){var t,n,i=this;null!=(t=Ne.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",function(){return e(i.remoteConfig)}):e()}},{key:"Pr",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 Os.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void Os.warn("Remote config is disabled. Falling back to local config.");this.Mr(function(t){if(!t)return Os.info("No config found after loading remote JS config. Falling back to JSON."),void e.Pr(function(t){e.Rr(t),e.Or()});e.Rr(t),e.Or()})}catch(e){Os.error("Error loading remote config",e)}}},{key:"stop",value:function(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}},{key:"refresh",value:function(){!this._instance.Lr()&&Ce&&"hidden"!==Ce.visibilityState&&this._instance.reloadFeatureFlags()}},{key:"Or",value:function(){var e,t=this;if(!this.Fr){var n=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==n&&(this.Fr=setInterval(function(){t.refresh()},n))}}},{key:"Rr",value:function(e){var t;e||Os.error("Failed to fetch remote config from PostHog."),this._instance.Rr(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}(),Is="gzip-js",Rs="base64",Ms=Uint8Array,Cs=Uint16Array,Ts=Uint32Array,As=new Ms([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]),qs=new Ms([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]),js=new Ms([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(e,t){for(var n=new Cs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new Ts(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]},Ds=Ls(As,2),Ns=Ds[1];for(Ds[0][28]=258,Ns[258]=28,Sr=Ls(qs,0)[1],Pr=new Cs(32768),Fr=0;32768>Fr;++Fr)Er=(43690&Fr)>>>1|(21845&Fr)<<1,Pr[Fr]=((65280&(Er=(61680&(Er=(52428&Er)>>>2|(13107&Er)<<2))>>>4|(3855&Er)<<4))>>>8|(255&Er)<<8)>>>1;var Hs=function(e,t,n){for(var i=e.length,r=0,s=new Cs(t);i>r;++r)++s[e[r]-1];var o,a=new Cs(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Cs(1<<t);var u=15-t;for(r=0;i>r;++r)if(e[r])for(var l=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,f=d|(1<<c)-1;f>=d;++d)o[Pr[d]>>>u]=l}else for(o=new Cs(i),r=0;i>r;++r)o[r]=Pr[a[e[r]-1]++]>>>15-e[r];return o},zs=new Ms(288);for(Fr=0;144>Fr;++Fr)zs[Fr]=8;for(Fr=144;256>Fr;++Fr)zs[Fr]=9;for(Fr=256;280>Fr;++Fr)zs[Fr]=7;for(Fr=280;288>Fr;++Fr)zs[Fr]=8;var Us=new Ms(32);for(Fr=0;32>Fr;++Fr)Us[Fr]=5;var Bs=Hs(zs,9,0),Vs=Hs(Us,5,0),Gs=function(e){return(e/8|0)+(7&e&&1)},Ws=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(_instanceof(e,Cs)?Cs:_instanceof(e,Ts)?Ts:Ms)(n-t);return i.set(e.subarray(t,n)),i},Ks=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Xs=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ys=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 Ms(0),0];if(1==r){var o=new Ms(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],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=r-1;)a=n[n[d].f>n[l].f?l++:d++],u=n[l!=c&&n[d].f>n[l].f?l++:d++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var f=s[0].s;for(i=1;r>i;++i)s[i].s>f&&(f=s[i].s);var h=new Cs(f+1),_=Js(n[c-1],h,0);if(_>t){i=0;var p=0,v=_-t,g=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=h[y])break;p+=g-(1<<_-h[y]),h[y]=t}for(p>>>=v;p>0;){var m=s[i].s;t>h[m]?p-=1<<t-h[m]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;h[b]==t&&(--h[b],++p)}_=t}return[new Ms(h),_]},Js=function(e,t,n){return-1==e.s?Math.max(Js(e.l,t,n+1),Js(e.r,t,n+1)):t[e.s]=n},Zs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Cs(++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]},Qs=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},eo=function(e,t,n){var i=n.length,r=Gs(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)},to=function(e,t,n,i,r,s,o,a,u,l,c){Ks(t,c++,n),++r[256];for(var d=Ys(r,15),f=d[0],h=d[1],_=Ys(s,15),p=_[0],v=_[1],g=Zs(f),y=g[0],m=g[1],b=Zs(p),k=b[0],w=b[1],x=new Cs(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=Ys(x,7),P=S[0],F=S[1],O=19;O>4&&!P[js[O-1]];--O);var $,I,R,M,C=l+5<<3,T=Qs(r,zs)+Qs(s,Us)+o,A=Qs(r,f)+Qs(s,p)+o+14+3*O+Qs(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(T>=C&&A>=C)return eo(t,c,e.subarray(u,u+l));if(Ks(t,c,1+(T>A)),c+=2,T>A){$=Hs(f,h,0),I=f,R=Hs(p,v,0),M=p;var q=Hs(P,F,0);for(Ks(t,c,m-257),Ks(t,c+5,w-1),Ks(t,c+10,O-4),c+=14,E=0;O>E;++E)Ks(t,c+3*E,P[js[E]]);c+=3*O;for(var j=[y,k],L=0;2>L;++L){var D=j[L];for(E=0;D.length>E;++E)Ks(t,c,q[N=31&D[E]]),c+=P[N],N>15&&(Ks(t,c,D[E]>>>5&127),c+=D[E]>>>12)}}else $=Bs,I=zs,R=Vs,M=Us;for(E=0;a>E;++E)if(i[E]>255){var N;Xs(t,c,$[257+(N=i[E]>>>18&31)]),c+=I[N+257],N>7&&(Ks(t,c,i[E]>>>23&31),c+=As[N]);var H=31&i[E];Xs(t,c,R[H]),c+=M[H],H>3&&(Xs(t,c,i[E]>>>5&8191),c+=qs[H])}else Xs(t,c,$[i[E]]),c+=I[i[E]];return Xs(t,c,$[256]),c+I[256]},no=new Ts([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),io=function(){for(var e=new Ts(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),ro=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},so=!!qe||!!Ae,oo="text/plain",ao=!1,uo=function(e,t){var n=_sliced_to_array(e.split("#"),2),i=n[0],r=n[1],s=_sliced_to_array(i.split("?"),2),o=s[0],a=s[1];if(!a)return e;var u=a.split("&").filter(function(e){return e.split("=")[0]!==t}).join("&");return o+(u?"?"+u:"")+(r?"#"+r:"")},lo=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=Ue({},t),u=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:[],l=function(e,t){var n,i;void 0===t&&(t="&");var r=[];return O(e,function(e,t){ct(e)||ct(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 l&&u.push(l),s+"?"+u.join("&")},co=function(e,t){return JSON.stringify(e,function(e,t){return"bigint"==(void 0===t?"undefined":_type_of(t))?t.toString():t},t)},fo=function(e){if(e.tr)return e.tr;var t,n=e.data,i=e.compression;if(n){if(i===Is){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=io[255&t^e[i]]^t>>>8;n=t},d:function(){return 4294967295^n}}),r=e.length;i.p(e);var s,o,a,u,l=(u=10+((s=t).filename&&s.filename.length+1||0),function(e,t,n,i){var r=e.length,s=new Ms(i+r+5*(1+Math.floor(r/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>r)for(var u=0;r>=u;u+=65535){var l=u+65535;r>l?a=eo(o,a,e.subarray(u,l)):(o[u]=!0,a=eo(o,a,e.subarray(u,r)))}else{for(var c=no[t-1],d=c>>>13,f=8191&c,h=(1<<n)-1,_=new Cs(32768),p=new Cs(h+1),v=Math.ceil(n/3),g=2*v,y=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<g)&h},m=new Ts(25e3),b=new Cs(288),k=new Cs(32),w=0,x=0,E=(u=0,0),S=0,P=0;r>u;++u){var F=y(u),O=32767&u,$=p[F];if(_[O]=$,p[F]=O,u>=S){var I=r-u;if((w>7e3||E>24576)&&I>423){a=to(e,o,0,m,b,k,x,E,P,u-P,a),E=w=x=0,P=u;for(var R=0;286>R;++R)b[R]=0;for(R=0;30>R;++R)k[R]=0}var M=2,C=0,T=f,A=O-$&32767;if(I>2&&F==y(u-A))for(var q=Math.min(d,I)-1,j=Math.min(32767,u),L=Math.min(258,I);j>=A&&--T&&O!=$;){if(e[u+M]==e[u+M-A]){for(var D=0;L>D&&e[u+D]==e[u+D-A];++D);if(D>M){if(M=D,C=A,D>q)break;var N=Math.min(A,D-2),H=0;for(R=0;N>R;++R){var z=u-A+R+32768&32767,U=z-_[z]+32768&32767;U>H&&(H=U,$=z)}}}A+=(O=$)-($=_[O])+32768&32767}if(C){m[E++]=268435456|Ns[M]<<18|Sr[C];var B=31&Ns[M],V=31&Sr[C];x+=As[B]+qs[V],++b[257+B],++k[V],S=u+M,++w}else m[E++]=e[u],++b[e[u]]}}a=to(e,o,!0,m,b,k,x,E,P,u-P,a)}return Ws(s,0,i+Gs(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,u)),c=l.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&&ro(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)}}(l,t),ro(l,c-8,i.d()),ro(l,c-4,r),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Ms(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 Ms(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 Ws(n,0,i)}(co(n)),{mtime:0});return{contentType:oo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Rs){var s=function(e){return"data="+encodeURIComponent("string"==typeof e?e:co(e))}((t=co(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=co(n);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ho=function(e){var t,n,i,r=fo(e);return!r||(n=e.compression,i=Qr(e.url,"compression"),n!==Ve.GZipJS&&i!==Ve.GZipJS&&"gzip"!==i)||(_instanceof(t=r.body,ArrayBuffer)?Ke(new Uint8Array(t)):ArrayBuffer.isView(t)&&Ke(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:r}:(ao=!0,{url:uo(e.url,"compression"),encodedBody:fo(Ue({},e,{compression:void 0,tr:void 0}))})},_o=function(){var e=p(function(e){var t,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,function(e,t,n){return Ze.apply(this,arguments)}(co(e.data),ze.DEBUG,{rethrow:!0})];case 1:return(t=i.sent())?[4,t.arrayBuffer()]:[2,e];case 2:return n=i.sent(),[2,Ue({},e,{tr:{contentType:oo,body:n,estimatedSize:n.byteLength}})]}})});return function(t){return e.apply(this,arguments)}}(),po=function(e,t){return lo(e,{_:(new Date).getTime().toString(),ver:ze.JS_SDK_VERSION,compression:t})},vo=[];Ae&&vo.push({transport:"fetch",method:function(e){var t,n=ho(e),i=n.url,r=n.encodedBody,s=null!=r?r:{},o=s.contentType,a=s.body,u=s.estimatedSize,l=new Headers;O(e.headers,function(e,t){l.append(t,e)}),o&&l.append("Content-Type",o);var c=null;if(je){var d=new je;c={signal:d.signal,timeout:setTimeout(function(){return d.abort()},e.timeout)}}Ae(i,Ue({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(u||0),body:a,signal:null==(t=c)?void 0:t.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){ii.error(e)}null==e.callback||e.callback(i)})}).catch(function(t){ii.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(function(){return c?clearTimeout(c.timeout):null})}}),qe&&vo.push({transport:"XHR",method:function(e){var t=new qe,n=ho(e),i=n.url,r=n.encodedBody;t.open(e.method||"GET",i,!0);var s=null!=r?r:{},o=s.contentType,a=s.body;O(e.headers,function(e,n){t.setRequestHeader(n,e)}),o&&t.setRequestHeader("Content-Type",o),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=function(){if(4===t.readyState){var n={statusCode:t.status,text:t.responseText};if(200===t.status)try{n.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(n)}},t.send(a)}}),null!=Me&&Me.sendBeacon&&vo.push({transport:"sendBeacon",method:function(e){try{var t=ho(e),n=t.url,i=t.encodedBody,r=lo(n,{beacon:"1"}),s=null!=i?i:{},o=s.contentType,a=s.body;if(!a)return;var u=_instanceof(a,Blob)?a:new Blob([a],{type:o});Me.sendBeacon(r,u)}catch(e){}}});var go,yo=3e3,mo=function(){function e(t,n){_class_call_check(this,e),this.Ar=!0,this.Nr=[],this.$r=xt((null==n?void 0:n.flush_interval_ms)||yo,250,5e3,ii.createLogger("flush interval"),yo),this.Dr=t}return _create_class(e,[{key:"enqueue",value:function(e){this.Nr.push(e),this.qr||this.jr()}},{key:"unload",value:function(){var e=this;this.Hr();var t=this.Nr.length>0?this.Ur():{},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.Dr(Ue({},t,{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.Ar=!1,this.jr()}},{key:"jr",value:function(){var e=this,t=this;this.Ar||(this.qr=setTimeout(function(){if(e.Hr(),e.Nr.length>0){var n=e.Ur(),i=function(){var e=n[r],i=(new Date).getTime();e.data&&ot(e.data)&&O(e.data,function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),t.Dr(e)};for(var r in n)i()}},this.$r))}},{key:"Hr",value:function(){clearTimeout(this.qr),this.qr=void 0}},{key:"Ur",value:function(){var e={};return O(this.Nr,function(t){var n,i=t,r=(i?i.batchKey:null)||i.url;ct(e[r])&&(e[r]=Ue({},i,{data:[]})),null==(n=e[r].data)||n.push(i.data)}),this.Nr=[],e}}]),e}(),bo=["retriesPerformedSoFar"],ko=function(){function e(t){var n=this;_class_call_check(this,e),this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=t,this.Nr=[],this.Vr=!0,!ct($e)&&"onLine"in $e.navigator&&(this.Vr=$e.navigator.onLine,this.Wr=function(){n.Vr=!0,n.Zr()},this.Gr=function(){n.Vr=!1},R($e,"online",this.Wr),R($e,"offline",this.Gr))}return _create_class(e,[{key:"length",get:function(){return this.Nr.length}},{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=v(e,bo);vt(n)&&(i.url=lo(i.url,{retry_count:n})),this._instance._send_request(Ue({},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.Qr(Ue({retriesPerformedSoFar:n},i))}}))}},{key:"Qr",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))),u=Date.now()+a;this.Nr.push({retryAt:u,requestOptions:e});var l="Enqueued failed request for retry in "+a;navigator.onLine||(l+=" (Browser is offline)"),ii.warn(l),this.Br||(this.Br=!0,this.Jr())}},{key:"Jr",value:function(){var e=this;if(this.Kr&&clearTimeout(this.Kr),0===this.Nr.length)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout(function(){e.Vr&&e.Nr.length>0&&e.Zr(),e.Jr()},this.zr)}},{key:"Zr",value:function(){var e=Date.now(),t=[],n=this.Nr.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.Nr=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value.requestOptions;this.retriableRequest(u)}}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.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,ct($e)||(this.Wr&&($e.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&($e.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr)[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request(Ue({},s,{transport:"sendBeacon"}))}catch(e){ii.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.Nr=[]}}]),e}(),wo=function(){function e(t){var n=this;_class_call_check(this,e),this.Yr=function(){var e,t,i,r;n.Xr||(n.Xr={});var s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,u=o+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;n.Xr.lastScrollY=Math.ceil(o),n.Xr.maxScrollY=Math.max(o,null!==(e=n.Xr.maxScrollY)&&void 0!==e?e:0),n.Xr.maxScrollHeight=Math.max(a,null!==(t=n.Xr.maxScrollHeight)&&void 0!==t?t:0),n.Xr.lastContentY=u,n.Xr.maxContentY=Math.max(u,null!==(i=n.Xr.maxContentY)&&void 0!==i?i:0),n.Xr.maxContentHeight=Math.max(l,null!==(r=n.Xr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}return _create_class(e,[{key:"ei",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.Xr}},{key:"resetContext",value:function(){var e=this.Xr;return setTimeout(this.Yr,0),e}},{key:"startMeasuringScrollPosition",value:function(){R($e,"scroll",this.Yr,{capture:!0}),R($e,"scrollend",this.Yr,{capture:!0}),R($e,"resize",this.Yr)}},{key:"scrollElement",value:function(){if(!this.ei)return null==$e?void 0:$e.document.documentElement;var e=ot(this.ei)?this.ei:[this.ei],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==$e?void 0:$e.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.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return $e&&($e.scrollY||$e.pageYOffset||$e.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return $e&&($e.scrollX||$e.pageXOffset||$e.document.documentElement.scrollLeft)||0}}]),e}(),xo=function(e){return D(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties)},Eo=function(){function e(t,n,i,r){var s=this;_class_call_check(this,e),this.ti=function(e){var t=s.ri();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.ii(s._instance)};s.ni.register(_define_property({},Vi,n))}},this._instance=t,this.si=n,this.ni=i,this.ii=r||xo,this.si.onSessionId(this.ti)}return _create_class(e,[{key:"ri",value:function(){return this.ni.props[Vi]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.ri())?void 0:e.props;return t?"r"in t?N(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 O(gr(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_"+nt(n)]=t}),e}}]),e}(),So=function(){function e(){_class_call_check(this,e),this.oi={}}return _create_class(e,[{key:"on",value:function(e,t){var n=this;return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),function(){n.oi[e]=n.oi[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.oi[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,u=!1,l=void 0;try{for(var c,d=(this.oi["*"]||[])[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){(0,c.value)(e,t)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}}]),e}(),Po=ri("[SessionId]"),Fo=function(){function e(t,n,i){var r,s=this;if(_class_call_check(this,e),this.ui=[],this.li=void 0,this.ai=new So,this.hi=function(e,t){return!(!vt(e)||!vt(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===rr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.ni=t.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=n||$r,this.fi=i||$r;var o=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*xt(this.qt.session_idle_timeout_seconds||1800,60,36e3,Po.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+o+"_window_id",this.mi="ph_"+o+"_primary_window_exists",this.yi()){var a=Nr.F(this.gi),u=Nr.F(this.mi);a&&!u?this.ci=a:Nr.q(this.gi),Nr.N(this.mi,!0)}if(null!=(r=this.qt.bootstrap)&&r.sessionID)try{var l=function(){var e=s.qt.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.bi(this.qt.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){Po.error("Invalid sessionID in bootstrap",e)}this.wi()}return _create_class(e,[{key:"on",value:function(e,t){return this.ai.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return ct(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),function(){t.ui=t.ui.filter(function(t){return t!==e})}}},{key:"yi",value:function(){return"memory"!==this.qt.persistence&&!this.ni._r&&Nr.R()}},{key:"xi",value:function(e){e!==this.ci&&(this.ci=e,this.yi()&&Nr.N(this.gi,e))}},{key:"Si",value:function(){return this.ci?this.ci:this.yi()?Nr.F(this.gi):null}},{key:"bi",value:function(e,t,n){e===this.di&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.di=e,this.ni.register(_define_property({},Si,[t,e,n])))}},{key:"ki",value:function(){var e=this.ni.props[Si];return ot(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.bi(null,null,null)}},{key:"destroy",value:function(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&$e&&($e.removeEventListener(lr,this.li,{capture:!1}),this.li=void 0),this.ui=[]}},{key:"wi",value:function(){var e=this;this.li=function(){e.yi()&&Nr.q(e.mi)},R($e,lr,this.li,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===rr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),i=_sliced_to_array(this.ki(),3),r=i[0],s=i[1],o=i[2],a=this.Si(),u=vt(o)&&Math.abs(n-o)>864e5,l=!1,c=!s,d=!c&&!e&&this.hi(n,r);c||d||u?(s=this.vi(),a=this.fi(),Po.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}}),o=n,l=!0):a||(a=this.fi(),l=!0);var f=vt(r)&&e&&!u?r:n,h=vt(o)?o:(new Date).getTime();return this.xi(a),this.bi(s,f,h),e||this.pi(),l&&this.ui.forEach(function(e){return e(s,a,l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0)}),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0,lastActivityTimestamp:r}}},{key:"pi",value:function(){var e=this;clearTimeout(this.Ci),this.Ci=setTimeout(function(){var t=_sliced_to_array(e.ki(),1)[0];if(e.hi((new Date).getTime(),t)){var n=e.di;e.resetSessionId(),e.ai.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}]),e}(),Oo=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&et(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(function(e){return et(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver},$o=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}},Io={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 $o(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!$o(t,e)})})},icontains:function(e,t){return t.map(Ro).some(function(t){return e.map(Ro).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(Ro).every(function(t){return e.map(Ro).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)})})}},Ro=function(e){return e.toLowerCase()},Mo="custom",Co="i.posthog.com",To=/^\/static\//,Ao=function(){function e(t){_class_call_check(this,e),this.Ii={},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("."+Co,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this.Ii[this.apiHost]||(this.Ii[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":Mo),this.Ii[this.apiHost]}},{key:"Ti",value:function(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&To.test(e))return t.trim().replace(/\/$/,"")||void 0}},{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("assets"===e){var n=this.Ti(t);if(n)return""+n+t}if(this.region===Mo)return this.apiHost+t;var i=Co+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}]),e}(),qo=ri("[Surveys]"),jo="seenSurvey_",Lo=[fs,_s,hs],Do={ignoreConditions:!1,ignoreDelay:!1,displayType:ks},No=ri("[PostHog ExternalIntegrations]"),Ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},zo=function(){function e(t){_class_call_check(this,e),this._instance=t}return _create_class(e,[{key:"lr",value:function(e,t){var n;null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,function(e){if(e)return No.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=function(t){var n,i,r;!c||null!=(n=Ne.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.lr(Ho[t],function(){var n;null==(n=Ne.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!c&&null!=(i=Ne.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]&&(null==(r=Ne.__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,u=_sliced_to_array(s.value,2),l=u[0],c=u[1];t(l)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}}]),e}(),Uo={},Bo=0,Vo=function(){},Go='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wo="Surveys module not available",Ko="sanitize_properties is deprecated. Use before_send instead",Xo="Invalid value for property_denylist config: ",Yo="posthog",Jo=!so&&-1===(null==De?void 0:De.indexOf("MSIE"))&&-1===(null==De?void 0:De.indexOf("Mozilla")),Zo=function(e){var t;return Ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:I(null==Ce?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Vo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:Te&&dt(null==Te?void 0:Te.search)&&-1!==Te.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==$e||null==(t=$e.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){ii.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:ar,before_send:void 0,request_queue_config:{flush_interval_ms:yo},error_tracking:{},_onCapture:Vo,__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))},Qo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],ea=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=Qo[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];ct(e[u])||(t[l]=e[u])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=_r({},t,e);return ot(e.property_blacklist)&&(ct(e.property_denylist)?c.property_denylist=e.property_blacklist:ot(e.property_denylist)?c.property_denylist=_to_consumable_array(e.property_blacklist).concat(_to_consumable_array(e.property_denylist)):ii.error(Xo+e.property_denylist)),c},ta=function(){function e(){_class_call_check(this,e),this.__forceAllowLocalhost=!1}return _create_class(e,[{key:"Ei",get:function(){return this.__forceAllowLocalhost},set:function(e){ii.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),na=function(){function e(){var t,n=this;_class_call_check(this,e),this.webPerformance=new ta,this.Oi=!1,this.version=ze.LIB_VERSION,this.Li=new So,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zo(),this.SentryIntegration=Kr,this.sentryIntegration=function(e){return t=C(n,e),{name:Wr,processEvent:function(e){return t(e)}};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new wo(this),this.pageViewManager=new Xr(this),this.rateLimiter=new Fs(this),this.requestRouter=new Ao(this),this.consent=new Hr(this),this.externalIntegrations=new zo(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=dt(e)?_define_property({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=dt(e)?_define_property({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return ii.info('send "'+(null==e?void 0:e.event)+'"',e)})}return _create_class(e,[{key:"Mi",value:function(e,t){if(e){var n=this.Pi.indexOf(e);-1!==n&&this.Pi.splice(n,1)}return this.Pi.push(t),null==t.initialize||t.initialize(),t}},{key:"Ri",value:function(){return this.config.cookieless_mode===rr||this.config.cookieless_mode===ir&&this.consent.isRejected()}},{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!==Yo){var r,s=null!==(r=Uo[i])&&void 0!==r?r:new e;return s._init(t,n,i),Uo[i]=s,Uo[Yo][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e,t,n){var i,r,s=this;if(void 0===t&&(t={}),ct(e)||ft(e))return ii.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.Di(t.debug),this.qi=t,this.ji=[],t.person_profiles?this.Ni=t.person_profiles:t.process_person&&(this.Ni=t.process_person),this.set_config(_r({},Zo(t.defaults),ea(t),{name:n,token:e})),this.config.on_xhr_error&&ii.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Is;var o=this.Hi();this.persistence=new ls(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ls(Ue({},this.config,{persistence:"sessionStorage"}),o);var a=Ue({},this.persistence.props),u=Ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ui=new mo(function(e){return s.Bi(e)},this.config.request_queue_config),this.zi=new ko(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Fo(this),this.sessionPropsManager=new Eo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ii.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){s.Vi(l)},0)):(ii.info("Initializing extensions synchronously"),this.Vi(l)),ze.DEBUG=ze.DEBUG||this.config.debug,ze.DEBUG&&ii.info("Starting in debug mode",{this:this,config:t,thisC:Ue({},this.config),p:a,s:u}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=Ue({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(r=t.bootstrap)?void 0:r.distinctID)){var c=t.bootstrap.distinctID,d=this.get_distinct_id(),f=this.persistence.get_property(Bi);if(t.bootstrap.isIdentifiedID&&null!=d&&d!==c&&f===sr)this.identify(c);else if(t.bootstrap.isIdentifiedID&&null!=d&&d!==c&&f===or)ii.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 h=this.config.get_device_id($r()),_=t.bootstrap.isIdentifiedID?h:c;this.persistence.set_property(Bi,t.bootstrap.isIdentifiedID?or:sr),this.register({distinct_id:c,$device_id:_})}}if(l)this.register_once({distinct_id:Zi,$device_id:null},"");else if(!this.get_distinct_id()){var p=this.config.get_device_id($r());this.register_once({distinct_id:p,$device_id:p},""),this.persistence.set_property(Bi,sr)}return R($e,"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()||$r()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(Bi,or)),t()},r=n.user();"then"in r&&at(r.then)?r.then(i):i(r)}(e,function(){n.register(function(e){Promise&&Promise.resolve||Gr.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()||(Gr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Gr.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,cr)},identify:function(e){return t(e,fr)},screen:function(e){return t(e,"$screen")}}}(e)).then(function(){t()})})}(this,function(){return s.Wi()}):this.Wi(),at(this.config._onCapture)&&this.config._onCapture!==Vo&&(ii.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return s.config._onCapture(e.event,e)})),this.config.ip&&ii.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:"Vi",value:function(t){var n,i,r,s,o,a,u,l=this,c=performance.now(),d=Ue({},e.__defaultExtensionClasses,this.config.__extensionClasses),f=[];d.featureFlags&&this.Pi.push(this.featureFlags=null!==(n=this.featureFlags)&&void 0!==n?n:new d.featureFlags(this)),d.exceptions&&this.Pi.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new d.exceptions(this)),d.historyAutocapture&&this.Pi.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Pi.push(new d.tracingHeaders(this)),d.siteApps&&this.Pi.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||f.push(function(){l.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Pi.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Pi.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this)),d.logs&&this.Pi.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new d.logs(this)),d.conversations&&this.Pi.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new d.conversations(this)),d.productTours&&this.Pi.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Pi.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Pi.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.Pi.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new d.toolbar(this)),d.experiments&&this.Pi.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this.Pi.forEach(function(e){e.initialize&&f.push(function(){null==e.initialize||e.initialize()})}),f.push(function(){if(l.Zi){var e=l.Zi;l.Zi=void 0,l.Rr(e)}}),this.Gi(f,c)}},{key:"Gi",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.Gi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){ii.error("Error initializing extension:",e)}}var r,s=Math.round(performance.now()-t);this.register_for_session((_define_property(r={},Qi,this.config.__preview_deferred_init_extensions?"deferred":"synchronous"),_define_property(r,er,s),r)),this.config.__preview_deferred_init_extensions&&ii.info("PostHog extensions initialized ("+s+"ms)")}},{key:"Rr",value:function(e){var t,n=this;if(!Ce||!Ce.body)return ii.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){n.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Zi=e),this.Qi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=g(e.supportedCompression,Is)?Is:g(e.supportedCompression,Rs)?Rs:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:ar}),this.Pi.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}},{key:"Wi",value:function(){var e=this;try{this.config.loaded(this)}catch(e){ii.critical("`loaded` function failed",e)}if(this.Ji(),this.config.internal_or_test_user_hostname&&null!=Te&&Te.hostname){var t=Te.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.Ri())&&e.Ki()},1),this.Yi=new $s(this),this.Yi.load()}},{key:"Ji",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ui)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&F(this.__request_queue,function(t){return e.Bi(t)}),this.__request_queue=[],this.Ji()}},{key:"_handle_unload",value:function(){var e,t,n,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(dr),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(n=this.Ui)||n.unload(),null==(i=this.zi)||i.unload()):this.Xi()&&this.capture(dr,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t=this;this.__loaded&&(Jo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=lo(e.url,{ip:this.config.ip?1:0}),e.headers=Ue({},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=Ue({},e);r.timeout=r.timeout||6e4,r.url=po(r.url,r.compression);var s=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=vo.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===Is&&Le&&!ao?_o(r).then(function(e){a(e)}).catch(function(t){if(Xe(t))return ao=!0,void a(Ue({},r,{compression:void 0,url:po(e.url,void 0)}));(function(e){if(!e||"object"!=(void 0===e?"undefined":_type_of(e)))return!1;var t="name"in e?String(e.name):"";return Xe(e)||t===We})(t)&&(ao=!0),a(r)}):a(r)}(Ue({},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:"Bi",value:function(e){this.zi?this.zi.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;Bo++;try{var n,i=[],r=[],s=[];F(e,function(e){if(e)if(ot(n=e[0]))s.push(e);else if(at(e))try{e.call(t)}catch(t){ii.error("Error executing queued PostHog call",e,t)}else ot(e)&&"alias"===n?i.push(e):ot(e)&&-1!==n.indexOf("capture")&&at(t[n])?s.push(e):r.push(e)});var o=function(e,t){F(e,function(e){try{if(ot(e[0])){var n=t;O(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ii.error("Error executing queued PostHog call",e,t)}})};o(i,this),o(r,this),o(s,this)}finally{Bo--}}},{key:"push",value:function(t){if(Bo>0&&ot(t)&&dt(t[0])){var n=e.prototype[t[0]];at(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.Ui){if(this.is_capturing())if(!ct(e)&&dt(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var l=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=t&&t.$current_url&&!dt(null==t?void 0:t.$current_url)&&(ii.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.en||ii.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,d=(null==n?void 0:n.timestamp)||c,f=(null==n?void 0:n.uuid)||$r(),h={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},d,f)};e===cr&&this.config.__preview_capture_bot_pageviews&&u&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),l&&(h.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens),(null==n?void 0:n.$set)&&(h.$set=null==n?void 0:n.$set);var _,p,v,g=this.tn(null==n?void 0:n.$set_once,e!==hr,e===fr);if(g&&(h.$set_once=g),null!=n&&n._noTruncate||(r=this.config.properties_string_max_length,s=h,o=function(e){return dt(e)?e.slice(0,r):e},a=new Set,h=function e(t,n){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),ot(t)?(i=[],F(t,function(t){i.push(e(t))})):(i={},O(t,function(t,n){a.has(t)||(i[n]=e(t,n))})),i);var i}(s)),h.timestamp=d,ct(null==n?void 0:n.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=c),e===vs||e===gs){var y=null==t?void 0:t[ys],m=null==t?void 0:t[ms];(function(e){try{var t=(r=""+jo+(i=n=e).id,i.current_iteration&&i.current_iteration>0&&(r=""+jo+i.id+"_"+i.current_iteration),r);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){qo.error("Failed to persist survey seen state",n)}var n,i,r})({id:y,current_iteration:m}),h.$set=Ue({},h.$set,_define_property({},(v="$survey_"+(p=e===gs?"responded":"dismissed")+"/"+(_={id:y,current_iteration:m}).id,_.current_iteration&&_.current_iteration>0&&(v="$survey_"+p+"/"+_.id+"/"+_.current_iteration),v),!0))}else e===ps&&(h.$set=Ue({},h.$set,_define_property({},bs,(new Date).toISOString())));if(e===xs){var b=null==t?void 0:t[Ss];b&&(h.$set=Ue({},h.$set,_define_property({},Es+"/"+b,(new Date).toISOString())))}var k=Ue({},h.properties.$set,h.$set);if(lt(k)||this.setPersonPropertiesForFlags(k),!_t(this.config.before_send)){var w=this.rn(h);if(!w)return;h=w}this.Li.emit("eventCaptured",h);var x={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:h,compression:"best-available",batchKey:null==n?void 0:n._batchKey,transport:null==n?void 0:n.transport};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Bi(x):this.Ui.enqueue(x),h}ii.critical("This capture call is ignored due to client rate limiting.")}}else ii.error("No event name provided to posthog.capture")}else ii.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=Ue({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=Ue({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!dt(o.distinct_id)&&!pt(o.distinct_id)||ft(o.distinct_id))&&ii.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,l=function(e,t){var n,i,r,s;if(!De)return{};var o,a,u,l,c,d,f,h,_=e?_to_consumable_array(is).concat(_to_consumable_array(t||[])):[],p=_sliced_to_array(function(e){for(var t=0;En.length>t;t++){var n=_sliced_to_array(En[t],2),i=n[0],r=n[1],s=i.exec(e),o=s&&(at(r)?r(s,e):r);if(o)return o}return["",""]}(De),2),v=p[0],g=p[1];return _r(gr({$os:v,$os_version:g,$browser:kn(De,navigator.vendor),$device:Sn(De),$device_type:(a=De,u={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(i=navigator)?void 0:i.maxTouchPoints,screenWidth:null==$e||null==(r=$e.screen)?void 0:r.width,screenHeight:null==$e||null==(s=$e.screen)?void 0:s.height,devicePixelRatio:null==$e?void 0:$e.devicePixelRatio},h=Sn(a),h===Tt||h===Ct||"Kobo"===h||"Kindle Fire"===h||h===dn?Mt:h===Qt||h===tn||h===en||h===un?"Console":h===qt?"Wearable":h?$t:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(l=null==u?void 0:u.maxTouchPoints)&&void 0!==l?l:0)>0?600>Math.min(null!==(c=null==u?void 0:u.screenWidth)&&void 0!==c?c:0,null!==(d=null==u?void 0:u.screenHeight)&&void 0!==d?d:0)/(null!==(f=null==u?void 0:u.devicePixelRatio)&&void 0!==f?f:1)?$t:Mt:"Desktop"),$timezone:H(),$timezone_offset:z()}),{$current_url:es(null==Te?void 0:Te.href,_,ss),$host:null==Te?void 0:Te.host,$pathname:null==Te?void 0:Te.pathname,$raw_user_agent:De.length>1e3?De.substring(0,997)+"...":De,$browser_version:xn(De,navigator.vendor),$browser_language:j(),$browser_language_prefix:(o=j(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==$e?void 0:$e.screen.height,$screen_width:null==$e?void 0:$e.screen.width,$viewport_height:null==$e?void 0:$e.innerHeight,$viewport_width:null==$e?void 0:$e.innerWidth,$lib:ze.LIB_NAME,$lib_version:ze.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()),d=c.sessionId,f=c.windowId;o.$session_id=d,o.$window_id=f}this.sessionPropsManager&&_r(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&_r(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(h=this.zi)?void 0:h.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Mo&&(o.$lib_custom_api_host=this.config.api_host),u=e!==cr||r?e!==dr||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=_r(o,u),e===cr&&Ce&&(o.title=Ce.title),!ct(s)){var _=n.getTime()-s;o.$duration=parseFloat((_/1e3).toFixed(3))}De&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=_r({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),ot(this.config.property_denylist)?O(this.config.property_denylist,function(e){delete o[e]}):ii.error(Xo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(ii.error(Ko),o=p(o,e));var v=this.nn();return o.$process_person_profile=v,v&&!r&&this.sn("_calculate_event_properties"),o}},{key:"tn",value:function(e,t,n){var i;if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.nn())return e;if(this.Oi&&!n)return e;var r=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=_r({},r,s||{},e||{}),a=this.config.sanitize_properties;return a&&(ii.error(Ko),o=a(o,"$set_once")),t&&(this.Oi=!0),lt(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:"an",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.Li.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:Wo}),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:Wo})}},{key:"getActiveMatchingSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Wo})}},{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=Do),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:Wo}}},{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:Wo})}},{key:"un",value:function(e){return!e||ft(e)?(ii.critical("Unique user id has not been set in posthog.identify"),!1):e===Zi?(ii.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())||(ii.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 ii.uninitializedWarning("posthog.identify");if(pt(e)&&(e=e.toString(),ii.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(e)&&this.sn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ui)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(li)&&(this.unregister(li),this.register({distinct_id:e}));var r,s=(this.persistence.get_property(Bi)||sr)===sr;e!==i&&s?(this.persistence.set_property(Bi,or),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(fr,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.$i=U(e,t,n),null==(r=this.featureFlags)||r.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(Ni))}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.sn("posthog.setPersonProperties")){var n=U(this.get_distinct_id(),e,t);this.$i!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.$i=n):ii.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:Ue({},i,_define_property({},e,t))}),r||n){var s={$group_type:e,$group_key:t};n&&(s.$group_set=n),this.capture(hr,s)}n&&this.setGroupPropertiesForFlags(_define_property({},e,n)),r&&!n&&this.reloadFeatureFlags()}else ii.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.sn("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,u;if(ii.info("reset"),!this.__loaded)return ii.uninitializedWarning("posthog.reset");var l,c=this.get_property(ui),d=this.get_property(bi);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),ct(d)||null==(l=this.persistence)||l.register(_define_property({},bi,d)),null==(i=this.surveys)||i.reset(),null==(r=this.Yi)||r.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Bi,sr),null==(u=this.sessionManager)||u.resetSessionId(),this.$i=null,this.config.cookieless_mode===rr)this.register_once({distinct_id:Zi,$device_id:null},"");else{var f=this.config.get_device_id($r());this.register_once({distinct_id:f,$device_id:e?f:c},"")}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.ln()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.hn()}},{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(ai)?(ii.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(ct(t)&&(t=this.get_distinct_id()),e!==t?(this.an(li,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ii.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=Ue({},this.config);if(ut(e)){var n,i,r,s,o,a,u,l,c,d;_r(this.config,ea(e));var f=this.Hi();null==(n=this.persistence)||n.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ls(Ue({},this.config,{persistence:"sessionStorage"}),f);var h=this.Di(this.config.debug);gt(h)&&(this.config.debug=h),gt(this.config.debug)&&(this.config.debug?(ze.DEBUG=!0,Ar.R()&&Ar.N("ph_debug",!0),ii.info("set_config",{config:e,oldConfig:t,newConfig:Ue({},this.config)})):(ze.DEBUG=!1,Ar.R()&&Ar.q("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(r=this.exceptions)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.cn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}},{key:"_overrideSDKInfo",value:function(e,t){ze.LIB_NAME=e,ze.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(Ue({},i,t))}}},{key:"addExceptionStep",value:function(e,t){var n;null==(n=this.exceptions)||n.addExceptionStep(e,t)}},{key:"captureLog",value:function(e){var t;null==(t=this.logs)||t.captureLog(e)}},{key:"logger",get:function(){var t,n;return null!==(t=null==(n=this.logs)?void 0:n.logger)&&void 0!==t?t:e.dn}},{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:Yo;return t!==Yo&&(t=Yo+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(Bi))===or||(null==(t=this.sessionPersistence)?void 0:t.get_property(Bi))===or}},{key:"nn",value:function(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ar&&!this._isIdentified()&&lt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[li])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Yi]))}},{key:"Xi",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.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"sn",value:function(e){return"never"===this.config.person_profiles?(ii.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Yi,!0),!0)}},{key:"Hi",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!==ir)}},{key:"cn",value:function(){var e,t,n,i,r=this.Hi();return(null==(e=this.persistence)?void 0:e._r)!==r&&(null==(n=this.persistence)||n.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._r)!==r&&(null==(i=this.sessionPersistence)||i.set_disabled(r)),r}},{key:"opt_in_capturing",value:function(t){var n;if(this.config.cookieless_mode!==rr){if(this.Ri()){var i,r,s,o,a;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Fo(this),this.pageViewManager=new Xr(this),this.persistence&&(this.sessionPropsManager=new Eo(this,this.sessionManager,this.persistence));var u,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.Mi(this.sessionRecording,new l(this)),this.Qi&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Qi)))}var c,d;this.consent.optInOut(!0),this.cn(),this.Ji(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),this.config.cookieless_mode==ir&&(null==(c=this.surveys)||c.loadIfEnabled()),(ct(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else ii.warn(Go)}},{key:"opt_out_capturing",value:function(){var e,t,n;this.config.cookieless_mode!==rr?(this.config.cookieless_mode===ir&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===ir&&(this.register({distinct_id:Zi,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki(),this.Ji())):ii.warn(Go)}},{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===rr||(this.config.cookieless_mode===ir?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this.cn()}},{key:"_is_bot",value:function(){return Me?Oo(Me,this.config.custom_blocked_useragents):void 0}},{key:"Ki",value:function(){Ce&&("visible"===Ce.visibilityState?this.Fi||(this.Fi=!0,this.capture(cr,{title:Ce.title},{send_instantly:!0}),this.Ai&&(Ce.removeEventListener(ur,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),R(Ce,ur,this.Ai)))}},{key:"debug",value:function(e){!1===e?(null==$e||$e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==$e||$e.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:"Lr",value:function(){var e,t,n,i,r,s,o=this.qi||{};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?(ii.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=ii,r=(t="advanced_disable_flags")in(e=o)&&!_t(e[t]),s=n in e&&!_t(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:"rn",value:function(e){if(_t(this.config.before_send))return e;var t=ot(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),_t(n)){var u="Event '"+e.event+"' was rejected in beforeSend function";return mt(e.event)?ii.warn(u+". This can cause unexpected behavior."):ii.info(u),null}n.properties&&!lt(n.properties)||ii.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.dr)?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:"Di",value:function(e){var t=gt(e)&&!e,n=Ar.R()&&"true"===Ar.A("ph_debug");return!t&&(!!n||e)}}]),e}();na.__defaultExtensionClasses={},na.dn={trace:go=function(){},debug:go,info:go,warn:go,error:go,fatal:go},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=vr(e.prototype[t[n]])}(na,["identify"]);var ia=1,ra=3,sa=11,oa=["a","button","form","input","select","textarea","label"],aa=["next","previous","prev",">","<"],ua=[".ph-no-rageclick",".ph-no-capture"],la=function(e){return!e||W(e,"html")||!G(e)},ca=function(e,t){if(!$e||la(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!W(r,"body");)if(X(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var s=ie(r);if(!s)break;if(t||oa.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=$e.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}},da="(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})",fa=new RegExp("^(?:"+da+")$"),ha=new RegExp(da),_a="\\d{3}-?\\d{2}-?\\d{4}",pa=new RegExp("^("+_a+")$"),va=new RegExp("("+_a+")");function ga(e){var t="";return e&&e.childNodes&&e.childNodes.length&&O(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var i=ee(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ga(e)).trim())}catch(e){ii.error("[AutoCapture]",e)}}),t}var ya=function(){function e(t){_class_call_check(this,e),this.disabled=!1===t;var n=ut(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}(),ma="$copy_autocapture",ba=ri("[AutoCapture]"),ka=ri("[ExceptionAutocapture]"),wa=ri("[TracingHeaders]"),xa=ri("[Web Vitals]"),Ea=9e5,Sa="disabled",Pa="lazy_loading",Fa="awaiting_config",Oa="missing_config";ri("[SessionRecording]"),ri("[SessionRecording]");var $a,Ia="[SessionRecording]",Ra=ri(Ia),Ma=ri("[Heatmaps]"),Ca=ri("[Product Tours]"),Ta=["$set_once","$set"],Aa=ri("[SiteApps]"),qa="Error while initializing PostHog app with config id ",ja=function(){function e(t){var n=this;_class_call_check(this,e),this.vn=new So,this.fn=function(e,t){return n.pn(e,t)&&n.gn(e,t)&&n.mn(e,t)&&n.yn(e,t)},this.pn=function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)},this._instance=t,this.bn=new Set,this._n=new Set}return _create_class(e,[{key:"init",value:function(){var e,t,n=this;ct(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(!ct(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(function(e){var t,n;null==(t=i._n)||t.add(e),null==(n=e.steps)||n.forEach(function(e){var t;null==(t=i.bn)||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.bn.has(e)||this.bn.has(null==t?void 0:t.event))&&this._n&&(null==(n=this._n)?void 0:n.size)>0&&this._n.forEach(function(e){i.wn(t,e)&&i.vn.emit("actionCaptured",e.name)})}},{key:"xn",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"wn",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.fn(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.vn.on(e,t)}},{key:"gn",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(!_e(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"mn",value:function(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}},{key:"Sn",value:function(e,t){var n;if(null==t||!t.href)return!0;var i=this.In(e);if(i.length>0)return i.some(function(e){return _e(e.href,t.href,t.href_matching||"exact")});var r,s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!s&&_e((r=s.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}},{key:"kn",value:function(e,t){var n;if(null==t||!t.text)return!0;var i=this.In(e);if(i.length>0)return i.some(function(e){return _e(e.text,t.text,t.text_matching||"exact")||_e(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;!_t(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 _e(e,s,o)}))}},{key:"Cn",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:"In",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:"yn",value:function(e,t){return null==t||!t.properties||0===t.properties.length||B(t.properties.reduce(function(e,t){var n=ot(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}(),La=function(){function e(t){_class_call_check(this,e),this._instance=t,this.Tn=new Map,this.En=new Map,this.Mn=new Map}return _create_class(e,[{key:"Pn",value:function(e,t){return!!e&&B(e.propertyFilters,null==t?void 0:t.properties)}},{key:"Rn",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:"On",value:function(e,t,n){var i=this,r=(n===cs?this.Tn:this.En).get(e),s=[];return this.Ln(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.Pn(o,t)})}},{key:"register",value:function(e){var t;ct(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}},{key:"An",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.Nn&&(this.Nn=new ja(this._instance),this.Nn.init(),this.Nn.xn(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.Nn)||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.Mn.get(n.name);i&&i.push(e.id),t.Mn.set(n.name,i||[e.id])}}))}))}},{key:"Fn",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.Tn=this.Rn(e,cs),this.En=this.Rn(e,ds))}},{key:"onEvent",value:function(e,t){var n,i=this,r=this.le(),s=this.$n(),o=this.Dn(),a=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var u,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(null==t||null==(u=t.properties)?void 0:u.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var d=a.indexOf(c);0>d||(a.splice(d,1),this.qn(a))}}else{if(this.En.has(e)){var f=this.On(e,t,ds);f.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(function(e){return e.id})}),f.forEach(function(e){var t=a.indexOf(e.id);0>t||a.splice(t,1),i.jn(e.id)}),this.qn(a))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var h=this.On(e,t,cs);this.qn(a.concat(h.map(function(e){return e.id})||[]))}}}},{key:"onAction",value:function(e){var t,n=this.$n(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.Mn.has(e)&&this.qn(i.concat(this.Mn.get(e)||[]))}},{key:"qn",value:function(e){var t=this,n=this.le(),i=_to_consumable_array(new Set(e)).filter(function(e){return!t.Hn(e)});n.info("updating activated items",{activatedItems:i}),this.Un(i)}},{key:"getActivatedIds",value:function(){var e,t=this.$n();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"getEventToItemsMap",value:function(){return this.Tn}},{key:"Bn",value:function(){return this.Nn}}]),e}(),Da=function(e){function t(e){return _class_call_check(this,t),_call_super(this,t,[e])}return _inherits(t,e),_create_class(t,[{key:"$n",value:function(){return Li}},{key:"Dn",value:function(){return ps}},{key:"Ln",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"jn",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"le",value:function(){return qo}},{key:"Un",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register(_define_property({},Li,e))}},{key:"Hn",value:function(){return!1}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItemsMap()}}]),t}(La),Na="SDK is not enabled or survey functionality is not yet loaded",Ha="Disabled. Not loading surveys.",za=null!=$e&&$e.location?ts($e.location.hash,"__posthog")||ts(location.hash,"state"):null,Ua="_postHogToolbarParams",Ba=ri("[Toolbar]"),Va=ri("[FeatureFlags]"),Ga=ri("[FeatureFlags]",{debugEnabled:!0}),Wa="\" failed. Feature flags didn't load in time.",Ka=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Xa=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=$(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=_sliced_to_array(s.value,2),u=a[0],l=a[1];l&&(t[u]=l)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},Ya=ri("[Error tracking]"),Ja="Refusing to render web experiment since the viewer is a likely bot",Za={icontains:function(e,t){return!!$e&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return!!$e&&-1===t.href.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return!!$e&&$o(t.href,e)},not_regex:function(e,t){return!!$e&&!$o(t.href,e)},exact:function(e,t){return t.href===e},is_not:function(e,t){return t.href!==e}},Qa=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.zn("retrieved web experiments from the server"),i.Vn=new Map,t.forEach(function(t){if(t.feature_flag_key){var n;i.Vn&&(e.zn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.Vn)||n.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);dt(r)&&t.variants[r]&&i.Wn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.Zn(o)&&i.Wn(t.name,s,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.zn(Ja);else if(!this.qt.disable_web_experiments){if(_t(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.zn("applying feature flags",t),t.forEach(function(e){var t;if(n.Vn&&null!=(t=n.Vn)&&t.has(e)){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.Vn)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&n.Wn(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=Qr(null==n?void 0:n.search,"__experiment_id"),r=Qr(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments(function(e){t.Gn(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.qt.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.qt.token),method:"GET",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"Gn",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.zn("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Wn(r[0].name,n,r[0].variants[n].transforms))}},{key:"Wn",value:function(t,n,i){this._is_bot()?e.zn(Ja):"control"!==n?i.forEach(function(i){if(i.selector){var r;e.zn("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.zn("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return Me&&this._instance?Oo(Me,this.qt.custom_blocked_useragents):void 0}}],[{key:"Zn",value:function(t){return!_t(t.conditions)&&e.Qn(t)&&e.Jn(t)}},{key:"Qn",value:function(t){var n;if(_t(t.conditions)||_t(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||Za[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==$e?void 0:$e.location}},{key:"Jn",value:function(e){var t;if(_t(e.conditions)||_t(null==(t=e.conditions)?void 0:t.utm))return!0;var n=T();if(n.utm_source){var i,r,s,o,a,u,l,c,d=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,f=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,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_medium)==n.utm_medium,_=null==(l=e.conditions)||null==(l=l.utm)||!l.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==n.utm_term;return d&&h&&_&&f}return!1}},{key:"zn",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];ii.info("[WebExperiments] "+e,n)}}]),e}(),eu=ri("[Conversations]"),tu="Conversations not available yet.",nu={featureFlags:function(){function e(t){_class_call_check(this,e),this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"ni",get:function(){return this._instance.persistence}},{key:"os",value:function(e){return this._instance.get_property(e)}},{key:"us",value:function(){var e,t;return null!==(e=null==(t=this.ni)?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}},{key:"ls",value:function(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,Va.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"hs",value:function(){var e,t=null!==(e=this.qt.evaluation_contexts)&&void 0!==e?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(Va.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=t&&t.length?t.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Va.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}},{key:"cs",value:function(){return this.hs().length>0}},{key:"ds",value:function(){var e=this.qt.flag_keys;if(!ct(e)){if(ot(e))return e.filter(function(e){var t=e&&"string"==typeof e&&e.trim().length>0;return t||Va.error("Invalid flag key found:",e,"Expected non-empty string"),t});Va.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}},{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},{}),u=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:u})}}},{key:"updateFlags",value:function(e,t,n){var i=null!=n&&n.merge?this.getFlagVariants():{},r=null!=n&&n.merge?this.getFlagPayloads():{},s=Ue({},i,e),o=Ue({},r,t),a={},u=!0,l=!1,c=void 0;try{for(var d,f=Object.entries(s)[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var h=_sliced_to_array(d.value,2),_=h[0],p=h[1],v="string"==typeof p;a[_]={key:_,enabled:!!v||Boolean(p),variant:v?p:void 0,reason:void 0,metadata:ct(null==o?void 0:o[_])?void 0:{id:0,version:void 0,description:void 0,payload:o[_]}}}}catch(e){l=!0,c=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw c}}this.receivedFeatureFlags({flags:a})}},{key:"hasLoadedFlags",get:function(){return this.Yn}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.os(Ii),t=this.os(Ci),n=this.os(Ti);if(!n&&!t)return e||{};var i=_r({},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 u,l=r[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c,d,f=u.value,h=i[f],_=null==t?void 0:t[f],p=ct(_)?null!==(c=null==h?void 0:h.enabled)&&void 0!==c&&c:!!_,v=ct(_)?h.variant:"string"==typeof _?_:void 0,g=null==n?void 0:n[f],y=Ue({},h,{enabled:p,variant:p?null!=v?v:null==h?void 0:h.variant:void 0});p!==(null==h?void 0:h.enabled)&&(y.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(y.original_variant=null==h?void 0:h.variant),g&&(y.metadata=Ue({},null==h?void 0:h.metadata,{payload:g,original_payload:null==h||null==(d=h.metadata)?void 0:d.payload})),i[f]=y}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return this.Kn||(Va.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Kn=!0),i}},{key:"getFlagVariants",value:function(){var e=this.os(Fi),t=this.os(Ci);if(!t)return e||{};for(var n=_r({},e),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Kn||(Va.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Kn=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.os(Ri),t=this.os(Ti);if(!t)return e||{};for(var n=_r({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Kn||(Va.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Kn=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this.es||this.qt.advanced_disable_feature_flags||this.vs||(this._instance.Li.emit("featureFlagsReloading",!0),this.vs=setTimeout(function(){e.fs()},5))}},{key:"ps",value:function(){clearTimeout(this.vs),this.vs=void 0}},{key:"ensureFlagsLoaded",value:function(){this.Yn||this.Xn||this.vs||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.es=e}},{key:"fs",value:function(e){var t,n=this;if(this.ps(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(ui),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ue({},(null==(t=this.ni)?void 0:t.get_initial_props())||{},this.os(Ai)||{}),group_properties:this.os(qi),timezone:H()};ht(r)||ct(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var o=this.ds();ct(o)||(s.flag_keys=o);var a=!!this.qt.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:u,data:s,compression:this.qt.disable_compression?void 0:Rs,timeout:this.qt.feature_flag_request_timeout_ms,callback:function(e){var t,i,r,o=!0;if(200===e.statusCode&&(n.ts||(n.$anon_distinct_id=void 0),o=!1),n.Xn=!1,!s.disable_flags||n.ts){n.rs=!o;var u=[];e.error?_instanceof(e.error,Error)?u.push("AbortError"===e.error.name?"timeout":"connection_error"):u.push("unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var l,c=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),null==(r=n.ni)||r.register(_define_property({},zi,u)),c?Va.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,{partialResponse:a}),n.ts&&(n.ts=!1,n.fs()))}}})}}},{key:"getFeatureFlag",value:function(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){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 Va.warn('getFeatureFlag for key "'+e+Wa)}},{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.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),i=e in n,r=n[e],s=this.getFlagPayloads()[e],o=String(r),a=this.os(Mi)||void 0,u=this.os(Ui)||void 0,l=this.os(Ni)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var c,d,f=this._instance.get_session_id(),h=this.os(Hi);f&&f!==h&&(l={},null==(c=this.ni)||c.register((_define_property(d={},Ni,l),_define_property(d,Hi,f),d)))}if((t.send_event||!("send_event"in t))&&(!(e in l)||!l[e].includes(o))){var _,p,v,g,y,m,b,k,w,x;ot(l[e])?l[e].push(o):l[e]=[o],null==(_=this.ni)||_.register(_define_property({},Ni,l));var E=this.getFeatureFlagDetails(e),S=_to_consumable_array(null!==(p=this.os(zi))&&void 0!==p?p:[]);ct(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:u,$feature_flag_bootstrapped_response:(null==(v=this.qt.bootstrap)||null==(v=v.featureFlags)?void 0:v[e])||null,$feature_flag_bootstrapped_payload:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[e])||null,$used_bootstrap_value:!this.rs};ct(null==E||null==(y=E.metadata)?void 0:y.version)||(P.$feature_flag_version=E.metadata.version);var F,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),ct(null==E?void 0:E.original_variant)&&ct(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=ct(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==(F=E.metadata)?void 0:F.original_payload),S.length&&(P.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",P)}if(i){var $=s;if(!ct(s))try{$=JSON.parse(s)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:$}}}}else Va.warn('getFeatureFlagResult for key "'+e+Wa)}},{key:"getRemoteConfigPayload",value:function(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.cs()&&(i.evaluation_contexts=this.hs());var r=this.ds();ct(r)||(i.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.qt.disable_compression?void 0:Rs,timeout:this.qt.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.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return ct(n)?void 0:!!n}Va.warn('isFeatureEnabled for key "'+e+Wa)}}},{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,n){if(this.ni){this.Yn=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,n,i,r,s){void 0===n&&(n={}),void 0===i&&(i={}),void 0===r&&(r={});var o,a,u=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(function(e){var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(function(e){return a[e].enabled}).filter(function(e){var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(function(e){var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):Va.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),l=u.flags,c=u.featureFlags,d=u.featureFlagPayloads;if(c){var f=e.requestId,h=e.evaluatedAt;if(ot(c)){Va.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _,p={};if(c)for(var v=0;c.length>v;v++)p[c[v]]=!0;t&&t.register((_define_property(_={},Oi,c),_define_property(_,Fi,p),_))}else{var g,y=c,m=d,b=l;if(null!=s&&s.partialResponse)y=Ue({},n,y),m=Ue({},i,m),b=Ue({},r,b);else if(e.errorsWhileComputingFlags)if(l){var k=new Set(Object.keys(l).filter(function(e){var t;return!(null!=(t=l[e])&&t.failed)}));y=Ue({},n,Object.fromEntries(Object.entries(y).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)}))),m=Ue({},i,Object.fromEntries(Object.entries(m||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)}))),b=Ue({},r,Object.fromEntries(Object.entries(b||{}).filter(function(e){var t=_sliced_to_array(e,1)[0];return k.has(t)})))}else y=Ue({},n,y),m=Ue({},i,m),b=Ue({},r,b);t&&t.register(Ue((_define_property(g={},Oi,Object.keys(Xa(y))),_define_property(g,Fi,y||{}),_define_property(g,Ri,m||{}),_define_property(g,Ii,b||{}),g),f?_define_property({},Mi,f):{},h?_define_property({},Ui,h):{}))}}}(e,this.ni,i,r,s,n),t||(this.ss=!1),this.gs(t)}}},{key:"override",value:function(e,t){void 0===t&&(t=!1),Va.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){if(!this._instance.__loaded||!this.ni)return Va.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ni.unregister(Ci),this.ni.unregister(Ti),this.gs(),Ga.info("All overrides cleared");if(ot(e)){var t=Ka(e);return this.ni.register(_define_property({},Ci,t)),this.gs(),Ga.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.Kn=Boolean(null!==(n=i.suppressWarning)&&void 0!==n&&n),"flags"in i)if(!1===i.flags)this.ni.unregister(Ci),Ga.info("Flag overrides cleared");else if(i.flags){if(ot(i.flags)){var r=Ka(i.flags);this.ni.register(_define_property({},Ci,r))}else this.ni.register(_define_property({},Ci,i.flags));Ga.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this.ni.unregister(Ti),Ga.info("Payload overrides cleared")):i.payloads&&(this.ni.register(_define_property({},Ti,i.payloads)),Ga.info("Payload overrides set",{payloads:i.payloads}))),void this.gs()}if(e&&"object"==(void 0===e?"undefined":_type_of(e)))return this.ni.register(_define_property({},Ci,e)),this.gs(),Ga.info("Flag overrides set",{flags:e});Va.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.Yn){var n=this.ys(),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.os($i)||[]).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,u=Ue({},this.getFlagVariants(),_define_property({},e,t));null==(i=this.ni)||i.register((_define_property(a={},Oi,Object.keys(Xa(u))),_define_property(a,Fi,u),a)),this.gs()}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i=this;void 0===t&&(t=!1);var r=this.os($i),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.qt.token+s),method:"GET",callback:function(t){var n,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(n=i.ni)||n.unregister($i),null==(r=i.ni)||r.register(_define_property({},$i,s)),e(s)}}})}},{key:"ys",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:"gs",value:function(e){var t=this.ys(),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.os(Ai)||{},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({},Ai,Ue({},n,s,i))),t&&this._instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this._instance.unregister(Ai)}},{key:"setGroupPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.os(qi)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(function(t){n[t]=Ue({},n[t],e[t]),delete e[t]}),this._instance.register(_define_property({},qi,Ue({},n,e))),t&&this._instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.os(qi)||{};this._instance.register(_define_property({},qi,Ue({},t,_define_property({},e,{}))))}else this._instance.unregister(qi)}},{key:"reset",value:function(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.ps(),this.Kn=!1}}]),e}()},iu={sessionRecording:function(){function e(t){if(_class_call_check(this,e),this._forceAllowLocalhostNetworkCapture=!1,this._s=Sa,this.ws=void 0,this._instance=t,!this._instance.sessionManager)throw Ra.error("started without valid sessionManager"),new Error(Ia+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===rr)throw new Error(Ia+' cannot be used with cookieless_mode="always"')}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"ni",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!(null==(e=this.bs)||!e.isStarted)}},{key:"status",get:function(){var e,t;return this._s===Fa||this._s===Oa?this._s:null!==(e=null==(t=this.bs)?void 0:t.status)&&void 0!==e?e:this._s}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"xs",get:function(){var e,t=!(null==(e=this._instance.get_property(bi))||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return $e&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){var t;if(!this.xs||null==(t=this.bs)||!t.isStarted){var n=!ct(Object.assign)&&!ct(Array.from);this.xs&&n?(this.Ss(e),Ra.info("starting")):(this._s=Sa,this.stopRecording())}}},{key:"Ss",value:function(e){var t,n,i,r=this;this.xs&&(this._s!==Fa&&this._s!==Oa&&(this._s=Pa),null!=Ne&&null!=(t=Ne.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=Ne.__PosthogExtensions__)&&n.initSessionRecording?this.ks(e):null==(i=Ne.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Cs,function(t){if(t)return Ra.error("could not load recorder",t);r.ks(e)}))}},{key:"stopRecording",value:function(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.stop()}},{key:"Is",value:function(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.discard()}},{key:"Ts",value:function(){var e;null==(e=this.ni)||e.unregister(Pi)}},{key:"Es",value:function(e,t){if(_t(e))return null;var n,i=pt(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Ra.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}},{key:"Ms",value:function(e){var t=this;if(this.ni){var n,i,r=this.ni,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.Es(null==(n=t.qt.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.Es(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;_t(a)&&t.Ts();var u=null==i?void 0:i.minimumDurationMilliseconds;r.register(_define_property({},bi,Ue({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:Ue({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:ct(u)?null:u,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})))};s(),null==(n=this.ws)||n.call(this),this.ws=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ms(e),void this.Is()):(this.Ms(e),void this.startIfEnabledOrStop()):(this._s===Fa&&(this._s=Oa,Ra.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.bs)&&n.log?this.bs.log(e,t):Ra.warn("log called before recorder was ready")}},{key:"Cs",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(bi);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"Ps",value:function(){var e,t,n=this._instance.get_property(bi);if(!n)return!1;try{t="object"==(void 0===n?"undefined":_type_of(n))?n:JSON.parse(n)}catch(e){return Ra.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var i=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}},{key:"ks",value:function(e){var t,n;if(null==(t=Ne.__PosthogExtensions__)||!t.initSessionRecording)return Ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session(_define_property({},tr,!0));if(this.bs||(this.bs=null==(n=Ne.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ps()){if(this._s===Oa||this._s===Fa)return;return this._s=Fa,Ra.info("persisted remote config is stale, requesting fresh config before starting"),void new $s(this._instance).load()}this._s=Pa,this.bs.start(e)}},{key:"onRRwebEmit",value:function(e){var t;null==(t=this.bs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.bs||null==(t=this.ni)||t.register(_define_property({},wi,!0)),null==(e=this.bs)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.bs||null==(t=this.ni)||t.register(_define_property({},ki,!0)),null==(e=this.bs)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.bs||null==(n=this.ni)||n.register(_define_property({},"url"===e?xi:Ei,!0)),null==(t=this.bs)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.bs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!(null==(n=this.bs)||!n.tryAddCustomEvent(e,t))}}]),e}()},ru={autocapture:function(){function e(t){_class_call_check(this,e),this.Rs=!1,this.Os=null,this.Ls=!1,this.instance=t,this.rageclicks=new ya(t.config.rageclick),this.Fs=null}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"qt",get:function(){var e,t,n=ut(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:"As",value:function(){var e=this;if(this.isBrowserSupported()){if($e&&Ce){var t=function(t){t=t||(null==$e?void 0:$e.event);try{e.Ns(t)}catch(e){ba.error("Failed to capture event",e)}};if(R(Ce,"submit",t,{capture:!0}),R(Ce,"change",t,{capture:!0}),R(Ce,"click",t,{capture:!0}),this.qt.capture_copied_text){var n=function(t){t=t||(null==$e?void 0:$e.event);try{e.Ns(t,ma)}catch(e){ba.error("Failed to capture copy/cut event",e)}};R(Ce,"copy",n,{capture:!0}),R(Ce,"cut",n,{capture:!0})}}}else ba.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.Rs&&(this.As(),this.Rs=!0)}},{key:"onRemoteConfig",value:function(e){e.elementsChainAsString&&(this.Ls=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(_define_property({},di,!!e.autocapture_opt_out)),this.Os=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this.Fs=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null==(t=this.Fs)||t.forEach(function(t){var i=null==Ce?void 0:Ce.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[di];if(ht(this.Os)&&!gt(n)&&!this.instance.Lr())return!1;var i=null!==(t=this.Os)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}},{key:"Ns",value:function(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=te(e);K(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(!$e||la(e))return!1;var n,i,r;if(gt(t)?(n=!!t&&ua,i=void 0):(n=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:ua,i=null==t?void 0:t.content_ignorelist),!1===n)return!1;var s=ca(e,!1).targetElementList;return!function(e,t){if(!1===e||ct(e))return!1;var n;if(!0===e)n=aa;else{if(!ot(e))return!1;if(e.length>10)return ii.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:ee(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!ne(s,n)}(i,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var r=t===ma;if(i&&function(e,t,n,i,r){var s,o,a,u;if(void 0===n&&(n=void 0),!$e||la(e))return!1;if(null!=(s=n)&&s.url_allowlist&&!J(n.url_allowlist))return!1;if(null!=(o=n)&&o.url_ignorelist&&J(n.url_ignorelist))return!1;if(null!=(a=n)&&a.dom_event_allowlist){var l=n.dom_event_allowlist;if(l&&!l.some(function(e){return t.type===e}))return!1}var c=ca(e,i),d=c.parentIsUsefulElement,f=c.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(ct(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 u,l=e[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){if(i=r(u.value))return i.v}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return!1}(f,n))return!1;if(!ne(f,null==(u=n)?void 0:u.css_selector_allowlist))return!1;var h=$e.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var _=e.tagName.toLowerCase();switch(_){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 d?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(oa.indexOf(_)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.qt,r,r?["copy","cut"]:void 0)){var s=function(e,t){var n,i,r=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,u=t.elementsChainAsString;if(!G(e))return{props:{}};for(var l=[e],c=e;c.parentNode&&!W(c,"body");)if(X(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!G(c.parentNode))break;l.push(c.parentNode),c=c.parentNode}var d,f,h,_=[],p={},v=!1,y=!1;if(O(l,function(e){var t=re(e);if(W(e,"a")){var n=e.getAttribute("href");v=t&&!!n&&oe(n)&&n}g(Z(e),"ph-no-capture")&&(y=!0),_.push(function(e,t,n,i){var r=e.tagName.toLowerCase(),s={tag_name:r};oa.indexOf(r)>-1&&!n&&(s.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?ce(1024,ae(e)):ce(1024,ee(e)));var o=Z(e);o.length>0&&(s.classes=o.filter(function(e){return""!==e})),O(e.attributes,function(n){var r;if((!se(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&oe(n.value)&&(!dt(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=n.value;"class"===n.name&&(o=Y(o).join(" ")),s["attr__"+n.name]=ce(1024,o)}});for(var a=1,u=1,l=e;l=de(l);)a++,l.tagName===e.tagName&&u++;return s.nth_child=a,s.nth_of_type=u,s}(e,s,o,a));var i=function(e){if(!re(e))return{};var t={};return O(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&&oe(i)&&(t[n]=i)}}),t}(e);_r(p,i)}),y)return{props:{},explicitNoCapture:y};if(o||(_[0].$el_text=W(e,"a")||W(e,"button")?ae(e):ee(e)),v){var m,b;_[0].attr__href=v;var k=null==(m=Zr(v))?void 0:m.host,w=null==$e||null==(b=$e.location)?void 0:b.host;k&&w&&k!==w&&(d=v)}return{props:_r({$event_type:r.type,$ce_version:1},u?{}:{$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,u=(e.attr_class.sort(),e.attr_class)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)i+="."+a.value.replace(/"/g,"")}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}var l=Ue({},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 $(l).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[ue(n.toString())]=ue(i.toString())}),(i+=":")+$(c).map(function(e){var t=_sliced_to_array(e,2);return t[0]+'="'+t[1]+'"'}).join("")}).join(";")}((h=f,h.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:le(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return $(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.qt.element_attribute_ignorelist,elementsChainAsString:this.Ls}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===ma){var u,l=Q(null==$e||null==(u=$e.getSelection())?void 0:u.toString()),c=e.type||"clipboard";if(!l)return!1;o.$selected_content=l,o.$copy_type=c}return this.instance.capture(t,o),!0}}}},{key:"isBrowserSupported",value:function(){return at(null==Ce?void 0:Ce.querySelectorAll)}}]),e}(),historyAutocapture:function(){function e(t){var n;_class_call_check(this,e),this._instance=t,this.$s=(null==$e||null==(n=$e.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&&(ii.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"stop",value:function(){this.Ds&&this.Ds(),this.Ds=void 0,ii.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){var e,t;if($e&&$e.history){var n=this;null!=(e=$e.history.pushState)&&e.__posthog_wrapped__||fe($e.history,"pushState",function(e){return function(t,i,r){e.call(this,t,i,r),n.qs("pushState")}}),null!=(t=$e.history.replaceState)&&t.__posthog_wrapped__||fe($e.history,"replaceState",function(e){return function(t,i,r){e.call(this,t,i,r),n.qs("replaceState")}}),this.js()}}},{key:"qs",value:function(e){try{var t,n=null==$e||null==(t=$e.location)?void 0:t.pathname;if(!n)return;n!==this.$s&&this.isEnabled&&this._instance.capture(cr,{navigation_type:e}),this.$s=n}catch(t){ii.error("Error capturing "+e+" pageview",t)}}},{key:"js",value:function(){var e=this;if(!this.Ds){var t=function(){e.qs("popstate")};R($e,"popstate",t),this.Ds=function(){$e&&$e.removeEventListener("popstate",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;_class_call_check(this,e),this.Hs=!1,this.Rs=!1,this.Us=null,this.instance=t,this.Hs=!(null==(n=this.instance.persistence)||!n.props[fi]),this.rageclicks=new ya(t.config.rageclick)}return _create_class(e,[{key:"qt",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return ut(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return _t(this.qt.capture_heatmaps)?_t(this.qt.enable_heatmaps)?this.Hs:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this.Rs)return;Ma.info("starting..."),this.Bs(),this.At()}else{var e;clearInterval(null!==(e=this.Us)&&void 0!==e?e:void 0),this.zs(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(_define_property({},fi,t)),this.Hs=t,this.startIfEnabled()}}},{key:"getAndClearBuffer",value:function(){var e=this.M;return this.M=void 0,e}},{key:"Vs",value:function(e){this.Mt(e.originalEvent,"deadclick")}},{key:"At",value:function(){this.Us&&clearInterval(this.Us),this.Us="visible"===(null==Ce?void 0:Ce.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}},{key:"Bs",value:function(){var e=this;$e&&Ce&&(this.Ws=this.Zr.bind(this),R($e,lr,this.Ws),this.Zs=function(t){return e.Mt(t||(null==$e?void 0:$e.event))},R(Ce,"click",this.Zs,{capture:!0}),this.Gs=function(t){return e.Qs(t||(null==$e?void 0:$e.event))},R(Ce,"mousemove",this.Gs,{capture:!0}),this.Js=new Vr(this.instance,Ur,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ks=this.At.bind(this),R(Ce,ur,this.Ks),this.Rs=!0)}},{key:"zs",value:function(){var e;$e&&Ce&&(this.Ws&&$e.removeEventListener(lr,this.Ws),this.Zs&&Ce.removeEventListener("click",this.Zs,{capture:!0}),this.Gs&&Ce.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Ks&&Ce.removeEventListener(ur,this.Ks),clearTimeout(this.Ys),null==(e=this.Js)||e.stop(),this.Rs=!1)}},{key:"Xs",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&&G(i)&&!W(i,"body");){if(i===n)return!1;if(g(t,null==$e?void 0:$e.getComputedStyle(i).position))return!0;i=ie(i)}return!1}(te(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"Mt",value:function(e,t){var n;if(void 0===t&&(t="click"),!V(e.target)&&he(e)){var i=this.Xs(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.eo(Ue({},i,{type:"rageclick"})),this.eo(i)}}},{key:"Qs",value:function(e){var t=this;!V(e.target)&&he(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(function(){t.eo(t.Xs(e,"mousemove"))},500))}},{key:"eo",value:function(e){if($e){var t=$e.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?_to_consumable_array(is).concat(_to_consumable_array(n||[])):[],r=es(t,i,ss);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}},{key:"Zr",value:function(){this.M&&!lt(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:Vr,webVitalsAutocapture:function(){function e(t){var n,i=this;_class_call_check(this,e),this.Hs=!1,this.Rs=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=function(){clearTimeout(i.io),0!==i.M.metrics.length&&(i._instance.capture("$web_vitals",i.M.metrics.reduce(function(e,t){var n;return Ue({},e,(_define_property(n={},"$web_vitals_"+t.name+"_event",Ue({},t)),_define_property(n,"$web_vitals_"+t.name+"_value",t.value),n))},{})),i.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=function(e){var t;i.M=i.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=i.no();if(!ct(n))if(_t(null==e?void 0:e.name)||_t(null==e?void 0:e.value))xa.error("Invalid metric received",e);else if(!i.so||i.so>e.value){i.M.url!==n&&(i.ro(),i.io=setTimeout(i.ro,i.flushToCaptureTimeoutMs)),ct(i.M.url)&&(i.M.url=n),i.M.firstMetricTimestamp=ct(i.M.firstMetricTimestamp)?Date.now():i.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=i._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=Ue({},e,{$current_url:n,timestamp:Date.now()});ct(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),i.M.metrics.push(s),i.M.metrics.length===i.allowedMetrics.length&&i.ro()}else xa.error("Ignoring metric with value >= "+i.so,e)},this.oo=function(){if(!i.Rs){var e,t,n,r,s,o=Ne.__PosthogExtensions__;ct(o)||ct(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.ht.bind(i)),i.allowedMetrics.indexOf("CLS")>-1&&t(i.ht.bind(i)),i.allowedMetrics.indexOf("FCP")>-1&&n(i.ht.bind(i)),i.allowedMetrics.indexOf("INP")>-1&&r(i.ht.bind(i)),i.Rs=!0):xa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Hs=!(null==(n=this._instance.persistence)||!n.props[vi]),this.startIfEnabled()}return _create_class(e,[{key:"ao",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=ut(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return _t(n)?(null==(t=this._instance.persistence)?void 0:t.props[mi])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(ut(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"useAttribution",get:function(){var e=ut(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}},{key:"so",get:function(){var e=ut(this.ao)&&pt(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:Ea;return e>0&&6e4>=e?Ea:e}},{key:"isEnabled",get:function(){var e=null==Te?void 0:Te.protocol;if("http:"!==e&&"https:"!==e)return xa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ut(this.ao)?this.ao.web_vitals:gt(this.ao)?this.ao:void 0;return gt(t)?t:this.Hs}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.Rs&&(xa.info("enabled, starting..."),this.lr(this.oo))}},{key:"onRemoteConfig",value:function(e){if("capturePerformance"in e){var t=ut(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=ut(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register(_define_property({},vi,t)),this._instance.persistence.register(_define_property({},mi,n))),this.Hs=t,this.startIfEnabled()}}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",function(t){t?xa.error("failed to load script",t):e()})}},{key:"no",value:function(){var e=$e?$e.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(is).concat(_to_consumable_array(t||[])):[];return es(e,n,ss)}xa.error("Could not determine current URL")}}]),e}()},su={exceptionObserver:function(){function e(t){var n,i,r,s=this;_class_call_check(this,e),this.oo=function(){var e;if($e&&s.isEnabled&&null!=(e=Ne.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Ne.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!s.uo&&s.qt.capture_unhandled_errors&&(s.uo=t(s.captureException.bind(s))),!s.lo&&s.qt.capture_unhandled_rejections&&(s.lo=n(s.captureException.bind(s))),!s.ho&&s.qt.capture_console_errors&&(s.ho=i(s.captureException.bind(s)))}catch(e){ka.error("failed to start",e),s.co()}}},this._instance=t,this.do=!(null==(n=this._instance.persistence)||!n.props[hi]),this.vo=new Ot({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,Gt:ka}),this.qt=this.fo(),this.startIfEnabledOrStop()}return _create_class(e,[{key:"fo",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ut(e)?t=Ue({},t,e):(ct(e)?this.do:e)&&(t=Ue({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(ka.info("enabled"),this.co(),this.lr(this.oo)):this.co()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",function(t){if(t)return ka.error("failed to load script",t);e()})}},{key:"co",value:function(){var e,t,n;null==(e=this.uo)||e.call(this),this.uo=void 0,null==(t=this.lo)||t.call(this),this.lo=void 0,null==(n=this.ho)||n.call(this),this.ho=void 0}},{key:"onRemoteConfig",value:function(e){"autocaptureExceptions"in e&&(this.do=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register(_define_property({},hi,this.do)),this.qt=this.fo(),this.startIfEnabledOrStop())}},{key:"onConfigChange",value:function(){this.qt=this.fo()}},{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.vo.consumeRateLimit(r)?ka.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.po=[],this.mo=new In([new Hn,new Yn,new Un,new zn,new Kn,new Wn,new Vn,new Xn],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 u=Nn.test(a)?a.replace(Nn,"$1"):a;if(!u.match(/\S*Error: /)){var l=!0,c=!1,d=void 0;try{for(var f,h=n[Symbol.iterator]();!(l=(f=h.next()).done);l=!0){var _=(0,f.value)(u,e);if(_){r.push(_);break}}}catch(e){c=!0,d=e}finally{try{l||null==h.return||h.return()}finally{if(c)throw d}}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 Ue({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||Rn});var n})}(r)}}("web:javascript",qn,Dn)),this._instance=t,this.po=null!==(n=null==(i=this._instance.persistence)?void 0:i.get_property(_i))&&void 0!==n?n:[],this.yo=S(this.bo()),this._o=new ti(this.yo)}return _create_class(e,[{key:"onConfigChange",value:function(){this.yo=S(this.bo()),this._o.setConfig(this.yo)}},{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.po=s,this._instance.persistence&&this._instance.persistence.register((_define_property(r={},_i,this.po),_define_property(r,pi,o),r))}}},{key:"wo",get:function(){var e,t=!!this._instance.get_property(pi),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.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"addExceptionStep",value:function(e,t){if(this.yo.enabled)try{if(!dt(e)||0===e.trim().length)return void Ya.warn("Ignoring exception step because message must be a non-empty string");var n,i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(function(n,i){return Qn.has(i)?(t.push(i),n):(n[i]=e[i],n)},{}),droppedKeys:t}}(this.xo(t)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&Ya.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(Ue((_define_property(n={},Jn,e),_define_property(n,Zn,(new Date).toISOString()),n),r))}catch(e){Ya.error("Failed to add exception step. Ignoring breadcrumb.",e)}}},{key:"sendExceptionEvent",value:function(e){try{var t=e.$exception_list;if(this.So(t)){if(this.ko(t))return this.Co("Exception dropped: matched a suppression rule"),void Ya.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void Ya.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Ya.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.yo.enabled&&_t(e.$exception_steps)?this.Eo(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return i&&this._o.clear(),i}catch(e){return Ya.error("Failed to capture exception event. Dropping this exception.",e),void this._o.clear()}}catch(e){return void Ya.error("Failed to process exception event. Ignoring this exception.",e)}}},{key:"Eo",value:function(e){try{var t=this._o.getAttachable();return 0===t.length?e:Ue({},e,{$exception_steps:t})}catch(t){return Ya.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}},{key:"Co",value:function(e){var t;this.yo.enabled&&this._o.add((_define_property(t={},Jn,e),_define_property(t,Zn,(new Date).toISOString()),t))}},{key:"xo",value:function(e){return ut(e)?Ue({},e):{}}},{key:"bo",value:function(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}},{key:"ko",value:function(e){if(0===e.length)return!1;var t=e.reduce(function(e,t){var n=t.type,i=t.value;return dt(n)&&n.length>0&&e.$exception_types.push(n),dt(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.po.some(function(e){var n=e.values.map(function(e){var n,i=Io[e.operator],r=ot(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:"Io",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:"To",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:"So",value:function(e){return!_t(e)&&ot(e)}}]),e}()},ou=Ue({productTours:function(){function e(t){_class_call_check(this,e),this.Mo=null,this.Po=null,this._instance=t}return _create_class(e,[{key:"ni",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){"productTours"in e&&(this.ni&&this.ni.register(_define_property({},yi,!!e.productTours)),this.loadIfEnabled())}},{key:"loadIfEnabled",value:function(){var e,t,n=this;this.Mo||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(yi)||this.lr(function(){return n.Ro()})}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",function(t){t?Ca.error("Could not load product tours script",t):e()})}},{key:"Ro",value:function(){var e;!this.Mo&&null!=(e=Ne.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=Ne.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e,t){var n=this;if(void 0===t&&(t=!1),!ot(this.Po)||t){var i=this.ni;if(i){var r=i.props[Di];if(ot(r)&&!t)return this.Po=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 Ca.error(s),void e([],{isLoaded:!1,error:s})}var o=ot(t.json.product_tours)?t.json.product_tours:[];n.Po=o,i&&i.register(_define_property({},Di,o)),e(o,{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}},{key:"getActiveProductTours",value:function(e){_t(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.Mo)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.Mo?this.Mo.previewTour(e):this.lr(function(){var n;t.Ro(),null==(n=t.Mo)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.Mo)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.Mo)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.Po=null,null==(e=this.ni)||e.unregister(Di)}},{key:"resetTour",value:function(e){var t;null==(t=this.Mo)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.Mo)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}]),e}()},nu),au={siteApps:function(){function e(t){_class_call_check(this,e),this._instance=t,this.Oo=[],this.apps={}}return _create_class(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"Lo",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.Oo.push(n),this.Oo.length>1e3&&(this.Oo=this.Oo.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=Ne._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.Lo.bind(this));this.Fo=function(){t(),e.Oo=[],e.Fo=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 u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{},d=!0,f=!1,h=void 0;try{for(var _,p=Object.entries(c)[Symbol.iterator]();!(d=(_=p.next()).done);d=!0){var g=_sliced_to_array(_.value,2),y=g[0],m=g[1];u[y]={id:l[y],type:y,properties:m}}}catch(e){f=!0,h=e}finally{try{d||null==p.return||p.return()}finally{if(f)throw h}}var b=e.$set_once,k=e.$set;return{event:Ue({},v(e,Ta),{properties:Ue({},e.properties,k?{$set:Ue({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},k)}:{},b?{$set_once:Ue({},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:u}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.Oo.length&&(Aa.info("Processing "+t.Oo.length+" events for site app with id "+e.id),t.Oo.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.Fo)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,Aa.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){Aa.error(qa+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){Aa.error("Error while processing buffered events PostHog app with config id "+e.id,t),n.errored=!0}}},{key:"Ao",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,u=!1,l=void 0;try{for(var c,d=e[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value;this.setupSiteApp(f)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}},{key:"No",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){Aa.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.Ao(),void this._instance.on("eventCaptured",function(e){return r.No(e)})):void Aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.Fo)||n.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var o=function(e){var t;Ne["__$$ph_site_app_"+e]=s._instance,null==(t=Ne.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,_,function(t){if(t)return Aa.error(qa+e,t)})},a=!0,u=!1,l=void 0;try{for(var c,d=e.siteApps[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value,h=f.id,_=f.url;o(h)}}catch(e){u=!0,l=e}finally{try{a||null==d.return||d.return()}finally{if(u)throw l}}}else Aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}]),e}()},uu={tracingHeaders:function(){function e(t){var n=this;_class_call_check(this,e),this.$o=void 0,this.Do=void 0,this.oo=function(){var e,t,i=n.qo()||[];ct(n.$o)&&(null==(e=Ne.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,n._instance.get_distinct_id(),n._instance.sessionManager)),ct(n.Do)&&(null==(t=Ne.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,n._instance.get_distinct_id(),n._instance.sessionManager))},this._instance=t}return _create_class(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"lr",value:function(e){var t,n;null!=(t=Ne.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=Ne.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",function(t){if(t)return wa.error("failed to load script",t);e()})}},{key:"qo",value:function(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}},{key:"startIfEnabledOrStop",value:function(){var e,t;this.qo()?this.lr(this.oo):(null==(e=this.$o)||e.call(this),null==(t=this.Do)||t.call(this),this.$o=void 0,this.Do=void 0)}}]),e}()},lu=Ue({surveys:function(){function e(t){_class_call_check(this,e),this.jo=void 0,this._surveyManager=null,this.Ho=!1,this.Uo=[],this.Bo=null,this._instance=t,this._surveyEventReceiver=null}return _create_class(e,[{key:"qt",get:function(){return this._instance.config}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this.qt.disable_surveys){var t=e.surveys;if(_t(t))return qo.warn("Flags not loaded yet. Not loading surveys.");var n=ot(t);this.jo=n?t.length>0:t,qo.info("flags response received, isSurveysEnabled: "+this.jo),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(jo)||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.Ho)qo.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)qo.info(Ha);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())qo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t){if(!ct(this.jo)||this.qt.advanced_enable_surveys){var n=this.jo||this.qt.advanced_enable_surveys;this.Ho=!0;try{var i=t.generateSurveys;if(i)return void this.zo(i,n);var r=t.loadExternalDependency;if(!r)return void this.Vo(nr);r(this._instance,"surveys",function(i){i||!t.generateSurveys?e.Vo("Could not load surveys script",i):e.zo(t.generateSurveys,n)})}catch(e){throw this.Vo("Error initializing surveys",e),e}finally{this.Ho=!1}}}else qo.error("PostHog Extensions not found.")}}},{key:"zo",value:function(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Da(this._instance),qo.info("Surveys loaded successfully"),this.Wo({isLoaded:!0})}},{key:"Vo",value:function(e,t){qo.error(e,t),this.Wo({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.Uo.push(e),this._surveyManager&&this.Wo({isLoaded:!0}),function(){t.Uo=t.Uo.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e,t){var n=this;if(void 0===t&&(t=!1),this.qt.disable_surveys)return qo.info(Ha),e([]);var i,r=this._instance.get_property(ji);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Bo?this.Bo.then(function(t){var n=t.surveys,i=t.context;return e(n,i)}):("undefined"!=typeof Promise&&(this.Bo=new Promise(function(e){i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:function(t){var r;n.Bo=null;var s=t.statusCode;if(200!==s||!t.json){var o="Surveys API could not be loaded, status: "+s;qo.error(o);var a={isLoaded:!1,error:o};return e([],a),void(null==i||i({surveys:[],context:a}))}var u,l=t.json.surveys||[],c=l.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==(u=n._surveyEventReceiver)||u.register(c)),null==(r=n._instance.persistence)||r.register(_define_property({},ji,l));var d={isLoaded:!0};e(l,d),null==i||i({surveys:l,context:d})}}))}},{key:"Wo",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.Uo[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){qo.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),!_t(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qo.warn("init was not called")}},{key:"Zo",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:"Go",value:function(e){if(_t(this._surveyManager))return{eligible:!1,reason:Na};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(_t(this._surveyManager))return qo.warn("init was not called"),{visible:!1,disabledReason:Na};var t=this.Go(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;return _t(this._surveyManager)?(qo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Na})):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.Go(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(_t(this._surveyManager))qo.warn("init was not called");else{var s="string"==typeof e?this.Zo(e):e;if(null!=s&&s.id)if(Lo.includes(s.type)){var o=null==Ce?void 0:Ce.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(qo.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(function(){var e,t;qo.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),qo.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);qo.warn("Survey element not found")}else qo.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qo.warn("Survey not found")}}},{key:"displaySurvey",value:function(e,t){var n;if(_t(this._surveyManager))qo.warn("init was not called");else{var i=this.Zo(e);if(i){var r=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=Ue({},i,{appearance:Ue({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ks&&t.initialResponses&&qo.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 qo.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==ws?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else qo.warn("Survey not found")}}},{key:"cancelPendingSurvey",value:function(e){_t(this._surveyManager)?qo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}]),e}()},nu),cu={toolbar:function(){function e(t){_class_call_check(this,e),this.instance=t}return _create_class(e,[{key:"Qo",value:function(e){Ne.ph_toolbar_state=e}},{key:"Jo",value:function(){var e;return null!==(e=Ne.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),M(this.instance.config))return!1;if(!$e||!Ce)return!1;e=null!=e?e:$e.location,n=null!=n?n:$e.history;try{if(!t){try{$e.localStorage.setItem("test","test"),$e.localStorage.removeItem("test")}catch(e){return!1}t=null==$e?void 0:$e.localStorage}var i,r=za||ts(e.hash,"__posthog")||ts(e.hash,"state"),s=r?pr(function(){return JSON.parse(atob(decodeURIComponent(r)))})||pr(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(Ua)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}},{key:"Ko",value:function(e){var t=Ne.ph_load_toolbar||Ne.ph_load_editor;!_t(t)&&at(t)?t(e,this.instance):Ba.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t=this,n=!(null==Ce||!Ce.getElementById(Ji));if(!$e||n)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=Ue({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if($e.localStorage.setItem(Ua,JSON.stringify(Ue({},r,{source:void 0}))),2===this.Jo())this.Ko(r);else if(0===this.Jo()){var s;this.Qo(1),null==(s=Ne.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",function(e){if(e)return Ba.error("[Toolbar] Failed to load",e),void t.Qo(0);t.Qo(2),t.Ko(r)}),R($e,"turbolinks:load",function(){t.Qo(0),t.loadToolbar(r)})}return!0}},{key:"Yo",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}()},du=Ue({experiments:Qa},nu),fu={conversations:function(){function e(t){_class_call_check(this,e),this.Xo=void 0,this._conversationsManager=null,this.ea=!1,this.ta=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;_t(t)||(gt(t)?this.Xo=t:(this.Xo=t.enabled,this.ta=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Xo=void 0,this.ta=null}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.ea||this._instance.config.disable_conversations||M(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t&&!ct(this.Xo)&&this.Xo)if(this.ta&&this.ta.token){this.ea=!0;try{var n=t.initConversations;if(n)return this.ra(n),void(this.ea=!1);var i=t.loadExternalDependency;if(!i)return void this.ia(nr);i(this._instance,"conversations",function(n){n||!t.initConversations?e.ia("Could not load conversations script",n):e.ra(t.initConversations),e.ea=!1})}catch(e){this.ia("Error initializing conversations",e),this.ea=!1}}else eu.error("Conversations enabled but missing token in remote config.")}}},{key:"ra",value:function(e){if(this.ta)try{this._conversationsManager=e(this.ta,this._instance),eu.info("Conversations loaded successfully")}catch(e){this.ia("Error completing conversations initialization",e)}else eu.error("Cannot complete initialization: remote config is null")}},{key:"ia",value:function(e,t){eu.error(e,t),this._conversationsManager=null,this.ea=!1}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():eu.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Xo&&!ht(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 p(function(){return _ts_generator(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(eu.warn(tu),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return p(function(){return _ts_generator(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(eu.warn(tu),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(eu.warn(tu),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(eu.warn(tu),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(eu.warn(tu),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return p(function(){return _ts_generator(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(eu.warn(tu),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return p(function(){return _ts_generator(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(eu.warn(tu),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:"ln",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"hn",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},hu={logs:function(){function e(t){var n;_class_call_check(this,e),this.na=!1,this.sa=!1,this.Gt=ri("[logs]"),this.oa=[],this.aa=0,this.ua=0,this.la=!1,this._instance=t,this._instance&&null!=(n=this._instance.config.logs)&&n.captureConsoleLogs&&(this.na=!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;!_t(n)&&n&&(this.na=!0,this.loadIfEnabled())}},{key:"reset",value:function(){this.oa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.aa=0,this.ua=0,this.la=!1}},{key:"loadIfEnabled",value:function(){var e=this;if(this.na&&!this.sa){var t=null==Ne?void 0:Ne.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",function(n){var i;n||null==(i=t.logs)||!i.initializeLogs?e.Gt.error("Could not load logs script",n):(t.logs.initializeLogs(e._instance),e.sa=!0)}):this.Gt.error(nr)}else this.Gt.error("PostHog Extensions not found.")}}},{key:"captureLog",value:function(e){var t,n,i,r,s,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!==(t=null==(n=this._instance.config.logs)?void 0:n.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(i=null==(r=this._instance.config.logs)?void 0:r.maxLogsPerInterval)&&void 0!==i?i:1e3,l=Date.now();if(a>l-this.ua||(this.ua=l,this.aa=0,this.la=!1),u>this.aa){this.aa++;var c=function(e,t){var n=e.level||"info",i=Fn[n]||On,r=i.text,s=i.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var u=Ue({},a,e.attributes||{}),l={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:r,body:{stringValue:e.body},attributes:k(u)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),ct(e.trace_flags)||(l.flags=e.trace_flags),l}(e,this.ha());this.oa.push({record:c}),(null!==(s=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==s?s:100)>this.oa.length?this.ca():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+u+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}},{key:"logger",get:function(){var e=this;return this.da||(this.da={trace:function(t,n){return e.captureLog({body:t,level:"trace",attributes:n})},debug:function(t,n){return e.captureLog({body:t,level:"debug",attributes:n})},info:function(t,n){return e.captureLog({body:t,level:"info",attributes:n})},warn:function(t,n){return e.captureLog({body:t,level:"warn",attributes:n})},error:function(t,n){return e.captureLog({body:t,level:"error",attributes:n})},fatal:function(t,n){return e.captureLog({body:t,level:"fatal",attributes:n})}}),this.da}},{key:"flushLogs",value:function(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),0!==this.oa.length){var t=this.oa;this.oa=[];var n=this._instance.config.logs,i=Ue({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),r=(o=t.map(function(e){return e.record}),a=i,u=ze.LIB_NAME,l=ze.LIB_VERSION,{resourceLogs:[{resource:{attributes:k(a)},scopeLogs:[{scope:{name:u,version:l},logRecords:o}]}]}),s=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:s,data:r,compression:"best-available",batchKey:"logs",transport:e})}var o,a,u,l}},{key:"ca",value:function(){var e,t,n=this;this.qr||(this.qr=setTimeout(function(){n.qr=void 0,n.flushLogs()},null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}},{key:"ha",value:function(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId;t.sessionId=n}if(null!=Ne&&null!=(e=Ne.location)&&e.href&&(t.currentUrl=Ne.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}]),e}()},_u=Ue({},nu,iu,ru,su,ou,au,lu,uu,cu,du,fu,hu);na.__defaultExtensionClasses=Ue({},_u);var pu,vu=($a=Uo[Yo]=new na,function(){function e(){e.done||(e.done=!0,Jo=!1,O(Uo,function(e){e._dom_loaded()}))}null!=Ce&&Ce.addEventListener?"complete"===Ce.readyState?e():R(Ce,"DOMContentLoaded",e,{capture:!1}):$e&&ii.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$a),gu={},yu={type:"posthog",config:{},init:function(e){return _async_to_generator(function(e){var t,n,i,r,s,o,a,u,l;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=pe(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),u=!1,r.init(s,_object_spread_props(_object_spread({},a),{loaded:function(){u=!0}})),u?[3,2]:[4,Promise.resolve()]):[2,!1];case 1:c.sent(),c.label=2;case 2:return l={lastIdentity:{},lastGroup:{}},[2,_object_spread_props(_object_spread({},t),{settings:_object_spread_props(_object_spread({},i),{_state:l})})]}})}).apply(this,arguments)},push:function(e,t){return _async_to_generator(function(e,t){var n,i,r,s,o,a,c,d,f,_,p,v,g,y,m,b,k,w;return _ts_generator(this,function(x){switch(x.label){case 0:return n=t.config,i=t.rule,r=t.env,s=t.data,o=t.collector,d=pe(r),f=n.settings||{},_=(null==i?void 0:i.settings)||{},p=f._state||{},void 0===_.reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3]);case 1:return[4,h(e,_.reset,{collector:o})];case 2:v=x.sent(),x.label=3;case 3:v&&(d.reset(),p.lastIdentity={},p.lastGroup={}),x.label=4;case 4:return void 0===(g=null!==(a=_.identify)&&void 0!==a?a:f.identify)?[3,6]:[4,h(e,g,{collector:o})];case 5:y=x.sent(),u(y)&&(p.lastIdentity=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_object_spread({},n),r=t.distinctId,s=u(t.$set)?t.$set:void 0,o=u(t.$set_once)?t.$set_once:void 0;return l(r)&&""!==r?(r!==n.distinctId||s||o)&&(e.identify(r,s,o),i.distinctId=r):(s||o)&&e.setPersonProperties(s,o),i}(d,y,p.lastIdentity)),x.label=6;case 6:return void 0===(m=null!==(c=_.group)&&void 0!==c?c:f.group)?[3,8]:[4,h(e,m,{collector:o})];case 7:b=x.sent(),u(b)&&(p.lastGroup=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_object_spread({},n),r=t.type,s=t.key,o=u(t.properties)?t.properties:void 0;return l(r)&&l(s)&&(r!==n.type||s!==n.key||o)&&(e.group(r,s,o),i.type=r,i.key=s),i}(d,b,p.lastGroup)),x.label=8;case 8:return!0!==(null==i?void 0:i.silent)&&(k=l(null==i?void 0:i.name)?i.name:e.name,w=u(s)?s:{},d.capture(k,w)),f._state=p,[2]}})}).apply(this,arguments)},on:function(e,t){var n;if("consent"===e&&(null==t?void 0:t.data)){var i=pe(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()}}},mu=yu;return pu=be,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,u=function(){var r=a.value;me.call(e,r)||r===n||ve(e,r,{get:function(){return t[r]},enumerable:!(i=ge(t,r))||i.enumerable})},l=ye(t)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)u()}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}}return e}(ve({},"__esModule",{value:!0}),pu)}();