posthog-js 1.200.0 → 1.200.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/customizations.full.js +1 -1
  14. package/dist/customizations.full.js.map +1 -1
  15. package/dist/dead-clicks-autocapture.js.map +1 -1
  16. package/dist/exception-autocapture.js.map +1 -1
  17. package/dist/external-scripts-loader.js.map +1 -1
  18. package/dist/main.js +1 -1
  19. package/dist/main.js.map +1 -1
  20. package/dist/module.d.ts +5 -0
  21. package/dist/module.full.d.ts +5 -0
  22. package/dist/module.full.js +1 -1
  23. package/dist/module.full.js.map +1 -1
  24. package/dist/module.full.no-external.d.ts +5 -0
  25. package/dist/module.full.no-external.js +1 -1
  26. package/dist/module.full.no-external.js.map +1 -1
  27. package/dist/module.js +1 -1
  28. package/dist/module.js.map +1 -1
  29. package/dist/module.no-external.d.ts +5 -0
  30. package/dist/module.no-external.js +1 -1
  31. package/dist/module.no-external.js.map +1 -1
  32. package/dist/recorder-v2.js.map +1 -1
  33. package/dist/recorder.js.map +1 -1
  34. package/dist/src/constants.d.ts +6 -0
  35. package/dist/src/entrypoints/tracing-headers.d.ts +2 -2
  36. package/dist/src/types.d.ts +5 -0
  37. package/dist/src/utils/globals.d.ts +2 -2
  38. package/dist/surveys-preview.js.map +1 -1
  39. package/dist/surveys.js.map +1 -1
  40. package/dist/tracing-headers.js +1 -1
  41. package/dist/tracing-headers.js.map +1 -1
  42. package/dist/web-vitals.js.map +1 -1
  43. package/lib/package.json +1 -1
  44. package/lib/src/constants.d.ts +6 -0
  45. package/lib/src/constants.js +6 -0
  46. package/lib/src/constants.js.map +1 -1
  47. package/lib/src/entrypoints/tracing-headers.d.ts +2 -2
  48. package/lib/src/entrypoints/tracing-headers.js +5 -3
  49. package/lib/src/entrypoints/tracing-headers.js.map +1 -1
  50. package/lib/src/extensions/replay/sessionrecording.js +3 -0
  51. package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
  52. package/lib/src/extensions/tracing-headers.js +0 -1
  53. package/lib/src/extensions/tracing-headers.js.map +1 -1
  54. package/lib/src/posthog-core.js +36 -13
  55. package/lib/src/posthog-core.js.map +1 -1
  56. package/lib/src/sessionid.js +6 -0
  57. package/lib/src/sessionid.js.map +1 -1
  58. package/lib/src/types.d.ts +5 -0
  59. package/lib/src/types.js.map +1 -1
  60. package/lib/src/utils/globals.d.ts +2 -2
  61. package/lib/src/utils/globals.js.map +1 -1
  62. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,i=Array.prototype,r=i.forEach,s=i.indexOf,n=null==t?void 0:t.navigator,o=null==t?void 0:t.document,a=null==t?void 0:t.location,l=null==t?void 0:t.fetch,u=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,c=null==t?void 0:t.AbortController,d=null==n?void 0:n.userAgent,h=null!=e?e:{},p={DEBUG:!1,LIB_VERSION:"1.200.0"},_={},v=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function g(e,t,i){if(A(e))if(r&&e.forEach===r)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var s=0,n=e.length;s<n;s++)if(s in e&&t.call(i,e[s],s)===_)return}function f(e,t,i){if(!z(e)){if(A(e))return g(e,t,i);if(V(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===_)return}else for(var s in e)if(L.call(e,s)&&t.call(i,e[s],s)===_)return}}var m=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e};function b(e,t){return-1!==e.indexOf(t)}function y(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var w=function(e){try{return e()}catch(e){return}},S=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Y.critical(e)}}},E=function(e){var t={};return f(e,(function(e,i){H(e)&&e.length>0&&(t[i]=e)})),t},k=function(e){return e.replace(/^\$/,"")};function x(e,t){return i=e,r=e=>H(e)&&!j(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t,i):t:s.has(t)?void 0:(s.add(t),A(t)?(n=[],g(t,(t=>{n.push(e(t))}))):(n={},f(t,((t,i)=>{s.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,r,s}var C=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),j(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},I=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(i,r,s,n,o){if(i)if(i.addEventListener&&!n)i.addEventListener(r,s,!!o);else{var a="on"+r,l=i[a];i[a]=function(i,r,s){return function(n){if(n=n||t(null==e?void 0:e.event)){var o,a=!0;D(s)&&(o=s(n));var l=r.call(i,n);return!1!==o&&!1!==l||(a=!1),a}}}(i,s,l)}else Y.error("No valid element provided to register_event")}}();function P(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}var T,R="$copy_autocapture",F=["$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"];exports.Compression=void 0,(T=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",T.Base64="base64";var $=Array.isArray,O=Object.prototype,L=O.hasOwnProperty,M=O.toString,A=$||function(e){return"[object Array]"===M.call(e)},D=e=>"function"==typeof e,N=e=>e===Object(e)&&!A(e),q=e=>{if(N(e)){for(var t in e)if(L.call(e,t))return!1;return!0}return!1},B=e=>void 0===e,H=e=>"[object String]"==M.call(e),U=e=>H(e)&&0===e.trim().length,j=e=>null===e,z=e=>B(e)||j(e),W=e=>"[object Number]"==M.call(e),G=e=>"[object Boolean]"===M.call(e),V=e=>e instanceof FormData,Q=e=>b(F,e),J=t=>{var i={_log:function(i){if(e&&(p.DEBUG||h.POSTHOG_DEBUG)&&!B(e.console)&&e.console){for(var r=("__rrweb_original__"in e.console[i]?e.console[i].__rrweb_original__:e.console[i]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;o<s;o++)n[o-1]=arguments[o];r(t,...n)}},info:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("error",...t)},critical:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling ".concat(e))},createLogger:e=>J("".concat(t," ").concat(e))};return i},Y=J("[PostHog.js]"),X=Y.createLogger,K=X("[ExternalScriptsLoader]"),Z=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return K.warn("".concat(t," was requested but loading of external scripts is disabled.")),i("Loading of external scripts is disabled");var r=()=>{if(!o)return i("document not found");var e=o.createElement("script");e.type="text/javascript",e.crossOrigin="anonymous",e.src=t,e.onload=e=>i(void 0,e),e.onerror=e=>i(e);var r,s=o.querySelectorAll("body > script");s.length>0?null===(r=s[0].parentNode)||void 0===r||r.insertBefore(e,s[0]):o.body.appendChild(e)};null!=o&&o.body?r():null==o||o.addEventListener("DOMContentLoaded",r)};function ee(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function te(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(i),!0).forEach((function(t){ie(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ee(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ie(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function re(e,t){if(null==e)return{};var i,r,s=function(e,t){if(null==e)return{};var i,r,s={},n=Object.keys(e);for(r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(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}h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if("remote-config"===t&&(r="/array/".concat(e.config.token,"/config.js")),"toolbar"===t){var s=3e5,n=Math.floor(Date.now()/s)*s;r="".concat(r,"&t=").concat(n)}var o=e.requestRouter.endpointFor("assets",r);Z(e,o,i)},h.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);Z(e,r,i)};var se="$people_distinct_id",ne="__alias",oe="__timers",ae="$autocapture_disabled_server_side",le="$heatmaps_enabled_server_side",ue="$exception_capture_enabled_server_side",ce="$web_vitals_enabled_server_side",de="$dead_clicks_enabled_server_side",he="$web_vitals_allowed_metrics",pe="$session_recording_enabled_server_side",_e="$console_log_recording_enabled_server_side",ve="$session_recording_network_payload_capture",ge="$session_recording_canvas_recording",fe="$replay_sample_rate",me="$replay_minimum_duration",be="$replay_script_config",ye="$sesid",we="$session_is_sampled",Se="$session_recording_url_trigger_activated_session",Ee="$session_recording_event_trigger_activated_session",ke="$enabled_feature_flags",xe="$early_access_features",Ce="$stored_person_properties",Ie="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Re="$flag_call_reported",Fe="$user_state",$e="$client_session_props",Oe="$capture_rate_limit",Le="$initial_campaign_params",Me="$initial_referrer_info",Ae="$initial_person_info",De="$epp",Ne="__POSTHOG_TOOLBAR__",qe=[se,ne,"__cmpns",oe,pe,le,ye,ke,Fe,xe,Ie,Ce,Pe,Re,$e,Oe,Le,Me,De],Be=X("[FeatureFlags]"),He="$active_feature_flags",Ue="$override_feature_flags",je="$feature_flag_payloads",ze=e=>{var t={};for(var[i,r]of y(e||{}))r&&(t[i]=r);return t};class We{constructor(e){ie(this,"_override_warning",!1),ie(this,"_hasLoadedFlags",!1),ie(this,"_requestInFlight",!1),ie(this,"_reloadingDisabled",!1),ie(this,"_additionalReloadRequested",!1),ie(this,"_decideCalled",!1),ie(this,"_flagsLoadedFromRemote",!1),this.instance=e,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(ke),t=this.instance.get_property(Ue);if(!t)return e||{};for(var i=m({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(Be.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){return this.instance.get_property(je)||{}}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((()=>{this._callDecideEndpoint()}),5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callDecideEndpoint(e){if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:this.instance.get_property(Ce),group_properties:this.instance.get_property(Ie)};(null!=e&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(t.disable_flags=!0),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var i,r,s=!0;(200===e.statusCode&&(this.$anon_distinct_id=void 0,s=!1),this._requestInFlight=!1,this._decideCalled)||(this._decideCalled=!0,this.instance._onRemoteConfig(null!==(r=e.json)&&void 0!==r?r:{}));t.disable_flags||(this._flagsLoadedFromRemote=!s,this.receivedFeatureFlags(null!==(i=e.json)&&void 0!==i?i:{},s),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint()))}})}}getFeatureFlag(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i,r,s,n,o,a=this.getFlagVariants()[e],l="".concat(a),u=this.instance.get_property(Re)||{};if(t.send_event||!("send_event"in t))if(!(e in u)||!u[e].includes(l))A(u[e])?u[e].push(l):u[e]=[l],null===(i=this.instance.persistence)||void 0===i||i.register({[Re]:u}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_bootstrapped_response:(null===(r=this.instance.config.bootstrap)||void 0===r||null===(s=r.featureFlags)||void 0===s?void 0:s[e])||null,$feature_flag_bootstrapped_payload:(null===(n=this.instance.config.bootstrap)||void 0===n||null===(o=n.featureFlagPayloads)||void 0===o?void 0:o[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote});return a}Be.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);Be.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this.instance.persistence){this._hasLoadedFlags=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e.featureFlags,n=e.featureFlagPayloads;if(s)if(A(s)){var o={};if(s)for(var a=0;a<s.length;a++)o[s[a]]=!0;t&&t.register({[He]:s,[ke]:o})}else{var l=s,u=n;e.errorsWhileComputingFlags&&(l=te(te({},i),l),u=te(te({},r),u)),t&&t.register({[He]:Object.keys(ze(l)),[ke]:l||{},[je]:u||{}})}}(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return Be.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(Ue);else if(A(e)){for(var i={},r=0;r<e.length;r++)i[e[r]]=!0;this.instance.persistence.register({[Ue]:i})}else this.instance.persistence.register({[Ue]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,r={["$feature_enrollment/".concat(e)]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:r}),this.setPersonPropertiesForFlags(r,!1);var s=te(te({},this.getFlagVariants()),{},{[e]:t});null===(i=this.instance.persistence)||void 0===i||i.register({[He]:Object.keys(ze(s)),[ke]:s}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.instance.get_property(xe);if(i&&!t)return e(i);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:t=>{var i;if(t.json){var r=t.json.earlyAccessFeatures;return null===(i=this.instance.persistence)||void 0===i||i.register({[xe]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(Ce)||{};this.instance.register({[Ce]:te(te({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Ce)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(Ie)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=te(te({},i[t]),e[t]),delete e[t]})),this.instance.register({[Ie]:te(te({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Ie)||{};this.instance.register({[Ie]:te(te({},t),{},{[e]:{}})})}else this.instance.unregister(Ie)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return W(e)&&isFinite(e)&&Math.floor(e)===e});var Ge="0123456789abcdef";class Ve{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,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 Ve(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Ge.charAt(this.bytes[t]>>>4)+Ge.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ve(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Qe{constructor(){ie(this,"timestamp",0),ie(this,"counter",0),ie(this,"random",new Xe)}generate(){var e=this.generateOrAbort();if(B(e)){this.timestamp=0;var t=this.generateOrAbort();if(B(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Ve.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var Je,Ye=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!B(e.crypto)&&crypto.getRandomValues&&(Ye=e=>crypto.getRandomValues(e));class Xe{constructor(){ie(this,"buffer",new Uint32Array(8)),ie(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(Ye(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Ke=()=>Ze().toString(),Ze=()=>(Je||(Je=new Qe)).generate(),et="Thu, 01 Jan 1970 00:00:00 GMT",tt="";var it=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function rt(e,t){if(t){var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if(tt)return tt;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Ke(),n=new RegExp("(^|;)\\s*"+s+"=1");!tt&&r--;){var a=i.slice(r).join("."),l=s+"=1;domain=."+a;t.cookie=l,n.test(t.cookie)&&(t.cookie=l+";expires="+et,tt=a)}return tt}(e);if(!i){var r=(e=>{var t=e.match(it);return t?t[0]:""})(e);r!==i&&Y.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var st={is_supported:()=>!!o,error:function(e){Y.error("cookieStore error: "+e)},get:function(e){if(o){try{for(var t=e+"=",i=o.cookie.split(";").filter((e=>e.length)),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},parse:function(e){var t;try{t=JSON.parse(st.get(e))||{}}catch(e){}return t},set:function(e,t,i,r,s){if(o)try{var n="",a="",l=rt(o.location.hostname,r);if(i){var u=new Date;u.setTime(u.getTime()+24*i*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Y.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,c}catch(e){return}},remove:function(e,t){try{st.set(e,"",-1,t)}catch(e){return}}},nt=null,ot={is_supported:function(){if(!j(nt))return nt;var t=!0;if(B(e))t=!1;else try{var i="__mplssupport__";ot.set(i,"xyz"),'"xyz"'!==ot.get(i)&&(t=!1),ot.remove(i)}catch(e){t=!1}return t||Y.error("localStorage unsupported; falling back to cookie store"),nt=t,t},error:function(e){Y.error("localStorage error: "+e)},get:function(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){ot.error(e)}return null},parse:function(e){try{return JSON.parse(ot.get(e))||{}}catch(e){}return null},set:function(t,i){try{null==e||e.localStorage.setItem(t,JSON.stringify(i))}catch(e){ot.error(e)}},remove:function(t){try{null==e||e.localStorage.removeItem(t)}catch(e){ot.error(e)}}},at=["distinct_id",ye,we,De,Ae],lt=te(te({},ot),{},{parse:function(e){try{var t={};try{t=st.parse(e)||{}}catch(e){}var i=m(t,JSON.parse(ot.get(e)||"{}"));return ot.set(e,i),i}catch(e){}return null},set:function(e,t,i,r,s,n){try{ot.set(e,t,void 0,void 0,n);var o={};at.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&st.set(e,o,i,r,s,n)}catch(e){ot.error(e)}},remove:function(t,i){try{null==e||e.localStorage.removeItem(t),st.remove(t,i)}catch(e){ot.error(e)}}}),ut={},ct={is_supported:function(){return!0},error:function(e){Y.error("memoryStorage error: "+e)},get:function(e){return ut[e]||null},parse:function(e){return ut[e]||null},set:function(e,t){ut[e]=t},remove:function(e){delete ut[e]}},dt=null,ht={is_supported:function(){if(!j(dt))return dt;if(dt=!0,B(e))dt=!1;else try{var t="__support__";ht.set(t,"xyz"),'"xyz"'!==ht.get(t)&&(dt=!1),ht.remove(t)}catch(e){dt=!1}return dt},error:function(e){Y.error("sessionStorage error: ",e)},get:function(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){ht.error(e)}return null},parse:function(e){try{return JSON.parse(ht.get(e))||null}catch(e){}return null},set:function(t,i){try{null==e||e.sessionStorage.setItem(t,JSON.stringify(i))}catch(e){ht.error(e)}},remove:function(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){ht.error(e)}}},pt=["localhost","127.0.0.1"],_t=e=>{var t=null==o?void 0:o.createElement("a");return B(t)?null:(t.href=e,t)},vt=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},gt=function(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",s=[];return f(e,(function(e,r){B(e)||B(r)||"undefined"===r||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(r),s[s.length]=i+"="+t)})),s.join(r)},ft=function(e,t){for(var i,r=((e.split("#")[0]||"").split("?")[1]||"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!A(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Y.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},mt=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},bt="Mobile",yt="iOS",wt="Android",St="Tablet",Et=wt+" "+St,kt="iPad",xt="Apple",Ct=xt+" Watch",It="Safari",Pt="BlackBerry",Tt="Samsung",Rt=Tt+"Browser",Ft=Tt+" Internet",$t="Chrome",Ot=$t+" OS",Lt=$t+" "+yt,Mt="Internet Explorer",At=Mt+" "+bt,Dt="Opera",Nt=Dt+" Mini",qt="Edge",Bt="Microsoft "+qt,Ht="Firefox",Ut=Ht+" "+yt,jt="Nintendo",zt="PlayStation",Wt="Xbox",Gt=wt+" "+bt,Vt=bt+" "+It,Qt="Windows",Jt=Qt+" Phone",Yt="Nokia",Xt="Ouya",Kt="Generic",Zt=Kt+" "+bt.toLowerCase(),ei=Kt+" "+St.toLowerCase(),ti="Konqueror",ii="(\\d+(\\.\\d+)?)",ri=new RegExp("Version/"+ii),si=new RegExp(Wt,"i"),ni=new RegExp(zt+" \\w+","i"),oi=new RegExp(jt+" \\w+","i"),ai=new RegExp(Pt+"|PlayBook|BB10","i"),li={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var ui=(e,t)=>t&&b(t,xt)||function(e){return b(e,It)&&!b(e,$t)&&!b(e,wt)}(e),ci=function(e,t){return t=t||"",b(e," OPR/")&&b(e,"Mini")?Nt:b(e," OPR/")?Dt:ai.test(e)?Pt:b(e,"IE"+bt)||b(e,"WPDesktop")?At:b(e,Rt)?Ft:b(e,qt)||b(e,"Edg/")?Bt:b(e,"FBIOS")?"Facebook "+bt:b(e,"UCWEB")||b(e,"UCBrowser")?"UC Browser":b(e,"CriOS")?Lt:b(e,"CrMo")||b(e,$t)?$t:b(e,wt)&&b(e,It)?Gt:b(e,"FxiOS")?Ut:b(e.toLowerCase(),ti.toLowerCase())?ti:ui(e,t)?b(e,bt)?Vt:It:b(e,Ht)?Ht:b(e,"MSIE")||b(e,"Trident/")?Mt:b(e,"Gecko")?Ht:""},di={[At]:[new RegExp("rv:"+ii)],[Bt]:[new RegExp(qt+"?\\/"+ii)],[$t]:[new RegExp("("+$t+"|CrMo)\\/"+ii)],[Lt]:[new RegExp("CriOS\\/"+ii)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ii)],[It]:[ri],[Vt]:[ri],[Dt]:[new RegExp("(Opera|OPR)\\/"+ii)],[Ht]:[new RegExp(Ht+"\\/"+ii)],[Ut]:[new RegExp("FxiOS\\/"+ii)],[ti]:[new RegExp("Konqueror[:/]?"+ii,"i")],[Pt]:[new RegExp(Pt+" "+ii),ri],[Gt]:[new RegExp("android\\s"+ii,"i")],[Ft]:[new RegExp(Rt+"\\/"+ii)],[Mt]:[new RegExp("(rv:|MSIE )"+ii)],Mozilla:[new RegExp("rv:"+ii)]},hi=[[new RegExp(Wt+"; "+Wt+" (.*?)[);]","i"),e=>[Wt,e&&e[1]||""]],[new RegExp(jt,"i"),[jt,""]],[new RegExp(zt,"i"),[zt,""]],[ai,[Pt,""]],[new RegExp(Qt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Jt,""];if(new RegExp(bt).test(t)&&!/IEMobile\b/.test(t))return[Qt+" "+bt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=li[r]||"";return/arm/i.test(t)&&(s="RT"),[Qt,s]}return[Qt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[yt,t.join(".")]}return[yt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=B(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+wt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wt+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[wt,t.join(".")]}return[wt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ot,""]],[/Linux|debian/i,["Linux",""]]],pi=function(e){return oi.test(e)?jt:ni.test(e)?zt:si.test(e)?Wt:new RegExp(Xt,"i").test(e)?Xt:new RegExp("("+Jt+"|WPDesktop)","i").test(e)?Jt:/iPad/.test(e)?kt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ct:ai.test(e)?Pt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Yt,"i").test(e)?Yt:/(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(bt).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)?wt:Et:wt:new RegExp("(pda|"+bt+")","i").test(e)?Zt:new RegExp(St,"i").test(e)&&!new RegExp(St+" pc","i").test(e)?ei:""},_i="https?://(.*)",vi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],gi={campaignParams:function(e){return o?this._campaignParamsFromUrl(o.URL,e):{}},_campaignParamsFromUrl:function(e,t){var i=vi.concat(t||[]),r={};return f(i,(function(t){var i=ft(e,t);r[t]=i||null})),r},_searchEngine:function(e){return e?0===e.search(_i+"google.([^/?]*)")?"google":0===e.search(_i+"bing.com")?"bing":0===e.search(_i+"yahoo.com")?"yahoo":0===e.search(_i+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=gi._searchEngine(e),i="yahoo"!=t?"q":"p",r={};if(!j(t)){r.$search_engine=t;var s=o?ft(o.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},searchInfo:function(){var e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:ci,browserVersion:function(e,t){var i=ci(e,t),r=di[i];if(B(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<hi.length;t++){var[i,r]=hi[t],s=i.exec(e),n=s&&(D(r)?r(s,e):r);if(n)return n}return["",""]},device:pi,deviceType:function(e){var t=pi(e);return t===kt||t===Et||"Kobo"===t||"Kindle Fire"===t||t===ei?St:t===jt||t===Wt||t===zt||t===Xt?"Console":t===Ct?"Wearable":t?bt:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=_t(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==a?void 0:a.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var t,{r:i,u:r}=e,s={$initial_referrer:i,$initial_referring_domain:null==i?void 0:"$direct"==i?"$direct":null===(t=_t(i))||void 0===t?void 0:t.host};if(r){s.$initial_current_url=r;var n=_t(r);s.$initial_host=null==n?void 0:n.host,s.$initial_pathname=null==n?void 0:n.pathname,f(this._campaignParamsFromUrl(r),(function(e,t){s["$initial_"+k(t)]=e}))}i&&f(this._searchInfoFromReferrer(i),(function(e,t){s["$initial_"+k(t)]=e}));return s},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){if(!d)return{};var[t,i]=gi.os(d);return m(E({$os:t,$os_version:i,$browser:gi.browser(d,navigator.vendor),$device:gi.device(d),$device_type:gi.deviceType(d),$timezone:gi.timezone(),$timezone_offset:gi.timezoneOffset()}),{$current_url:null==a?void 0:a.href,$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:gi.browserVersion(d,navigator.vendor),$browser_language:gi.browserLanguage(),$browser_language_prefix:gi.browserLanguagePrefix(),$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:"web",$lib_version:p.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!d)return{};var[e,t]=gi.os(d);return m(E({$os:e,$os_version:t,$browser:gi.browser(d,navigator.vendor)}),{$browser_version:gi.browserVersion(d,navigator.vendor)})}},fi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class mi{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&Y.info("Persistence loaded",e.persistence,te({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){-1===fi.indexOf(e.persistence.toLowerCase())&&(Y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&ot.is_supported()?ot:"localstorage+cookie"===t&&lt.is_supported()?lt:"sessionstorage"===t&&ht.is_supported()?ht:"memory"===t?ct:"cookie"===t?st:lt.is_supported()?lt:st}properties(){var e={};return f(this.props,(function(t,i){if(i===ke&&N(t))for(var r=Object.keys(t),n=0;n<r.length;n++)e["$feature/".concat(r[n])]=t[r[n]];else a=i,l=!1,(j(o=qe)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(f(o,(function(e){if(l||(l=e===a))return _})),l))||(e[i]=t);var o,a,l})),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=m({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(N(e)){B(t)&&(t="None"),this.expire_days=B(i)?this.default_expiry:i;var r=!1;if(f(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(N(e)){this.expire_days=B(t)?this.default_expiry:t;var i=!1;if(f(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=gi.campaignParams(this.config.custom_campaign_params);q(E(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(gi.searchInfo())}update_referrer_info(){this.register_once(gi.referrerInfo(),void 0)}set_initial_person_info(){this.props[Le]||this.props[Me]||this.register_once({[Ae]:gi.initialPersonInfo()},void 0)}get_referrer_info(){return E({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};f([Me,Le],(t=>{var i=this.props[t];i&&f(i,(function(t,i){e["$initial_"+k(i)]=t}))}));var t=this.props[Ae];if(t){var i=gi.initialPersonPropsFromInfo(t);m(e,i)}return e}safe_merge(e){return f(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var i=this.buildStorage(e),r=this.props;this.clear(),this.storage=i,this.props=r,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[oe]||{};i[e]=t,this.props[oe]=i,this.save()}remove_event_timer(e){var t=(this.props[oe]||{})[e];return B(t)||(delete this.props[oe][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function bi(e){var t,i;return(null===(t=JSON.stringify(e,(i=[],function(e,t){if(N(t)){for(;i.length>0&&i[i.length-1]!==this;)i.pop();return i.includes(t)?"[Circular]":(i.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function yi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var i=Math.floor(e.data.length/2),r=e.data.slice(0,i),s=e.data.slice(i);return[yi({size:bi(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),yi({size:bi(s),data:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var wi=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(wi||{}),Si=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Si||{});function Ei(e){var t;return e.id===Ne||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function ki(e){return!!e&&1===e.nodeType}function xi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ci(e){return!!e&&3===e.nodeType}function Ii(e){return!!e&&11===e.nodeType}function Pi(e){return e?v(e).split(/\s+/):[]}function Ti(t){var i=null==e?void 0:e.location.href;return!!(i&&t&&t.some((e=>i.match(e))))}function Ri(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Pi(t)}function Fi(e){return z(e)?null:v(e).split(/(\s+)/).filter((e=>Wi(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $i(e){var t="";return Di(e)&&!Ni(e)&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;Ci(e)&&e.textContent&&(t+=null!==(i=Fi(e.textContent))&&void 0!==i?i:"")})),v(t)}function Oi(e){return B(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Li=["a","button","form","input","select","textarea","label"];function Mi(e){var t=e.parentNode;return!(!t||!ki(t))&&t}function Ai(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!e||!t||xi(t,"html")||!ki(t))return!1;if(null!=r&&r.url_allowlist&&!Ti(r.url_allowlist))return!1;if(null!=r&&r.url_ignorelist&&Ti(r.url_ignorelist))return!1;if(null!=r&&r.dom_event_allowlist){var o=r.dom_event_allowlist;if(o&&!o.some((e=>i.type===e)))return!1}for(var a=!1,l=[t],u=!0,c=t;c.parentNode&&!xi(c,"body");)if(Ii(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(u=Mi(c)))break;if(s||Li.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=e.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),c=u}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(B(i))return!0;var r=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e){var n=r(s);if("object"==typeof n)return n.v}return!1}(l,r))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(B(i))return!0;var r=function(e){if(i.some((t=>e.matches(t))))return{v:!0}};for(var s of e){var n=r(s);if("object"==typeof n)return n.v}return!1}(l,r))return!1;var h=e.getComputedStyle(t);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===i.type)return!0;var p=t.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Li.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}function Di(e){for(var t=e;t.parentNode&&!xi(t,"body");t=t.parentNode){var i=Ri(t);if(b(i,"ph-sensitive")||b(i,"ph-no-capture"))return!1}if(b(Ri(e),"ph-include"))return!0;var r=e.type||"";if(H(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";if(H(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Ni(e){return!!(xi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xi(e,"select")||xi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var qi="(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})",Bi=new RegExp("^(?:".concat(qi,")$")),Hi=new RegExp(qi),Ui="\\d{3}-?\\d{2}-?\\d{4}",ji=new RegExp("^(".concat(Ui,")$")),zi=new RegExp("(".concat(Ui,")"));function Wi(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(z(e))return!1;if(H(e)){if(e=v(e),(t?Bi:Hi).test((e||"").replace(/[- ]/g,"")))return!1;if((t?ji:zi).test(e))return!1}return!0}function Gi(e){var t=$i(e);return Wi(t="".concat(t," ").concat(Vi(e)).trim())?t:""}function Vi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{var r=$i(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(Vi(e)).trim())}catch(e){Y.error("[AutoCapture]",e)}})),t}function Qi(e){return function(e){var t=e.map((e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+=".".concat(s.replace(/"/g,""));var n=te(te(te(te({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),o={};return y(n).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return o[Ji(t.toString())]=Ji(i.toString())})),r+=":",r+=y(n).map((e=>{var[t,i]=e;return"".concat(t,'="').concat(i,'"')})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Yi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return y(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function Ji(e){return e.replace(/"|\\"/g,'\\"')}function Yi(e){var t=e.attr__class;return t?A(t)?t:Pi(t):void 0}var Xi="[SessionRecording]",Ki="redacted",Zi={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},er=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],tr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ir=["/s/","/e/","/i/"];function rr(e,t,i,r){if(z(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return H(s)&&(s=parseInt(s)),s>i?Xi+" ".concat(r," body too large to record (").concat(s," bytes)"):e}function sr(e,t){if(z(e))return e;var i=e;return Wi(i,!1)||(i=Xi+" "+t+" body "+Ki),f(tr,(e=>{var r,s;null!==(r=i)&&void 0!==r&&r.length&&-1!==(null===(s=i)||void 0===s?void 0:s.indexOf(e))&&(i=Xi+" "+t+" body "+Ki+" as might contain: "+e)})),i}var nr=(e,t)=>{var i,r,s,n={payloadSizeLimitBytes:Zi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Zi.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Zi.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,u=(i=n,s=Math.min(1e6,null!==(r=i.payloadSizeLimitBytes)&&void 0!==r?r:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=rr(e.requestBody,e.requestHeaders,s,"Request")),null!=e&&e.responseBody&&(e.responseBody=rr(e.responseBody,e.responseHeaders,s,"Response")),e)),c=t=>{return u(((e,t)=>{var i,r=_t(e.name),s=0===t.indexOf("http")?null===(i=_t(t))||void 0===i?void 0:i.pathname:t;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&ir.some((e=>0===n.indexOf(e)))))return e})((r=(i=t).requestHeaders,z(r)||f(Object.keys(null!=r?r:{}),(e=>{er.includes(e.toLowerCase())&&(r[e]=Ki)})),i),e.api_host));var i,r},d=D(e.session_recording.maskNetworkRequestFn);return d&&D(e.session_recording.maskCapturedNetworkRequestFn)&&Y.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return te(te({},t),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=D(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,r,s,n=c(t);return n&&null!==(i=null===(r=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===r?void 0:r.call(s,n))&&void 0!==i?i:void 0}:e=>function(e){if(!B(e))return e.requestBody=sr(e.requestBody,"Request"),e.responseBody=sr(e.responseBody,"Response"),e}(c(e)),te(te(te({},Zi),n),{},{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};function or(e,t,i,r,s){return t>i&&(Y.warn("min cannot be greater than max."),t=i),W(e)?e>i?(r&&Y.warn(r+" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r&&Y.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&Y.warn(r+" must be a number. using max or fallback. max: "+i+", fallback: "+s),or(s||i,t,i,r))}class ar{constructor(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(this,"bucketSize",100),ie(this,"refillRate",10),ie(this,"mutationBuckets",{}),ie(this,"loggedTracker",{}),ie(this,"refillBuckets",(()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))})),ie(this,"getNodeOrRelevantParent",(e=>{var t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var i=t.closest("svg");if(i)return[this.rrweb.mirror.getId(i),i]}return[e,t]})),ie(this,"numberOfChanges",(e=>{var t,i,r,s,n,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(r=null===(s=e.attributes)||void 0===s?void 0:s.length)&&void 0!==r?r:0)+(null!==(n=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),ie(this,"throttleMutations",(e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,i=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t,i,r,[s,n]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[s])return!1;(this.mutationBuckets[s]=null!==(t=this.mutationBuckets[s])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[s]=Math.max(this.mutationBuckets[s]-1,0),0===this.mutationBuckets[s])&&(this.loggedTracker[s]||(this.loggedTracker[s]=!0,null===(i=(r=this.options).onBlockedNode)||void 0===i||i.call(r,s,n)));return e})));var r=this.numberOfChanges(t);return 0!==r||i===r?e:void 0})),this.rrweb=e,this.options=r,this.refillRate=or(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=or(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}}var lr=Uint8Array,ur=Uint16Array,cr=Uint32Array,dr=new lr([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]),hr=new lr([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]),pr=new lr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_r=function(e,t){for(var i=new ur(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new cr(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},vr=_r(dr,2),gr=vr[0],fr=vr[1];gr[28]=258,fr[258]=28;for(var mr=_r(hr,0)[1],br=new ur(32768),yr=0;yr<32768;++yr){var wr=(43690&yr)>>>1|(21845&yr)<<1;wr=(61680&(wr=(52428&wr)>>>2|(13107&wr)<<2))>>>4|(3855&wr)<<4,br[yr]=((65280&wr)>>>8|(255&wr)<<8)>>>1}var Sr=function(e,t,i){for(var r=e.length,s=0,n=new ur(t);s<r;++s)++n[e[s]-1];var o,a=new ur(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ur(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,h=d|(1<<c)-1;d<=h;++d)o[br[d]>>>l]=u}else for(o=new ur(r),s=0;s<r;++s)o[s]=br[a[e[s]-1]++]>>>15-e[s];return o},Er=new lr(288);for(yr=0;yr<144;++yr)Er[yr]=8;for(yr=144;yr<256;++yr)Er[yr]=9;for(yr=256;yr<280;++yr)Er[yr]=7;for(yr=280;yr<288;++yr)Er[yr]=8;var kr=new lr(32);for(yr=0;yr<32;++yr)kr[yr]=5;var xr=Sr(Er,9,0),Cr=Sr(kr,5,0),Ir=function(e){return(e/8>>0)+(7&e&&1)},Pr=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof ur?ur:e instanceof cr?cr:lr)(i-t);return r.set(e.subarray(t,i)),r},Tr=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8},Rr=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Fr=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new lr(0),0];if(1==s){var o=new lr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[u].f<i[d].f?u++:d++],l=i[u!=c&&i[u].f<i[d].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(r=1;r<s;++r)n[r].s>h&&(h=n[r].s);var p=new ur(h+1),_=$r(i[c-1],p,0);if(_>t){r=0;var v=0,g=_-t,f=1<<g;for(n.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<s;++r){var m=n[r].s;if(!(p[m]>t))break;v+=f-(1<<_-p[m]),p[m]=t}for(v>>>=g;v>0;){var b=n[r].s;p[b]<t?v-=1<<t-p[b]++-1:++r}for(;r>=0&&v;--r){var y=n[r].s;p[y]==t&&(--p[y],++v)}_=t}return[new lr(p),_]},$r=function(e,t,i){return-1==e.s?Math.max($r(e.l,t,i+1),$r(e.r,t,i+1)):t[e.s]=i},Or=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ur(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Lr=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Mr=function(e,t,i){var r=i.length,s=Ir(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Ar=function(e,t,i,r,s,n,o,a,l,u,c){Tr(t,c++,i),++s[256];for(var d=Fr(s,15),h=d[0],p=d[1],_=Fr(n,15),v=_[0],g=_[1],f=Or(h),m=f[0],b=f[1],y=Or(v),w=y[0],S=y[1],E=new ur(19),k=0;k<m.length;++k)E[31&m[k]]++;for(k=0;k<w.length;++k)E[31&w[k]]++;for(var x=Fr(E,7),C=x[0],I=x[1],P=19;P>4&&!C[pr[P-1]];--P);var T,R,F,$,O=u+5<<3,L=Lr(s,Er)+Lr(n,kr)+o,M=Lr(s,h)+Lr(n,v)+o+14+3*P+Lr(E,C)+(2*E[16]+3*E[17]+7*E[18]);if(O<=L&&O<=M)return Mr(t,c,e.subarray(l,l+u));if(Tr(t,c,1+(M<L)),c+=2,M<L){T=Sr(h,p,0),R=h,F=Sr(v,g,0),$=v;var A=Sr(C,I,0);Tr(t,c,b-257),Tr(t,c+5,S-1),Tr(t,c+10,P-4),c+=14;for(k=0;k<P;++k)Tr(t,c+3*k,C[pr[k]]);c+=3*P;for(var D=[m,w],N=0;N<2;++N){var q=D[N];for(k=0;k<q.length;++k){var B=31&q[k];Tr(t,c,A[B]),c+=C[B],B>15&&(Tr(t,c,q[k]>>>5&127),c+=q[k]>>>12)}}}else T=xr,R=Er,F=Cr,$=kr;for(k=0;k<a;++k)if(r[k]>255){B=r[k]>>>18&31;Rr(t,c,T[B+257]),c+=R[B+257],B>7&&(Tr(t,c,r[k]>>>23&31),c+=dr[B]);var H=31&r[k];Rr(t,c,F[H]),c+=$[H],H>3&&(Rr(t,c,r[k]>>>5&8191),c+=hr[H])}else Rr(t,c,T[r[k]]),c+=R[r[k]];return Rr(t,c,T[256]),c+R[256]},Dr=new cr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Nr=function(){for(var e=new cr(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),qr=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Nr[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}},Br=function(e,t,i,r,s){return function(e,t,i,r,s,n){var o=e.length,a=new lr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var d=c+65535;d<o?u=Mr(l,u,e.subarray(c,d)):(l[c]=n,u=Mr(l,u,e.subarray(c,o)))}else{for(var h=Dr[t-1],p=h>>>13,_=8191&h,v=(1<<i)-1,g=new ur(32768),f=new ur(v+1),m=Math.ceil(i/3),b=2*m,y=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<b)&v},w=new cr(25e3),S=new ur(288),E=new ur(32),k=0,x=0,C=(c=0,0),I=0,P=0;c<o;++c){var T=y(c),R=32767&c,F=f[T];if(g[R]=F,f[T]=R,I<=c){var $=o-c;if((k>7e3||C>24576)&&$>423){u=Ar(e,l,0,w,S,E,x,C,P,c-P,u),C=k=x=0,P=c;for(var O=0;O<286;++O)S[O]=0;for(O=0;O<30;++O)E[O]=0}var L=2,M=0,A=_,D=R-F&32767;if($>2&&T==y(c-D))for(var N=Math.min(p,$)-1,q=Math.min(32767,c),B=Math.min(258,$);D<=q&&--A&&R!=F;){if(e[c+L]==e[c+L-D]){for(var H=0;H<B&&e[c+H]==e[c+H-D];++H);if(H>L){if(L=H,M=D,H>N)break;var U=Math.min(D,H-2),j=0;for(O=0;O<U;++O){var z=c-D+O+32768&32767,W=z-g[z]+32768&32767;W>j&&(j=W,F=z)}}}D+=(R=F)-(F=g[R])+32768&32767}if(M){w[C++]=268435456|fr[L]<<18|mr[M];var G=31&fr[L],V=31&mr[M];x+=dr[G]+hr[V],++S[257+G],++E[V],I=c+L,++k}else w[C++]=e[c],++S[e[c]]}}u=Ar(e,l,n,w,S,E,x,C,P,c-P,u)}return Pr(a,0,r+Ir(u)+s)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,r,!s)},Hr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},Ur=function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Hr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}},jr=function(e){return 10+(e.filename&&e.filename.length+1||0)};function zr(e,t){void 0===t&&(t={});var i=qr(),r=e.length;i.p(e);var s=Br(e,t,jr(t),8),n=s.length;return Ur(s,t),Hr(s,n-8,i.d()),Hr(s,n-4,r),s}function Wr(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new lr(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;o<i;++o){if(s+5>r.length){var a=new lr(s+8+(i-o<<1));a.set(r),r=a}var l=e.charCodeAt(o);l<128||t?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Pr(r,0,s)}var Gr="[SessionRecording]",Vr=X(Gr),Qr=3e5,Jr=[Si.MouseMove,Si.MouseInteraction,Si.Scroll,Si.ViewportResize,Si.Input,Si.TouchMove,Si.MediaInteraction,Si.Drag],Yr=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Xr(e){return function(e,t){for(var i="",r=0;r<e.length;){var s=e[r++];s<128||t?i+=String.fromCharCode(s):s<224?i+=String.fromCharCode((31&s)<<6|63&e[r++]):s<240?i+=String.fromCharCode((15&s)<<12|(63&e[r++])<<6|63&e[r++]):(s=((15&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}(zr(Wr(JSON.stringify(e))),!0)}function Kr(e){return e.type===wi.Custom&&"sessionIdle"===e.data.tag}function Zr(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class es{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Gr+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:Qr}get isSampled(){var e=this.instance.get_property(we);return G(e)?e:null}get sessionDuration(){var e,t,i=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-r:null}get isRecordingEnabled(){var t=!!this.instance.get_property(pe),i=!this.instance.config.disable_session_recording;return e&&t&&i}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(_e),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,i,r,s,n,o=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(ge),l=null!==(e=null!==(t=null==o?void 0:o.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,u=null!==(i=null!==(r=null==o?void 0:o.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==i?i:0,c=null!==(s=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==s?s:0;return{enabled:l,fps:or(u,0,12,"canvas recording fps"),quality:or(c,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(ve),r={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==i?void 0:i.recordHeaders),n=(null==r?void 0:r.recordBody)||(null==i?void 0:i.recordBody),o=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(G(o)?o:null==i?void 0:i.capturePerformance);return s||n||a?{recordHeaders:s,recordBody:n,recordPerformance:a}:void 0}get sampleRate(){var e=this.instance.get_property(fe);return W(e)?e:null}get minimumDuration(){var e=this.instance.get_property(me);return W(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this._urlBlocked?"paused":z(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":G(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(Se))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(Ee))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(ie(this,"queuedRRWebEvents",[]),ie(this,"isIdle",!1),ie(this,"_linkedFlagSeen",!1),ie(this,"_lastActivityTimestamp",Date.now()),ie(this,"_linkedFlag",null),ie(this,"_removePageViewCaptureHook",void 0),ie(this,"_onSessionIdListener",void 0),ie(this,"_persistDecideOnSessionListener",void 0),ie(this,"_samplingSessionListener",void 0),ie(this,"_urlTriggers",[]),ie(this,"_urlBlocklist",[]),ie(this,"_urlBlocked",!1),ie(this,"_eventTriggers",[]),ie(this,"_removeEventTriggerCaptureHook",void 0),ie(this,"_forceAllowLocalhostNetworkCapture",!1),ie(this,"_onBeforeUnload",(()=>{this._flushBuffer()})),ie(this,"_onOffline",(()=>{this._tryAddCustomEvent("browser offline",{})})),ie(this,"_onOnline",(()=>{this._tryAddCustomEvent("browser online",{})})),ie(this,"_onVisibilityChange",(()=>{if(null!=o&&o.visibilityState){var e="window "+o.visibilityState;this._tryAddCustomEvent(e,{})}})),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Vr.error("started without valid sessionManager"),new Error(Gr+" started without valid sessionManager. This is a bug.");var{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=i,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Vr.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),null==e||e.addEventListener("beforeunload",this._onBeforeUnload),null==e||e.addEventListener("offline",this._onOffline),null==e||e.addEventListener("online",this._onOnline),null==e||e.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),z(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskUrl(null==e?void 0:e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Vr.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,i)=>{var r,s,n,o;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),null===(r=this.instance)||void 0===r||null===(s=r.persistence)||void 0===s||s.unregister(Ee),null===(n=this.instance)||void 0===n||null===(o=n.persistence)||void 0===o||o.unregister(Se))})))):this.stopRecording()}stopRecording(){var t,i,r,s;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==e||e.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(r=this._onSessionIdListener)||void 0===r||r.call(this),this._onSessionIdListener=void 0,null===(s=this._samplingSessionListener)||void 0===s||s.call(this),this._samplingSessionListener=void 0,Vr.info("stopped"))}makeSamplingDecision(e){var t,i=this.sessionId!==e,r=this.sampleRate;if(W(r)){var s,n=this.isSampled,o=i||!G(n);if(o)s=Math.random()<r;else s=n;o&&(s?this._reportStarted("sampled"):Vr.warn("Sample rate (".concat(r,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:s})),null===(t=this.instance.persistence)||void 0===t||t.register({[we]:s})}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register({[we]:null})}}onRemoteConfig(e){var t,i,r,s,n,o;(this._persistRemoteConfig(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(o=e.sessionRecording)||void 0===o?void 0:o.endpoint);if(this._setupSampling(),!z(this._linkedFlag)&&!this._linkedFlagSeen){var a=H(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,l=H(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((e,t)=>{var i=N(t)&&a in t,r=l?t[a]===l:i;r&&this._reportStarted("linked_flag_matched",{linkedFlag:a,linkedVariant:l}),this._linkedFlagSeen=r}))}null!==(r=e.sessionRecording)&&void 0!==r&&r.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(s=e.sessionRecording)&&void 0!==s&&s.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(n=e.sessionRecording)&&void 0!==n&&n.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){W(this.sampleRate)&&z(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistRemoteConfig(e){if(this.instance.persistence){var t,i=this.instance.persistence,r=()=>{var t,r,s,n,o,a,l,u,c=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,d=z(c)?null:parseFloat(c),h=null===(r=e.sessionRecording)||void 0===r?void 0:r.minimumDurationMilliseconds;i.register({[pe]:!!e.sessionRecording,[_e]:null===(s=e.sessionRecording)||void 0===s?void 0:s.consoleLogRecordingEnabled,[ve]:te({capturePerformance:e.capturePerformance},null===(n=e.sessionRecording)||void 0===n?void 0:n.networkPayloadCapture),[ge]:{enabled:null===(o=e.sessionRecording)||void 0===o?void 0:o.recordCanvas,fps:null===(a=e.sessionRecording)||void 0===a?void 0:a.canvasFps,quality:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasQuality},[fe]:d,[me]:B(h)?null:h,[be]:null===(u=e.sessionRecording)||void 0===u?void 0:u.scriptConfig})};r(),null===(t=this._persistDecideOnSessionListener)||void 0===t||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}log(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!B(Object.assign)&&!B(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,this.scriptName,(e=>{if(e)return Vr.error("could not load recorder",e);this._onScriptLoaded()}));Vr.info("starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}get scriptName(){var e,t,i;return(null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t||null===(i=t.get_property(be))||void 0===i?void 0:i.script)||"recorder"}isInteractiveEvent(e){var t;return 3===e.type&&-1!==Jr.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)),!this.isIdle){var{windowId:r,sessionId:s}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=this.sessionId!==s,o=this.windowId!==r;this.windowId=r,this.sessionId=s,n||o?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Vr.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Yr((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Yr((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording;for(var[r,s]of Object.entries(i||{}))r in t&&("maskInputOptions"===r?t.maskInputOptions=te({password:!0},s):t[r]=s);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new ar(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{var i="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");Vr.info(i,{node:t}),this.log(Gr+" "+i,"warn")}});var n=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(te({emit:e=>{this.onRRwebEmit(e)},plugins:n},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:n.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Vr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_gatherRRWebPlugins(){var e,t,i,r,s=[],n=null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.isConsoleLogCaptureEnabled&&s.push(n());var o=null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.rrwebPlugins)||void 0===r?void 0:r.getRecordNetworkPlugin;this.networkPayloadCapture&&D(o)&&(!pt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(o(nr(this.instance.config,this.networkPayloadCapture))):Vr.info("NetworkCapture not started because we are on localhost."));return s}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&N(e)){if(e.type===wi.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"!==this.status||function(e){return e.type===wi.Custom&&"recording paused"===e.data.tag}(e)){e.type===wi.FullSnapshot&&this._scheduleFullSnapshot(),e.type===wi.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var s=function(e){var t=e;if(t&&N(t)&&6===t.type&&N(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var i=[],r=0;r<t.data.payload.payload.length;r++)t.data.payload.payload[r]&&t.data.payload.payload[r].length>2e3?i.push(t.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):i.push(t.data.payload.payload[r]);return t.data.payload.payload=i,e}return e}(r);if(this._updateWindowAndSessionIds(s),!this.isIdle||Kr(s)){if(Kr(s)){var n=s.data.payload;if(n){var o=n.lastActivityTimestamp,a=n.threshold;s.timestamp=o+a}}var l=null===(t=this.instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(bi(e)<1024)return e;try{if(e.type===wi.FullSnapshot)return te(te({},e),{},{data:Xr(e.data),cv:"2024-10"});if(e.type===wi.IncrementalSnapshot&&e.data.source===Si.Mutation)return te(te({},e),{},{cv:"2024-10",data:te(te({},e.data),{},{texts:Xr(e.data.texts),attributes:Xr(e.data.attributes),removes:Xr(e.data.removes),adds:Xr(e.data.adds)})});if(e.type===wi.IncrementalSnapshot&&e.data.source===Si.StyleSheetRule)return te(te({},e),{},{cv:"2024-10",data:te(te({},e.data),{},{adds:Xr(e.data.adds),removes:Xr(e.data.removes)})})}catch(e){Vr.error("could not compress event - will use uncompressed event",e)}return e}(s):s,u={$snapshot_bytes:bi(l),$snapshot_data:l,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(u):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&e){var t=this._maskUrl(e.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var i,r={url:e};return null===(i=r=t.maskNetworkRequestFn(r))||void 0===i?void 0:i.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,i=W(t)&&t>=0,r=W(e)&&i&&t<e;if("buffering"===this.status||r)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&yi(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:"web",$lib_version:p.LIB_VERSION})}));return this.clearBuffer()}_captureSnapshotBuffered(e){var t,i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0!==e&&e.location.href){var t=e.location.href,i="paused"===this.status,r=Zr(t,this._urlBlocklist);r&&!i?this._pauseRecording():!r&&i&&this._resumeRecording(),Zr(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,i;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({["url"===e?Se:Ee]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),Vr.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Vr.info("recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&z(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){Vr.error("Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[we]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),Vr.info(e.replace("_"," "),t),b(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}var ts=X("[Decide]");class is{constructor(e){this.instance=e}_loadRemoteConfigJs(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.loadExternalDependency?null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"remote-config",(()=>e(h._POSTHOG_CONFIG))):(ts.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:t=>{e(t.json)}})}load(){if(this.instance.config.__preview_remote_config)return h._POSTHOG_CONFIG?(ts.info("Using preloaded remote config",h._POSTHOG_CONFIG),void this.onRemoteConfig(h._POSTHOG_CONFIG)):void(this.instance.config.advanced_disable_decide?ts.warn("Remote config is disabled. Falling back to local config."):this._loadRemoteConfigJs((e=>{if(!e)return ts.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this.onRemoteConfig(e)}));this.onRemoteConfig(e)})))}onRemoteConfig(e){e?(this.instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this.instance.featureFlags.ensureFlagsLoaded()):ts.error("Failed to fetch remote config from PostHog.")}}var rs,ss=null!=e&&e.location?mt(e.location.hash,"__posthog")||mt(location.hash,"state"):null,ns="_postHogToolbarParams";!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(rs||(rs={}));class os{constructor(e){this.instance=e}setToolbarState(e){h.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:rs.UNINITIALIZED}maybeLoadToolbar(){var t,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||!o)return!1;r=null!==(t=r)&&void 0!==t?t:e.location,n=null!==(i=n)&&void 0!==i?i:e.history;try{if(!s){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}s=null==e?void 0:e.localStorage}var a,l=ss||mt(r.hash,"__posthog")||mt(r.hash,"state"),u=l?w((()=>JSON.parse(atob(decodeURIComponent(l)))))||w((()=>JSON.parse(decodeURIComponent(l)))):null;return u&&"ph_authorize"===u.action?((a=u).source="url",a&&Object.keys(a).length>0&&(u.desiredHash?r.hash=u.desiredHash:n?n.replaceState(n.state,"",r.pathname+r.search):r.hash="")):((a=JSON.parse(s.getItem(ns)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch(e){return!1}}_callLoadToolbar(e){(h.ph_load_toolbar||h.ph_load_editor)(e,this.instance)}loadToolbar(t){var i=!(null==o||!o.getElementById(Ne));if(!e||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=te(te({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(e.localStorage.setItem(ns,JSON.stringify(te(te({},s),{},{source:void 0}))),this.getToolbarState()===rs.LOADED)this._callLoadToolbar(s);else if(this.getToolbarState()===rs.UNINITIALIZED){var n,a;this.setToolbarState(rs.LOADING),null===(n=h.__PosthogExtensions__)||void 0===n||null===(a=n.loadExternalDependency)||void 0===a||a.call(n,this.instance,"toolbar",(e=>{if(e)return Y.error("[Toolbar] Failed to load",e),void this.setToolbarState(rs.UNINITIALIZED);this.setToolbarState(rs.LOADED),this._callLoadToolbar(s)})),I(e,"turbolinks:load",(()=>{this.setToolbarState(rs.UNINITIALIZED),this.loadToolbar(s)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}class as{constructor(e){ie(this,"isPaused",!0),ie(this,"queue",[]),ie(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this.sendRequest(te(te({},e),{},{transport:"sendBeacon"}))}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),i=function(i){var r=t[i],s=(new Date).getTime();r.data&&A(r.data)&&f(r.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e.sendRequest(r)};for(var r in t)i(r)}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return f(this.queue,(t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;B(e[s])&&(e[s]=te(te({},r),{},{data:[]})),null===(i=e[s].data)||void 0===i||i.push(r.data)})),this.queue=[],e}}var ls=!!u||!!l,us="text/plain",cs=(e,t)=>{var[i,r]=e.split("?"),s=te({},t);null==r||r.split("&").forEach((e=>{var[t]=e.split("=");delete s[t]}));var n=gt(s);return n=n?(r?r+"&":"")+n:r,"".concat(i,"?").concat(n)},ds=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),hs=e=>{var{data:t,compression:i}=e;if(t){if(i===exports.Compression.GZipJS){var r=zr(Wr(ds(t)),{mtime:0}),s=new Blob([r],{type:us});return{contentType:us,body:s,estimatedSize:s.size}}if(i===exports.Compression.Base64){var n=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=C(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,c[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(ds(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:ds(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ds(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ps=[];u&&ps.push({transport:"XHR",method:e=>{var t,i=new u;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=hs(e))&&void 0!==t?t:{};f(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.withCredentials=!0,i.onreadystatechange=()=>{if(4===i.readyState){var t,r={statusCode:i.status,text:i.responseText};if(200===i.status)try{r.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,r)}},i.send(s)}}),l&&ps.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=hs(e))&&void 0!==t?t:{},o=new Headers;f(e.headers,(function(e,t){o.append(t,e)})),r&&o.append("Content-Type",r);var a=e.url,u=null;if(c){var d=new c;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),e.timeout)}}l(a,te({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null===(i=u)||void 0===i?void 0:i.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r,s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Y.error(e)}null===(r=e.callback)||void 0===r||r.call(e,s)})))).catch((t=>{var i;Y.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,text:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),null!=n&&n.sendBeacon&&ps.push({transport:"sendBeacon",method:e=>{var t=cs(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=hs(e))&&void 0!==i?i:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(t,o)}catch(e){}}});var _s=["retriesPerformedSoFar"];class vs{constructor(t){ie(this,"isPolling",!1),ie(this,"pollIntervalMs",3e3),ie(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!B(e)&&"onLine"in e.navigator&&(this.areWeOnline=e.navigator.onLine,e.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),e.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=re(e,_s);W(t)&&t>0&&(i.url=cs(i.url,{retry_count:t})),this.instance._send_request(te(te({},i),{},{callback:e=>{var r;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue(te({retriesPerformedSoFar:t},i)):null===(r=i.callback)||void 0===r||r.call(i,e)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this.queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in ".concat(i);navigator.onLine||(s+=" (Browser is offline)"),Y.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){var e=Date.now(),t=[],i=this.queue.filter((i=>i.retryAt<e||(t.push(i),!1)));if(this.queue=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(te(te({},e),{},{transport:"sendBeacon"}))}catch(e){Y.error(e)}this.queue=[]}}var gs,fs=X("[SessionId]");class ms{constructor(e,t,i){var r;if(ie(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");this.config=e.config,this.persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Ke,this._windowIdGenerator=i||Ke;var s=this.config.persistence_name||this.config.token,n=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*or(n,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=ht.parse(this._window_id_storage_key),a=ht.parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:ht.remove(this._window_id_storage_key),ht.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{var l=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){fs.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return B(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&ht.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ht.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?ht.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[ye]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[ye];return A(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==e||e.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&&ht.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),[i,r,s]=this._getSessionId(),n=this._getWindowId(),o=W(s)&&s>0&&Math.abs(t-s)>864e5,a=!1,l=!r,u=!e&&Math.abs(t-i)>this.sessionTimeoutMs;l||u||o?(r=this._sessionIdGenerator(),n=this._windowIdGenerator(),fs.info("new session ID generated",{sessionId:r,windowId:n,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}}),s=t,a=!0):n||(n=this._windowIdGenerator(),a=!0);var c=0===i||!e||o?t:i,d=0===s?(new Date).getTime():s;return this._setWindowId(n),this._setSessionId(r,c,d),a&&this._sessionIdChangedHandlers.forEach((e=>e(r,n,a?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}:void 0))),{sessionId:r,windowId:n,sessionStartTimestamp:d,changeReason:a?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:i}}}!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(gs||(gs={}));var bs="i.posthog.com";class ys{constructor(e){ie(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(bs),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=gs.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=gs.EU:this._regionCache[this.apiHost]=gs.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return this.uiHost+t;if(this.region===gs.CUSTOM)return this.apiHost+t;var i=bs+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var ws="posthog-js";function Ss(e){var{organization:t,projectId:i,prefix:r,severityAllowList:s=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{var o,a,l,u,c;if(!("*"===s||s.includes(n.level))||!e.__loaded)return n;n.tags||(n.tags={});var d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));n.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(n.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h=(null===(o=n.exception)||void 0===o?void 0:o.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));var p={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||n.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:(null===(u=h[0])||void 0===u?void 0:u.value)||n.message,$sentry_exception_type:null===(c=h[0])||void 0===c?void 0:c.type,$sentry_tags:n.tags};return t&&i&&(p.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+n.event_id),e.exceptions.sendExceptionEvent(p),n}}class Es{constructor(e,t,i,r,s){this.name=ws,this.setupOnce=function(n){n(Ss(e,{organization:t,projectId:i,prefix:r,severityAllowList:s}))}}}var ks,xs,Cs,Is=X("[SegmentIntegration]");function Ps(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Ke();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(Fe,"identified")),t()},s=i.user();"then"in s&&D(s.then)?s.then((e=>r(e))):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Is.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{var r;if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Is.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Is.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e._calculate_event_properties(i,null!==(r=t.event.properties)&&void 0!==r?r:{},new Date);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class Ts{constructor(e){this._instance=e}doPageView(t){var i,r=this._previousPageViewProperties(t);return this._currentPath=null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=t,r}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,i=this._prevPageviewTimestamp,r=this._instance.scrollManager.getContext();if(!i)return{};var s={};if(r){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(B(n)||B(o)||B(a)||B(l)||B(u)||B(c)))n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),s={$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:n<=1?1:or(o/n,0,1),$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:n<=1?1:or(a/n,0,1),$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:l<=1?1:or(u/l,0,1),$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:l<=1?1:or(c/l,0,1)}}return t&&(s.$prev_pageview_pathname=t),i&&(s.$prev_pageview_duration=(e.getTime()-i.getTime())/1e3),s}}exports.SurveyType=void 0,(ks=exports.SurveyType||(exports.SurveyType={})).Popover="popover",ks.API="api",ks.Widget="widget",exports.SurveyQuestionType=void 0,(xs=exports.SurveyQuestionType||(exports.SurveyQuestionType={})).Open="open",xs.MultipleChoice="multiple_choice",xs.SingleChoice="single_choice",xs.Rating="rating",xs.Link="link",exports.SurveyQuestionBranchingType=void 0,(Cs=exports.SurveyQuestionBranchingType||(exports.SurveyQuestionBranchingType={})).NextQuestion="next_question",Cs.End="end",Cs.ResponseBased="response_based",Cs.SpecificQuestion="specific_question";class Rs{constructor(){ie(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this.events[e]||[])i(t);for(var r of this.events["*"]||[])r(e,t)}}class Fs{constructor(e){ie(this,"_debugEventEmitter",new Rs),ie(this,"checkStep",((e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t))),ie(this,"checkStepEvent",((e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event))),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!B(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,i;if(!B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(i=e.steps)||void 0===i||i.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(i=this.instance)&&void 0!==i&&i.autocapture)){var r,s=new Set;e.forEach((e=>{var t;null===(t=e.steps)||void 0===t||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null===(r=this.instance)||void 0===r||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(i=this.actionRegistry)||void 0===i?void 0:i.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(null!=t&&t.url){var i,r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Fs.matchString(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(t,i,r){switch(r){case"regex":return!!e&&vt(t,i);case"exact":return i===t;case"contains":var s=Fs.escapeStringRegexp(i).replace(/_/g,".").replace(/%/g,".*");return vt(t,s);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!Fs.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!Fs.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!Fs.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1;if(null!=t&&t.selector){var i,r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class $s{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter((e=>{var t,i,r,s;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(i=e.conditions)||void 0===i||null===(r=i.actions)||void 0===r||null===(s=r.values)||void 0===s?void 0:s.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new Fs(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,i,r,s,n,o,a,l,u,c;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(r=i.actions)&&void 0!==r&&r.values&&(null===(s=e.conditions)||void 0===s||null===(n=s.actions)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u||null===(c=u.values)||void 0===c||c.forEach((t=>{if(t&&t.name){var i=this.actionToSurveys.get(t.name);i&&i.push(e.id),this.actionToSurveys.set(t.name,i||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0!==e.filter((e=>{var t,i,r,s;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(r=i.events)||void 0===r||null===(s=r.values)||void 0===s?void 0:s.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,i,r;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(r=i.values)||void 0===r||r.forEach((t=>{if(t&&t.name){var i=this.eventToSurveys.get(t.name);i&&i.push(e.id),this.eventToSurveys.set(t.name,i||[e.id])}}))}))}}onEvent(e,t){var i,r,s=(null===(i=this.instance)||void 0===i||null===(r=i.persistence)||void 0===r?void 0:r.props[Te])||[];if($s.SURVEY_SHOWN_EVENT_NAME==e&&t&&s.length>0){var n,o=null==t||null===(n=t.properties)||void 0===n?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this._updateActivatedSurveys(s))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,i,r=(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i?void 0:i.props[Te])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({[Te]:[...new Set(e)]})}getSurveys(){var e,t,i=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Te];return i||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}ie($s,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Os,Ls,Ms,As,Ds,Ns,qs,Bs,Hs={},Us=[],js=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zs=Array.isArray;function Ws(e,t){for(var i in t)e[i]=t[i];return e}function Gs(e){var t=e.parentNode;t&&t.removeChild(e)}function Vs(e,t,i,r,s){var n={type:e,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++Ms:s,__i:-1,__u:0};return null==s&&null!=Ls.vnode&&Ls.vnode(n),n}function Qs(e){return e.children}function Js(e,t){this.props=e,this.context=t}function Ys(e,t){if(null==t)return e.__?Ys(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?Ys(e):null}function Xs(e){var t,i;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e){e.__e=e.__c.base=i.__e;break}return Xs(e)}}function Ks(e){(!e.__d&&(e.__d=!0)&&As.push(e)&&!Zs.__r++||Ds!==Ls.debounceRendering)&&((Ds=Ls.debounceRendering)||Ns)(Zs)}function Zs(){var e,t,i,r,s,n,o,a,l;for(As.sort(qs);e=As.shift();)e.__d&&(t=As.length,r=void 0,n=(s=(i=e).__v).__e,a=[],l=[],(o=i.__P)&&((r=Ws({},s)).__v=s.__v+1,Ls.vnode&&Ls.vnode(r),un(o,r,s,i.__n,void 0!==o.ownerSVGElement,32&s.__u?[n]:null,a,null==n?Ys(s):n,!!(32&s.__u),l),r.__.__k[r.__i]=r,cn(a,r,l),r.__e!=n&&Xs(r)),As.length>t&&As.sort(qs));Zs.__r=0}function en(e,t,i,r,s,n,o,a,l,u,c){var d,h,p,_,v,g=r&&r.__k||Us,f=t.length;for(i.__d=l,tn(i,t,g),l=i.__d,d=0;d<f;d++)null!=(p=i.__k[d])&&"boolean"!=typeof p&&"function"!=typeof p&&(h=-1===p.__i?Hs:g[p.__i]||Hs,p.__i=d,un(e,p,h,s,n,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&hn(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==v&&null!=_&&(v=_),65536&p.__u||h.__k===p.__k?l=rn(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:_&&(l=_.nextSibling),p.__d=void 0,p.__u&=-196609);i.__d=l,i.__e=v}function tn(e,t,i){var r,s,n,o,a,l=t.length,u=i.length,c=u,d=0;for(e.__k=[],r=0;r<l;r++)null!=(s=e.__k[r]=null==(s=t[r])||"boolean"==typeof s||"function"==typeof s?null:"string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Vs(null,s,null,null,s):zs(s)?Vs(Qs,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?Vs(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,a=sn(s,i,o=r+d,c),s.__i=a,n=null,-1!==a&&(c--,(n=i[a])&&(n.__u|=131072)),null==n||null===n.__v?(-1==a&&d--,"function"!=typeof s.type&&(s.__u|=65536)):a!==o&&(a===o+1?d++:a>o?c>l-o?d+=a-o:d--:d=a<o&&a==o-1?a-o:0,a!==r+d&&(s.__u|=65536))):(n=i[r])&&null==n.key&&n.__e&&(n.__e==e.__d&&(e.__d=Ys(n)),pn(n,n,!1),i[r]=null,c--);if(c)for(r=0;r<u;r++)null!=(n=i[r])&&0==(131072&n.__u)&&(n.__e==e.__d&&(e.__d=Ys(n)),pn(n,n))}function rn(e,t,i){var r,s;if("function"==typeof e.type){for(r=e.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=e,t=rn(r[s],t,i));return t}return e.__e!=t&&(i.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function sn(e,t,i,r){var s=e.key,n=e.type,o=i-1,a=i+1,l=t[i];if(null===l||l&&s==l.key&&n===l.type)return i;if(r>(null!=l&&0==(131072&l.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((l=t[o])&&0==(131072&l.__u)&&s==l.key&&n===l.type)return o;o--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&s==l.key&&n===l.type)return a;a++}}return-1}function nn(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||js.test(t)?i:i+"px"}function on(e,t,i,r,s){var n;e:if("style"===t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)i&&t in i||nn(e.style,t,"");if(i)for(t in i)r&&i[t]===r[t]||nn(e.style,t,i[t])}else if("o"===t[0]&&"n"===t[1])n=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+n]=i,i?r?i.u=r.u:(i.u=Date.now(),e.addEventListener(t,n?ln:an,n)):e.removeEventListener(t,n?ln:an,n);else{if(s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,i))}}function an(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Ls.event?Ls.event(e):e)}function ln(e){return this.l[e.type+!0](Ls.event?Ls.event(e):e)}function un(e,t,i,r,s,n,o,a,l,u){var c,d,h,p,_,v,g,f,m,b,y,w,S,E,k,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),n=[a=t.__e=i.__e]),(c=Ls.__b)&&c(t);e:if("function"==typeof x)try{if(f=t.props,m=(c=x.contextType)&&r[c.__c],b=c?m?m.props.value:c.__:r,i.__c?g=(d=t.__c=i.__c).__=d.__E:("prototype"in x&&x.prototype.render?t.__c=d=new x(f,b):(t.__c=d=new Js(f,b),d.constructor=x,d.render=_n),m&&m.sub(d),d.props=f,d.state||(d.state={}),d.context=b,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Ws({},d.__s)),Ws(d.__s,x.getDerivedStateFromProps(f,d.__s))),p=d.props,_=d.state,d.__v=t,h)null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==x.getDerivedStateFromProps&&f!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(f,b),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,b)||t.__v===i.__v)){for(t.__v!==i.__v&&(d.props=f,d.state=d.__s,d.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.forEach((function(e){e&&(e.__=t)})),y=0;y<d._sb.length;y++)d.__h.push(d._sb[y]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,b),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,_,v)}))}if(d.context=b,d.props=f,d.__P=e,d.__e=!1,w=Ls.__r,S=0,"prototype"in x&&x.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do{d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=Ws(Ws({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(p,_)),en(e,zs(k=null!=c&&c.type===Qs&&null==c.key?c.props.children:c)?k:[k],t,i,r,s,n,o,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=n?(t.__e=a,t.__u|=l?160:32,n[n.indexOf(a)]=null):(t.__e=i.__e,t.__k=i.__k),Ls.__e(e,t,i)}else null==n&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=dn(i.__e,t,i,r,s,n,o,l,u);(c=Ls.diffed)&&c(t)}function cn(e,t,i){t.__d=void 0;for(var r=0;r<i.length;r++)hn(i[r],i[++r],i[++r]);Ls.__c&&Ls.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ls.__e(e,t.__v)}}))}function dn(e,t,i,r,s,n,o,a,l){var u,c,d,h,p,_,v,g=i.props,f=t.props,m=t.type;if("svg"===m&&(s=!0),null!=n)for(u=0;u<n.length;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName===m:3===p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null===m)return document.createTextNode(f);e=s?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,f.is&&f),n=null,a=!1}if(null===m)g===f||a&&e.data===f||(e.data=f);else{if(n=n&&Os.call(e.childNodes),g=i.props||Hs,!a&&null!=n)for(g={},u=0;u<e.attributes.length;u++)g[(p=e.attributes[u]).name]=p.value;for(u in g)p=g[u],"children"==u||("dangerouslySetInnerHTML"==u?d=p:"key"===u||u in f||on(e,u,null,p,s));for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?_=p:"checked"==u?v=p:"key"===u||a&&"function"!=typeof p||g[u]===p||on(e,u,p,g[u],s);if(c)a||d&&(c.__html===d.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),en(e,zs(h)?h:[h],t,i,r,s&&"foreignObject"!==m,n,o,n?n[0]:i.__k&&Ys(i,0),a,l),null!=n)for(u=n.length;u--;)null!=n[u]&&Gs(n[u]);a||(u="value",void 0!==_&&(_!==e[u]||"progress"===m&&!_||"option"===m&&_!==g[u])&&on(e,u,_,g[u],!1),u="checked",void 0!==v&&v!==e[u]&&on(e,u,v,g[u],!1))}return e}function hn(e,t,i){try{"function"==typeof e?e(t):e.current=t}catch(e){Ls.__e(e,i)}}function pn(e,t,i){var r,s;if(Ls.unmount&&Ls.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||hn(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ls.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&pn(r[s],t,i||"function"!=typeof e.type);i||null==e.__e||Gs(e.__e),e.__=e.__e=e.__d=void 0}function _n(e,t,i){return this.constructor(e,i)}Os=Us.slice,Ls={__e:function(e,t,i,r){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,r||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},Ms=0,Js.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Ws({},this.state),"function"==typeof e&&(e=e(Ws({},i),this.props)),e&&Ws(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ks(this))},Js.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ks(this))},Js.prototype.render=Qs,As=[],Ns="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qs=function(e,t){return e.__v.__b-t.__v.__b},Zs.__r=0,Bs=0;!function(e,t){var i={__c:t="__cC"+Bs++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var i,r;return this.getChildContext||(i=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&i.some((function(e){e.__e=!0,Ks(e)}))},this.sub=function(e){i.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i.splice(i.indexOf(e),1),t&&t.call(e)}}),e.children}};i.Provider.__=i.Consumer.contextType=i}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var vn=X("[Surveys]"),gn={icontains:t=>!!e&&e.location.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:t=>!!e&&-1===e.location.href.toLowerCase().indexOf(t.toLowerCase()),regex:t=>!!e&&vt(e.location.href,t),not_regex:t=>!!e&&!vt(e.location.href,t),exact:t=>(null==e?void 0:e.location.href)===t,is_not:t=>(null==e?void 0:e.location.href)!==t};class fn{constructor(e){this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);null!=i&&i.startsWith("seenSurvey_")&&e.push(i)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e,t,i,r=null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||r||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new $s(this.instance)),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"surveys",(e=>{var t,i;if(e)return vn.error("Could not load surveys script",e);this._surveyManager=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,this.instance)})))}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new $s(this.instance));var i=this.instance.get_property(Pe);if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{var i;if(200!==t.statusCode||!t.json)return e([]);var r,s=t.json.surveys||[],n=s.filter((e=>{var t,i,r,s,n,o,a,l,u,c,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(r=i.events)||void 0===r?void 0:r.values)&&(null===(s=e.conditions)||void 0===s||null===(n=s.events)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n));return null===(i=this.instance.persistence)||void 0===i||i.register({[Pe]:s}),e(s)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var i,r=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,i,r,s;if(!e.conditions)return!0;var n=null===(t=e.conditions)||void 0===t||!t.url||gn[null!==(i=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==i?i:"icontains"](e.conditions.url),a=null===(s=e.conditions)||void 0===s||!s.selector||(null==o?void 0:o.querySelector(e.conditions.selector));return n&&a})),s=null===(i=this._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),n=r.filter((e=>{var t,i,r,n,o,a,l,u,c,d,h;if(!(e.linked_flag_key||e.targeting_flag_key||e.internal_targeting_flag_key||null!==(t=e.feature_flag_keys)&&void 0!==t&&t.length))return!0;var p=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),_=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),v=(null===(i=e.conditions)||void 0===i?void 0:i.events)&&(null===(r=e.conditions)||void 0===r||null===(n=r.events)||void 0===n?void 0:n.values)&&(null===(o=e.conditions)||void 0===o||null===(a=o.events)||void 0===a?void 0:a.values.length)>0,g=(null===(l=e.conditions)||void 0===l?void 0:l.actions)&&(null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c?void 0:c.values)&&(null===(d=e.conditions)||void 0===d||null===(h=d.actions)||void 0===h?void 0:h.values.length)>0,f=!v&&!g||(null==s?void 0:s.includes(e.id)),m=this._canActivateRepeatedly(e),b=!(e.internal_targeting_flag_key&&!m)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key),y=this.checkFlags(e);return p&&_&&b&&f&&y}));return e(n)}),t)}checkFlags(e){var t;return null===(t=e.feature_flag_keys)||void 0===t||!t.length||e.feature_flag_keys.every((e=>{var{key:t,value:i}=e;return!t||!i||this.instance.featureFlags.isFeatureEnabled(i)}))}getNextSurveyStep(e,t,i){var r,s=e.questions[t],n=t+1;if(null===(r=s.branching)||void 0===r||!r.type)return t===e.questions.length-1?exports.SurveyQuestionBranchingType.End:n;if(s.branching.type===exports.SurveyQuestionBranchingType.End)return exports.SurveyQuestionBranchingType.End;if(s.branching.type===exports.SurveyQuestionBranchingType.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===exports.SurveyQuestionBranchingType.ResponseBased){if(s.type===exports.SurveyQuestionType.SingleChoice){var o,a,l=s.choices.indexOf("".concat(i));if(null!==(o=s.branching)&&void 0!==o&&null!==(a=o.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var u=s.branching.responseValues[l];return Number.isInteger(u)?u:u===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}else if(s.type===exports.SurveyQuestionType.Rating){var c,d;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");var h=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,s.scale);if(null!==(c=s.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(h)){var p=s.branching.responseValues[h];return Number.isInteger(p)?p:p===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}return n}return vn.warn("Falling back to next question index due to unexpected branching type"),n}_canActivateRepeatedly(e){var t;return z(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(vn.warn("init was not called"),!1):h.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){z(this._surveyManager)?vn.warn("init was not called"):this.getSurveys((t=>{var i=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(i)}))}renderSurvey(e,t){z(this._surveyManager)?vn.warn("init was not called"):this.getSurveys((i=>{var r=i.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(r,null==o?void 0:o.querySelector(t))}))}}var mn=X("[RateLimiter]");class bn{constructor(e){var t,i;ie(this,"serverLimits",{}),ie(this,"lastEventRateLimited",!1),ie(this,"checkForLimiting",(e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{mn.info("".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void mn.warn('could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}})),this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(i=e.config.rate_limiting)||void 0===i?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=(new Date).getTime(),n=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Oe))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||r||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null===(i=this.instance.persistence)||void 0===i||i.set_property(Oe,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var yn=()=>te({initialPathName:(null==a?void 0:a.pathname)||"",referringDomain:gi.referringDomain()},gi.campaignParams());class wn{constructor(e,t,i){ie(this,"_onSessionIdCallback",(e=>{var t=this._getStoredProps();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[$e]:i})}})),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=i||yn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[$e]}getSessionProps(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}var Sn=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],En=function(e,t){if(!e)return!1;var i=e.toLowerCase();return Sn.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},kn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&En(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>En(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};class xn{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Cn=X("[Dead Clicks]"),In=()=>!0,Pn=e=>{var t,i=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(de)),r=e.instance.config.capture_dead_clicks;return G(r)?r:i};class Tn{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[de]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"dead-clicks-autocapture",(t=>{t?Cn.error("failed to load script",t):e()}))}start(){var e;if(o){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=h.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=N(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(o),Cn.info("starting...")}}else Cn.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Cn.info("stopping..."))}}var Rn=X("[Heatmaps]");class Fn{constructor(t){var i;ie(this,"rageclicks",new xn),ie(this,"_enabledServerSide",!1),ie(this,"_initialized",!1),ie(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[le]),null==e||e.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){var e=5e3;return N(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return B(this.instance.config.capture_heatmaps)?B(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Rn.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[le]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){e&&o&&(I(o,"click",(t=>this._onClick(t||(null==e?void 0:e.event))),!1,!0),I(o,"mousemove",(t=>this._onMouseMove(t||(null==e?void 0:e.event))),!1,!0),this.deadClicksCapture=new Tn(this.instance,In,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(t,i,r){for(var s=t;s&&ki(s)&&!xi(s,"body");){if(s===r)return!1;if(b(i,null==e?void 0:e.getComputedStyle(s).position))return!0;s=Mi(s)}return!1}(Oi(t),["fixed","sticky"],n);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:r),target_fixed:o,type:i}}_onClick(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!Ei(e.target)){var r=this._getProperties(e,i);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(te(te({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){Ei(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(e){var i=e.location.href;this.buffer=this.buffer||{},this.buffer[i]||(this.buffer[i]=[]),this.buffer[i].push(t)}}flush(){this.buffer&&!q(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class $n{constructor(e){ie(this,"_updateScrollData",(()=>{var e,t,i,r;this.context||(this.context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.context.lastScrollY=Math.ceil(n),this.context.maxScrollY=Math.max(n,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(o,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(i=this.context.maxContentY)&&void 0!==i?i:0),this.context.maxContentHeight=Math.max(l,null!==(r=this.context.maxContentHeight)&&void 0!==r?r:0)})),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){null==e||e.addEventListener("scroll",this._updateScrollData,!0),null==e||e.addEventListener("scrollend",this._updateScrollData,!0),null==e||e.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==e?void 0:e.document.documentElement;var t=A(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var i of t){var r=null==e?void 0:e.document.querySelector(i);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}}var On=X("[AutoCapture]");function Ln(e,t){return t.length>e?t.slice(0,e)+"...":t}function Mn(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ki(t));return t}function An(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Li.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=Ln(1024,Gi(e)):n.$el_text=Ln(1024,$i(e)));var o=Ri(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),f(e.attributes,(function(i){var s;if((!Ni(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==r||!r.includes(i.name))&&!t&&Wi(i.value)&&(s=i.name,!H(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=i.value;"class"===i.name&&(o=Pi(o).join(" ")),n["attr__"+i.name]=Ln(1024,o)}}));for(var a=1,l=1,u=e;u=Mn(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Dn(t,i){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i,c=[t],d=t;d.parentNode&&!xi(d,"body");)Ii(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,p=[],_={},v=!1,g=!1;if(f(c,(e=>{var t=Di(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Wi(v)&&v),b(Ri(e),"ph-no-capture")&&(g=!0),p.push(An(e,o,a,l));var i=function(e){if(!Di(e))return{};var t={};return f(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Wi(r)&&(t[i]=r)}})),t}(e);m(_,i)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?p[0].$el_text=Gi(t):p[0].$el_text=$i(t)),v){var y,w;p[0].attr__href=v;var S=null===(y=_t(v))||void 0===y?void 0:y.host,E=null==e||null===(w=e.location)||void 0===w?void 0:w.host;S&&E&&S!==E&&(h=v)}return{props:m({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:Qi(p)},null!==(r=p[0])&&void 0!==r&&r.$el_text?{$el_text:null===(s=p[0])||void 0===s?void 0:s.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},_)}}class Nn{constructor(e){ie(this,"_initialized",!1),ie(this,"_isDisabledServerSide",null),ie(this,"rageclicks",new xn),ie(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,i=N(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null===(e=i.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null===(t=i.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(e&&o){var t=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){On.error("Failed to capture event",e)}},i=t=>{t=t||(null==e?void 0:e.event),this._captureEvent(t,R)};I(o,"submit",t,!1,!0),I(o,"change",t,!1,!0),I(o,"click",t,!1,!0),this.config.capture_copied_text&&(I(o,"copy",i,!1,!0),I(o,"cut",i,!1,!0))}}else On.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ae]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{var r=null==o?void 0:o.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ae],r=this._isDisabledServerSide;if(j(r)&&!G(i)&&!this.instance.config.advanced_disable_decide)return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var r,s=Oi(t);if(Ci(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent)this.instance.config.rageclick&&null!==(r=this.rageclicks)&&void 0!==r&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this._captureEvent(t,"$rageclick");var n=i===R;if(s&&Ai(s,t,this.config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Dn(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===R){var u,c=Fi(null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString()),d=t.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return D(null==o?void 0:o.querySelectorAll)}}var qn=X("[TracingHeaders]");class Bn{constructor(e){ie(this,"_restoreXHRPatch",void 0),ie(this,"_restoreFetchPatch",void 0),ie(this,"_startCapturing",(()=>{var e,t,i,r;B(this._restoreXHRPatch)&&(null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));B(this._restoreFetchPatch)&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.tracingHeadersPatchFns)||void 0===r||r._patchFetch(this.instance.sessionManager))})),this.instance=e}_loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"tracing-headers",(t=>{if(t)return qn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Hn;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Hn||(Hn={}));class Un{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Hn.DENIED:this.storedConsent}isOptedOut(){return this.consent===Hn.DENIED||this.consent===Hn.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return"1"===e?Hn.GRANTED:"0"===e?Hn.DENIED:Hn.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?ot:st;var t="localStorage"===e?st:ot;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!P([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,h.doNotTrack],(e=>b([!0,1,"1","yes"],e)))}}var jn=X("[ExceptionAutocapture]");class zn{constructor(t){var i;ie(this,"originalOnUnhandledRejectionHandler",void 0),ie(this,"startCapturing",(()=>{var t,i,r,s;if(e&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.errorWrappingFunctions)||void 0===i?void 0:i.wrapOnError,o=null===(r=h.__PosthogExtensions__)||void 0===r||null===(s=r.errorWrappingFunctions)||void 0===s?void 0:s.wrapUnhandledRejection;if(n&&o)try{this.unwrapOnError=n(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){jn.error("failed to start",e),this.stopCapturing()}else jn.error("failed to load error wrapping functions - cannot start")}})),this.instance=t,this.remoteEnabled=!(null===(i=this.instance.persistence)||void 0===i||!i.props[ue]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var t;return!(null==e||null===(t=e.onerror)||void 0===t||!t.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(jn.info("enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,i;this.hasHandlers&&e(),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"exception-autocapture",(t=>{if(t)return jn.error("failed to load script",t);e()}))}stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[ue]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}var Wn=X("[Web Vitals]"),Gn=9e5;class Vn{constructor(e){var t;ie(this,"_enabledServerSide",!1),ie(this,"_initialized",!1),ie(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),ie(this,"_flushToCapture",(()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,t)=>te(te({},e),{},{["$web_vitals_".concat(t.name,"_event")]:te({},t),["$web_vitals_".concat(t.name,"_value")]:t.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),ie(this,"_addToBuffer",(e=>{var t,i=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if(B(i))Wn.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._currentURL();if(!B(r))if(z(null==e?void 0:e.name)||z(null==e?void 0:e.value))Wn.error("Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)Wn.error("Ignoring metric with value >= "+this._maxAllowedValue,e);else this.buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),B(this.buffer.url)&&(this.buffer.url=r),this.buffer.firstMetricTimestamp=B(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(te(te({},e),{},{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}})),ie(this,"_startCapturing",(()=>{var e,t,i,r,s=h.__PosthogExtensions__;B(s)||B(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this._addToBuffer.bind(this)),this._initialized=!0):Wn.error("web vitals callbacks not loaded - not starting")})),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[ce]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=N(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return B(i)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[he])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=N(this.instance.config.capture_performance)&&W(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Gn;return 0<e&&e<=6e4?Gn:e}get isEnabled(){var e=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return G(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Wn.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var t=N(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=N(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[ce]:t}),this.instance.persistence.register({[he]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"web-vitals",(t=>{t?Wn.error("failed to load script",t):e()}))}_currentURL(){var t=e?e.location.href:void 0;return t||Wn.error("Could not determine current URL"),t}}var Qn={icontains:(t,i)=>!!e&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!e&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!e&&vt(i.href,t),not_regex:(t,i)=>!!e&&!vt(i.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Jn{constructor(e){var t=this;ie(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.getWebExperiments((e=>{Jn.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;if(t._flagToExperiments)Jn.logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=t._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e);var r=t.instance.getFeatureFlag(e.feature_flag_key);H(r)&&e.variants[r]&&t.applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];Jn.matchesTestVariant(n)&&t.applyTransforms(e.name,s,n.transforms)}}))}),e)})),this.instance=e,this.instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())Jn.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(z(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jn.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var i,r=this.instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=Jn.getWindowLocation();if(null!=e&&e.search){var t=ft(null==e?void 0:e.search,"__experiment_id"),i=ft(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Jn.logInfo("previewing web experiments ".concat(t," && ").concat(i)),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.instance.config.disable_web_experiments&&!i)return e([]);var r=this.instance.get_property("$web_experiments");if(r&&!t)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(Jn.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(r[0].name,t,r[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!z(e.conditions)&&(Jn.matchUrlConditions(e)&&Jn.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;var i,r,s,n=Jn.getWindowLocation();return!!n&&(null===(i=e.conditions)||void 0===i||!i.url||Qn[null!==(r=null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==e?void 0:e.location}static matchUTMConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var i=gi.campaignParams();if(i.utm_source){var r,s,n,o,a,l,u,c,d,h,p,_,v,g,f,m,b=null===(r=e.conditions)||void 0===r||null===(s=r.utm)||void 0===s||!s.utm_campaign||(null===(n=e.conditions)||void 0===n||null===(o=n.utm)||void 0===o?void 0:o.utm_campaign)==i.utm_campaign,y=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(u=e.conditions)||void 0===u||null===(c=u.utm)||void 0===c?void 0:c.utm_source)==i.utm_source,w=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(p=e.conditions)||void 0===p||null===(_=p.utm)||void 0===_?void 0:_.utm_medium)==i.utm_medium,S=null===(v=e.conditions)||void 0===v||null===(g=v.utm)||void 0===g||!g.utm_term||(null===(f=e.conditions)||void 0===f||null===(m=f.utm)||void 0===m?void 0:m.utm_term)==i.utm_term;return b&&w&&S&&y}return!1}static logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Y.info("[WebExperiments] ".concat(e),i)}applyTransforms(e,t,i,r){var s;this._is_bot()?Jn.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var s;Jn.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),i);var n,o=0,a=null===(s=document)||void 0===s?void 0:s.querySelectorAll(i.selector);if(null==a||a.forEach((e=>{var t=e;o+=1,i.attributes&&i.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),i.text&&(t.innerText=i.text),i.html&&(t.parentElement?t.parentElement.innerHTML=i.html:t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:r,$web_experiment_document_url:null===(n=Jn.getWindowLocation())||void 0===n?void 0:n.href,$web_experiment_elements_modified:o})}})):(Jn.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:r,$web_experiment_variant:t,$web_experiment_document_url:null===(s=Jn.getWindowLocation())||void 0===s?void 0:s.href,$web_experiment_elements_modified:0}))}_is_bot(){return n&&this.instance?kn(n,this.instance.config.custom_blocked_useragents):void 0}}class Yn{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Xn=["$set_once","$set"],Kn=X("[SiteApps]");class Zn{constructor(e){this.instance=e,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this.bufferedInvocations.push(i),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this.instance.get_property("$groups")||[],c=this.instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))l[d]={id:u[d],type:d,properties:h};var{$set_once:p,$set:_}=e;return{event:te(te({},re(e,Xn)),{},{properties:te(te(te({},e.properties),_?{$set:te(te({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),_)}:{}),p?{$set_once:te(te({},null!==(r=null===(s=e.properties)||void 0===s?void 0:s.$set_once)&&void 0!==r?r:{}),p)}:{}),elements_chain:null!==(n=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=t;var i=i=>{var r;for(var s of(this.apps[e.id].errored=!i,this.apps[e.id].loaded=!0,Kn.info("Site app with id ".concat(e.id," ").concat(i?"loaded":"errored")),i&&this.bufferedInvocations.length&&(Kn.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(e.id)),this.bufferedInvocations.forEach((e=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)}))),Object.values(this.apps)))if(!s.loaded)return;null===(r=this.stopBuffering)||void 0===r||r.call(this)};try{var{processEvent:r}=e.init({posthog:this.instance,callback:e=>{i(e)}});r&&(t.processEvent=r)}catch(t){Kn.error("Error while initializing PostHog app with config id ".concat(e.id),t),i(!1)}}onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{var r;null===(r=i.processEvent)||void 0===r||r.call(i,t)}catch(t){Kn.error("Error while processing event ".concat(e.event," for site app ").concat(i.id),t)}}}onRemoteConfig(e){var t,i,r=this;if(A(h._POSTHOG_JS_APPS)){if(!this.isEnabled)return void Kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');for(var s of h._POSTHOG_JS_APPS)this.setupSiteApp(s);var n;h._POSTHOG_JS_APPS.length?this.instance.on("eventCaptured",(e=>this.onCapturedEvent(e))):null===(n=this.stopBuffering)||void 0===n||n.call(this)}else if(null===(t=this.stopBuffering)||void 0===t||t.call(this),null!==(i=e.siteApps)&&void 0!==i&&i.length)if(this.isEnabled){var o=function(e,t){var i,s;h["__$$ph_site_app_".concat(e)]=r.instance,null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadSiteApp)||void 0===s||s.call(i,r.instance,t,(t=>{if(t)return Kn.error("Error while initializing PostHog app with config id ".concat(e),t)}))};for(var{id:a,url:l}of e.siteApps)o(a,l)}else Kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var eo={},to=()=>{},io="posthog",ro=!ls&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),so=()=>{var t,i,r;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(i=null==o?void 0:o.location,r=null==i?void 0:i.hostname,!!H(r)&&"herokuapp.com"!==r.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",loaded:to,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:a&&H(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null===(t=e.location)||void 0===t?void 0:t.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Y.error(t)},get_device_id:e=>e,_onCapture:to,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},no=e=>{var t={};B(e.process_person)||(t.person_profiles=e.process_person),B(e.xhr_headers)||(t.request_headers=e.xhr_headers),B(e.cookie_name)||(t.persistence_name=e.cookie_name),B(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var i=m({},t,e);return A(e.property_blacklist)&&(B(e.property_denylist)?i.property_denylist=e.property_blacklist:A(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Y.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class oo{constructor(){ie(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ao{get decideEndpointWasHit(){return this.featureFlags.hasLoadedFlags}constructor(){ie(this,"webPerformance",new oo),ie(this,"version",p.LIB_VERSION),ie(this,"_internalEventEmitter",new Rs),this.config=so(),this.SentryIntegration=Es,this.sentryIntegration=e=>function(e,t){var i=Ss(e,t);return{name:ws,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new We(this),this.toolbar=new os(this),this.scrollManager=new $n(this),this.pageViewManager=new Ts(this),this.surveys=new fn(this),this.experiments=new Jn(this),this.exceptions=new Yn(this),this.rateLimiter=new bn(this),this.requestRouter=new ys(this),this.consent=new Un(this),this.people={set:(e,t,i)=>{var r=H(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=H(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Y.info('send "'.concat(null==e?void 0:e.event,'"'),e)))}init(e,t,i){if(i&&i!==io){var r,s=null!==(r=eo[i])&&void 0!==r?r:new ao;return s._init(e,t,i),eo[i]=s,eo[io][i]=s,s}return this._init(e,t,i)}_init(t){var i,r,s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(B(t)||U(t))return Y.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 Y.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],n.person_profiles&&(this._initialPersonProfilesConfig=n.person_profiles),this.set_config(m({},so(),no(n),{name:o,token:t})),this.config.on_xhr_error&&Y.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:exports.Compression.GZipJS,this.persistence=new mi(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mi(te(te({},this.config),{},{persistence:"sessionStorage"}));var a=te({},this.persistence.props),l=te({},this.sessionPersistence.props);if(this._requestQueue=new as((e=>this._send_retriable_request(e))),this._retryQueue=new vs(this),this.__request_queue=[],this.sessionManager=new ms(this),this.sessionPropsManager=new wn(this.sessionManager,this.persistence),new Bn(this).startIfEnabledOrStop(),this.siteApps=new Zn(this),null===(i=this.siteApps)||void 0===i||i.init(),this.sessionRecording=new es(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Nn(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Fn(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Vn(this),this.exceptionObserver=new zn(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Tn(this,Pn),this.deadClicksAutocapture.startIfEnabled(),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&Y.info("Starting in debug mode",{this:this,config:n,thisC:te({},this.config),p:a,s:l}),this._sync_opt_out_with_persistence(),void 0!==(null===(r=n.bootstrap)||void 0===r?void 0:r.distinctID)){var u,c,d=this.config.get_device_id(Ke()),h=null!==(u=n.bootstrap)&&void 0!==u&&u.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(Fe,null!==(c=n.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var _,v,g=Object.keys((null===(_=n.bootstrap)||void 0===_?void 0:_.featureFlags)||{}).filter((e=>{var t,i;return!(null===(t=n.bootstrap)||void 0===t||null===(i=t.featureFlags)||void 0===i||!i[e])})).reduce(((e,t)=>{var i,r;return e[t]=(null===(i=n.bootstrap)||void 0===i||null===(r=i.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),f=Object.keys((null===(v=n.bootstrap)||void 0===v?void 0:v.featureFlagPayloads)||{}).filter((e=>g[e])).reduce(((e,t)=>{var i,r,s,o;null!==(i=n.bootstrap)&&void 0!==i&&null!==(r=i.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(s=n.bootstrap)||void 0===s||null===(o=s.featureFlagPayloads)||void 0===o?void 0:o[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:f})}if(!this.get_distinct_id()){var b=this.config.get_device_id(Ke());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Fe,"anonymous")}return null==e||null===(s=e.addEventListener)||void 0===s||s.call(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),n.segment?Ps(this,(()=>this._loaded())):this._loaded(),D(this.config._onCapture)&&this.config._onCapture!==to&&(Y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_onRemoteConfig(e){var t,i,r,s,n,a,l,u,c;if(!o||!o.body)return Y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=b(e.supportedCompression,exports.Compression.GZipJS)?exports.Compression.GZipJS:b(e.supportedCompression,exports.Compression.Base64)?exports.Compression.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(i=this.siteApps)||void 0===i||i.onRemoteConfig(e),null===(r=this.sessionRecording)||void 0===r||r.onRemoteConfig(e),null===(s=this.autocapture)||void 0===s||s.onRemoteConfig(e),null===(n=this.heatmaps)||void 0===n||n.onRemoteConfig(e),null===(a=this.surveys)||void 0===a||a.onRemoteConfig(e),null===(l=this.webVitalsAutocapture)||void 0===l||l.onRemoteConfig(e),null===(u=this.exceptionObserver)||void 0===u||u.onRemoteConfig(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){Y.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),new is(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||g(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ro?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=cs(e.url,{ip:this.config.ip?1:0}),e.headers=te({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=te({},e);s.timeout=s.timeout||6e4,s.url=cs(s.url,{_:(new Date).getTime().toString(),ver:p.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"XHR",o=null!==(i=null===(r=P(ps,(e=>e.transport===n)))||void 0===r?void 0:r.method)&&void 0!==i?i:ps[0].method;if(!o)throw new Error("No available transport method");o(s)})(te(te({},e),{},{callback:t=>{var i,r,s;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(r=(s=this.config).on_request_error)||void 0===r||r.call(s,t));null===(i=e.callback)||void 0===i||i.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],s=[];g(e,(e=>{e&&(t=e[0],A(t)?s.push(e):D(e)?e.call(this):A(e)&&"alias"===t?i.push(e):A(e)&&-1!==t.indexOf("capture")&&D(this[t])?s.push(e):r.push(e))}));var n=function(e,t){g(e,(function(e){if(A(e[0])){var i=t;f(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};n(i,this),n(r,this),n(s,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!B(e)&&H(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var n=new Date,o=(null==i?void 0:i.timestamp)||n,a={uuid:Ke(),event:e,properties:this._calculate_event_properties(e,t||{},o)};s&&(a.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==i?void 0:i.$set)&&(a.$set=null==i?void 0:i.$set);var l=this._calculate_set_once_properties(null==i?void 0:i.$set_once);l&&(a.$set_once=l),(a=x(a,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,B(null==i?void 0:i.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=n);var u=te(te({},a.properties.$set),a.$set);if(q(u)||this.setPersonPropertiesForFlags(u),!z(this.config.before_send)){var c=this._runBeforeSend(a);if(!c)return;a=c}this._internalEventEmitter.emit("eventCaptured",a);var d={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(d):this._requestQueue.enqueue(d),a}Y.critical("This capture call is ignored due to client rate limiting.")}}else Y.error("No event name provided to posthog.capture")}else Y.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,t,i){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var r=this.persistence.remove_event_timer(e),s=te({},t);if(s.token=this.config.token,"$snapshot"===e){var n=te(te({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=n.distinct_id,(!H(s.distinct_id)&&!W(s.distinct_id)||U(s.distinct_id))&&Y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var a=gi.properties();if(this.sessionManager){var{sessionId:l,windowId:u}=this.sessionManager.checkAndGetSessionAndWindowId();s.$session_id=l,s.$window_id=u}if(this.sessionRecording&&(s.$recording_status=this.sessionRecording.status),this.requestRouter.region===gs.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var c=this.sessionPropsManager.getSessionProps();s=m(s,c)}if(!this.config.disable_scroll_properties){var h={};"$pageview"===e?h=this.pageViewManager.doPageView(i):"$pageleave"===e&&(h=this.pageViewManager.doPageLeave(i)),s=m(s,h)}if("$pageview"===e&&o&&(s.title=o.title),!B(r)){var p=i.getTime()-r;s.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=m({},a,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),A(this.config.property_denylist)?f(this.config.property_denylist,(function(e){delete s[e]})):Y.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(s=_(s,e));var v=this._hasPersonProcessing();return s.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),s}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=m({},this.persistence.get_initial_props(),e||{}),i=this.config.sanitize_properties;return i&&(t=i(t,"$set_once")),q(t)?void 0:t}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var r;null===(r=this.persistence)||void 0===r||r.register_once(e,t,i)}register_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,i){return this.surveys.getNextSurveyStep(e,t,i)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Y.uninitializedWarning("posthog.identify");if(W(e)&&(e=e.toString(),Y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))Y.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(ne)&&(this.unregister(ne),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(Fe)||"anonymous");e!==r&&n?(this.persistence.set_property(Fe,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(Re))}}else Y.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,i){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:te(te({},r),{},{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else Y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s,n;if(Y.info("reset"),!this.__loaded)return Y.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(i=this.sessionPersistence)||void 0===i||i.clear(),null===(r=this.surveys)||void 0===r||r.reset(),null===(s=this.persistence)||void 0===s||s.set_property(Fe,"anonymous"),null===(n=this.sessionManager)||void 0===n||n.resetSessionId();var a=this.config.get_device_id(Ke());this.register_once({distinct_id:a,$device_id:e?a:o},"")}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;var o=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0);r+="?t=".concat(o)}return r}alias(e,t){return e===this.get_property(se)?(Y.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(B(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ne,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,r,s,n=te({},this.config);N(e)&&(m(this.config,no(e)),null===(t=this.persistence)||void 0===t||t.update_config(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mi(te(te({},this.config),{},{persistence:"sessionStorage"})),ot.is_supported()&&"true"===ot.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(p.DEBUG=!0,Y.info("set_config",{config:e,oldConfig:n,newConfig:te({},this.config)})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(r=this.autocapture)||void 0===r||r.startIfEnabled(),null===(s=this.heatmaps)||void 0===s||s.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=!0===e,i={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(i).some(Boolean)){var r,s,n,o,a;if(null===(r=this.sessionManager)||void 0===r||r.checkAndGetSessionAndWindowId(),i.sampling)null===(s=this.sessionRecording)||void 0===s||s.overrideSampling();if(i.linked_flag)null===(n=this.sessionRecording)||void 0===n||n.overrideLinkedFlag();if(i.url_trigger)null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url");if(i.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started)}captureException(e,t){var i,r=new Error("PostHog syntheticException"),s=D(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?h.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:r}):te({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},t);this.exceptions.sendExceptionEvent(s)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:io;return t!==io&&(t=io+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(Fe))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(Fe))}_hasPersonProcessing(){var e,t,i,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&q(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[ne])&&(null===(i=this.persistence)||void 0===i||null===(r=i.props)||void 0===r||!r[De]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(De,!0),!0)}_sync_opt_out_with_persistence(){var e,t,i,r,s=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||s&&!!n;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==o&&(null===(i=this.persistence)||void 0===i||i.set_disabled(o));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==o&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(o))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),B(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return n?kn(n,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){o&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(z(this.config.before_send))return e;var t=A(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),z(i)){var s="Event '".concat(e.event,"' was rejected in beforeSend function");return Q(e.event)?Y.warn("".concat(s,". This can cause unexpected behavior.")):Y.info(s),null}i.properties&&!q(i.properties)||Y.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=S(e.prototype[t[i]])}(ao,["identify"]);var lo,uo=(lo=eo[io]=new ao,function(){function t(){t.done||(t.done=!0,ro=!1,f(eo,(function(e){e._dom_loaded()})))}null!=o&&o.addEventListener&&("complete"===o.readyState?t():o.addEventListener("DOMContentLoaded",t,!1)),e&&I(e,"load",t,!0)}(),lo);exports.COPY_AUTOCAPTURE_EVENT=R,exports.PostHog=ao,exports.default=uo,exports.knownUnsafeEditableEvent=F,exports.posthog=uo,exports.severityLevels=["fatal","error","warning","log","info","debug"];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,i=Array.prototype,r=i.forEach,s=i.indexOf,n=null==t?void 0:t.navigator,o=null==t?void 0:t.document,a=null==t?void 0:t.location,l=null==t?void 0:t.fetch,u=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,c=null==t?void 0:t.AbortController,d=null==n?void 0:n.userAgent,h=null!=e?e:{},_={DEBUG:!1,LIB_VERSION:"1.200.2"},p={},v=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function g(e,t,i){if(A(e))if(r&&e.forEach===r)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var s=0,n=e.length;s<n;s++)if(s in e&&t.call(i,e[s],s)===p)return}function f(e,t,i){if(!z(e)){if(A(e))return g(e,t,i);if(V(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===p)return}else for(var s in e)if(L.call(e,s)&&t.call(i,e[s],s)===p)return}}var m=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e};function b(e,t){return-1!==e.indexOf(t)}function y(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var w=function(e){try{return e()}catch(e){return}},S=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Y.critical(e)}}},E=function(e){var t={};return f(e,(function(e,i){H(e)&&e.length>0&&(t[i]=e)})),t},k=function(e){return e.replace(/^\$/,"")};function x(e,t){return i=e,r=e=>H(e)&&!j(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t,i):t:s.has(t)?void 0:(s.add(t),A(t)?(n=[],g(t,(t=>{n.push(e(t))}))):(n={},f(t,((t,i)=>{s.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,r,s}var C=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),j(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},I=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(i,r,s,n,o){if(i)if(i.addEventListener&&!n)i.addEventListener(r,s,!!o);else{var a="on"+r,l=i[a];i[a]=function(i,r,s){return function(n){if(n=n||t(null==e?void 0:e.event)){var o,a=!0;D(s)&&(o=s(n));var l=r.call(i,n);return!1!==o&&!1!==l||(a=!1),a}}}(i,s,l)}else Y.error("No valid element provided to register_event")}}();function P(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}var T,R="$copy_autocapture",F=["$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"];exports.Compression=void 0,(T=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",T.Base64="base64";var $=Array.isArray,O=Object.prototype,L=O.hasOwnProperty,M=O.toString,A=$||function(e){return"[object Array]"===M.call(e)},D=e=>"function"==typeof e,N=e=>e===Object(e)&&!A(e),q=e=>{if(N(e)){for(var t in e)if(L.call(e,t))return!1;return!0}return!1},B=e=>void 0===e,H=e=>"[object String]"==M.call(e),U=e=>H(e)&&0===e.trim().length,j=e=>null===e,z=e=>B(e)||j(e),W=e=>"[object Number]"==M.call(e),G=e=>"[object Boolean]"===M.call(e),V=e=>e instanceof FormData,Q=e=>b(F,e),J=t=>{var i={_log:function(i){if(e&&(_.DEBUG||h.POSTHOG_DEBUG)&&!B(e.console)&&e.console){for(var r=("__rrweb_original__"in e.console[i]?e.console[i].__rrweb_original__:e.console[i]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;o<s;o++)n[o-1]=arguments[o];r(t,...n)}},info:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._log("error",...t)},critical:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling ".concat(e))},createLogger:e=>J("".concat(t," ").concat(e))};return i},Y=J("[PostHog.js]"),X=Y.createLogger,K=X("[ExternalScriptsLoader]"),Z=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return K.warn("".concat(t," was requested but loading of external scripts is disabled.")),i("Loading of external scripts is disabled");var r=()=>{if(!o)return i("document not found");var e=o.createElement("script");e.type="text/javascript",e.crossOrigin="anonymous",e.src=t,e.onload=e=>i(void 0,e),e.onerror=e=>i(e);var r,s=o.querySelectorAll("body > script");s.length>0?null===(r=s[0].parentNode)||void 0===r||r.insertBefore(e,s[0]):o.body.appendChild(e)};null!=o&&o.body?r():null==o||o.addEventListener("DOMContentLoaded",r)};function ee(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function te(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(i),!0).forEach((function(t){ie(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ee(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ie(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function re(e,t){if(null==e)return{};var i,r,s=function(e,t){if(null==e)return{};var i,r,s={},n=Object.keys(e);for(r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(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}h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if("remote-config"===t&&(r="/array/".concat(e.config.token,"/config.js")),"toolbar"===t){var s=3e5,n=Math.floor(Date.now()/s)*s;r="".concat(r,"&t=").concat(n)}var o=e.requestRouter.endpointFor("assets",r);Z(e,o,i)},h.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);Z(e,r,i)};var se="$people_distinct_id",ne="__alias",oe="__timers",ae="$autocapture_disabled_server_side",le="$heatmaps_enabled_server_side",ue="$exception_capture_enabled_server_side",ce="$web_vitals_enabled_server_side",de="$dead_clicks_enabled_server_side",he="$web_vitals_allowed_metrics",_e="$session_recording_enabled_server_side",pe="$console_log_recording_enabled_server_side",ve="$session_recording_network_payload_capture",ge="$session_recording_canvas_recording",fe="$replay_sample_rate",me="$replay_minimum_duration",be="$replay_script_config",ye="$sesid",we="$session_is_sampled",Se="$session_recording_url_trigger_activated_session",Ee="$session_recording_event_trigger_activated_session",ke="$enabled_feature_flags",xe="$early_access_features",Ce="$stored_person_properties",Ie="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Re="$flag_call_reported",Fe="$user_state",$e="$client_session_props",Oe="$capture_rate_limit",Le="$initial_campaign_params",Me="$initial_referrer_info",Ae="$initial_person_info",De="$epp",Ne="__POSTHOG_TOOLBAR__",qe="$posthog_cklsh",Be=[se,ne,"__cmpns",oe,_e,le,ye,ke,Fe,xe,Ie,Ce,Pe,Re,$e,Oe,Le,Me,De],He=X("[FeatureFlags]"),Ue="$active_feature_flags",je="$override_feature_flags",ze="$feature_flag_payloads",We=e=>{var t={};for(var[i,r]of y(e||{}))r&&(t[i]=r);return t};class Ge{constructor(e){ie(this,"_override_warning",!1),ie(this,"_hasLoadedFlags",!1),ie(this,"_requestInFlight",!1),ie(this,"_reloadingDisabled",!1),ie(this,"_additionalReloadRequested",!1),ie(this,"_decideCalled",!1),ie(this,"_flagsLoadedFromRemote",!1),this.instance=e,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(ke),t=this.instance.get_property(je);if(!t)return e||{};for(var i=m({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(He.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){return this.instance.get_property(ze)||{}}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((()=>{this._callDecideEndpoint()}),5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callDecideEndpoint(e){if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:this.instance.get_property(Ce),group_properties:this.instance.get_property(Ie)};(null!=e&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(t.disable_flags=!0),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var i,r,s=!0;(200===e.statusCode&&(this.$anon_distinct_id=void 0,s=!1),this._requestInFlight=!1,this._decideCalled)||(this._decideCalled=!0,this.instance._onRemoteConfig(null!==(r=e.json)&&void 0!==r?r:{}));t.disable_flags||(this._flagsLoadedFromRemote=!s,this.receivedFeatureFlags(null!==(i=e.json)&&void 0!==i?i:{},s),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint()))}})}}getFeatureFlag(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i,r,s,n,o,a=this.getFlagVariants()[e],l="".concat(a),u=this.instance.get_property(Re)||{};if(t.send_event||!("send_event"in t))if(!(e in u)||!u[e].includes(l))A(u[e])?u[e].push(l):u[e]=[l],null===(i=this.instance.persistence)||void 0===i||i.register({[Re]:u}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_bootstrapped_response:(null===(r=this.instance.config.bootstrap)||void 0===r||null===(s=r.featureFlags)||void 0===s?void 0:s[e])||null,$feature_flag_bootstrapped_payload:(null===(n=this.instance.config.bootstrap)||void 0===n||null===(o=n.featureFlagPayloads)||void 0===o?void 0:o[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote});return a}He.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);He.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this.instance.persistence){this._hasLoadedFlags=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e.featureFlags,n=e.featureFlagPayloads;if(s)if(A(s)){var o={};if(s)for(var a=0;a<s.length;a++)o[s[a]]=!0;t&&t.register({[Ue]:s,[ke]:o})}else{var l=s,u=n;e.errorsWhileComputingFlags&&(l=te(te({},i),l),u=te(te({},r),u)),t&&t.register({[Ue]:Object.keys(We(l)),[ke]:l||{},[ze]:u||{}})}}(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return He.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(je);else if(A(e)){for(var i={},r=0;r<e.length;r++)i[e[r]]=!0;this.instance.persistence.register({[je]:i})}else this.instance.persistence.register({[je]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,r={["$feature_enrollment/".concat(e)]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:r}),this.setPersonPropertiesForFlags(r,!1);var s=te(te({},this.getFlagVariants()),{},{[e]:t});null===(i=this.instance.persistence)||void 0===i||i.register({[Ue]:Object.keys(We(s)),[ke]:s}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.instance.get_property(xe);if(i&&!t)return e(i);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:t=>{var i;if(t.json){var r=t.json.earlyAccessFeatures;return null===(i=this.instance.persistence)||void 0===i||i.register({[xe]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(Ce)||{};this.instance.register({[Ce]:te(te({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Ce)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(Ie)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=te(te({},i[t]),e[t]),delete e[t]})),this.instance.register({[Ie]:te(te({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Ie)||{};this.instance.register({[Ie]:te(te({},t),{},{[e]:{}})})}else this.instance.unregister(Ie)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return W(e)&&isFinite(e)&&Math.floor(e)===e});var Ve="0123456789abcdef";class Qe{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,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 Qe(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Ve.charAt(this.bytes[t]>>>4)+Ve.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Qe(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Je{constructor(){ie(this,"timestamp",0),ie(this,"counter",0),ie(this,"random",new Ke)}generate(){var e=this.generateOrAbort();if(B(e)){this.timestamp=0;var t=this.generateOrAbort();if(B(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Qe.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var Ye,Xe=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!B(e.crypto)&&crypto.getRandomValues&&(Xe=e=>crypto.getRandomValues(e));class Ke{constructor(){ie(this,"buffer",new Uint32Array(8)),ie(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(Xe(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Ze=()=>et().toString(),et=()=>(Ye||(Ye=new Je)).generate(),tt="Thu, 01 Jan 1970 00:00:00 GMT",it="";var rt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function st(e,t){if(t){var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if(it)return it;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Ze(),n=new RegExp("(^|;)\\s*"+s+"=1");!it&&r--;){var a=i.slice(r).join("."),l=s+"=1;domain=."+a;t.cookie=l,n.test(t.cookie)&&(t.cookie=l+";expires="+tt,it=a)}return it}(e);if(!i){var r=(e=>{var t=e.match(rt);return t?t[0]:""})(e);r!==i&&Y.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var nt={is_supported:()=>!!o,error:function(e){Y.error("cookieStore error: "+e)},get:function(e){if(o){try{for(var t=e+"=",i=o.cookie.split(";").filter((e=>e.length)),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},parse:function(e){var t;try{t=JSON.parse(nt.get(e))||{}}catch(e){}return t},set:function(e,t,i,r,s){if(o)try{var n="",a="",l=st(o.location.hostname,r);if(i){var u=new Date;u.setTime(u.getTime()+24*i*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Y.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,c}catch(e){return}},remove:function(e,t){try{nt.set(e,"",-1,t)}catch(e){return}}},ot=null,at={is_supported:function(){if(!j(ot))return ot;var t=!0;if(B(e))t=!1;else try{var i="__mplssupport__";at.set(i,"xyz"),'"xyz"'!==at.get(i)&&(t=!1),at.remove(i)}catch(e){t=!1}return t||Y.error("localStorage unsupported; falling back to cookie store"),ot=t,t},error:function(e){Y.error("localStorage error: "+e)},get:function(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){at.error(e)}return null},parse:function(e){try{return JSON.parse(at.get(e))||{}}catch(e){}return null},set:function(t,i){try{null==e||e.localStorage.setItem(t,JSON.stringify(i))}catch(e){at.error(e)}},remove:function(t){try{null==e||e.localStorage.removeItem(t)}catch(e){at.error(e)}}},lt=["distinct_id",ye,we,De,Ae],ut=te(te({},at),{},{parse:function(e){try{var t={};try{t=nt.parse(e)||{}}catch(e){}var i=m(t,JSON.parse(at.get(e)||"{}"));return at.set(e,i),i}catch(e){}return null},set:function(e,t,i,r,s,n){try{at.set(e,t,void 0,void 0,n);var o={};lt.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&nt.set(e,o,i,r,s,n)}catch(e){at.error(e)}},remove:function(t,i){try{null==e||e.localStorage.removeItem(t),nt.remove(t,i)}catch(e){at.error(e)}}}),ct={},dt={is_supported:function(){return!0},error:function(e){Y.error("memoryStorage error: "+e)},get:function(e){return ct[e]||null},parse:function(e){return ct[e]||null},set:function(e,t){ct[e]=t},remove:function(e){delete ct[e]}},ht=null,_t={is_supported:function(){if(!j(ht))return ht;if(ht=!0,B(e))ht=!1;else try{var t="__support__";_t.set(t,"xyz"),'"xyz"'!==_t.get(t)&&(ht=!1),_t.remove(t)}catch(e){ht=!1}return ht},error:function(e){Y.error("sessionStorage error: ",e)},get:function(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){_t.error(e)}return null},parse:function(e){try{return JSON.parse(_t.get(e))||null}catch(e){}return null},set:function(t,i){try{null==e||e.sessionStorage.setItem(t,JSON.stringify(i))}catch(e){_t.error(e)}},remove:function(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){_t.error(e)}}},pt=["localhost","127.0.0.1"],vt=e=>{var t=null==o?void 0:o.createElement("a");return B(t)?null:(t.href=e,t)},gt=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},ft=function(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",s=[];return f(e,(function(e,r){B(e)||B(r)||"undefined"===r||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(r),s[s.length]=i+"="+t)})),s.join(r)},mt=function(e,t){for(var i,r=((e.split("#")[0]||"").split("?")[1]||"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!A(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Y.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},bt=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},yt="Mobile",wt="iOS",St="Android",Et="Tablet",kt=St+" "+Et,xt="iPad",Ct="Apple",It=Ct+" Watch",Pt="Safari",Tt="BlackBerry",Rt="Samsung",Ft=Rt+"Browser",$t=Rt+" Internet",Ot="Chrome",Lt=Ot+" OS",Mt=Ot+" "+wt,At="Internet Explorer",Dt=At+" "+yt,Nt="Opera",qt=Nt+" Mini",Bt="Edge",Ht="Microsoft "+Bt,Ut="Firefox",jt=Ut+" "+wt,zt="Nintendo",Wt="PlayStation",Gt="Xbox",Vt=St+" "+yt,Qt=yt+" "+Pt,Jt="Windows",Yt=Jt+" Phone",Xt="Nokia",Kt="Ouya",Zt="Generic",ei=Zt+" "+yt.toLowerCase(),ti=Zt+" "+Et.toLowerCase(),ii="Konqueror",ri="(\\d+(\\.\\d+)?)",si=new RegExp("Version/"+ri),ni=new RegExp(Gt,"i"),oi=new RegExp(Wt+" \\w+","i"),ai=new RegExp(zt+" \\w+","i"),li=new RegExp(Tt+"|PlayBook|BB10","i"),ui={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var ci=(e,t)=>t&&b(t,Ct)||function(e){return b(e,Pt)&&!b(e,Ot)&&!b(e,St)}(e),di=function(e,t){return t=t||"",b(e," OPR/")&&b(e,"Mini")?qt:b(e," OPR/")?Nt:li.test(e)?Tt:b(e,"IE"+yt)||b(e,"WPDesktop")?Dt:b(e,Ft)?$t:b(e,Bt)||b(e,"Edg/")?Ht:b(e,"FBIOS")?"Facebook "+yt:b(e,"UCWEB")||b(e,"UCBrowser")?"UC Browser":b(e,"CriOS")?Mt:b(e,"CrMo")||b(e,Ot)?Ot:b(e,St)&&b(e,Pt)?Vt:b(e,"FxiOS")?jt:b(e.toLowerCase(),ii.toLowerCase())?ii:ci(e,t)?b(e,yt)?Qt:Pt:b(e,Ut)?Ut:b(e,"MSIE")||b(e,"Trident/")?At:b(e,"Gecko")?Ut:""},hi={[Dt]:[new RegExp("rv:"+ri)],[Ht]:[new RegExp(Bt+"?\\/"+ri)],[Ot]:[new RegExp("("+Ot+"|CrMo)\\/"+ri)],[Mt]:[new RegExp("CriOS\\/"+ri)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ri)],[Pt]:[si],[Qt]:[si],[Nt]:[new RegExp("(Opera|OPR)\\/"+ri)],[Ut]:[new RegExp(Ut+"\\/"+ri)],[jt]:[new RegExp("FxiOS\\/"+ri)],[ii]:[new RegExp("Konqueror[:/]?"+ri,"i")],[Tt]:[new RegExp(Tt+" "+ri),si],[Vt]:[new RegExp("android\\s"+ri,"i")],[$t]:[new RegExp(Ft+"\\/"+ri)],[At]:[new RegExp("(rv:|MSIE )"+ri)],Mozilla:[new RegExp("rv:"+ri)]},_i=[[new RegExp(Gt+"; "+Gt+" (.*?)[);]","i"),e=>[Gt,e&&e[1]||""]],[new RegExp(zt,"i"),[zt,""]],[new RegExp(Wt,"i"),[Wt,""]],[li,[Tt,""]],[new RegExp(Jt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Yt,""];if(new RegExp(yt).test(t)&&!/IEMobile\b/.test(t))return[Jt+" "+yt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=ui[r]||"";return/arm/i.test(t)&&(s="RT"),[Jt,s]}return[Jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[wt,t.join(".")]}return[wt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=B(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+St+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+St+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[St,t.join(".")]}return[St,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Lt,""]],[/Linux|debian/i,["Linux",""]]],pi=function(e){return ai.test(e)?zt:oi.test(e)?Wt:ni.test(e)?Gt:new RegExp(Kt,"i").test(e)?Kt:new RegExp("("+Yt+"|WPDesktop)","i").test(e)?Yt:/iPad/.test(e)?xt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?It:li.test(e)?Tt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Xt,"i").test(e)?Xt:/(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(yt).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)?St:kt:St:new RegExp("(pda|"+yt+")","i").test(e)?ei:new RegExp(Et,"i").test(e)&&!new RegExp(Et+" pc","i").test(e)?ti:""},vi="https?://(.*)",gi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],fi={campaignParams:function(e){return o?this._campaignParamsFromUrl(o.URL,e):{}},_campaignParamsFromUrl:function(e,t){var i=gi.concat(t||[]),r={};return f(i,(function(t){var i=mt(e,t);r[t]=i||null})),r},_searchEngine:function(e){return e?0===e.search(vi+"google.([^/?]*)")?"google":0===e.search(vi+"bing.com")?"bing":0===e.search(vi+"yahoo.com")?"yahoo":0===e.search(vi+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=fi._searchEngine(e),i="yahoo"!=t?"q":"p",r={};if(!j(t)){r.$search_engine=t;var s=o?mt(o.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},searchInfo:function(){var e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:di,browserVersion:function(e,t){var i=di(e,t),r=hi[i];if(B(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<_i.length;t++){var[i,r]=_i[t],s=i.exec(e),n=s&&(D(r)?r(s,e):r);if(n)return n}return["",""]},device:pi,deviceType:function(e){var t=pi(e);return t===xt||t===kt||"Kobo"===t||"Kindle Fire"===t||t===ti?Et:t===zt||t===Gt||t===Wt||t===Kt?"Console":t===It?"Wearable":t?yt:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=vt(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==a?void 0:a.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var t,{r:i,u:r}=e,s={$initial_referrer:i,$initial_referring_domain:null==i?void 0:"$direct"==i?"$direct":null===(t=vt(i))||void 0===t?void 0:t.host};if(r){s.$initial_current_url=r;var n=vt(r);s.$initial_host=null==n?void 0:n.host,s.$initial_pathname=null==n?void 0:n.pathname,f(this._campaignParamsFromUrl(r),(function(e,t){s["$initial_"+k(t)]=e}))}i&&f(this._searchInfoFromReferrer(i),(function(e,t){s["$initial_"+k(t)]=e}));return s},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){if(!d)return{};var[t,i]=fi.os(d);return m(E({$os:t,$os_version:i,$browser:fi.browser(d,navigator.vendor),$device:fi.device(d),$device_type:fi.deviceType(d),$timezone:fi.timezone(),$timezone_offset:fi.timezoneOffset()}),{$current_url:null==a?void 0:a.href,$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:fi.browserVersion(d,navigator.vendor),$browser_language:fi.browserLanguage(),$browser_language_prefix:fi.browserLanguagePrefix(),$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:"web",$lib_version:_.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!d)return{};var[e,t]=fi.os(d);return m(E({$os:e,$os_version:t,$browser:fi.browser(d,navigator.vendor)}),{$browser_version:fi.browserVersion(d,navigator.vendor)})}},mi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class bi{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&Y.info("Persistence loaded",e.persistence,te({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){-1===mi.indexOf(e.persistence.toLowerCase())&&(Y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&at.is_supported()?at:"localstorage+cookie"===t&&ut.is_supported()?ut:"sessionstorage"===t&&_t.is_supported()?_t:"memory"===t?dt:"cookie"===t?nt:ut.is_supported()?ut:nt}properties(){var e={};return f(this.props,(function(t,i){if(i===ke&&N(t))for(var r=Object.keys(t),n=0;n<r.length;n++)e["$feature/".concat(r[n])]=t[r[n]];else a=i,l=!1,(j(o=Be)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(f(o,(function(e){if(l||(l=e===a))return p})),l))||(e[i]=t);var o,a,l})),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=m({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(N(e)){B(t)&&(t="None"),this.expire_days=B(i)?this.default_expiry:i;var r=!1;if(f(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(N(e)){this.expire_days=B(t)?this.default_expiry:t;var i=!1;if(f(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=fi.campaignParams(this.config.custom_campaign_params);q(E(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(fi.searchInfo())}update_referrer_info(){this.register_once(fi.referrerInfo(),void 0)}set_initial_person_info(){this.props[Le]||this.props[Me]||this.register_once({[Ae]:fi.initialPersonInfo()},void 0)}get_referrer_info(){return E({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};f([Me,Le],(t=>{var i=this.props[t];i&&f(i,(function(t,i){e["$initial_"+k(i)]=t}))}));var t=this.props[Ae];if(t){var i=fi.initialPersonPropsFromInfo(t);m(e,i)}return e}safe_merge(e){return f(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var i=this.buildStorage(e),r=this.props;this.clear(),this.storage=i,this.props=r,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[oe]||{};i[e]=t,this.props[oe]=i,this.save()}remove_event_timer(e){var t=(this.props[oe]||{})[e];return B(t)||(delete this.props[oe][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function yi(e){var t,i;return(null===(t=JSON.stringify(e,(i=[],function(e,t){if(N(t)){for(;i.length>0&&i[i.length-1]!==this;)i.pop();return i.includes(t)?"[Circular]":(i.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function wi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var i=Math.floor(e.data.length/2),r=e.data.slice(0,i),s=e.data.slice(i);return[wi({size:yi(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),wi({size:yi(s),data:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var Si=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Si||{}),Ei=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Ei||{});function ki(e){var t;return e.id===Ne||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function xi(e){return!!e&&1===e.nodeType}function Ci(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ii(e){return!!e&&3===e.nodeType}function Pi(e){return!!e&&11===e.nodeType}function Ti(e){return e?v(e).split(/\s+/):[]}function Ri(t){var i=null==e?void 0:e.location.href;return!!(i&&t&&t.some((e=>i.match(e))))}function Fi(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ti(t)}function $i(e){return z(e)?null:v(e).split(/(\s+)/).filter((e=>Gi(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Oi(e){var t="";return Ni(e)&&!qi(e)&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;Ii(e)&&e.textContent&&(t+=null!==(i=$i(e.textContent))&&void 0!==i?i:"")})),v(t)}function Li(e){return B(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Mi=["a","button","form","input","select","textarea","label"];function Ai(e){var t=e.parentNode;return!(!t||!xi(t))&&t}function Di(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!e||!t||Ci(t,"html")||!xi(t))return!1;if(null!=r&&r.url_allowlist&&!Ri(r.url_allowlist))return!1;if(null!=r&&r.url_ignorelist&&Ri(r.url_ignorelist))return!1;if(null!=r&&r.dom_event_allowlist){var o=r.dom_event_allowlist;if(o&&!o.some((e=>i.type===e)))return!1}for(var a=!1,l=[t],u=!0,c=t;c.parentNode&&!Ci(c,"body");)if(Pi(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(u=Ai(c)))break;if(s||Mi.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=e.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),c=u}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(B(i))return!0;var r=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e){var n=r(s);if("object"==typeof n)return n.v}return!1}(l,r))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(B(i))return!0;var r=function(e){if(i.some((t=>e.matches(t))))return{v:!0}};for(var s of e){var n=r(s);if("object"==typeof n)return n.v}return!1}(l,r))return!1;var h=e.getComputedStyle(t);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===i.type)return!0;var _=t.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Mi.indexOf(_)>-1||"true"===t.getAttribute("contenteditable"))}}function Ni(e){for(var t=e;t.parentNode&&!Ci(t,"body");t=t.parentNode){var i=Fi(t);if(b(i,"ph-sensitive")||b(i,"ph-no-capture"))return!1}if(b(Fi(e),"ph-include"))return!0;var r=e.type||"";if(H(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";if(H(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function qi(e){return!!(Ci(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ci(e,"select")||Ci(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Bi="(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})",Hi=new RegExp("^(?:".concat(Bi,")$")),Ui=new RegExp(Bi),ji="\\d{3}-?\\d{2}-?\\d{4}",zi=new RegExp("^(".concat(ji,")$")),Wi=new RegExp("(".concat(ji,")"));function Gi(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(z(e))return!1;if(H(e)){if(e=v(e),(t?Hi:Ui).test((e||"").replace(/[- ]/g,"")))return!1;if((t?zi:Wi).test(e))return!1}return!0}function Vi(e){var t=Oi(e);return Gi(t="".concat(t," ").concat(Qi(e)).trim())?t:""}function Qi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{var r=Oi(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(Qi(e)).trim())}catch(e){Y.error("[AutoCapture]",e)}})),t}function Ji(e){return function(e){var t=e.map((e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+=".".concat(s.replace(/"/g,""));var n=te(te(te(te({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),o={};return y(n).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return o[Yi(t.toString())]=Yi(i.toString())})),r+=":",r+=y(n).map((e=>{var[t,i]=e;return"".concat(t,'="').concat(i,'"')})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Xi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return y(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function Yi(e){return e.replace(/"|\\"/g,'\\"')}function Xi(e){var t=e.attr__class;return t?A(t)?t:Ti(t):void 0}var Ki="[SessionRecording]",Zi="redacted",er={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},tr=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ir=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],rr=["/s/","/e/","/i/"];function sr(e,t,i,r){if(z(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return H(s)&&(s=parseInt(s)),s>i?Ki+" ".concat(r," body too large to record (").concat(s," bytes)"):e}function nr(e,t){if(z(e))return e;var i=e;return Gi(i,!1)||(i=Ki+" "+t+" body "+Zi),f(ir,(e=>{var r,s;null!==(r=i)&&void 0!==r&&r.length&&-1!==(null===(s=i)||void 0===s?void 0:s.indexOf(e))&&(i=Ki+" "+t+" body "+Zi+" as might contain: "+e)})),i}var or=(e,t)=>{var i,r,s,n={payloadSizeLimitBytes:er.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...er.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...er.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,u=(i=n,s=Math.min(1e6,null!==(r=i.payloadSizeLimitBytes)&&void 0!==r?r:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=sr(e.requestBody,e.requestHeaders,s,"Request")),null!=e&&e.responseBody&&(e.responseBody=sr(e.responseBody,e.responseHeaders,s,"Response")),e)),c=t=>{return u(((e,t)=>{var i,r=vt(e.name),s=0===t.indexOf("http")?null===(i=vt(t))||void 0===i?void 0:i.pathname:t;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&rr.some((e=>0===n.indexOf(e)))))return e})((r=(i=t).requestHeaders,z(r)||f(Object.keys(null!=r?r:{}),(e=>{tr.includes(e.toLowerCase())&&(r[e]=Zi)})),i),e.api_host));var i,r},d=D(e.session_recording.maskNetworkRequestFn);return d&&D(e.session_recording.maskCapturedNetworkRequestFn)&&Y.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return te(te({},t),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=D(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,r,s,n=c(t);return n&&null!==(i=null===(r=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===r?void 0:r.call(s,n))&&void 0!==i?i:void 0}:e=>function(e){if(!B(e))return e.requestBody=nr(e.requestBody,"Request"),e.responseBody=nr(e.responseBody,"Response"),e}(c(e)),te(te(te({},er),n),{},{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};function ar(e,t,i,r,s){return t>i&&(Y.warn("min cannot be greater than max."),t=i),W(e)?e>i?(r&&Y.warn(r+" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r&&Y.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&Y.warn(r+" must be a number. using max or fallback. max: "+i+", fallback: "+s),ar(s||i,t,i,r))}class lr{constructor(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(this,"bucketSize",100),ie(this,"refillRate",10),ie(this,"mutationBuckets",{}),ie(this,"loggedTracker",{}),ie(this,"refillBuckets",(()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))})),ie(this,"getNodeOrRelevantParent",(e=>{var t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var i=t.closest("svg");if(i)return[this.rrweb.mirror.getId(i),i]}return[e,t]})),ie(this,"numberOfChanges",(e=>{var t,i,r,s,n,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(r=null===(s=e.attributes)||void 0===s?void 0:s.length)&&void 0!==r?r:0)+(null!==(n=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),ie(this,"throttleMutations",(e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,i=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t,i,r,[s,n]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[s])return!1;(this.mutationBuckets[s]=null!==(t=this.mutationBuckets[s])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[s]=Math.max(this.mutationBuckets[s]-1,0),0===this.mutationBuckets[s])&&(this.loggedTracker[s]||(this.loggedTracker[s]=!0,null===(i=(r=this.options).onBlockedNode)||void 0===i||i.call(r,s,n)));return e})));var r=this.numberOfChanges(t);return 0!==r||i===r?e:void 0})),this.rrweb=e,this.options=r,this.refillRate=ar(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ar(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}}var ur=Uint8Array,cr=Uint16Array,dr=Uint32Array,hr=new ur([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]),_r=new ur([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]),pr=new ur([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vr=function(e,t){for(var i=new cr(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new dr(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},gr=vr(hr,2),fr=gr[0],mr=gr[1];fr[28]=258,mr[258]=28;for(var br=vr(_r,0)[1],yr=new cr(32768),wr=0;wr<32768;++wr){var Sr=(43690&wr)>>>1|(21845&wr)<<1;Sr=(61680&(Sr=(52428&Sr)>>>2|(13107&Sr)<<2))>>>4|(3855&Sr)<<4,yr[wr]=((65280&Sr)>>>8|(255&Sr)<<8)>>>1}var Er=function(e,t,i){for(var r=e.length,s=0,n=new cr(t);s<r;++s)++n[e[s]-1];var o,a=new cr(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new cr(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,h=d|(1<<c)-1;d<=h;++d)o[yr[d]>>>l]=u}else for(o=new cr(r),s=0;s<r;++s)o[s]=yr[a[e[s]-1]++]>>>15-e[s];return o},kr=new ur(288);for(wr=0;wr<144;++wr)kr[wr]=8;for(wr=144;wr<256;++wr)kr[wr]=9;for(wr=256;wr<280;++wr)kr[wr]=7;for(wr=280;wr<288;++wr)kr[wr]=8;var xr=new ur(32);for(wr=0;wr<32;++wr)xr[wr]=5;var Cr=Er(kr,9,0),Ir=Er(xr,5,0),Pr=function(e){return(e/8>>0)+(7&e&&1)},Tr=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof cr?cr:e instanceof dr?dr:ur)(i-t);return r.set(e.subarray(t,i)),r},Rr=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8},Fr=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},$r=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new ur(0),0];if(1==s){var o=new ur(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[u].f<i[d].f?u++:d++],l=i[u!=c&&i[u].f<i[d].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(r=1;r<s;++r)n[r].s>h&&(h=n[r].s);var _=new cr(h+1),p=Or(i[c-1],_,0);if(p>t){r=0;var v=0,g=p-t,f=1<<g;for(n.sort((function(e,t){return _[t.s]-_[e.s]||e.f-t.f}));r<s;++r){var m=n[r].s;if(!(_[m]>t))break;v+=f-(1<<p-_[m]),_[m]=t}for(v>>>=g;v>0;){var b=n[r].s;_[b]<t?v-=1<<t-_[b]++-1:++r}for(;r>=0&&v;--r){var y=n[r].s;_[y]==t&&(--_[y],++v)}p=t}return[new ur(_),p]},Or=function(e,t,i){return-1==e.s?Math.max(Or(e.l,t,i+1),Or(e.r,t,i+1)):t[e.s]=i},Lr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cr(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Mr=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Ar=function(e,t,i){var r=i.length,s=Pr(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Dr=function(e,t,i,r,s,n,o,a,l,u,c){Rr(t,c++,i),++s[256];for(var d=$r(s,15),h=d[0],_=d[1],p=$r(n,15),v=p[0],g=p[1],f=Lr(h),m=f[0],b=f[1],y=Lr(v),w=y[0],S=y[1],E=new cr(19),k=0;k<m.length;++k)E[31&m[k]]++;for(k=0;k<w.length;++k)E[31&w[k]]++;for(var x=$r(E,7),C=x[0],I=x[1],P=19;P>4&&!C[pr[P-1]];--P);var T,R,F,$,O=u+5<<3,L=Mr(s,kr)+Mr(n,xr)+o,M=Mr(s,h)+Mr(n,v)+o+14+3*P+Mr(E,C)+(2*E[16]+3*E[17]+7*E[18]);if(O<=L&&O<=M)return Ar(t,c,e.subarray(l,l+u));if(Rr(t,c,1+(M<L)),c+=2,M<L){T=Er(h,_,0),R=h,F=Er(v,g,0),$=v;var A=Er(C,I,0);Rr(t,c,b-257),Rr(t,c+5,S-1),Rr(t,c+10,P-4),c+=14;for(k=0;k<P;++k)Rr(t,c+3*k,C[pr[k]]);c+=3*P;for(var D=[m,w],N=0;N<2;++N){var q=D[N];for(k=0;k<q.length;++k){var B=31&q[k];Rr(t,c,A[B]),c+=C[B],B>15&&(Rr(t,c,q[k]>>>5&127),c+=q[k]>>>12)}}}else T=Cr,R=kr,F=Ir,$=xr;for(k=0;k<a;++k)if(r[k]>255){B=r[k]>>>18&31;Fr(t,c,T[B+257]),c+=R[B+257],B>7&&(Rr(t,c,r[k]>>>23&31),c+=hr[B]);var H=31&r[k];Fr(t,c,F[H]),c+=$[H],H>3&&(Fr(t,c,r[k]>>>5&8191),c+=_r[H])}else Fr(t,c,T[r[k]]),c+=R[r[k]];return Fr(t,c,T[256]),c+R[256]},Nr=new dr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=function(){for(var e=new dr(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Br=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=qr[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}},Hr=function(e,t,i,r,s){return function(e,t,i,r,s,n){var o=e.length,a=new ur(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var d=c+65535;d<o?u=Ar(l,u,e.subarray(c,d)):(l[c]=n,u=Ar(l,u,e.subarray(c,o)))}else{for(var h=Nr[t-1],_=h>>>13,p=8191&h,v=(1<<i)-1,g=new cr(32768),f=new cr(v+1),m=Math.ceil(i/3),b=2*m,y=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<b)&v},w=new dr(25e3),S=new cr(288),E=new cr(32),k=0,x=0,C=(c=0,0),I=0,P=0;c<o;++c){var T=y(c),R=32767&c,F=f[T];if(g[R]=F,f[T]=R,I<=c){var $=o-c;if((k>7e3||C>24576)&&$>423){u=Dr(e,l,0,w,S,E,x,C,P,c-P,u),C=k=x=0,P=c;for(var O=0;O<286;++O)S[O]=0;for(O=0;O<30;++O)E[O]=0}var L=2,M=0,A=p,D=R-F&32767;if($>2&&T==y(c-D))for(var N=Math.min(_,$)-1,q=Math.min(32767,c),B=Math.min(258,$);D<=q&&--A&&R!=F;){if(e[c+L]==e[c+L-D]){for(var H=0;H<B&&e[c+H]==e[c+H-D];++H);if(H>L){if(L=H,M=D,H>N)break;var U=Math.min(D,H-2),j=0;for(O=0;O<U;++O){var z=c-D+O+32768&32767,W=z-g[z]+32768&32767;W>j&&(j=W,F=z)}}}D+=(R=F)-(F=g[R])+32768&32767}if(M){w[C++]=268435456|mr[L]<<18|br[M];var G=31&mr[L],V=31&br[M];x+=hr[G]+_r[V],++S[257+G],++E[V],I=c+L,++k}else w[C++]=e[c],++S[e[c]]}}u=Dr(e,l,n,w,S,E,x,C,P,c-P,u)}return Tr(a,0,r+Pr(u)+s)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,r,!s)},Ur=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},jr=function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Ur(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}},zr=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Wr(e,t){void 0===t&&(t={});var i=Br(),r=e.length;i.p(e);var s=Hr(e,t,zr(t),8),n=s.length;return jr(s,t),Ur(s,n-8,i.d()),Ur(s,n-4,r),s}function Gr(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new ur(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;o<i;++o){if(s+5>r.length){var a=new ur(s+8+(i-o<<1));a.set(r),r=a}var l=e.charCodeAt(o);l<128||t?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Tr(r,0,s)}var Vr="[SessionRecording]",Qr=X(Vr),Jr=3e5,Yr=[Ei.MouseMove,Ei.MouseInteraction,Ei.Scroll,Ei.ViewportResize,Ei.Input,Ei.TouchMove,Ei.MediaInteraction,Ei.Drag],Xr=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Kr(e){return function(e,t){for(var i="",r=0;r<e.length;){var s=e[r++];s<128||t?i+=String.fromCharCode(s):s<224?i+=String.fromCharCode((31&s)<<6|63&e[r++]):s<240?i+=String.fromCharCode((15&s)<<12|(63&e[r++])<<6|63&e[r++]):(s=((15&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}(Wr(Gr(JSON.stringify(e))),!0)}function Zr(e){return e.type===Si.Custom&&"sessionIdle"===e.data.tag}function es(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class ts{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Vr+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:Jr}get isSampled(){var e=this.instance.get_property(we);return G(e)?e:null}get sessionDuration(){var e,t,i=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-r:null}get isRecordingEnabled(){var t=!!this.instance.get_property(_e),i=!this.instance.config.disable_session_recording;return e&&t&&i}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(pe),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,i,r,s,n,o=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(ge),l=null!==(e=null!==(t=null==o?void 0:o.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,u=null!==(i=null!==(r=null==o?void 0:o.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==i?i:0,c=null!==(s=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==s?s:0;return{enabled:l,fps:ar(u,0,12,"canvas recording fps"),quality:ar(c,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(ve),r={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==i?void 0:i.recordHeaders),n=(null==r?void 0:r.recordBody)||(null==i?void 0:i.recordBody),o=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(G(o)?o:null==i?void 0:i.capturePerformance);return s||n||a?{recordHeaders:s,recordBody:n,recordPerformance:a}:void 0}get sampleRate(){var e=this.instance.get_property(fe);return W(e)?e:null}get minimumDuration(){var e=this.instance.get_property(me);return W(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this._urlBlocked?"paused":z(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":G(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(Se))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(Ee))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(ie(this,"queuedRRWebEvents",[]),ie(this,"isIdle",!1),ie(this,"_linkedFlagSeen",!1),ie(this,"_lastActivityTimestamp",Date.now()),ie(this,"_linkedFlag",null),ie(this,"_removePageViewCaptureHook",void 0),ie(this,"_onSessionIdListener",void 0),ie(this,"_persistDecideOnSessionListener",void 0),ie(this,"_samplingSessionListener",void 0),ie(this,"_urlTriggers",[]),ie(this,"_urlBlocklist",[]),ie(this,"_urlBlocked",!1),ie(this,"_eventTriggers",[]),ie(this,"_removeEventTriggerCaptureHook",void 0),ie(this,"_forceAllowLocalhostNetworkCapture",!1),ie(this,"_onBeforeUnload",(()=>{this._flushBuffer()})),ie(this,"_onOffline",(()=>{this._tryAddCustomEvent("browser offline",{})})),ie(this,"_onOnline",(()=>{this._tryAddCustomEvent("browser online",{})})),ie(this,"_onVisibilityChange",(()=>{if(null!=o&&o.visibilityState){var e="window "+o.visibilityState;this._tryAddCustomEvent(e,{})}})),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Qr.error("started without valid sessionManager"),new Error(Vr+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Vr+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=i,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Qr.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),null==e||e.addEventListener("beforeunload",this._onBeforeUnload),null==e||e.addEventListener("offline",this._onOffline),null==e||e.addEventListener("online",this._onOnline),null==e||e.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),z(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskUrl(null==e?void 0:e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Qr.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,i)=>{var r,s,n,o;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),null===(r=this.instance)||void 0===r||null===(s=r.persistence)||void 0===s||s.unregister(Ee),null===(n=this.instance)||void 0===n||null===(o=n.persistence)||void 0===o||o.unregister(Se))})))):this.stopRecording()}stopRecording(){var t,i,r,s;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==e||e.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(r=this._onSessionIdListener)||void 0===r||r.call(this),this._onSessionIdListener=void 0,null===(s=this._samplingSessionListener)||void 0===s||s.call(this),this._samplingSessionListener=void 0,Qr.info("stopped"))}makeSamplingDecision(e){var t,i=this.sessionId!==e,r=this.sampleRate;if(W(r)){var s,n=this.isSampled,o=i||!G(n);if(o)s=Math.random()<r;else s=n;o&&(s?this._reportStarted("sampled"):Qr.warn("Sample rate (".concat(r,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:s})),null===(t=this.instance.persistence)||void 0===t||t.register({[we]:s})}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register({[we]:null})}}onRemoteConfig(e){var t,i,r,s,n,o;(this._persistRemoteConfig(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(o=e.sessionRecording)||void 0===o?void 0:o.endpoint);if(this._setupSampling(),!z(this._linkedFlag)&&!this._linkedFlagSeen){var a=H(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,l=H(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((e,t)=>{var i=N(t)&&a in t,r=l?t[a]===l:i;r&&this._reportStarted("linked_flag_matched",{linkedFlag:a,linkedVariant:l}),this._linkedFlagSeen=r}))}null!==(r=e.sessionRecording)&&void 0!==r&&r.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(s=e.sessionRecording)&&void 0!==s&&s.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(n=e.sessionRecording)&&void 0!==n&&n.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){W(this.sampleRate)&&z(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistRemoteConfig(e){if(this.instance.persistence){var t,i=this.instance.persistence,r=()=>{var t,r,s,n,o,a,l,u,c=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,d=z(c)?null:parseFloat(c),h=null===(r=e.sessionRecording)||void 0===r?void 0:r.minimumDurationMilliseconds;i.register({[_e]:!!e.sessionRecording,[pe]:null===(s=e.sessionRecording)||void 0===s?void 0:s.consoleLogRecordingEnabled,[ve]:te({capturePerformance:e.capturePerformance},null===(n=e.sessionRecording)||void 0===n?void 0:n.networkPayloadCapture),[ge]:{enabled:null===(o=e.sessionRecording)||void 0===o?void 0:o.recordCanvas,fps:null===(a=e.sessionRecording)||void 0===a?void 0:a.canvasFps,quality:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasQuality},[fe]:d,[me]:B(h)?null:h,[be]:null===(u=e.sessionRecording)||void 0===u?void 0:u.scriptConfig})};r(),null===(t=this._persistDecideOnSessionListener)||void 0===t||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}log(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!B(Object.assign)&&!B(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,this.scriptName,(e=>{if(e)return Qr.error("could not load recorder",e);this._onScriptLoaded()}));Qr.info("starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}get scriptName(){var e,t,i;return(null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t||null===(i=t.get_property(be))||void 0===i?void 0:i.script)||"recorder"}isInteractiveEvent(e){var t;return 3===e.type&&-1!==Yr.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)),!this.isIdle){var{windowId:r,sessionId:s}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=this.sessionId!==s,o=this.windowId!==r;this.windowId=r,this.sessionId=s,n||o?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Qr.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Xr((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Xr((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording;for(var[r,s]of Object.entries(i||{}))r in t&&("maskInputOptions"===r?t.maskInputOptions=te({password:!0},s):t[r]=s);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new lr(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{var i="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");Qr.info(i,{node:t}),this.log(Vr+" "+i,"warn")}});var n=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(te({emit:e=>{this.onRRwebEmit(e)},plugins:n},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:n.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Qr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_gatherRRWebPlugins(){var e,t,i,r,s=[],n=null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.isConsoleLogCaptureEnabled&&s.push(n());var o=null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.rrwebPlugins)||void 0===r?void 0:r.getRecordNetworkPlugin;this.networkPayloadCapture&&D(o)&&(!pt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(o(or(this.instance.config,this.networkPayloadCapture))):Qr.info("NetworkCapture not started because we are on localhost."));return s}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&N(e)){if(e.type===Si.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"!==this.status||function(e){return e.type===Si.Custom&&"recording paused"===e.data.tag}(e)){e.type===Si.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Si.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var s=function(e){var t=e;if(t&&N(t)&&6===t.type&&N(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var i=[],r=0;r<t.data.payload.payload.length;r++)t.data.payload.payload[r]&&t.data.payload.payload[r].length>2e3?i.push(t.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):i.push(t.data.payload.payload[r]);return t.data.payload.payload=i,e}return e}(r);if(this._updateWindowAndSessionIds(s),!this.isIdle||Zr(s)){if(Zr(s)){var n=s.data.payload;if(n){var o=n.lastActivityTimestamp,a=n.threshold;s.timestamp=o+a}}var l=null===(t=this.instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(yi(e)<1024)return e;try{if(e.type===Si.FullSnapshot)return te(te({},e),{},{data:Kr(e.data),cv:"2024-10"});if(e.type===Si.IncrementalSnapshot&&e.data.source===Ei.Mutation)return te(te({},e),{},{cv:"2024-10",data:te(te({},e.data),{},{texts:Kr(e.data.texts),attributes:Kr(e.data.attributes),removes:Kr(e.data.removes),adds:Kr(e.data.adds)})});if(e.type===Si.IncrementalSnapshot&&e.data.source===Ei.StyleSheetRule)return te(te({},e),{},{cv:"2024-10",data:te(te({},e.data),{},{adds:Kr(e.data.adds),removes:Kr(e.data.removes)})})}catch(e){Qr.error("could not compress event - will use uncompressed event",e)}return e}(s):s,u={$snapshot_bytes:yi(l),$snapshot_data:l,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(u):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&e){var t=this._maskUrl(e.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var i,r={url:e};return null===(i=r=t.maskNetworkRequestFn(r))||void 0===i?void 0:i.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,i=W(t)&&t>=0,r=W(e)&&i&&t<e;if("buffering"===this.status||r)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&wi(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:"web",$lib_version:_.LIB_VERSION})}));return this.clearBuffer()}_captureSnapshotBuffered(e){var t,i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0!==e&&e.location.href){var t=e.location.href,i="paused"===this.status,r=es(t,this._urlBlocklist);r&&!i?this._pauseRecording():!r&&i&&this._resumeRecording(),es(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,i;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({["url"===e?Se:Ee]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),Qr.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Qr.info("recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&z(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){Qr.error("Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[we]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),Qr.info(e.replace("_"," "),t),b(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}var is=X("[Decide]");class rs{constructor(e){this.instance=e}_loadRemoteConfigJs(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.loadExternalDependency?null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"remote-config",(()=>e(h._POSTHOG_CONFIG))):(is.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:t=>{e(t.json)}})}load(){if(this.instance.config.__preview_remote_config)return h._POSTHOG_CONFIG?(is.info("Using preloaded remote config",h._POSTHOG_CONFIG),void this.onRemoteConfig(h._POSTHOG_CONFIG)):void(this.instance.config.advanced_disable_decide?is.warn("Remote config is disabled. Falling back to local config."):this._loadRemoteConfigJs((e=>{if(!e)return is.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this.onRemoteConfig(e)}));this.onRemoteConfig(e)})))}onRemoteConfig(e){e?(this.instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this.instance.featureFlags.ensureFlagsLoaded()):is.error("Failed to fetch remote config from PostHog.")}}var ss,ns=null!=e&&e.location?bt(e.location.hash,"__posthog")||bt(location.hash,"state"):null,os="_postHogToolbarParams";!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(ss||(ss={}));class as{constructor(e){this.instance=e}setToolbarState(e){h.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:ss.UNINITIALIZED}maybeLoadToolbar(){var t,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||!o)return!1;r=null!==(t=r)&&void 0!==t?t:e.location,n=null!==(i=n)&&void 0!==i?i:e.history;try{if(!s){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}s=null==e?void 0:e.localStorage}var a,l=ns||bt(r.hash,"__posthog")||bt(r.hash,"state"),u=l?w((()=>JSON.parse(atob(decodeURIComponent(l)))))||w((()=>JSON.parse(decodeURIComponent(l)))):null;return u&&"ph_authorize"===u.action?((a=u).source="url",a&&Object.keys(a).length>0&&(u.desiredHash?r.hash=u.desiredHash:n?n.replaceState(n.state,"",r.pathname+r.search):r.hash="")):((a=JSON.parse(s.getItem(os)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch(e){return!1}}_callLoadToolbar(e){(h.ph_load_toolbar||h.ph_load_editor)(e,this.instance)}loadToolbar(t){var i=!(null==o||!o.getElementById(Ne));if(!e||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=te(te({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(e.localStorage.setItem(os,JSON.stringify(te(te({},s),{},{source:void 0}))),this.getToolbarState()===ss.LOADED)this._callLoadToolbar(s);else if(this.getToolbarState()===ss.UNINITIALIZED){var n,a;this.setToolbarState(ss.LOADING),null===(n=h.__PosthogExtensions__)||void 0===n||null===(a=n.loadExternalDependency)||void 0===a||a.call(n,this.instance,"toolbar",(e=>{if(e)return Y.error("[Toolbar] Failed to load",e),void this.setToolbarState(ss.UNINITIALIZED);this.setToolbarState(ss.LOADED),this._callLoadToolbar(s)})),I(e,"turbolinks:load",(()=>{this.setToolbarState(ss.UNINITIALIZED),this.loadToolbar(s)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}class ls{constructor(e){ie(this,"isPaused",!0),ie(this,"queue",[]),ie(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this.sendRequest(te(te({},e),{},{transport:"sendBeacon"}))}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),i=function(i){var r=t[i],s=(new Date).getTime();r.data&&A(r.data)&&f(r.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e.sendRequest(r)};for(var r in t)i(r)}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return f(this.queue,(t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;B(e[s])&&(e[s]=te(te({},r),{},{data:[]})),null===(i=e[s].data)||void 0===i||i.push(r.data)})),this.queue=[],e}}var us=!!u||!!l,cs="text/plain",ds=(e,t)=>{var[i,r]=e.split("?"),s=te({},t);null==r||r.split("&").forEach((e=>{var[t]=e.split("=");delete s[t]}));var n=ft(s);return n=n?(r?r+"&":"")+n:r,"".concat(i,"?").concat(n)},hs=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),_s=e=>{var{data:t,compression:i}=e;if(t){if(i===exports.Compression.GZipJS){var r=Wr(Gr(hs(t)),{mtime:0}),s=new Blob([r],{type:cs});return{contentType:cs,body:s,estimatedSize:s.size}}if(i===exports.Compression.Base64){var n=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=C(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,c[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(hs(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:hs(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=hs(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ps=[];u&&ps.push({transport:"XHR",method:e=>{var t,i=new u;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=_s(e))&&void 0!==t?t:{};f(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.withCredentials=!0,i.onreadystatechange=()=>{if(4===i.readyState){var t,r={statusCode:i.status,text:i.responseText};if(200===i.status)try{r.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,r)}},i.send(s)}}),l&&ps.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=_s(e))&&void 0!==t?t:{},o=new Headers;f(e.headers,(function(e,t){o.append(t,e)})),r&&o.append("Content-Type",r);var a=e.url,u=null;if(c){var d=new c;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),e.timeout)}}l(a,te({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null===(i=u)||void 0===i?void 0:i.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r,s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Y.error(e)}null===(r=e.callback)||void 0===r||r.call(e,s)})))).catch((t=>{var i;Y.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,text:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),null!=n&&n.sendBeacon&&ps.push({transport:"sendBeacon",method:e=>{var t=ds(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=_s(e))&&void 0!==i?i:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(t,o)}catch(e){}}});var vs=["retriesPerformedSoFar"];class gs{constructor(t){ie(this,"isPolling",!1),ie(this,"pollIntervalMs",3e3),ie(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!B(e)&&"onLine"in e.navigator&&(this.areWeOnline=e.navigator.onLine,e.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),e.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=re(e,vs);W(t)&&t>0&&(i.url=ds(i.url,{retry_count:t})),this.instance._send_request(te(te({},i),{},{callback:e=>{var r;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue(te({retriesPerformedSoFar:t},i)):null===(r=i.callback)||void 0===r||r.call(i,e)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this.queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in ".concat(i);navigator.onLine||(s+=" (Browser is offline)"),Y.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){var e=Date.now(),t=[],i=this.queue.filter((i=>i.retryAt<e||(t.push(i),!1)));if(this.queue=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(te(te({},e),{},{transport:"sendBeacon"}))}catch(e){Y.error(e)}this.queue=[]}}var fs,ms=X("[SessionId]");class bs{constructor(e,t,i){var r;if(ie(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=e.config,this.persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Ze,this._windowIdGenerator=i||Ze;var s=this.config.persistence_name||this.config.token,n=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ar(n,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=_t.parse(this._window_id_storage_key),a=_t.parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:_t.remove(this._window_id_storage_key),_t.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{var l=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){ms.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return B(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&_t.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&_t.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?_t.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[ye]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[ye];return A(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==e||e.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&&_t.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var i=t||(new Date).getTime(),[r,s,n]=this._getSessionId(),o=this._getWindowId(),a=W(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,u=!s,c=!e&&Math.abs(i-r)>this.sessionTimeoutMs;u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),ms.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=0===r||!e||a?i:r,h=0===n?(new Date).getTime():n;return this._setWindowId(o),this._setSessionId(s,d,h),l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:h,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}}!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(fs||(fs={}));var ys="i.posthog.com";class ws{constructor(e){ie(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(ys),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=fs.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=fs.EU:this._regionCache[this.apiHost]=fs.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return this.uiHost+t;if(this.region===fs.CUSTOM)return this.apiHost+t;var i=ys+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var Ss="posthog-js";function Es(e){var{organization:t,projectId:i,prefix:r,severityAllowList:s=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{var o,a,l,u,c;if(!("*"===s||s.includes(n.level))||!e.__loaded)return n;n.tags||(n.tags={});var d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));n.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(n.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h=(null===(o=n.exception)||void 0===o?void 0:o.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));var _={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||n.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:(null===(u=h[0])||void 0===u?void 0:u.value)||n.message,$sentry_exception_type:null===(c=h[0])||void 0===c?void 0:c.type,$sentry_tags:n.tags};return t&&i&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+n.event_id),e.exceptions.sendExceptionEvent(_),n}}class ks{constructor(e,t,i,r,s){this.name=Ss,this.setupOnce=function(n){n(Es(e,{organization:t,projectId:i,prefix:r,severityAllowList:s}))}}}var xs,Cs,Is,Ps=X("[SegmentIntegration]");function Ts(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Ze();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(Fe,"identified")),t()},s=i.user();"then"in s&&D(s.then)?s.then((e=>r(e))):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Ps.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{var r;if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ps.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ps.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e._calculate_event_properties(i,null!==(r=t.event.properties)&&void 0!==r?r:{},new Date);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class Rs{constructor(e){this._instance=e}doPageView(t){var i,r=this._previousPageViewProperties(t);return this._currentPath=null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=t,r}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,i=this._prevPageviewTimestamp,r=this._instance.scrollManager.getContext();if(!i)return{};var s={};if(r){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(B(n)||B(o)||B(a)||B(l)||B(u)||B(c)))n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),s={$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:n<=1?1:ar(o/n,0,1),$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:n<=1?1:ar(a/n,0,1),$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:l<=1?1:ar(u/l,0,1),$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:l<=1?1:ar(c/l,0,1)}}return t&&(s.$prev_pageview_pathname=t),i&&(s.$prev_pageview_duration=(e.getTime()-i.getTime())/1e3),s}}exports.SurveyType=void 0,(xs=exports.SurveyType||(exports.SurveyType={})).Popover="popover",xs.API="api",xs.Widget="widget",exports.SurveyQuestionType=void 0,(Cs=exports.SurveyQuestionType||(exports.SurveyQuestionType={})).Open="open",Cs.MultipleChoice="multiple_choice",Cs.SingleChoice="single_choice",Cs.Rating="rating",Cs.Link="link",exports.SurveyQuestionBranchingType=void 0,(Is=exports.SurveyQuestionBranchingType||(exports.SurveyQuestionBranchingType={})).NextQuestion="next_question",Is.End="end",Is.ResponseBased="response_based",Is.SpecificQuestion="specific_question";class Fs{constructor(){ie(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this.events[e]||[])i(t);for(var r of this.events["*"]||[])r(e,t)}}class $s{constructor(e){ie(this,"_debugEventEmitter",new Fs),ie(this,"checkStep",((e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t))),ie(this,"checkStepEvent",((e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event))),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!B(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,i;if(!B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(i=e.steps)||void 0===i||i.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(i=this.instance)&&void 0!==i&&i.autocapture)){var r,s=new Set;e.forEach((e=>{var t;null===(t=e.steps)||void 0===t||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null===(r=this.instance)||void 0===r||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(i=this.actionRegistry)||void 0===i?void 0:i.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(null!=t&&t.url){var i,r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!$s.matchString(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(t,i,r){switch(r){case"regex":return!!e&&gt(t,i);case"exact":return i===t;case"contains":var s=$s.escapeStringRegexp(i).replace(/_/g,".").replace(/%/g,".*");return gt(t,s);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!$s.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!$s.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!$s.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1;if(null!=t&&t.selector){var i,r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class Os{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter((e=>{var t,i,r,s;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(i=e.conditions)||void 0===i||null===(r=i.actions)||void 0===r||null===(s=r.values)||void 0===s?void 0:s.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new $s(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,i,r,s,n,o,a,l,u,c;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(r=i.actions)&&void 0!==r&&r.values&&(null===(s=e.conditions)||void 0===s||null===(n=s.actions)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u||null===(c=u.values)||void 0===c||c.forEach((t=>{if(t&&t.name){var i=this.actionToSurveys.get(t.name);i&&i.push(e.id),this.actionToSurveys.set(t.name,i||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0!==e.filter((e=>{var t,i,r,s;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(r=i.events)||void 0===r||null===(s=r.values)||void 0===s?void 0:s.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,i,r;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(r=i.values)||void 0===r||r.forEach((t=>{if(t&&t.name){var i=this.eventToSurveys.get(t.name);i&&i.push(e.id),this.eventToSurveys.set(t.name,i||[e.id])}}))}))}}onEvent(e,t){var i,r,s=(null===(i=this.instance)||void 0===i||null===(r=i.persistence)||void 0===r?void 0:r.props[Te])||[];if(Os.SURVEY_SHOWN_EVENT_NAME==e&&t&&s.length>0){var n,o=null==t||null===(n=t.properties)||void 0===n?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this._updateActivatedSurveys(s))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,i,r=(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i?void 0:i.props[Te])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({[Te]:[...new Set(e)]})}getSurveys(){var e,t,i=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Te];return i||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}ie(Os,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Ls,Ms,As,Ds,Ns,qs,Bs,Hs,Us={},js=[],zs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ws=Array.isArray;function Gs(e,t){for(var i in t)e[i]=t[i];return e}function Vs(e){var t=e.parentNode;t&&t.removeChild(e)}function Qs(e,t,i,r,s){var n={type:e,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++As:s,__i:-1,__u:0};return null==s&&null!=Ms.vnode&&Ms.vnode(n),n}function Js(e){return e.children}function Ys(e,t){this.props=e,this.context=t}function Xs(e,t){if(null==t)return e.__?Xs(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?Xs(e):null}function Ks(e){var t,i;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e){e.__e=e.__c.base=i.__e;break}return Ks(e)}}function Zs(e){(!e.__d&&(e.__d=!0)&&Ds.push(e)&&!en.__r++||Ns!==Ms.debounceRendering)&&((Ns=Ms.debounceRendering)||qs)(en)}function en(){var e,t,i,r,s,n,o,a,l;for(Ds.sort(Bs);e=Ds.shift();)e.__d&&(t=Ds.length,r=void 0,n=(s=(i=e).__v).__e,a=[],l=[],(o=i.__P)&&((r=Gs({},s)).__v=s.__v+1,Ms.vnode&&Ms.vnode(r),cn(o,r,s,i.__n,void 0!==o.ownerSVGElement,32&s.__u?[n]:null,a,null==n?Xs(s):n,!!(32&s.__u),l),r.__.__k[r.__i]=r,dn(a,r,l),r.__e!=n&&Ks(r)),Ds.length>t&&Ds.sort(Bs));en.__r=0}function tn(e,t,i,r,s,n,o,a,l,u,c){var d,h,_,p,v,g=r&&r.__k||js,f=t.length;for(i.__d=l,rn(i,t,g),l=i.__d,d=0;d<f;d++)null!=(_=i.__k[d])&&"boolean"!=typeof _&&"function"!=typeof _&&(h=-1===_.__i?Us:g[_.__i]||Us,_.__i=d,cn(e,_,h,s,n,o,a,l,u,c),p=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&_n(h.ref,null,_),c.push(_.ref,_.__c||p,_)),null==v&&null!=p&&(v=p),65536&_.__u||h.__k===_.__k?l=sn(_,l,e):"function"==typeof _.type&&void 0!==_.__d?l=_.__d:p&&(l=p.nextSibling),_.__d=void 0,_.__u&=-196609);i.__d=l,i.__e=v}function rn(e,t,i){var r,s,n,o,a,l=t.length,u=i.length,c=u,d=0;for(e.__k=[],r=0;r<l;r++)null!=(s=e.__k[r]=null==(s=t[r])||"boolean"==typeof s||"function"==typeof s?null:"string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Qs(null,s,null,null,s):Ws(s)?Qs(Js,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?Qs(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,a=nn(s,i,o=r+d,c),s.__i=a,n=null,-1!==a&&(c--,(n=i[a])&&(n.__u|=131072)),null==n||null===n.__v?(-1==a&&d--,"function"!=typeof s.type&&(s.__u|=65536)):a!==o&&(a===o+1?d++:a>o?c>l-o?d+=a-o:d--:d=a<o&&a==o-1?a-o:0,a!==r+d&&(s.__u|=65536))):(n=i[r])&&null==n.key&&n.__e&&(n.__e==e.__d&&(e.__d=Xs(n)),pn(n,n,!1),i[r]=null,c--);if(c)for(r=0;r<u;r++)null!=(n=i[r])&&0==(131072&n.__u)&&(n.__e==e.__d&&(e.__d=Xs(n)),pn(n,n))}function sn(e,t,i){var r,s;if("function"==typeof e.type){for(r=e.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=e,t=sn(r[s],t,i));return t}return e.__e!=t&&(i.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function nn(e,t,i,r){var s=e.key,n=e.type,o=i-1,a=i+1,l=t[i];if(null===l||l&&s==l.key&&n===l.type)return i;if(r>(null!=l&&0==(131072&l.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((l=t[o])&&0==(131072&l.__u)&&s==l.key&&n===l.type)return o;o--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&s==l.key&&n===l.type)return a;a++}}return-1}function on(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||zs.test(t)?i:i+"px"}function an(e,t,i,r,s){var n;e:if("style"===t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)i&&t in i||on(e.style,t,"");if(i)for(t in i)r&&i[t]===r[t]||on(e.style,t,i[t])}else if("o"===t[0]&&"n"===t[1])n=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+n]=i,i?r?i.u=r.u:(i.u=Date.now(),e.addEventListener(t,n?un:ln,n)):e.removeEventListener(t,n?un:ln,n);else{if(s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,i))}}function ln(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Ms.event?Ms.event(e):e)}function un(e){return this.l[e.type+!0](Ms.event?Ms.event(e):e)}function cn(e,t,i,r,s,n,o,a,l,u){var c,d,h,_,p,v,g,f,m,b,y,w,S,E,k,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),n=[a=t.__e=i.__e]),(c=Ms.__b)&&c(t);e:if("function"==typeof x)try{if(f=t.props,m=(c=x.contextType)&&r[c.__c],b=c?m?m.props.value:c.__:r,i.__c?g=(d=t.__c=i.__c).__=d.__E:("prototype"in x&&x.prototype.render?t.__c=d=new x(f,b):(t.__c=d=new Ys(f,b),d.constructor=x,d.render=vn),m&&m.sub(d),d.props=f,d.state||(d.state={}),d.context=b,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Gs({},d.__s)),Gs(d.__s,x.getDerivedStateFromProps(f,d.__s))),_=d.props,p=d.state,d.__v=t,h)null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==x.getDerivedStateFromProps&&f!==_&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(f,b),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,b)||t.__v===i.__v)){for(t.__v!==i.__v&&(d.props=f,d.state=d.__s,d.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.forEach((function(e){e&&(e.__=t)})),y=0;y<d._sb.length;y++)d.__h.push(d._sb[y]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,b),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(_,p,v)}))}if(d.context=b,d.props=f,d.__P=e,d.__e=!1,w=Ms.__r,S=0,"prototype"in x&&x.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do{d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=Gs(Gs({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(_,p)),tn(e,Ws(k=null!=c&&c.type===Js&&null==c.key?c.props.children:c)?k:[k],t,i,r,s,n,o,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=n?(t.__e=a,t.__u|=l?160:32,n[n.indexOf(a)]=null):(t.__e=i.__e,t.__k=i.__k),Ms.__e(e,t,i)}else null==n&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=hn(i.__e,t,i,r,s,n,o,l,u);(c=Ms.diffed)&&c(t)}function dn(e,t,i){t.__d=void 0;for(var r=0;r<i.length;r++)_n(i[r],i[++r],i[++r]);Ms.__c&&Ms.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ms.__e(e,t.__v)}}))}function hn(e,t,i,r,s,n,o,a,l){var u,c,d,h,_,p,v,g=i.props,f=t.props,m=t.type;if("svg"===m&&(s=!0),null!=n)for(u=0;u<n.length;u++)if((_=n[u])&&"setAttribute"in _==!!m&&(m?_.localName===m:3===_.nodeType)){e=_,n[u]=null;break}if(null==e){if(null===m)return document.createTextNode(f);e=s?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,f.is&&f),n=null,a=!1}if(null===m)g===f||a&&e.data===f||(e.data=f);else{if(n=n&&Ls.call(e.childNodes),g=i.props||Us,!a&&null!=n)for(g={},u=0;u<e.attributes.length;u++)g[(_=e.attributes[u]).name]=_.value;for(u in g)_=g[u],"children"==u||("dangerouslySetInnerHTML"==u?d=_:"key"===u||u in f||an(e,u,null,_,s));for(u in f)_=f[u],"children"==u?h=_:"dangerouslySetInnerHTML"==u?c=_:"value"==u?p=_:"checked"==u?v=_:"key"===u||a&&"function"!=typeof _||g[u]===_||an(e,u,_,g[u],s);if(c)a||d&&(c.__html===d.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),tn(e,Ws(h)?h:[h],t,i,r,s&&"foreignObject"!==m,n,o,n?n[0]:i.__k&&Xs(i,0),a,l),null!=n)for(u=n.length;u--;)null!=n[u]&&Vs(n[u]);a||(u="value",void 0!==p&&(p!==e[u]||"progress"===m&&!p||"option"===m&&p!==g[u])&&an(e,u,p,g[u],!1),u="checked",void 0!==v&&v!==e[u]&&an(e,u,v,g[u],!1))}return e}function _n(e,t,i){try{"function"==typeof e?e(t):e.current=t}catch(e){Ms.__e(e,i)}}function pn(e,t,i){var r,s;if(Ms.unmount&&Ms.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||_n(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ms.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&pn(r[s],t,i||"function"!=typeof e.type);i||null==e.__e||Vs(e.__e),e.__=e.__e=e.__d=void 0}function vn(e,t,i){return this.constructor(e,i)}Ls=js.slice,Ms={__e:function(e,t,i,r){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,r||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},As=0,Ys.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Gs({},this.state),"function"==typeof e&&(e=e(Gs({},i),this.props)),e&&Gs(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),Zs(this))},Ys.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zs(this))},Ys.prototype.render=Js,Ds=[],qs="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Bs=function(e,t){return e.__v.__b-t.__v.__b},en.__r=0,Hs=0;!function(e,t){var i={__c:t="__cC"+Hs++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var i,r;return this.getChildContext||(i=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&i.some((function(e){e.__e=!0,Zs(e)}))},this.sub=function(e){i.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i.splice(i.indexOf(e),1),t&&t.call(e)}}),e.children}};i.Provider.__=i.Consumer.contextType=i}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var gn=X("[Surveys]"),fn={icontains:t=>!!e&&e.location.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:t=>!!e&&-1===e.location.href.toLowerCase().indexOf(t.toLowerCase()),regex:t=>!!e&&gt(e.location.href,t),not_regex:t=>!!e&&!gt(e.location.href,t),exact:t=>(null==e?void 0:e.location.href)===t,is_not:t=>(null==e?void 0:e.location.href)!==t};class mn{constructor(e){this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);null!=i&&i.startsWith("seenSurvey_")&&e.push(i)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e,t,i,r=null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||r||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new Os(this.instance)),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"surveys",(e=>{var t,i;if(e)return gn.error("Could not load surveys script",e);this._surveyManager=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,this.instance)})))}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new Os(this.instance));var i=this.instance.get_property(Pe);if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{var i;if(200!==t.statusCode||!t.json)return e([]);var r,s=t.json.surveys||[],n=s.filter((e=>{var t,i,r,s,n,o,a,l,u,c,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(r=i.events)||void 0===r?void 0:r.values)&&(null===(s=e.conditions)||void 0===s||null===(n=s.events)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n));return null===(i=this.instance.persistence)||void 0===i||i.register({[Pe]:s}),e(s)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var i,r=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,i,r,s;if(!e.conditions)return!0;var n=null===(t=e.conditions)||void 0===t||!t.url||fn[null!==(i=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==i?i:"icontains"](e.conditions.url),a=null===(s=e.conditions)||void 0===s||!s.selector||(null==o?void 0:o.querySelector(e.conditions.selector));return n&&a})),s=null===(i=this._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),n=r.filter((e=>{var t,i,r,n,o,a,l,u,c,d,h;if(!(e.linked_flag_key||e.targeting_flag_key||e.internal_targeting_flag_key||null!==(t=e.feature_flag_keys)&&void 0!==t&&t.length))return!0;var _=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),p=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),v=(null===(i=e.conditions)||void 0===i?void 0:i.events)&&(null===(r=e.conditions)||void 0===r||null===(n=r.events)||void 0===n?void 0:n.values)&&(null===(o=e.conditions)||void 0===o||null===(a=o.events)||void 0===a?void 0:a.values.length)>0,g=(null===(l=e.conditions)||void 0===l?void 0:l.actions)&&(null===(u=e.conditions)||void 0===u||null===(c=u.actions)||void 0===c?void 0:c.values)&&(null===(d=e.conditions)||void 0===d||null===(h=d.actions)||void 0===h?void 0:h.values.length)>0,f=!v&&!g||(null==s?void 0:s.includes(e.id)),m=this._canActivateRepeatedly(e),b=!(e.internal_targeting_flag_key&&!m)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key),y=this.checkFlags(e);return _&&p&&b&&f&&y}));return e(n)}),t)}checkFlags(e){var t;return null===(t=e.feature_flag_keys)||void 0===t||!t.length||e.feature_flag_keys.every((e=>{var{key:t,value:i}=e;return!t||!i||this.instance.featureFlags.isFeatureEnabled(i)}))}getNextSurveyStep(e,t,i){var r,s=e.questions[t],n=t+1;if(null===(r=s.branching)||void 0===r||!r.type)return t===e.questions.length-1?exports.SurveyQuestionBranchingType.End:n;if(s.branching.type===exports.SurveyQuestionBranchingType.End)return exports.SurveyQuestionBranchingType.End;if(s.branching.type===exports.SurveyQuestionBranchingType.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===exports.SurveyQuestionBranchingType.ResponseBased){if(s.type===exports.SurveyQuestionType.SingleChoice){var o,a,l=s.choices.indexOf("".concat(i));if(null!==(o=s.branching)&&void 0!==o&&null!==(a=o.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var u=s.branching.responseValues[l];return Number.isInteger(u)?u:u===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}else if(s.type===exports.SurveyQuestionType.Rating){var c,d;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");var h=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,s.scale);if(null!==(c=s.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(h)){var _=s.branching.responseValues[h];return Number.isInteger(_)?_:_===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}return n}return gn.warn("Falling back to next question index due to unexpected branching type"),n}_canActivateRepeatedly(e){var t;return z(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(gn.warn("init was not called"),!1):h.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){z(this._surveyManager)?gn.warn("init was not called"):this.getSurveys((t=>{var i=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(i)}))}renderSurvey(e,t){z(this._surveyManager)?gn.warn("init was not called"):this.getSurveys((i=>{var r=i.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(r,null==o?void 0:o.querySelector(t))}))}}var bn=X("[RateLimiter]");class yn{constructor(e){var t,i;ie(this,"serverLimits",{}),ie(this,"lastEventRateLimited",!1),ie(this,"checkForLimiting",(e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{bn.info("".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void bn.warn('could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}})),this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(i=e.config.rate_limiting)||void 0===i?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=(new Date).getTime(),n=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Oe))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||r||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null===(i=this.instance.persistence)||void 0===i||i.set_property(Oe,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var wn=()=>te({initialPathName:(null==a?void 0:a.pathname)||"",referringDomain:fi.referringDomain()},fi.campaignParams());class Sn{constructor(e,t,i){ie(this,"_onSessionIdCallback",(e=>{var t=this._getStoredProps();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[$e]:i})}})),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=i||wn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[$e]}getSessionProps(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}var En=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],kn=function(e,t){if(!e)return!1;var i=e.toLowerCase();return En.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},xn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&kn(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>kn(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};class Cn{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var In=X("[Dead Clicks]"),Pn=()=>!0,Tn=e=>{var t,i=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(de)),r=e.instance.config.capture_dead_clicks;return G(r)?r:i};class Rn{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[de]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"dead-clicks-autocapture",(t=>{t?In.error("failed to load script",t):e()}))}start(){var e;if(o){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=h.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=N(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(o),In.info("starting...")}}else In.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,In.info("stopping..."))}}var Fn=X("[Heatmaps]");class $n{constructor(t){var i;ie(this,"rageclicks",new Cn),ie(this,"_enabledServerSide",!1),ie(this,"_initialized",!1),ie(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[le]),null==e||e.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){var e=5e3;return N(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return B(this.instance.config.capture_heatmaps)?B(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Fn.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[le]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){e&&o&&(I(o,"click",(t=>this._onClick(t||(null==e?void 0:e.event))),!1,!0),I(o,"mousemove",(t=>this._onMouseMove(t||(null==e?void 0:e.event))),!1,!0),this.deadClicksCapture=new Rn(this.instance,Pn,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(t,i,r){for(var s=t;s&&xi(s)&&!Ci(s,"body");){if(s===r)return!1;if(b(i,null==e?void 0:e.getComputedStyle(s).position))return!0;s=Ai(s)}return!1}(Li(t),["fixed","sticky"],n);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:r),target_fixed:o,type:i}}_onClick(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!ki(e.target)){var r=this._getProperties(e,i);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(te(te({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){ki(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(e){var i=e.location.href;this.buffer=this.buffer||{},this.buffer[i]||(this.buffer[i]=[]),this.buffer[i].push(t)}}flush(){this.buffer&&!q(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class On{constructor(e){ie(this,"_updateScrollData",(()=>{var e,t,i,r;this.context||(this.context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.context.lastScrollY=Math.ceil(n),this.context.maxScrollY=Math.max(n,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(o,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(i=this.context.maxContentY)&&void 0!==i?i:0),this.context.maxContentHeight=Math.max(l,null!==(r=this.context.maxContentHeight)&&void 0!==r?r:0)})),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){null==e||e.addEventListener("scroll",this._updateScrollData,!0),null==e||e.addEventListener("scrollend",this._updateScrollData,!0),null==e||e.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==e?void 0:e.document.documentElement;var t=A(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var i of t){var r=null==e?void 0:e.document.querySelector(i);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}}var Ln=X("[AutoCapture]");function Mn(e,t){return t.length>e?t.slice(0,e)+"...":t}function An(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!xi(t));return t}function Dn(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Mi.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=Mn(1024,Vi(e)):n.$el_text=Mn(1024,Oi(e)));var o=Fi(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),f(e.attributes,(function(i){var s;if((!qi(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==r||!r.includes(i.name))&&!t&&Gi(i.value)&&(s=i.name,!H(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=i.value;"class"===i.name&&(o=Ti(o).join(" ")),n["attr__"+i.name]=Mn(1024,o)}}));for(var a=1,l=1,u=e;u=An(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Nn(t,i){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i,c=[t],d=t;d.parentNode&&!Ci(d,"body");)Pi(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,_=[],p={},v=!1,g=!1;if(f(c,(e=>{var t=Ni(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Gi(v)&&v),b(Fi(e),"ph-no-capture")&&(g=!0),_.push(Dn(e,o,a,l));var i=function(e){if(!Ni(e))return{};var t={};return f(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Gi(r)&&(t[i]=r)}})),t}(e);m(p,i)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?_[0].$el_text=Vi(t):_[0].$el_text=Oi(t)),v){var y,w;_[0].attr__href=v;var S=null===(y=vt(v))||void 0===y?void 0:y.host,E=null==e||null===(w=e.location)||void 0===w?void 0:w.host;S&&E&&S!==E&&(h=v)}return{props:m({$event_type:n.type,$ce_version:1},u?{}:{$elements:_},{$elements_chain:Ji(_)},null!==(r=_[0])&&void 0!==r&&r.$el_text?{$el_text:null===(s=_[0])||void 0===s?void 0:s.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},p)}}class qn{constructor(e){ie(this,"_initialized",!1),ie(this,"_isDisabledServerSide",null),ie(this,"rageclicks",new Cn),ie(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,i=N(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null===(e=i.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null===(t=i.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(e&&o){var t=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){Ln.error("Failed to capture event",e)}},i=t=>{t=t||(null==e?void 0:e.event),this._captureEvent(t,R)};I(o,"submit",t,!1,!0),I(o,"change",t,!1,!0),I(o,"click",t,!1,!0),this.config.capture_copied_text&&(I(o,"copy",i,!1,!0),I(o,"cut",i,!1,!0))}}else Ln.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ae]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{var r=null==o?void 0:o.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ae],r=this._isDisabledServerSide;if(j(r)&&!G(i)&&!this.instance.config.advanced_disable_decide)return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var r,s=Li(t);if(Ii(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent)this.instance.config.rageclick&&null!==(r=this.rageclicks)&&void 0!==r&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this._captureEvent(t,"$rageclick");var n=i===R;if(s&&Di(s,t,this.config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Nn(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===R){var u,c=$i(null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString()),d=t.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return D(null==o?void 0:o.querySelectorAll)}}var Bn=X("[TracingHeaders]");class Hn{constructor(e){ie(this,"_restoreXHRPatch",void 0),ie(this,"_restoreFetchPatch",void 0),ie(this,"_startCapturing",(()=>{var e,t,i,r;B(this._restoreXHRPatch)&&(null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));B(this._restoreFetchPatch)&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.tracingHeadersPatchFns)||void 0===r||r._patchFetch(this.instance.sessionManager))})),this.instance=e}_loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"tracing-headers",(t=>{if(t)return Bn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Un;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Un||(Un={}));class jn{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Un.DENIED:this.storedConsent}isOptedOut(){return this.consent===Un.DENIED||this.consent===Un.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return"1"===e?Un.GRANTED:"0"===e?Un.DENIED:Un.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?at:nt;var t="localStorage"===e?nt:at;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!P([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,h.doNotTrack],(e=>b([!0,1,"1","yes"],e)))}}var zn=X("[ExceptionAutocapture]");class Wn{constructor(t){var i;ie(this,"originalOnUnhandledRejectionHandler",void 0),ie(this,"startCapturing",(()=>{var t,i,r,s;if(e&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.errorWrappingFunctions)||void 0===i?void 0:i.wrapOnError,o=null===(r=h.__PosthogExtensions__)||void 0===r||null===(s=r.errorWrappingFunctions)||void 0===s?void 0:s.wrapUnhandledRejection;if(n&&o)try{this.unwrapOnError=n(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){zn.error("failed to start",e),this.stopCapturing()}else zn.error("failed to load error wrapping functions - cannot start")}})),this.instance=t,this.remoteEnabled=!(null===(i=this.instance.persistence)||void 0===i||!i.props[ue]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var t;return!(null==e||null===(t=e.onerror)||void 0===t||!t.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(zn.info("enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,i;this.hasHandlers&&e(),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"exception-autocapture",(t=>{if(t)return zn.error("failed to load script",t);e()}))}stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[ue]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}var Gn=X("[Web Vitals]"),Vn=9e5;class Qn{constructor(e){var t;ie(this,"_enabledServerSide",!1),ie(this,"_initialized",!1),ie(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),ie(this,"_flushToCapture",(()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,t)=>te(te({},e),{},{["$web_vitals_".concat(t.name,"_event")]:te({},t),["$web_vitals_".concat(t.name,"_value")]:t.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),ie(this,"_addToBuffer",(e=>{var t,i=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if(B(i))Gn.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._currentURL();if(!B(r))if(z(null==e?void 0:e.name)||z(null==e?void 0:e.value))Gn.error("Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)Gn.error("Ignoring metric with value >= "+this._maxAllowedValue,e);else this.buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),B(this.buffer.url)&&(this.buffer.url=r),this.buffer.firstMetricTimestamp=B(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(te(te({},e),{},{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}})),ie(this,"_startCapturing",(()=>{var e,t,i,r,s=h.__PosthogExtensions__;B(s)||B(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this._addToBuffer.bind(this)),this._initialized=!0):Gn.error("web vitals callbacks not loaded - not starting")})),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[ce]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=N(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return B(i)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[he])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=N(this.instance.config.capture_performance)&&W(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Vn;return 0<e&&e<=6e4?Vn:e}get isEnabled(){var e=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return G(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Gn.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var t=N(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=N(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[ce]:t}),this.instance.persistence.register({[he]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,r;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"web-vitals",(t=>{t?Gn.error("failed to load script",t):e()}))}_currentURL(){var t=e?e.location.href:void 0;return t||Gn.error("Could not determine current URL"),t}}var Jn={icontains:(t,i)=>!!e&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!e&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!e&&gt(i.href,t),not_regex:(t,i)=>!!e&&!gt(i.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Yn{constructor(e){var t=this;ie(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.getWebExperiments((e=>{Yn.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;if(t._flagToExperiments)Yn.logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=t._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e);var r=t.instance.getFeatureFlag(e.feature_flag_key);H(r)&&e.variants[r]&&t.applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];Yn.matchesTestVariant(n)&&t.applyTransforms(e.name,s,n.transforms)}}))}),e)})),this.instance=e,this.instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())Yn.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(z(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Yn.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var i,r=this.instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=Yn.getWindowLocation();if(null!=e&&e.search){var t=mt(null==e?void 0:e.search,"__experiment_id"),i=mt(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Yn.logInfo("previewing web experiments ".concat(t," && ").concat(i)),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.instance.config.disable_web_experiments&&!i)return e([]);var r=this.instance.get_property("$web_experiments");if(r&&!t)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(Yn.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(r[0].name,t,r[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!z(e.conditions)&&(Yn.matchUrlConditions(e)&&Yn.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;var i,r,s,n=Yn.getWindowLocation();return!!n&&(null===(i=e.conditions)||void 0===i||!i.url||Jn[null!==(r=null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==e?void 0:e.location}static matchUTMConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var i=fi.campaignParams();if(i.utm_source){var r,s,n,o,a,l,u,c,d,h,_,p,v,g,f,m,b=null===(r=e.conditions)||void 0===r||null===(s=r.utm)||void 0===s||!s.utm_campaign||(null===(n=e.conditions)||void 0===n||null===(o=n.utm)||void 0===o?void 0:o.utm_campaign)==i.utm_campaign,y=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(u=e.conditions)||void 0===u||null===(c=u.utm)||void 0===c?void 0:c.utm_source)==i.utm_source,w=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(_=e.conditions)||void 0===_||null===(p=_.utm)||void 0===p?void 0:p.utm_medium)==i.utm_medium,S=null===(v=e.conditions)||void 0===v||null===(g=v.utm)||void 0===g||!g.utm_term||(null===(f=e.conditions)||void 0===f||null===(m=f.utm)||void 0===m?void 0:m.utm_term)==i.utm_term;return b&&w&&S&&y}return!1}static logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Y.info("[WebExperiments] ".concat(e),i)}applyTransforms(e,t,i,r){var s;this._is_bot()?Yn.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var s;Yn.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),i);var n,o=0,a=null===(s=document)||void 0===s?void 0:s.querySelectorAll(i.selector);if(null==a||a.forEach((e=>{var t=e;o+=1,i.attributes&&i.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),i.text&&(t.innerText=i.text),i.html&&(t.parentElement?t.parentElement.innerHTML=i.html:t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:r,$web_experiment_document_url:null===(n=Yn.getWindowLocation())||void 0===n?void 0:n.href,$web_experiment_elements_modified:o})}})):(Yn.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:r,$web_experiment_variant:t,$web_experiment_document_url:null===(s=Yn.getWindowLocation())||void 0===s?void 0:s.href,$web_experiment_elements_modified:0}))}_is_bot(){return n&&this.instance?xn(n,this.instance.config.custom_blocked_useragents):void 0}}class Xn{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Kn=["$set_once","$set"],Zn=X("[SiteApps]");class eo{constructor(e){this.instance=e,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this.bufferedInvocations.push(i),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this.instance.get_property("$groups")||[],c=this.instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))l[d]={id:u[d],type:d,properties:h};var{$set_once:_,$set:p}=e;return{event:te(te({},re(e,Kn)),{},{properties:te(te(te({},e.properties),p?{$set:te(te({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),p)}:{}),_?{$set_once:te(te({},null!==(r=null===(s=e.properties)||void 0===s?void 0:s.$set_once)&&void 0!==r?r:{}),_)}:{}),elements_chain:null!==(n=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=t;var i=i=>{var r;for(var s of(this.apps[e.id].errored=!i,this.apps[e.id].loaded=!0,Zn.info("Site app with id ".concat(e.id," ").concat(i?"loaded":"errored")),i&&this.bufferedInvocations.length&&(Zn.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(e.id)),this.bufferedInvocations.forEach((e=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)}))),Object.values(this.apps)))if(!s.loaded)return;null===(r=this.stopBuffering)||void 0===r||r.call(this)};try{var{processEvent:r}=e.init({posthog:this.instance,callback:e=>{i(e)}});r&&(t.processEvent=r)}catch(t){Zn.error("Error while initializing PostHog app with config id ".concat(e.id),t),i(!1)}}onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{var r;null===(r=i.processEvent)||void 0===r||r.call(i,t)}catch(t){Zn.error("Error while processing event ".concat(e.event," for site app ").concat(i.id),t)}}}onRemoteConfig(e){var t,i,r=this;if(A(h._POSTHOG_JS_APPS)){if(!this.isEnabled)return void Zn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');for(var s of h._POSTHOG_JS_APPS)this.setupSiteApp(s);var n;h._POSTHOG_JS_APPS.length?this.instance.on("eventCaptured",(e=>this.onCapturedEvent(e))):null===(n=this.stopBuffering)||void 0===n||n.call(this)}else if(null===(t=this.stopBuffering)||void 0===t||t.call(this),null!==(i=e.siteApps)&&void 0!==i&&i.length)if(this.isEnabled){var o=function(e,t){var i,s;h["__$$ph_site_app_".concat(e)]=r.instance,null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadSiteApp)||void 0===s||s.call(i,r.instance,t,(t=>{if(t)return Zn.error("Error while initializing PostHog app with config id ".concat(e),t)}))};for(var{id:a,url:l}of e.siteApps)o(a,l)}else Zn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var to={},io=()=>{},ro="posthog",so=!us&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),no=()=>{var t,i,r;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(i=null==o?void 0:o.location,r=null==i?void 0:i.hostname,!!H(r)&&"herokuapp.com"!==r.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",loaded:io,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:a&&H(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null===(t=e.location)||void 0===t?void 0:t.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Y.error(t)},get_device_id:e=>e,_onCapture:io,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},oo=e=>{var t={};B(e.process_person)||(t.person_profiles=e.process_person),B(e.xhr_headers)||(t.request_headers=e.xhr_headers),B(e.cookie_name)||(t.persistence_name=e.cookie_name),B(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var i=m({},t,e);return A(e.property_blacklist)&&(B(e.property_denylist)?i.property_denylist=e.property_blacklist:A(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Y.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class ao{constructor(){ie(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class lo{get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){ie(this,"webPerformance",new ao),ie(this,"version",_.LIB_VERSION),ie(this,"_internalEventEmitter",new Fs),this.config=no(),this.SentryIntegration=ks,this.sentryIntegration=e=>function(e,t){var i=Es(e,t);return{name:Ss,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new Ge(this),this.toolbar=new as(this),this.scrollManager=new On(this),this.pageViewManager=new Rs(this),this.surveys=new mn(this),this.experiments=new Yn(this),this.exceptions=new Xn(this),this.rateLimiter=new yn(this),this.requestRouter=new ws(this),this.consent=new jn(this),this.people={set:(e,t,i)=>{var r=H(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=H(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Y.info('send "'.concat(null==e?void 0:e.event,'"'),e)))}init(e,t,i){if(i&&i!==ro){var r,s=null!==(r=to[i])&&void 0!==r?r:new lo;return s._init(e,t,i),to[i]=s,to[ro][i]=s,s}return this._init(e,t,i)}_init(t){var i,r,s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(B(t)||U(t))return Y.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 Y.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],n.person_profiles&&(this._initialPersonProfilesConfig=n.person_profiles),this.set_config(m({},no(),oo(n),{name:o,token:t})),this.config.on_xhr_error&&Y.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:exports.Compression.GZipJS,this.persistence=new bi(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bi(te(te({},this.config),{},{persistence:"sessionStorage"}));var a=te({},this.persistence.props),l=te({},this.sessionPersistence.props);if(this._requestQueue=new ls((e=>this._send_retriable_request(e))),this._retryQueue=new gs(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new bs(this),this.sessionPropsManager=new Sn(this.sessionManager,this.persistence)),new Hn(this).startIfEnabledOrStop(),this.siteApps=new eo(this),null===(i=this.siteApps)||void 0===i||i.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new ts(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new qn(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new $n(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Qn(this),this.exceptionObserver=new Wn(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Rn(this,Tn),this.deadClicksAutocapture.startIfEnabled(),_.DEBUG=_.DEBUG||this.config.debug,_.DEBUG&&Y.info("Starting in debug mode",{this:this,config:n,thisC:te({},this.config),p:a,s:l}),this._sync_opt_out_with_persistence(),void 0!==(null===(r=n.bootstrap)||void 0===r?void 0:r.distinctID)){var u,c,d=this.config.get_device_id(Ze()),h=null!==(u=n.bootstrap)&&void 0!==u&&u.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(Fe,null!==(c=n.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var p,v,g=Object.keys((null===(p=n.bootstrap)||void 0===p?void 0:p.featureFlags)||{}).filter((e=>{var t,i;return!(null===(t=n.bootstrap)||void 0===t||null===(i=t.featureFlags)||void 0===i||!i[e])})).reduce(((e,t)=>{var i,r;return e[t]=(null===(i=n.bootstrap)||void 0===i||null===(r=i.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),f=Object.keys((null===(v=n.bootstrap)||void 0===v?void 0:v.featureFlagPayloads)||{}).filter((e=>g[e])).reduce(((e,t)=>{var i,r,s,o;null!==(i=n.bootstrap)&&void 0!==i&&null!==(r=i.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(s=n.bootstrap)||void 0===s||null===(o=s.featureFlagPayloads)||void 0===o?void 0:o[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:f})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qe,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Ze());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Fe,"anonymous")}return null==e||null===(s=e.addEventListener)||void 0===s||s.call(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),n.segment?Ts(this,(()=>this._loaded())):this._loaded(),D(this.config._onCapture)&&this.config._onCapture!==io&&(Y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_onRemoteConfig(e){var t,i,r,s,n,a,l,u,c;if(!o||!o.body)return Y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=b(e.supportedCompression,exports.Compression.GZipJS)?exports.Compression.GZipJS:b(e.supportedCompression,exports.Compression.Base64)?exports.Compression.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(i=this.siteApps)||void 0===i||i.onRemoteConfig(e),null===(r=this.sessionRecording)||void 0===r||r.onRemoteConfig(e),null===(s=this.autocapture)||void 0===s||s.onRemoteConfig(e),null===(n=this.heatmaps)||void 0===n||n.onRemoteConfig(e),null===(a=this.surveys)||void 0===a||a.onRemoteConfig(e),null===(l=this.webVitalsAutocapture)||void 0===l||l.onRemoteConfig(e),null===(u=this.exceptionObserver)||void 0===u||u.onRemoteConfig(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){Y.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),new rs(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||g(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(so?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ds(e.url,{ip:this.config.ip?1:0}),e.headers=te({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=te({},e);s.timeout=s.timeout||6e4,s.url=ds(s.url,{_:(new Date).getTime().toString(),ver:_.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"XHR",o=null!==(i=null===(r=P(ps,(e=>e.transport===n)))||void 0===r?void 0:r.method)&&void 0!==i?i:ps[0].method;if(!o)throw new Error("No available transport method");o(s)})(te(te({},e),{},{callback:t=>{var i,r,s;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(r=(s=this.config).on_request_error)||void 0===r||r.call(s,t));null===(i=e.callback)||void 0===i||i.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],s=[];g(e,(e=>{e&&(t=e[0],A(t)?s.push(e):D(e)?e.call(this):A(e)&&"alias"===t?i.push(e):A(e)&&-1!==t.indexOf("capture")&&D(this[t])?s.push(e):r.push(e))}));var n=function(e,t){g(e,(function(e){if(A(e[0])){var i=t;f(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};n(i,this),n(r,this),n(s,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!B(e)&&H(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var n=new Date,o=(null==i?void 0:i.timestamp)||n,a={uuid:Ze(),event:e,properties:this._calculate_event_properties(e,t||{},o)};s&&(a.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==i?void 0:i.$set)&&(a.$set=null==i?void 0:i.$set);var l=this._calculate_set_once_properties(null==i?void 0:i.$set_once);l&&(a.$set_once=l),(a=x(a,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,B(null==i?void 0:i.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=n);var u=te(te({},a.properties.$set),a.$set);if(q(u)||this.setPersonPropertiesForFlags(u),!z(this.config.before_send)){var c=this._runBeforeSend(a);if(!c)return;a=c}this._internalEventEmitter.emit("eventCaptured",a);var d={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(d):this._requestQueue.enqueue(d),a}Y.critical("This capture call is ignored due to client rate limiting.")}}else Y.error("No event name provided to posthog.capture")}else Y.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,t,i){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var r=this.persistence.remove_event_timer(e),s=te({},t);if(s.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(s.$cklsh_mode=!0),"$snapshot"===e){var n=te(te({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=n.distinct_id,(!H(s.distinct_id)&&!W(s.distinct_id)||U(s.distinct_id))&&Y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var a=fi.properties();if(this.sessionManager){var{sessionId:l,windowId:u}=this.sessionManager.checkAndGetSessionAndWindowId();s.$session_id=l,s.$window_id=u}if(this.sessionRecording&&(s.$recording_status=this.sessionRecording.status),this.requestRouter.region===fs.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var c=this.sessionPropsManager.getSessionProps();s=m(s,c)}if(!this.config.disable_scroll_properties){var h={};"$pageview"===e?h=this.pageViewManager.doPageView(i):"$pageleave"===e&&(h=this.pageViewManager.doPageLeave(i)),s=m(s,h)}if("$pageview"===e&&o&&(s.title=o.title),!B(r)){var _=i.getTime()-r;s.$duration=parseFloat((_/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=m({},a,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),A(this.config.property_denylist)?f(this.config.property_denylist,(function(e){delete s[e]})):Y.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(s=p(s,e));var v=this._hasPersonProcessing();return s.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),s}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=m({},this.persistence.get_initial_props(),e||{}),i=this.config.sanitize_properties;return i&&(t=i(t,"$set_once")),q(t)?void 0:t}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var r;null===(r=this.persistence)||void 0===r||r.register_once(e,t,i)}register_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,i){return this.surveys.getNextSurveyStep(e,t,i)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Y.uninitializedWarning("posthog.identify");if(W(e)&&(e=e.toString(),Y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))Y.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(ne)&&(this.unregister(ne),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(Fe)||"anonymous");e!==r&&n?(this.persistence.set_property(Fe,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(Re))}}else Y.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,i){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:te(te({},r),{},{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else Y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s,n;if(Y.info("reset"),!this.__loaded)return Y.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(i=this.sessionPersistence)||void 0===i||i.clear(),null===(r=this.surveys)||void 0===r||r.reset(),null===(s=this.persistence)||void 0===s||s.set_property(Fe,"anonymous"),null===(n=this.sessionManager)||void 0===n||n.resetSessionId(),this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qe,$device_id:null},"");else{var a=this.config.get_device_id(Ze());this.register_once({distinct_id:a,$device_id:e?a:o},"")}}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;var o=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0);r+="?t=".concat(o)}return r}alias(e,t){return e===this.get_property(se)?(Y.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(B(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ne,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,r,s,n=te({},this.config);N(e)&&(m(this.config,oo(e)),null===(t=this.persistence)||void 0===t||t.update_config(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bi(te(te({},this.config),{},{persistence:"sessionStorage"})),at.is_supported()&&"true"===at.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(_.DEBUG=!0,Y.info("set_config",{config:e,oldConfig:n,newConfig:te({},this.config)})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(r=this.autocapture)||void 0===r||r.startIfEnabled(),null===(s=this.heatmaps)||void 0===s||s.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=!0===e,i={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(i).some(Boolean)){var r,s,n,o,a;if(null===(r=this.sessionManager)||void 0===r||r.checkAndGetSessionAndWindowId(),i.sampling)null===(s=this.sessionRecording)||void 0===s||s.overrideSampling();if(i.linked_flag)null===(n=this.sessionRecording)||void 0===n||n.overrideLinkedFlag();if(i.url_trigger)null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url");if(i.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started)}captureException(e,t){var i,r=new Error("PostHog syntheticException"),s=D(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?h.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:r}):te({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},t);this.exceptions.sendExceptionEvent(s)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:ro;return t!==ro&&(t=ro+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(Fe))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(Fe))}_hasPersonProcessing(){var e,t,i,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&q(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[ne])&&(null===(i=this.persistence)||void 0===i||null===(r=i.props)||void 0===r||!r[De]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(De,!0),!0)}_sync_opt_out_with_persistence(){var e,t,i,r,s=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||s&&!!n;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==o&&(null===(i=this.persistence)||void 0===i||i.set_disabled(o));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==o&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(o))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),B(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return n?xn(n,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){o&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(z(this.config.before_send))return e;var t=A(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),z(i)){var s="Event '".concat(e.event,"' was rejected in beforeSend function");return Q(e.event)?Y.warn("".concat(s,". This can cause unexpected behavior.")):Y.info(s),null}i.properties&&!q(i.properties)||Y.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=S(e.prototype[t[i]])}(lo,["identify"]);var uo,co=(uo=to[ro]=new lo,function(){function t(){t.done||(t.done=!0,so=!1,f(to,(function(e){e._dom_loaded()})))}null!=o&&o.addEventListener&&("complete"===o.readyState?t():o.addEventListener("DOMContentLoaded",t,!1)),e&&I(e,"load",t,!0)}(),uo);exports.COPY_AUTOCAPTURE_EVENT=R,exports.PostHog=lo,exports.default=co,exports.knownUnsafeEditableEvent=F,exports.posthog=co,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map