PageSourceSearch

https://www.lastmyle.co/_next/static/chunks/67a3bf3c.067d86b74d41fcd4.js

js lastmyle.co collected 2026-10-05 04:04:45 UTC 194,018 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[765],{4651:function(e,t,i){i.r(t),i.d(t,{COPY_AUTOCAPTURE_EVENT:function(){return m},Compression:function(){return r},PostHog:function(){return nz},SurveyQuestionBranchingType:function(){return sO},SurveyQuestionType:function(){return s$},SurveySchedule:function(){return sM},SurveyType:function(){return sR},default:function(){return nG},knownUnsafeEditableEvent:function(){return y},posthog:function(){return nG},severityLevels:function(){return b}});var r,s="undefined"!=typeof window?window:void 0,n="undefined"!=typeof globalThis?globalThis:s,o=Array.prototype,a=o.forEach,l=o.indexOf,c=null==n?void 0:n.navigator,u=null==n?void 0:n.document,d=null==n?void 0:n.location,h=null==n?void 0:n.fetch,_=null!=n&&n.XMLHttpRequest&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,p=null==n?void 0:n.AbortController,v=null==c?void 0:c.userAgent,g=null!=s?s:{},f={DEBUG:!1,LIB_VERSION:"1.234.5"},m="$copy_autocapture",y=["$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"];(tb=r||(r={})).GZipJS="gzip-js",tb.Base64="base64";var b=["fatal","error","warning","log","info","debug"];function w(e,t){return -1!==e.indexOf(t)}var S=function(e){return e.trim()},k=function(e){return e.replace(/^\$/,"")},E=Array.isArray,x=Object.prototype,I=x.hasOwnProperty,C=x.toString,P=E||function(e){return"[object Array]"===C.call(e)},F=e=>"function"==typeof e,T=e=>e===Object(e)&&!P(e),R=e=>{if(T(e)){for(var t in e)if(I.call(e,t))return!1;return!0}return!1},$=e=>void 0===e,O=e=>"[object String]"==C.call(e),M=e=>O(e)&&0===e.trim().length,A=e=>null===e,L=e=>$(e)||A(e),D=e=>"[object Number]"==C.call(e),q=e=>"[object Boolean]"===C.call(e),N=e=>e instanceof FormData,B=e=>w(y,e),H=e=>{var t={_log:function(t){if(s&&(f.DEBUG||g.POSTHOG_DEBUG)&&!$(s.console)&&s.console){for(var i=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];i(e,...n)}},info:function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];t._log("log",...i)},warn:function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];t._log("warn",...i)},error:function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];t._log("error",...i)},critical:function(){for(var t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{t.error("You must initialize PostHog before calling ".concat(e))},createLogger:t=>H("".concat(e," ").concat(t))};return t},U=H("[PostHog.js]"),j=U.createLogger,z=j("[ExternalScriptsLoader]"),W=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return z.warn("".concat(t," was requested but loading of external scripts is disabled.")),i("Loading of external scripts is disabled");var r=null==u?void 0:u.querySelectorAll("script");if(r){for(var s=0;s<r.length;s++)if(r[s].src===t)return i()}var n=()=>{if(!u)return i("document not found");var r=u.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>i(void 0,e),r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var s,n=u.querySelectorAll("body > script");n.length>0?null===(s=n[0].parentNode)||void 0===s||s.insertBefore(r,n[0]):u.body.appendChild(r)};null!=u&&u.body?n():null==u||u.addEventListener("DOMContentLoaded",n)};function V(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 G(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?V(Object(i),!0).forEach(function(t){J(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):V(Object(i)).forEac
1h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function J(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(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}g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__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*Math.floor(Date.now()/3e5);r="".concat(r,"&t=").concat(s)}var n=e.requestRouter.endpointFor("assets",r);W(e,n,i)},g.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);W(e,r,i)};var K={};function Q(e,t,i){if(P(e)){if(a&&e.forEach===a)e.forEach(t,i);else if("length"in e&&e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===K)return}}}function X(e,t,i){if(!L(e)){if(P(e))return Q(e,t,i);if(N(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===K)return}else for(var s in e)if(I.call(e,s)&&t.call(i,e[s],s)===K)return}}var Z=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Q(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},ee=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Q(i,function(t){Q(t,function(t){e.push(t)})}),e};function et(e){for(var t=Object.keys(e),i=t.length,r=Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var ei=function(e){try{return e()}catch(e){return}},er=function(e){return function(){try{for(var t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){U.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),U.critical(e)}}},es=function(e){var t={};return X(e,function(e,i){O(e)&&e.length>0&&(t[i]=e)}),t},en=["herokuapp.com","vercel.app","netlify.app"];function eo(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function ea(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var el="$people_distinct_id",ec="__alias",eu="__timers",ed="$autocapture_disabled_server_side",eh="$heatmaps_enabled_server_side",e_="$exception_capture_enabled_server_side",ep="$web_vitals_enabled_server_side",ev="$dead_clicks_enabled_server_side",eg="$web_vitals_allowed_metrics",ef="$session_recording_enabled_server_side",em="$console_log_recording_enabled_server_side",ey="$session_recording_network_payload_capture",eb="$session_recording_masking",ew="$session_recording_canvas_recording",eS="$replay_sample_rate",ek="$replay_minimum_duration",eE="$replay_script_config",ex="$sesid",eI="$session_is_sampled",eC="$session_recording_url_trigger_activated_session",eP="$session_recording_event_trigger_activated_session",eF="$enabled_feature_flags",eT="$early_access_features",eR="$feature_flag_details",e$="$stored_person_properties",eO="$stored_group_properties",eM="$surveys",eA="$surveys_activated",eL="$flag_call_reported",eD="$user_state",eq="$client_session_props",eN="$capture_rate_limit",eB="$initial_campaign_params",eH="$initial_referrer_info",eU="$initial_person_info",ej="$epp",ez="__POSTHOG_TOOLBAR__",eW="$posthog_cookieless",eV=[el,ec,"__cmpns",eu,ef,eh,ex,eF,eD,eT,eR,eO,e$,eM,eL,eq,eN,eB,eH,ej];function eG(e){var t;return e instanceof Element&&(e.id===ez||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container")))}function eJ(e){return!!e&&1===e.nodeType}function eY(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function eK(e){return!!e&&3===e.nodeType}function eQ(e){return!!e&&11===e.nodeType}function eX(e){return e?S(e).split(/\s+/):[]}function eZ(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function e0(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 eX(t)}function e1(e){return L(e)?null:S(e).split(/(\s+)/).filter(e=>ts(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function e2(e){var t="";
1return e4(e)&&!e8(e)&&e.childNodes&&e.childNodes.length&&X(e.childNodes,function(e){var i;eK(e)&&e.textContent&&(t+=null!==(i=e1(e.textContent))&&void 0!==i?i:"")}),S(t)}function e3(e){var t;return $(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var e5=["a","button","form","input","select","textarea","label"];function e6(e){var t=e.parentNode;return!(!t||!eJ(t))&&t}function e4(e){for(var t=e;t.parentNode&&!eY(t,"body");t=t.parentNode){var i=e0(t);if(w(i,"ph-sensitive")||w(i,"ph-no-capture"))return!1}if(w(e0(e),"ph-include"))return!0;var r=e.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!(O(s)&&/^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,"")))}function e8(e){return!!(eY(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||eY(e,"select")||eY(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var e7="(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})",e9=new RegExp("^(?:".concat(e7,")$")),te=new RegExp(e7),tt="\\d{3}-?\\d{2}-?\\d{4}",ti=new RegExp("^(".concat(tt,")$")),tr=new RegExp("(".concat(tt,")"));function ts(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!(L(e)||O(e)&&(e=S(e),(t?e9:te).test((e||"").replace(/[- ]/g,""))||(t?ti:tr).test(e)))}function tn(e){var t=e2(e);return ts(t="".concat(t," ").concat(function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&X(t.childNodes,function(t){var r;if(t&&"span"===(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase()))try{var s=e2(t);i="".concat(i," ").concat(s).trim(),t.childNodes&&t.childNodes.length&&(i="".concat(i," ").concat(e(t)).trim())}catch(e){U.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function to(e){return e.replace(/"|\\"/g,'\\"')}class ta{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 tl=["localhost","127.0.0.1"],tc=e=>{var t=null==u?void 0:u.createElement("a");return $(t)?null:(t.href=e,t)},tu=function(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",s=[];return X(e,function(e,r){$(e)||$(r)||"undefined"===r||(t=encodeURIComponent(e instanceof File?e.name:e.toString()),i=encodeURIComponent(r),s[s.length]=i+"="+t)}),s.join(r)},td=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!P(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){U.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},th=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var h=c[d].split("=");P(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(c[d]))}var _=l;return null!=a&&(_+="?"+u.join("&")),null!=n&&(_+="#"+n),_},t_=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},tp=j("[AutoCapture]");function tv(e,t){return t.length>e?t.slice(0,e)+"...":t}class tg{constructor(e){J(this,"_initialized",!1),J(this,"_isDisabledServerSide",null),J(this,"rageclicks",new ta),J(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,i=T(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(s&&u){var e=e=>{e=e||(null==s?void 0:s.event);try{this._captureEvent(e)}catch(e){tp.error("Failed to capture event",e)}};if(ea(u,"submit",e,{capture:!0}),ea(u,"change",e,{capture:!0}),ea(u,"click",e,{capture:!0}),this.config.capture_copied_text){var t=e=>{e=e||(null==s?void 0:s.event),this._captureEvent(e,m)};ea(u,"copy",t,{capture:!0}),ea(u,"cut",t,{capture:!0})}}}else tp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}
1onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ed]:!!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==u?void 0:u.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[ed];if(A(this._isDisabledServerSide)&&!q(i)&&!this.instance.config.advanced_disable_decide)return!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}_captureEvent(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var i,r=e3(e);eK(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!==(i=this.rageclicks)&&void 0!==i&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick");var n=t===m;if(r&&function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!s||!e||eY(e,"html")||!eJ(e)||null!=i&&i.url_allowlist&&!eZ(i.url_allowlist)||null!=i&&i.url_ignorelist&&eZ(i.url_ignorelist))return!1;if(null!=i&&i.dom_event_allowlist){var o=i.dom_event_allowlist;if(o&&!o.some(e=>t.type===e))return!1}for(var a=!1,l=[e],c=!0,u=e;u.parentNode&&!eY(u,"body");)if(eQ(u.parentNode))l.push(u.parentNode.host),u=u.parentNode.host;else{if(!(c=e6(u)))break;if(r||e5.indexOf(c.tagName.toLowerCase())>-1)a=!0;else{var d=s.getComputedStyle(c);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(c),u=c}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if($(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,i)||!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if($(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,i))return!1;var h=s.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var _=e.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return a?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(e5.indexOf(_)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!eY(d,"body");)eQ(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,_=[],p={},v=!1,g=!1;if(X(u,e=>{var t=e4(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&ts(v)&&v),w(e0(e),"ph-no-capture")&&(g=!0),_.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};e5.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=tv(1024,tn(e)):n.$el_text=tv(1024,e2(e)));var o=e0(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),X(e.attributes,function(i){var s;if((!e8(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&ts(i.value)&&(!O(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=eX(o).join(" ")),n["attr__"+i.name]=tv(1024,o)}});for(var a=1,l=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!eJ(t));return t}(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),Z(p,function(e){if(!e4(e))return{};var t={};return X(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&&ts(r)&&(t[i]=r)}}),t}(e))}),g)return{props:{},explicitNoCapture:g};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?_[0].$el_text=tn(e):_[0].$el_text=e2(e)),v){_[0].attr__href=v;var f,m,y=null===(f=tc(v))||void 0===f?void 0:f.host,b=null==s||null===(m=s.location)||void 0===m?void 0:m.host;y&&b&&y!==b&&(h=v)}return{props:Z({$event_type:n.type,$ce_version:1},c?{}:{$elements:_},{$elements_chain:_.map(e=>{var t,i,r,s={text:null===(i=e.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:e.tag_name,href:null===(r=e.attr__href)||void 0===r?void 0:r.slice(0,2048),attr_class:(t=e.attr__class)?P(t)?t:eX(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return et(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}
1).forEach(e=>{var[t,i]=e;return s.attributes[t]=i}),s}).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=G(G(G(G({},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 et(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[to(t.toString())]=to(i.toString())}),r+=":"+et(n).map(e=>{var[t,i]=e;return"".concat(t,'="').concat(i,'"')}).join("")}).join(";")},null!==(i=_[0])&&void 0!==i&&i.$el_text?{$el_text:null===(r=_[0])||void 0===r?void 0:r.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},p)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsC
1hainAsString});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===m){var c,u=e1(null==s||null===(c=s.getSelection())||void 0===c?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return F(null==u?void 0:u.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return D(e)&&isFinite(e)&&Math.floor(e)===e});var tf="0123456789abcdef";class tm{constructor(e){if(this.bytes=e,16!==e.length)throw 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 RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/1099511627776,s[1]=e/4294967296,s[2]=e/16777216,s[3]=e/65536,s[4]=e/256,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 tm(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+tf.charAt(this.bytes[t]>>>4)+tf.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new tm(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 ty{constructor(){J(this,"timestamp",0),J(this,"counter",0),J(this,"random",new tk)}generate(){var e=this.generateOrAbort();if($(e)){this.timestamp=0;var t=this.generateOrAbort();if($(t))throw 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 tm.fromFieldsV7(this.timestamp,Math.trunc(this.counter/1073741824),1073741823&this.counter,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var tb,tw,tS=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw 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};s&&!$(s.crypto)&&crypto.getRandomValues&&(tS=e=>crypto.getRandomValues(e));class tk{constructor(){J(this,"buffer",new Uint32Array(8)),J(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(tS(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var tE,tx=()=>tI().toString(),tI=()=>(tw||(tw=new ty)).generate(),tC="",tP=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,tF={is_supported:()=>!!u,error:function(e){U.error("cookieStore error: "+e)},get:function(e){if(u){try{for(var t=e+"=",i=u.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(tF.get(e))||{}}catch(e){}return t},set:function(e,t,i,r,s){if(u)try{var n="",o="",a=function(e,t){if(t){var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u;if(tC)return tC;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+tx(),n=RegExp("(^|;)\\s*"+s+"=1");!tC&&r--;){var o=i.slice(r).join("."),a=s+"=1;domain=."+o;t.cookie=a,n.test(t.cookie)&&(t.cookie=a+";expires=Thu, 01 Jan 1970 00:00:00 GMT",tC=o)}return tC}(e);if(!i){var r,s=(r=e.match(tP))?r[0]:"";s!==i&&U.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(u.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*36e5),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&U.warn("cookieStore warning: large cookie, len="+c.length),u.cookie=c,c}catch(e){return}},remove:function(e,t){try{tF.set(e,"",-1,t)}catch(e){return}}},tT=null,tR={is_supported:function(){if(!A(tT))return tT;var e=!0;if($(s))e=!1;
1else try{var t="__mplssupport__";tR.set(t,"xyz"),'"xyz"'!==tR.get(t)&&(e=!1),tR.remove(t)}catch(t){e=!1}return e||U.error("localStorage unsupported; falling back to cookie store"),tT=e,e},error:function(e){U.error("localStorage error: "+e)},get:function(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){tR.error(e)}return null},parse:function(e){try{return JSON.parse(tR.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){tR.error(e)}},remove:function(e){try{null==s||s.localStorage.removeItem(e)}catch(e){tR.error(e)}}},t$=["distinct_id",ex,eI,ej,eU],tO=G(G({},tR),{},{parse:function(e){try{var t={};try{t=tF.parse(e)||{}}catch(e){}var i=Z(t,JSON.parse(tR.get(e)||"{}"));return tR.set(e,i),i}catch(e){}return null},set:function(e,t,i,r,s,n){try{tR.set(e,t,void 0,void 0,n);var o={};t$.forEach(e=>{t[e]&&(o[e]=t[e])}),Object.keys(o).length&&tF.set(e,o,i,r,s,n)}catch(e){tR.error(e)}},remove:function(e,t){try{null==s||s.localStorage.removeItem(e),tF.remove(e,t)}catch(e){tR.error(e)}}}),tM={},tA={is_supported:function(){return!0},error:function(e){U.error("memoryStorage error: "+e)},get:function(e){return tM[e]||null},parse:function(e){return tM[e]||null},set:function(e,t){tM[e]=t},remove:function(e){delete tM[e]}},tL=null,tD={is_supported:function(){if(!A(tL))return tL;if(tL=!0,$(s))tL=!1;else try{var e="__support__";tD.set(e,"xyz"),'"xyz"'!==tD.get(e)&&(tL=!1),tD.remove(e)}catch(e){tL=!1}return tL},error:function(e){U.error("sessionStorage error: ",e)},get:function(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){tD.error(e)}return null},parse:function(e){try{return JSON.parse(tD.get(e))||null}catch(e){}return null},set:function(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){tD.error(e)}},remove:function(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){tD.error(e)}}};(tQ=tE||(tE={}))[tQ.PENDING=-1]="PENDING",tQ[tQ.DENIED=0]="DENIED",tQ[tQ.GRANTED=1]="GRANTED";class tq{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?tE.DENIED:this.storedConsent}isOptedOut(){return this.consent===tE.DENIED||this.consent===tE.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?tE.GRANTED:"0"===e?tE.DENIED:tE.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?tR:tF;var t="localStorage"===e?tF:tR;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&&!!eo([null==c?void 0:c.doNotTrack,null==c?void 0:c.msDoNotTrack,g.doNotTrack],e=>w([!0,1,"1","yes"],e))}}var tN=j("[Dead Clicks]"),tB=()=>!0,tH=e=>{var t,i=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(ev)),r=e.instance.config.capture_dead_clicks;return q(r)?r:i};class tU{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({[ev]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var t,i,r;null!==(t=g.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"dead-clicks-autocapture",t=>{t?tN.error("failed to load script",t):e()})}start(){var e;if(u){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=g.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=T(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(u),tN.info("starting...")}}else tN.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,tN.info("stopping..."))}}var tj=j("[ExceptionAutocapture]");class tz{constructor(e){var t;J(this,"startCapturing",()=>{var e;if(s&&this.isEnabled&&null!==(e=g.__PosthogExtensions__)&&void 0!==e&&e.errorWrappingFunctions){var t=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=t(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=r(this.captureException.bind(this)))}catch(e){tj.error("failed to start",e),this.stopCapturing()}}}),this.instance=e,this.remoteEnabled=!(null===(t=this.instance.persistence)||void 0===t||!t.props[e_]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var e=this.instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return T(e)?t=G(G({},t),e):($(e)?this.remoteEnabled:e)&&(t=G(G({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(tj.info("enabled"),this.loadScript(this.startCapturing))}loadScript(e){var t,i,r;null!==(t=g.__PosthogExtensions__)&&void 0!==t&&t.errorWrappingFunctions&&e(
1),null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"exception-autocapture",t=>{if(t)return tj.error("failed to load script",t);e()})}stopCapturing(){var e,t,i;null===(e=this.unwrapOnError)||void 0===e||e.call(this),this.unwrapOnError=void 0,null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this),this.unwrapUnhandledRejection=void 0,null===(i=this.unwrapConsoleError)||void 0===i||i.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[e_]: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)}}function tW(e){return!$(Event)&&tV(e,Event)}function tV(e,t){try{return e instanceof t}catch(e){return!1}}function tG(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function tJ(e){return tG(e,"DOMError")}var tY=/\(error: (.*)\)/;function tK(e,t,i,r){var s={platform:"web:javascript",filename:e,function:"<anonymous>"===t?"?":t,in_app:!0};return $(i)||(s.lineno=i),$(r)||(s.colno=r),s}var tQ,tX,tZ,t0,t1=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,t2=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,t3=/\((\S*)(?::(\d+))(?::(\d+))\)/,t5=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,t6=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,t4=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];var r=t.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=[],s=e.split("\n"),n=t;n<s.length;n++){var o=s[n];if(!(o.length>1024)){var a=tY.test(o)?o.replace(tY,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of r){var c=l(a);if(c){i.push(c);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>G(G({},e),{},{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"}))}(i)}}(...[[30,e=>{var t=t1.exec(e);if(t){var[,i,r,s]=t;return tK(i,"?",+r,+s)}var n=t2.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=t3.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=t8(n[1]||"?",n[2]);return tK(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,e=>{var t=t5.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=t6.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],s=t[1]||"?";return[s,r]=t8(s,r),tK(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]),t8=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},t7=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function t9(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.stacktrace||e.stack||"",r=e&&ie.test(e.message)?1:0;try{var s,n,o=(s=t4(i,r),n=function(e){var t=globalThis._posthogChunkIds;if(!t)return{};var i=Object.keys(t);return t0&&i.length===tZ||(tZ=i.length,t0=i.reduce((i,r)=>{tX||(tX={});var s=tX[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,tX[r]=[l,c];break}}return i},{})),t0}(t4),s.forEach(e=>{e.filename&&(e.chunk_id=n[e.filename])}),s);return o.slice(0,o.length-t)}catch(e){}return[]}var ie=/Minified React error #\d+;/i;function it(e,t){var i,r,s,n=t9(e),o=null===(r=null==t?void 0:t.handled)||void 0===r||r,a=null!==(s=null==t?void 0:t.synthetic)&&void 0!==s&&s;return{$exception_list:[{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:(i=e.message).error&&"string"==typeof i.error.message?String(i.error.message):String(i),stacktrace:{frames:n,type:"raw"},mechanism:{handled:o,synthetic:a}}],$exception_level:"error"}}function ii(e,t){var i,r,s,n=null===(i=null==t?void 0:t.handled)||void 0===i||i,o=null===(r=null==t?void 0:t.synthetic)||void 0===r||r,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(s=null==t?void 0:t.defaultExceptionType)&&void 0!==s?s:"Error",value:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:n,synthetic:o}};if(null!=t&&t.syntheticException){var l=t9(t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function ir(e){var t,i;return(null===(t=JSON.stringify(e,(i=[],function(e,t){if(T(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}var is=((rs=is||{})[rs.DomContentLoaded=0]="DomContentLoaded",rs[rs.Load=1]="Load",rs[rs.FullSnapshot=2]="FullSnapshot",rs[rs.IncrementalSnapshot=3]="IncrementalSnapshot",rs[rs.Meta=4]="Meta",rs[rs.Custom=5]="Custom",rs[rs.Plugin=6]="Plugin",rs),io=((rn=io||{})[rn.Mutation=0]="Mutation",rn[rn.MouseMove=1]="MouseMove",rn[rn.MouseInteraction=2]="MouseInteraction",rn[rn.Scroll=3]="Scroll",rn[rn.ViewportResize=4]="ViewportResize",rn[rn.Input=5]="Input",rn[rn.TouchMove=6]="TouchMove",rn[rn.MediaInteraction=7]="MediaInteraction",rn[rn.StyleSheetRule=8]="StyleSheetRule",rn[rn.CanvasMutation=9]="CanvasMutation",rn[rn.Font=10]="Font",rn[rn.Log=11]="Log",rn[rn.Drag=12]="Drag",rn[rn.StyleDeclaration=13]="StyleDeclaration",rn[rn.Selection=14]="Selection",rn[rn.AdoptedStyleSheet=15]="AdoptedStyleSheet",rn[rn.CustomElement=16]="CustomElement",rn),ia="[SessionRecording]",il="redacted",ic={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",".clarity.ms","analytics.google.com"]},iu=["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"],id=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ih=["/s/","/e/","/i/"];function i_(e,t,i,r){if(L(e))return e;var s=(null==t?void 0:t["content-length"])||new Blob([e]).size;return O(s)&&(s=parseInt(s)),s>i?ia+" ".concat(r," body too large to record (").concat(s," bytes)"):e}function ip(e,t){if(L(e))return e;var i=e;return ts(i,!1)||(i=ia+" "+t+" body "+il),X(id,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=ia+" "+t+" body "+il+" as might contain: "+e)}),i}var iv=(e,t)=>{var i,r,s={payloadSizeLimitBytes:ic.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ic.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...ic.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(r=Math.min(1e6,null!==(i=s.payloadSizeLimitBytes)&&void 0!==i?i:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=i_(e.requestBody,e.requestHeaders,r,"Request")),null!=e&&e.responseBody&&(e.responseBody=i_(e.responseBody,e.responseHeaders,r,"Response")),e)),c=t=>{var i;return l(((e,t)=>{var i,r=tc(e.name),s=0===t.indexOf("http")?null===(i=tc(t))||void 0===i?void 0:i.pathname:t;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&ih.some(e=>0===n.indexOf(e))))return e})((L(i=t.requestHeaders)||X(Object.keys(null!=i?i:{}),e=>{iu.includes(e.toLowerCase())&&(i[e]=il)}),t),e.api_host))}
1,u=F(e.session_recording.maskNetworkRequestFn);return u&&F(e.session_recording.maskCapturedNetworkRequestFn)&&U.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return G(G({},t),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=F(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(!$(e))return e.requestBody=ip(e.requestBody,"Request"),e.responseBody=ip(e.responseBody,"Response"),e})(c(e)),G(G(G({},ic),s),{},{recordHeaders:n,recordBody:o,recordPerformance:a,recordInitialRequests:a})};function ig(e,t,i,r,s){return t>i&&(U.warn("min cannot be greater than max."),t=i),D(e)?e>i?(r&&U.warn(r+" cannot be  greater than max: "+i+". Using max value instead."),i):e<t?(r&&U.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&U.warn(r+" must be a number. using max or fallback. max: "+i+", fallback: "+s),ig(s||i,t,i,r))}class im{constructor(e){var t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};J(this,"bucketSize",100),J(this,"refillRate",10),J(this,"mutationBuckets",{}),J(this,"loggedTracker",{}),J(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]})}),J(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]}),J(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)}),J(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);return 0!==this.mutationBuckets[s]&&(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))),e)}));var r=this.numberOfChanges(t);return 0!==r||i===r?e:void 0}),this.rrweb=e,this.options=r,this.refillRate=ig(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ig(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var iy=Uint8Array,ib=Uint16Array,iw=Uint32Array,iS=new iy([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]),ik=new iy([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]),iE=new iy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ix=function(e,t){for(var i=new ib(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new iw(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]},iI=ix(iS,2),iC=iI[0],iP=iI[1];iC[28]=258,iP[258]=28;for(var iF=ix(ik,0)[1],iT=new ib(32768),iR=0;iR<32768;++iR){var i$=(43690&iR)>>>1|(21845&iR)<<1;i$=(61680&(i$=(52428&i$)>>>2|(13107&i$)<<2))>>>4|(3855&i$)<<4,iT[iR]=((65280&i$)>>>8|(255&i$)<<8)>>>1}var iO=function(e,t,i){for(var r=e.length,s=0,n=new ib(t);s<r;++s)++n[e[s]-1];var o,a=new ib(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ib(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[iT[d]>>>l]=c}else for(o=new ib(r),s=0;s<r;++s)o[s]=iT[a[e[s]-1]++]>>>15-e[s];return o},iM=new iy(288);for(iR=0;iR<144;++iR)iM[iR]=8;for(iR=144;iR<256;++iR)iM[iR]=9;for(iR=256;iR<280;++iR)iM[iR]=7;for(iR=280;iR<288;++iR)iM[iR]=8;var iA=new iy(32);for(iR=0;iR<32;++iR)iA[iR]=5;var iL=iO(iM,9,0),iD=iO(iA,5,0),iq=function(e){return(e/8>>0)+(7&e&&1)},iN=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof ib?ib:e instanceof iw?iw:iy)(i-t);return r.set(e.subarray(t,i)),r},iB=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8},iH=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},iU=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 iy(0),0];if(1==s){var o=new iy(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],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[c].f<i[d].f?c++:d++],l=i[c!=u&&i[c].f<i[d].f?c++:d++],i[u++]={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 ib(h+1),p=ij(i[u-1],_,0);if(p>t){r=0;
1var 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 y=n[r].s;_[y]<t?v-=1<<t-_[y]++-1:++r}for(;r>=0&&v;--r){var b=n[r].s;_[b]==t&&(--_[b],++v)}p=t}return[new iy(_),p]},ij=function(e,t,i){return -1==e.s?Math.max(ij(e.l,t,i+1),ij(e.r,t,i+1)):t[e.s]=i},iz=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ib(++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]},iW=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},iV=function(e,t,i){var r=i.length,s=iq(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)},iG=function(e,t,i,r,s,n,o,a,l,c,u){iB(t,u++,i),++s[256];for(var d=iU(s,15),h=d[0],_=d[1],p=iU(n,15),v=p[0],g=p[1],f=iz(h),m=f[0],y=f[1],b=iz(v),w=b[0],S=b[1],k=new ib(19),E=0;E<m.length;++E)k[31&m[E]]++;for(E=0;E<w.length;++E)k[31&w[E]]++;for(var x=iU(k,7),I=x[0],C=x[1],P=19;P>4&&!I[iE[P-1]];--P);var F,T,R,$,O=c+5<<3,M=iW(s,iM)+iW(n,iA)+o,A=iW(s,h)+iW(n,v)+o+14+3*P+iW(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(O<=M&&O<=A)return iV(t,u,e.subarray(l,l+c));if(iB(t,u,1+(A<M)),u+=2,A<M){F=iO(h,_,0),T=h,R=iO(v,g,0),$=v;var L=iO(I,C,0);for(iB(t,u,y-257),iB(t,u+5,S-1),iB(t,u+10,P-4),u+=14,E=0;E<P;++E)iB(t,u+3*E,I[iE[E]]);u+=3*P;for(var D=[m,w],q=0;q<2;++q){var N=D[q];for(E=0;E<N.length;++E){var B=31&N[E];iB(t,u,L[B]),u+=I[B],B>15&&(iB(t,u,N[E]>>>5&127),u+=N[E]>>>12)}}}else F=iL,T=iM,R=iD,$=iA;for(E=0;E<a;++E)if(r[E]>255){iH(t,u,F[(B=r[E]>>>18&31)+257]),u+=T[B+257],B>7&&(iB(t,u,r[E]>>>23&31),u+=iS[B]);var H=31&r[E];iH(t,u,R[H]),u+=$[H],H>3&&(iH(t,u,r[E]>>>5&8191),u+=ik[H])}else iH(t,u,F[r[E]]),u+=T[r[E]];return iH(t,u,F[256]),u+T[256]},iJ=new iw([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),iY=function(){for(var e=new iw(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),iK=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=iY[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}},iQ=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},iX=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&&iQ(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)}};function iZ(e,t){void 0===t&&(t={});var i,r,s,n=iK(),o=e.length;n.p(e);var a=(r=t,s=10+((i=t).filename&&i.filename.length+1||0),function(e,t,i,r,s,n){var o=e.length,a=new iy(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?c=iV(l,c,e.subarray(u,d)):(l[u]=n,c=iV(l,c,e.subarray(u,o)))}else{for(var h=iJ[t-1],_=h>>>13,p=8191&h,v=(1<<i)-1,g=new ib(32768),f=new ib(v+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},w=new iw(25e3),S=new ib(288),k=new ib(32),E=0,x=0,I=(u=0,0),C=0,P=0;u<o;++u){var F=b(u),T=32767&u,R=f[F];if(g[T]=R,f[F]=T,C<=u){var $=o-u;if((E>7e3||I>24576)&&$>423){c=iG(e,l,0,w,S,k,x,I,P,u-P,c),I=E=x=0,P=u;for(var O=0;O<286;++O)S[O]=0;for(O=0;O<30;++O)k[O]=0}var M=2,A=0,L=p,D=T-R&32767;if($>2&&F==b(u-D))for(var q=Math.min(_,$)-1,N=Math.min(32767,u),B=Math.min(258,$);D<=N&&--L&&T!=R;){if(e[u+M]==e[u+M-D]){for(var H=0;H<B&&e[u+H]==e[u+H-D];++H);if(H>M){if(M=H,A=D,H>q)break;var U=Math.min(D,H-2),j=0;for(O=0;O<U;++O){var z=u-D+O+32768&32767,W=z-g[z]+32768&32767;W>j&&(j=W,R=z)}}}D+=(T=R)-(R=g[T])+32768&32767}if(A){w[I++]=268435456|iP[M]<<18|iF[A];var V=31&iP[M],G=31&iF[A];x+=iS[V]+ik[G],++S[257+V],++k[G],C=u+M,++E}else w[I++]=e[u],++S[e[u]]}}c=iG(e,l,n,w,S,k,x,I,P,u-P,c)}return iN(a,0,r+iq(c)+s)}(e,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+r.mem,s,8,!0)),l=a.length;return iX(a,t),iQ(a,l-8,n.d()),iQ(a,l-4,o),a}function i0(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new iy(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 iy(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):(l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return iN(r,0,s)}var i1="[SessionRecording]",i2=j(i1);function i3(){var e,t;return null==g||null===(e=g.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}var i5=[io.MouseMove,io.MouseInteraction,io.Scroll,io.ViewportResize,io.Input,io.TouchMove,io.MediaInteraction,io.Drag],i6=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function i4(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((1
15&s)<<12|(63&e[r++])<<6|63&e[r++]):i+=String.fromCharCode(55296|(s=((15&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536)>>10,56320|1023&s)}return i}(iZ(i0(JSON.stringify(e))),!0)}function i8(e){return e.type===is.Custom&&"sessionIdle"===e.data.tag}function i7(e,t){return t.some(t=>"regex"===t.matching&&new RegExp(t.url).test(e))}class i9{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw Error(i1+" 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:3e5}get isSampled(){var e=this.instance.get_property(eI);return q(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 e=!!this.instance.get_property(ef),t=!this.instance.config.disable_session_recording;return s&&e&&t}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(em),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(ew),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,c=null!==(i=null!==(r=null==o?void 0:o.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==i?i:4,u=null!==(s=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==s?s:.4;if("string"==typeof u){var d=parseFloat(u);u=isNaN(d)?.4:d}return{enabled:l,fps:ig(c,0,12,"canvas recording fps",4),quality:ig(u,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(ey),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=T(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(q(o)?o:null==i?void 0:i.capturePerformance);return s||n||a?{recordHeaders:s,recordBody:n,recordPerformance:a}:void 0}get masking(){var e,t,i,r,s,n,o=this.instance.get_property(eb),a={maskAllInputs:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.maskTextSelector,blockSelector:null===(i=this.instance.config.session_recording)||void 0===i?void 0:i.blockSelector},l=null!==(r=null==a?void 0:a.maskAllInputs)&&void 0!==r?r:null==o?void 0:o.maskAllInputs,c=null!==(s=null==a?void 0:a.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,u=null!==(n=null==a?void 0:a.blockSelector)&&void 0!==n?n:null==o?void 0:o.blockSelector;return $(l)&&$(c)&&$(u)?void 0:{maskAllInputs:null==l||l,maskTextSelector:c,blockSelector:u}}get sampleRate(){var e=this.instance.get_property(eS);return D(e)?e:null}get minimumDuration(){var e=this.instance.get_property(ek);return D(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?!1===this.isSampled?"disabled":this._urlBlocked?"paused":L(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":q(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(eC))===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(eP))===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(J(this,"queuedRRWebEvents",[]),J(this,"isIdle","unknown"),J(this,"_linkedFlagSeen",!1),J(this,"_lastActivityTimestamp",Date.now()),J(this,"_linkedFlag",null),J(this,"_removePageViewCaptureHook",void 0),J(this,"_onSessionIdListener",void 0),J(this,"_persistDecideOnSessionListener",void 0),J(this,"_samplingSessionListener",void 0),J(this,"_urlTriggers",[]),J(this,"_urlBlocklist",[]),J(this,"_urlBlocked",!1),J(this,"_eventTriggers",[]),J(this,"_removeEventTriggerCaptureHook",void 0),J(this,"_forceAllowLocalhostNetworkCapture",!1),J(this,"_onBeforeUnload",()=>{this._flushBuffer()}),J(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),J(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),J(this,"_onVisibilityChange",()=>{if(null!=u&&u.visibilityState){var e="window "+u.visibilityState;this._tryAddCustomEvent(e,{})}}),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw i2.error("started without valid sessionManager"),Error(i1+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw Error(i1+" 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&&i2.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as i
1dle"))}startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),ea(s,"beforeunload",this._onBeforeUnload),ea(s,"offline",this._onOffline),ea(s,"online",this._onOnline),ea(s,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),L(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){i2.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(eP),null===(n=this.instance)||void 0===n||null===(o=n.persistence)||void 0===o||o.unregister(eC))}))):this.stopRecording()}stopRecording(){var e,t,i,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==s||s.removeEventListener("beforeunload",this._onBeforeUnload),null==s||s.removeEventListener("offline",this._onOffline),null==s||s.removeEventListener("online",this._onOnline),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(e=this._removePageViewCaptureHook)||void 0===e||e.call(this),this._removePageViewCaptureHook=void 0,null===(t=this._removeEventTriggerCaptureHook)||void 0===t||t.call(this),this._removeEventTriggerCaptureHook=void 0,null===(i=this._onSessionIdListener)||void 0===i||i.call(this),this._onSessionIdListener=void 0,null===(r=this._samplingSessionListener)||void 0===r||r.call(this),this._samplingSessionListener=void 0,i2.info("stopped"))}_resetSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.unregister(eI)}makeSamplingDecision(e){var t,i=this.sessionId!==e,r=this.sampleRate;if(D(r)){var s=this.isSampled,n=i||!q(s),o=n?function(e){for(var t=0,i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i)|0;return Math.abs(t)}(e)%100<ig(100*r,0,100):s;n&&(o?this._reportStarted("sampled"):i2.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:o})),null===(t=this.instance.persistence)||void 0===t||t.register({[eI]:o})}else this._resetSampling()}onRemoteConfig(e){var t,i,r,s,n,o;if(this._tryAddCustomEvent("$remote_config_received",e),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),this._setupSampling(),!L(this._linkedFlag)&&!this._linkedFlagSeen){var a=O(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,l=O(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((e,t)=>{var i=T(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(){D(this.sampleRate)&&L(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,c,u,d=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,h=L(d)?null:parseFloat(d);L(h)&&this._resetSampling();var _=null===(r=e.sessionRecording)||void 0===r?void 0:r.minimumDurationMilliseconds;i.register({[ef]:!!e.sessionRecording,[em]:null===(s=e.sessionRecording)||void 0===s?void 0:s.consoleLogRecordingEnabled,[ey]:G({capturePerformance:e.capturePerformance},null===(n=e.sessionRecording)||void 0===n?void 0:n.networkPayloadCapture),[eb]:null===(o=e.sessionRecording)||void 0===o?void 0:o.masking,[ew]:{enabled:null===(a=e.sessionRecording)||void 0===a?void 0:a.recordCanvas,fps:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasFps,quality:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasQuality},[eS]:h,[ek]:$(_)?null:_,[eE]: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(!$(Object.assign)&&!$(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),i3())?this._onScriptLoaded():null===(t=g.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,this.scriptName,e=>{if(e)return i2.error("could not load recorder",e);this._onScriptLoaded()}),i2.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(eE))||void 0===i?void 0:i.script)||"recorder"}isInteractiveEvent(e){var t;return 3===e.type&&-1!==i5.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)){var r="unknown"===this.isIdle;this.isIdle=!1,r||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)}if(!this.isIdle){var{windowId:s,sessionId:n}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this.sessionId!==n,a=this.windowId!==s;this.windowId=s,this.sessionId=n,o||a?(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}):i2.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(i6(()=>i3().addCustomEvent(e,t)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(i6(()=>i3().takeFullSnapshot()))}_onScriptLoaded(){var e,t,i,r,s={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:{}
1,collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};for(var[n,o]of Object.entries(this.instance.config.session_recording||{}))n in s&&("maskInputOptions"===n?s.maskInputOptions=G({password:!0},o):s[n]=o);this.canvasRecording&&this.canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.canvasRecording.fps},s.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(s.maskAllInputs=null===(t=this.masking.maskAllInputs)||void 0===t||t,s.maskTextSelector=null!==(i=this.masking.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(r=this.masking.blockSelector)&&void 0!==r?r:void 0);var a=i3();if(a){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new im(a,{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");i2.info(i,{node:t}),this.log(i1+" "+i,"warn")}});var l=this._gatherRRWebPlugins();this.stopRrweb=a(G({emit:e=>{this.onRRwebEmit(e)},plugins:l},s)),this._lastActivityTimestamp=Date.now(),this.isIdle=q(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:l.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else i2.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_gatherRRWebPlugins(){var e,t,i,r,s=[],n=null===(e=g.__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=g.__PosthogExtensions__)||void 0===i||null===(r=i.rrwebPlugins)||void 0===r?void 0:r.getRecordNetworkPlugin;return this.networkPayloadCapture&&F(o)&&(!tl.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(o(iv(this.instance.config,this.networkPayloadCapture))):i2.info("NetworkCapture not started because we are on localhost.")),s}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&T(e)){if(e.type===is.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||e.type===is.Custom&&"recording paused"===e.data.tag){e.type===is.FullSnapshot&&this._scheduleFullSnapshot(),e.type===is.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var s=function(e){if(e&&T(e)&&6===e.type&&T(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var t=[],i=0;i<e.data.payload.payload.length;i++)e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?t.push(e.data.payload.payload[i].slice(0,2e3)+"...[truncated]"):t.push(e.data.payload.payload[i]);return e.data.payload.payload=t,e}return e}(r);if(this._updateWindowAndSessionIds(s),!0!==this.isIdle||i8(s)){if(i8(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(1024>ir(e))return e;try{if(e.type===is.FullSnapshot)return G(G({},e),{},{data:i4(e.data),cv:"2024-10"});if(e.type===is.IncrementalSnapshot&&e.data.source===io.Mutation)return G(G({},e),{},{cv:"2024-10",data:G(G({},e.data),{},{texts:i4(e.data.texts),attributes:i4(e.data.attributes),removes:i4(e.data.removes),adds:i4(e.data.adds)})});if(e.type===is.IncrementalSnapshot&&e.data.source===io.StyleSheetRule)return G(G({},e),{},{cv:"2024-10",data:G(G({},e.data),{},{adds:e.data.adds?i4(e.data.adds):void 0,removes:e.data.removes?i4(e.data.removes):void 0})})}catch(e){i2.error("could not compress event - will use uncompressed event",e)}return e}
1(s):s,c={$snapshot_bytes:ir(l),$snapshot_data:l,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(c):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&s){var e=this._maskUrl(s.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_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=D(t)&&t>=0,r=D(e)&&i&&t<e;return"buffering"===this.status||"paused"===this.status||"disabled"===this.status||r?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&(function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(t.size>=i&&t.data.length>1){var r=Math.floor(t.data.length/2),s=t.data.slice(0,r),n=t.data.slice(r);return[e({size:ir(s),data:s,sessionId:t.sessionId,windowId:t.windowId}),e({size:ir(n),data:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(e=>e)}return[t]})(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:f.LIB_VERSION})}),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!==s&&s.location.href){var e=s.location.href,t=this._urlBlocked,i=i7(e,this._urlBlocklist);i&&!t?this._pauseRecording():!i&&t&&this._resumeRecording(),i7(e,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?eC:eP]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),i2.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),i2.info("recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&L(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){i2.error("Could not activate event trigger",e)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[eI]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),i2.info(e.replace("_"," "),t),w(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}var re=j("[SegmentIntegration]"),rt="posthog-js";function ri(e){var{organization:t,projectId:i,prefix:r,severityAllowList:s=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{if(!("*"===s||s.includes(n.level))||!e.__loaded)return n;n.tags||(n.tags={});var o,a,l,c,u,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=>G(G({},e),{},{stacktrace:e.stacktrace?G(G({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>G(G({},e),{},{platform:"web:javascript"}))}):void 0})),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:_,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:(null===(c=h[0])||void 0===c?void 0:c.value)||n.message,$sentry_exception_type:null===(u=h[0])||void 0===u?void 0:u.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 rr{constructor(e,t,i,r,s){this.name=rt,this.setupOnce=function(n){n(ri(e,{organization:t,projectId:i,prefix:r,severityAllowList:s}))}}}var rs,rn,ro,ra=null!=s&&s.location?t_(s.location.hash,"__posthog")||t_(location.hash,"state"):null,rl="_postHogToolbarParam
1s",rc=j("[Toolbar]");(rb=ro||(ro={}))[rb.UNINITIALIZED=0]="UNINITIALIZED",rb[rb.LOADING=1]="LOADING",rb[rb.LOADED=2]="LOADED";class ru{constructor(e){this.instance=e}setToolbarState(e){g.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=g.ph_toolbar_state)&&void 0!==e?e:ro.UNINITIALIZED}maybeLoadToolbar(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!s||!u)return!1;i=null!==(e=i)&&void 0!==e?e:s.location,n=null!==(t=n)&&void 0!==t?t:s.history;try{if(!r){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}r=null==s?void 0:s.localStorage}var o,a=ra||t_(i.hash,"__posthog")||t_(i.hash,"state"),l=a?ei(()=>JSON.parse(atob(decodeURIComponent(a))))||ei(()=>JSON.parse(decodeURIComponent(a))):null;return l&&"ph_authorize"===l.action?((o=l).source="url",o&&Object.keys(o).length>0&&(l.desiredHash?i.hash=l.desiredHash:n?n.replaceState(n.state,"",i.pathname+i.search):i.hash="")):((o=JSON.parse(r.getItem(rl)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch(e){return!1}}_callLoadToolbar(e){var t=g.ph_load_toolbar||g.ph_load_editor;!L(t)&&F(t)?t(e,this.instance):rc.warn("No toolbar load function found")}loadToolbar(e){var t,i,r=!(null==u||!u.getElementById(ez));if(!s||r)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=G(G({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});return(s.localStorage.setItem(rl,JSON.stringify(G(G({},o),{},{source:void 0}))),this.getToolbarState()===ro.LOADED)?this._callLoadToolbar(o):this.getToolbarState()===ro.UNINITIALIZED&&(this.setToolbarState(ro.LOADING),null===(t=g.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"toolbar",e=>{if(e)return rc.error("[Toolbar] Failed to load",e),void this.setToolbarState(ro.UNINITIALIZED);this.setToolbarState(ro.LOADED),this._callLoadToolbar(o)}),ea(s,"turbolinks:load",()=>{this.setToolbarState(ro.UNINITIALIZED),this.loadToolbar(o)})),!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)}}var rd=j("[TracingHeaders]");class rh{constructor(e){J(this,"_restoreXHRPatch",void 0),J(this,"_restoreFetchPatch",void 0),J(this,"_startCapturing",()=>{var e,t,i,r;$(this._restoreXHRPatch)&&(null===(e=g.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager)),$(this._restoreFetchPatch)&&(null===(i=g.__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=g.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"tracing-headers",t=>{if(t)return rd.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 r_=j("[Web Vitals]");class rp{constructor(e){var t;J(this,"_enabledServerSide",!1),J(this,"_initialized",!1),J(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),J(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((e,t)=>G(G({},e),{},{["$web_vitals_".concat(t.name,"_event")]:G({},t),["$web_vitals_".concat(t.name,"_value")]:t.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),J(this,"_addToBuffer",e=>{var t,i=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if($(i))r_.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._currentURL();$(r)||(L(null==e?void 0:e.name)||L(null==e?void 0:e.value)?r_.error("Invalid metric received",e):this._maxAllowedValue&&e.value>=this._maxAllowedValue?r_.error("Ignoring metric with value >= "+this._maxAllowedValue,e):(this.buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),$(this.buffer.url)&&(this.buffer.url=r),this.buffer.firstMetricTimestamp=$(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(G(G({},e),{},{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),J(this,"_startCapturing",()=>{var e,t,i,r,s=g.__PosthogExtensions__;$(s)||$(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):r_.error("web vitals callbacks not loaded - not starting")}),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[ep]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=T(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 $(i)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[eg])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(T(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=T(this.instance.config.capture_performance)&&D(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:9e5;return 0<e&&e<=6e4?9e5:e}get isEnabled(){var e=T(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return q(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(r_.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var t=T(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=T(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[ep]:t}),this.instance.persistence.register({[eg]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,r;null!==(t=g.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"web-vitals",t=>{t?r_.error("failed to load script",t):e()})}_currentURL(){var e=s?s.location.href:void 0;return e||r_.error("Could not determine current URL"),e}}var rv=j("[Heatmaps]");function rg(e){return T(e)&&"clientX"in e&&"clientY"in e&&D(e.clientX)&&D(e.clientY)}class rf{constructor(e){var t;J(this,"rageclicks",new ta),J(this,"_enabledServerSide",!1),J(this,"_initialized",!1),J(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[eh])}get flushIntervalMilliseconds(){var e=5e3;return T(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 $(this.instance.config.capture_heatmaps)?$(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this._initialized||(rv.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({[eh]: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(){s&&u&&(ea(s,"beforeunload",this.flush.bind(this)),ea(u,"click",e=>this._onClick(e||(null==s?void 0:s.event)),{capture:!0}),ea(u,"mousemove",e=>this._onMouseMove(e||(null==s?void 0:s.event)),{capture:!0}),this.deadClicksCapture=new tU(this.instance,tB,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&eJ(r)&&!eY(r,"body")&&r!==i;){if(w(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=e6(r)}return!1}(e3(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}_onClick(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!eG(e.target)&&rg(e)){var r=this._getProperties(e,i);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(G(G({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!eG(e.target)&&rg(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(s){var t=s.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}flush(){this.buffer&&!R(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class rm{constructor(e){this._instance=e}doPageView(e,t){var i,r=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==s?void 0:s.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!($(n)||$(o)||$(a)||$(l)||$(c)||$(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var d=n<=1?1:ig(o/n,0,1),h=n<=1?1:ig(a/n,0,1),_=l<=1?1:ig(c/l,0,1),p=l<=1?1:ig(u/l,0,1);r=Z(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}class ry{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var rb,rw,rS="Mobile",rk="Android",rE="Tablet",rx=rk+" "+rE,rI="iPad",rC="Apple",rP=rC+" Watch",rF="Safari",rT="BlackBerry",rR="Samsung",r$=rR+"Browser",rO=rR+" Internet",rM="Chrome",rA=rM+" OS",rL=rM+" iOS",rD="Internet Explorer",rq=rD+" "+rS,rN="Opera",rB=rN+" Mini",rH="Edge",rU="Microsoft "+rH,rj="Firefox",rz=rj+" iOS",rW="Nintendo",rV="PlayStation",rG="Xbox",rJ=rk+" "+rS,rY=rS+" "+rF,rK="Windows",rQ=rK+" Phone",rX="Nokia",rZ="Ouya",r0="Generic",r1=r0+" "+rS.toLowerCase(),r2=r0+" "+rE.toLowerCase(),r3="Konqueror",r5="(\\d+(\\.\\d+)?)",r6=RegExp("Version/"+r5),r4=RegExp(rG,"i"),r8=RegExp(rV+" \\w+","i"),r7=RegExp(rW+" \\w+","i"),r9=RegExp(rT+"|PlayBook|BB10","i"),se={"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"},st=(e,t)=>
1t&&w(t,rC)||w(e,rF)&&!w(e,rM)&&!w(e,rk),si=function(e,t){return t=t||"",w(e," OPR/")&&w(e,"Mini")?rB:w(e," OPR/")?rN:r9.test(e)?rT:w(e,"IE"+rS)||w(e,"WPDesktop")?rq:w(e,r$)?rO:w(e,rH)||w(e,"Edg/")?rU:w(e,"FBIOS")?"Facebook "+rS:w(e,"UCWEB")||w(e,"UCBrowser")?"UC Browser":w(e,"CriOS")?rL:w(e,"CrMo")||w(e,rM)?rM:w(e,rk)&&w(e,rF)?rJ:w(e,"FxiOS")?rz:w(e.toLowerCase(),r3.toLowerCase())?r3:st(e,t)?w(e,rS)?rY:rF:w(e,rj)?rj:w(e,"MSIE")||w(e,"Trident/")?rD:w(e,"Gecko")?rj:""},sr={[rq]:[RegExp("rv:"+r5)],[rU]:[RegExp(rH+"?\\/"+r5)],[rM]:[RegExp("("+rM+"|CrMo)\\/"+r5)],[rL]:[RegExp("CriOS\\/"+r5)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+r5)],[rF]:[r6],[rY]:[r6],[rN]:[RegExp("(Opera|OPR)\\/"+r5)],[rj]:[RegExp(rj+"\\/"+r5)],[rz]:[RegExp("FxiOS\\/"+r5)],[r3]:[RegExp("Konqueror[:/]?"+r5,"i")],[rT]:[RegExp(rT+" "+r5),r6],[rJ]:[RegExp("android\\s"+r5,"i")],[rO]:[RegExp(r$+"\\/"+r5)],[rD]:[RegExp("(rv:|MSIE )"+r5)],Mozilla:[RegExp("rv:"+r5)]},ss=[[RegExp(rG+"; "+rG+" (.*?)[);]","i"),e=>[rG,e&&e[1]||""]],[RegExp(rW,"i"),[rW,""]],[RegExp(rV,"i"),[rV,""]],[r9,[rT,""]],[RegExp(rK,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[rQ,""];if(new RegExp(rS).test(t)&&!/IEMobile\b/.test(t))return[rK+" "+rS,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=se[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[rK,r]}return[rK,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=$(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+rk+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rk+")","i"),e=>e&&e[2]?[rk,[e[2],e[3],e[4]||"0"].join(".")]:[rk,""]],[/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/,[rA,""]],[/Linux|debian/i,["Linux",""]]],sn=function(e){return r7.test(e)?rW:r8.test(e)?rV:r4.test(e)?rG:RegExp(rZ,"i").test(e)?rZ:RegExp("("+rQ+"|WPDesktop)","i").test(e)?rQ:/iPad/.test(e)?rI:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?rP:r9.test(e)?rT:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(rX,"i").test(e)?rX:/(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(rS).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)?rk:rx:rk:RegExp("(pda|"+rS+")","i").test(e)?r1:RegExp(rE,"i").test(e)&&!RegExp(rE+" pc","i").test(e)?r2:""},so="https?://(.*)",sa=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],sl=ee(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],sa),sc="<masked>",su={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!u)return{};var r=t?ee([],sa,i||[]):[];return this._campaignParamsFromUrl(th(u.URL,r,sc),e)},_campaignParamsFromUrl:function(e,t){var i=sl.concat(t||[]),r={};return X(i,function(t){var i=td(e,t);r[t]=i||null}),r},_searchEngine:function(e){return e?0===e.search(so+"google.([^/?]*)")?"google":0===e.search(so+"bing.com")?"bing":0===e.search(so+"yahoo.com")?"yahoo":0===e.search(so+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=su._searchEngine(e),i="yahoo"!=t?"q":"p",r={};if(!A(t)){r.$search_engine=t;var s=u?td(u.referrer,i):"";s.length&&(r.ph_keyword=s)}return r},searchInfo:function(){var e=null==u?void 0:u.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:si,browserVersion:function(e,t){var i=sr[si(e,t)];if($(i))return null;for(var r=0;r<i.length;r++){var s=i[r],n=e.match(s);if(n)return parseFloat(n[n.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<ss.length;t++){var[i,r]=ss[t],s=i.exec(e),n=s&&(F(r)?r(s,e):r);if(n)return n}return["",""]},device:sn,deviceType:function(e){var t=sn(e);return t===rI||t===rx||"Kobo"===t||"Kindle Fire"===t||t===r2?rE:t===rW||t===rG||t===rV||t===rZ?"Console":t===rP?"Wearable":t?rS:"Desktop"},referrer:function(){return(null==u?void 0:u.referrer)||"$direct"},referringDomain:function(){var e;return null!=u&&u.referrer&&(null===(e=tc(u.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e?ee([],sa,t||[]):[],r=null==d?void 0:d.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?th(r,i,sc):void 0}},personPropsFromInfo:function(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null===(t=tc(i))||void 0===t?void 0:t.host};
1if(r){s.$current_url=r;var n=tc(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname,Z(s,this._campaignParamsFromUrl(r))}return i&&Z(s,this._searchInfoFromReferrer(i)),s},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),i={};return X(t,function(e,t){i["$initial_".concat(k(t))]=e}),i},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!v)return{};var i=e?ee([],sa,t||[]):[],[r,n]=su.os(v);return Z(es({$os:r,$os_version:n,$browser:su.browser(v,navigator.vendor),$device:su.device(v),$device_type:su.deviceType(v),$timezone:su.timezone(),$timezone_offset:su.timezoneOffset()}),{$current_url:th(null==d?void 0:d.href,i,sc),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:v.length>1e3?v.substring(0,997)+"...":v,$browser_version:su.browserVersion(v,navigator.vendor),$browser_language:su.browserLanguage(),$browser_language_prefix:su.browserLanguagePrefix(),$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:"web",$lib_version:f.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(!v)return{};var[e,t]=su.os(v);return Z(es({$os:e,$os_version:t,$browser:su.browser(v,navigator.vendor)}),{$browser_version:su.browserVersion(v,navigator.vendor)})}},sd=j("[FeatureFlags]"),sh="$active_feature_flags",s_="$override_feature_flags",sp="$feature_flag_payloads",sv="$override_feature_flag_payloads",sg="$feature_flag_request_id",sf=e=>{var t={};for(var[i,r]of et(e||{}))r&&(t[i]=r);return t},sm=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var i;return null===(i=t[e].metadata)||void 0===i?void 0:i.payload}).map(e=>{var i;return[e,null===(i=t[e].metadata)||void 0===i?void 0:i.payload]}))):sd.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(sS=rw||(rw={})).FeatureFlags="feature_flags",sS.Recordings="recordings";class sy{constructor(e){J(this,"_override_warning",!1),J(this,"_hasLoadedFlags",!1),J(this,"_requestInFlight",!1),J(this,"_reloadingDisabled",!1),J(this,"_additionalReloadRequested",!1),J(this,"_decideCalled",!1),J(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())}getFlagsWithDetails(){var e=this.instance.get_property(eR),t=this.instance.get_property(s_),i=this.instance.get_property(sv);if(!i&&!t)return e||{};var r=Z({},e||{});for(var s of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,o,a=r[s],l=null==t?void 0:t[s],c=$(l)?null!==(n=null==a?void 0:a.enabled)&&void 0!==n&&n:!!l,u=$(l)?a.variant:"string"==typeof l?l:void 0,d=null==i?void 0:i[s],h=G(G({},a),{},{enabled:c,variant:c?null!=u?u:null==a?void 0:a.variant:void 0});c!==(null==a?void 0:a.enabled)&&(h.original_enabled=null==a?void 0:a.enabled),u!==(null==a?void 0:a.variant)&&(h.original_variant=null==a?void 0:a.variant),d&&(h.metadata=G(G({},null==a?void 0:a.metadata),{},{payload:d,original_payload:null==a||null===(o=a.metadata)||void 0===o?void 0:o.payload})),r[s]=h}return this._override_warning||(sd.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this.instance.get_property(eF),t=this.instance.get_property(s_);if(!t)return e||{};for(var i=Z({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(sd.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this.instance.get_property(sp),t=this.instance.get_property(sv);if(!t)return e||{};for(var i=Z({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(sd.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}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){var t;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide){if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i={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:G(G({},(null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())||{}),this.instance.get_property(e$)||{}),group_properties:this.instance.get_property(eO)};(null!=e&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0);var s=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;s&&(i.timezone=su.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",s?"/flags/?v=2":"/decide/?v=4"),data:i,compression:this.instance.config.disable_compression?void 0:r.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,r,s,n=!0;200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),n=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig(null!==(s=e.json)&&void 0!==s?s:{})),i.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!n,e.json&&null!==(t=e.json.quotaLimited)&&void 0!==t&&t.includes(rw.FeatureFlags)?sd.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags(null!==(r=e.json)&&void 0!==r?r:{},n),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=this.getFlagVariants()[e],r="".concat(i),s=this.instance.get_property(sg)||void 0,n=this.instance.get_property(eL)||{};if((t.send_event||!("send_event"in t))&&(!(e in n)||!n[e].includes(r))){P(n[e])?n[e].push(r):n[e]=[r],null===(l=this.instance.persistence)||void 0===l||l.register({[eL]:n});var o=this.getFeatureFlagDetails(e),a={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null===(c=this.instance.config.bootstrap)||void 0===c||null===(u=c.featureFlags)||void 0===u?void 0:u[e])||null,$feature_flag_bootstrapped_payload:(null===(d=this.instance.config.bootstrap)||void 0===d||null===(h=d.featureFlagPayloads)||void 0===h?void 0:h[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};$(null==o||null===(_=o.metadata)||void 0===_?void 0:_.version)||(a.$feature_flag_version=o.metadata.version);var l,c,u,d,h,_,p,v,g,f,m,y,b=null!==(p=null==o||null===(v=o.reason)||void 0===v?void 0:v.description)&&void 0!==p?p:null==o||null===(g=o.reason)||void 0===g?void 0:g.code;b&&(a.$feature_flag_reason=b),null!=o&&null!==(f=o.metadata)&&void 0!==f&&f.id&&(a.$feature_flag_id=o.metadata.id),$(null==o?void 0:o.original_variant)&&$(null==o?void 0:o.original_enabled)||(a.$feature_flag_original_response=$(o.original_variant)?o.original_enabled:o.original_variant),null!=o&&null!==(m=o.metadata)&&void 0!==m&&m.original_payload&&(a.$feature_flag_original_payload=null==o||null===(y=o.metadata)||void 0===y?void 0:y.original_payload),this.instance.capture("$feature_flag_called",a)}return i}sd.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:i}
1,compression:this.instance.config.disable_compression?void 0:r.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null===(r=i.json)||void 0===r?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}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);sd.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(),s=this.getFlagsWithDetails();!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=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},n=sm(e),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var c=e.requestId;if(P(a)){sd.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var d=0;d<a.length;d++)u[a[d]]=!0;t&&t.register({[sh]:a,[eF]:u})}else{var h=a,_=l,p=o;e.errorsWhileComputingFlags&&(h=G(G({},i),h),_=G(G({},r),_),p=G(G({},s),p)),t&&t.register(G({[sh]:Object.keys(sf(h)),[eF]:h||{},[sp]:_||{},[eR]:p||{}},c?{[sg]:c}:{}))}}}(e,this.instance.persistence,i,r,s),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];sd.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this.instance.__loaded||!this.instance.persistence)return sd.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.instance.persistence.unregister(s_),this.instance.persistence.unregister(sv),void this._fireFeatureFlagsCallbacks();if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;if(this._override_warning=!!(null!==(t=e.suppressWarning)&&void 0!==t&&t),"flags"in e){if(!1===e.flags)this.instance.persistence.unregister(s_);else if(e.flags){if(P(e.flags)){for(var i={},r=0;r<e.flags.length;r++)i[e.flags[r]]=!0;this.instance.persistence.register({[s_]:i})}else this.instance.persistence.register({[s_]:e.flags})}}return"payloads"in e&&(!1===e.payloads?this.instance.persistence.unregister(sv):e.payloads&&this.instance.persistence.register({[sv]:e.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}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=(this.instance.get_property(eT)||[]).find(t=>t.flagKey===e),s={["$feature_enrollment/".concat(e)]:t},n={$feature_flag:e,$feature_enrollment:t,$set:s};r&&(n.$early_access_feature_name=r.name),this.instance.capture("$feature_enrollment_update",n),this.setPersonPropertiesForFlags(s,!1);var o=G(G({},this.getFlagVariants()),{},{[e]:t});null===(i=this.instance.persistence)||void 0===i||i.register({[sh]:Object.keys(sf(o)),[eF]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0,r=this.instance.get_property(eT),s=i?"&".concat(i.map(e=>"stage=".concat(e)).join("&")):"";if(r&&!t)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(s)),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({[eT]: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();
1this.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(e$)||{};this.instance.register({[e$]:G(G({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(e$)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(eO)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=G(G({},i[t]),e[t]),delete e[t]}),this.instance.register({[eO]:G(G({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(eO)||{};this.instance.register({[eO]:G(G({},t),{},{[e]:{}})})}else this.instance.unregister(eO)}}var sb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class sw{constructor(e){var t;this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(t="",e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"),this.storage=this.buildStorage(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,G({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){-1===sb.indexOf(e.persistence.toLowerCase())&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&tR.is_supported()?tR:"localstorage+cookie"===t&&tO.is_supported()?tO:"sessionstorage"===t&&tD.is_supported()?tD:"memory"===t?tA:"cookie"===t?tF:tO.is_supported()?tO:tF}properties(){var e={};return X(this.props,function(t,i){if(i===eF&&T(t))for(var r,s=Object.keys(t),n=0;n<s.length;n++)e["$feature/".concat(s[n])]=t[s[n]];else r=!1,(A(eV)?r:l&&eV.indexOf===l?-1!=eV.indexOf(i):(X(eV,function(e){if(r||(r=e===i))return K}),r))||(e[i]=t)}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Z({},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(T(e)){$(t)&&(t="None"),this.expire_days=$(i)?this.default_expiry:i;var r=!1;if(X(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(T(e)){this.expire_days=$(t)?this.default_expiry:t;var i=!1;if(X(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=su.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});R(es(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(su.searchInfo())}update_referrer_info(){this.register_once(su.referrerInfo(),void 0)}set_initial_person_info(){this.props[eB]||this.props[eH]||this.register_once({[eU]:su.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return es({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};X([eH,eB],t=>{var i=this.props[t];i&&X(i,function(t,i){e["$initial_"+k(i)]=t})});var t=this.props[eU];if(t){var i=su.initialPersonPropsFromInfo(t);Z(e,i)}return e}safe_merge(e){return X(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())}
vendor: 9,668 bytes, line 1
1get_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[eu]||{};i[e]=t,this.props[eu]=i,this.save()}remove_event_timer(e){var t=(this.props[eu]||{})[e];return $(t)||(delete this.props[eu][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var sS,sk,sE,sx,sI,sC,sP,sF,sT,sR,s$,sO,sM,sA={},sL=[],sD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sq=Array.isArray;function sN(e,t){for(var i in t)e[i]=t[i];return e}function sB(e){var t=e.parentNode;t&&t.removeChild(e)}function sH(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?++sx:s,__i:-1,__u:0};return null==s&&null!=sE.vnode&&sE.vnode(n),n}function sU(e){return e.children}function sj(e,t){this.props=e,this.context=t}function sz(e,t){if(null==t)return e.__?sz(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?sz(e):null}function sW(e){(!e.__d&&(e.__d=!0)&&sI.push(e)&&!sV.__r++||sC!==sE.debounceRendering)&&((sC=sE.debounceRendering)||sP)(sV)}function sV(){var e,t,i,r,s,n,o,a,l;for(sI.sort(sF);e=sI.shift();)e.__d&&(t=sI.length,r=void 0,n=(s=(i=e).__v).__e,a=[],l=[],(o=i.__P)&&((r=sN({},s)).__v=s.__v+1,sE.vnode&&sE.vnode(r),sX(o,r,s,i.__n,void 0!==o.ownerSVGElement,32&s.__u?[n]:null,a,null==n?sz(s):n,!!(32&s.__u),l),r.__.__k[r.__i]=r,function(e,t,i){t.__d=void 0;for(var r=0;r<i.length;r++)sZ(i[r],i[++r],i[++r]);sE.__c&&sE.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){sE.__e(e,t.__v)}})}(a,r,l),r.__e!=n&&function e(t){var i,r;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,i=0;i<t.__k.length;i++)if(null!=(r=t.__k[i])&&null!=r.__e){t.__e=t.__c.base=r.__e;break}return e(t)}}(r)),sI.length>t&&sI.sort(sF));sV.__r=0}function sG(e,t,i,r,s,n,o,a,l,c,u){var d,h,_,p,v,g=r&&r.__k||sL,f=t.length;for(i.__d=l,function(e,t,i){var r,s,n,o,a,l=t.length,c=i.length,u=c,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?sH(null,s,null,null,s):sq(s)?sH(sU,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?sH(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,a=function(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}(s,i,o=r+d,u),s.__i=a,n=null,-1!==a&&(u--,(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?u>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=sz(n)),s0(n,n,!1),i[r]=null,u--);if(u)for(r=0;r<c;r++)null!=(n=i[r])&&0==(131072&n.__u)&&(n.__e==e.__d&&(e.__d=sz(n)),s0(n,n))}(i,t,g),l=i.__d,d=0;d<f;d++)null!=(_=i.__k[d])&&"boolean"!=typeof _&&"function"!=typeof _&&(h=-1===_.__i?sA:g[_.__i]||sA,_.__i=d,sX(e,_,h,s,n,o,a,l,c,u),p=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&sZ(h.ref,null,_),u.push(_.ref,_.__c||p,_)),null==v&&null!=p&&(v=p),65536&_.__u||h.__k===_.__k?l=function e(t,i,r){var s,n;if("function"==typeof t.type){for(s=t.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=t,i=e(s[n],i,r));return i}return t.__e!=i&&(r.insertBefore(t.__e,i||null),i=t.__e),i&&i.nextSibling}(_,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 sJ(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||sD.test(t)?i:i+"px"}function sY(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||sJ(e.style,t,"");if(i)for(t in i)r&&i[t]===r[t]||sJ(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?sQ:sK,n)):e.removeEventListener(t,n?sQ:sK,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 sK(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(sE.event?sE.event(e):e)}function sQ(e){return this.l[e.type+!0](sE.event?sE.event(e):e)}function sX(e,t,i,r,s,n,o,a,l,c){var u,d,h,_,p,v,g,f,m,y,b,w,S,k,E,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),n=[a=t.__e=i.__e]),(u=sE.__b)&&u(t);e:if("function"==typeof x)try{if(f=t.props,m=(u=x.contextType)&&r[u.__c],y=u?m?m.props.value:u.__:r,i.__c?g=(d=t.__c=i.__c).__=d.__E:("prototype"in x&&x.prototype.render?t.__c=d=new x(f,y):(t.__c=d=new sj(f,y),d.constructor=x,d.render=s1),m&&m.sub(d),d.props=f,d.state||(d.state={}),d.context=y,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=sN({},d.__s)),sN(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,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,y)||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)}),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,y),null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(_,p,v)})}if(d.context=y,d.props=f,d.__P=e,d.__e=!1,w=sE.__r,S=0,"prototype"in x&&x.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[]}else do d.__d=!1,w&&w(t),u=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=sN(sN({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(_,p)),sG(e,sq(E=null!=u&&u.type===sU&&null==u.key?u.props.children:u)?E:[E],t,i,r,s,n,o,a,l,c),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),sE.__e(e,t,i)}else null==n&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=function(e,t,i,r,s,n,o,a,l){var c,u,d,h,_,p,v,g=i.props,f=t.props,m=t.type;if("svg"===m&&(s=!0),null!=n){for(c=0;c<n.length;c++)if((_=n[c])&&"setAttribute"in _==!!m&&(m?_.localName===m:3===_.nodeType)){e=_,n[c]=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&&sk.call(e.childNodes),g=i.props||sA,!a&&null!=n)for(g={},c=0;c<e.attributes.length;c++)g[(_=e.attributes[c]).name]=_.value;for(c in g)_=g[c],"children"==c||("dangerouslySetInnerHTML"==c?d=_:"key"===c||c in f||sY(e,c,null,_,s));for(c in f)_=f[c],"children"==c?h=_:"dangerouslySetInnerHTML"==c?u=_:"value"==c?p=_:"checked"==c?v=_:"key"===c||a&&"function"!=typeof _||g[c]===_||sY(e,c,_,g[c],s);if(u)a||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),sG(e,sq(h)?h:[h],t,i,r,s&&"foreignObject"!==m,n,o,n?n[0]:i.__k&&sz(i,0),a,l),null!=n)for(c=n.length;c--;)null!=n[c]&&sB(n[c]);a||(c="value",void 0===p||p===e[c]&&("progress"!==m||p)&&("option"!==m||p===g[c])||sY(e,c,p,g[c],!1),c="checked",void 0!==v&&v!==e[c]&&sY(e,c,v,g[c],!1))}return e}(i.__e,t,i,r,s,n,o,l,c);(u=sE.diffed)&&u(t)}function sZ(e,t,i){try{"function"==typeof e?e(t):e.current=t}catch(e){sE.__e(e,i)}}function s0(e,t,i){var r,s;if(sE.unmount&&sE.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||sZ(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){sE.__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]&&s0(r[s],t,i||"function"!=typeof e.type);i||null==e.__e||sB(e.__e),e.__=e.__e=e.__d=void 0}function s1(e,t,i){return this.constructor(e,i)}sk=sL.slice,sE={__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}},sx=0,sj.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=sN({},this.state),"function"==typeof e&&(e=e(sN({},i),this.props)),e&&sN(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),sW(this))},sj.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),sW(this))},sj.prototype.render=sU,sI=[],sP="function"==typeof Promise?Promise.prototype.then.bind(Prom
1ise.resolve()):setTimeout,sF=function(e,t){return e.__v.__b-t.__v.__b},sV.__r=0,sT=0,(nS=sR||(sR={})).Popover="popover",nS.API="api",nS.Widget="widget",(nk=s$||(s$={})).Open="open",nk.MultipleChoice="multiple_choice",nk.SingleChoice="single_choice",nk.Rating="rating",nk.Link="link",(nE=sO||(sO={})).NextQuestion="next_question",nE.End="end",nE.ResponseBased="response_based",nE.SpecificQuestion="specific_question",(nx=sM||(sM={})).Once="once",nx.Recurring="recurring",nx.Always="always",(nC={__c:nI="__cC"+sT++,__:{isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}},Consumer:function(e,t){return e.children(t)},Provider:function(e){var t,i;return this.getChildContext||(t=[],(i={})[nI]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&t.some(function(e){e.__e=!0,sW(e)})},this.sub=function(e){t.push(e);var i=e.componentWillUnmount;e.componentWillUnmount=function(){t.splice(t.indexOf(e),1),i&&i.call(e)}}),e.children}}).Provider.__=nC.Consumer.contextType=nC;var s2=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};class s3{constructor(){J(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 s5{constructor(e){J(this,"_debugEventEmitter",new s3),J(this,"checkStep",(e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t)),J(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,t;$(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)||null===(t=this.instance)||void 0===t||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!$(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||!s5.matchString(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(e,t,i){switch(i){case"regex":return!!s&&s2(e,t);case"exact":return t===e;case"contains":return s2(e,s5.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*"));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&&!s5.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&&!s5.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!s5.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||!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 s6{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;$(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});0!==t.length&&(null==this.actionMatcher&&(this.actionMatcher=new s5(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(e=>{this.onAction(e)}
1)),t.forEach(e=>{var t,i,r,s,n,o,a,l,c,u;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===(c=l.actions)||void 0===c||null===(u=c.values)||void 0===u||u.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;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[eA])||[];if(s6.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[eA])||[];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({[eA]:[...new Set(e)]})}getSurveys(){var e,t;return(null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[eA])||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}J(s6,"SURVEY_SHOWN_EVENT_NAME","survey shown");var s4=j("[Surveys]"),s8={icontains:(e,t)=>e.some(e=>t.toLowerCase().includes(e.toLowerCase())),not_icontains:(e,t)=>e.every(e=>!t.toLowerCase().includes(e.toLowerCase())),regex:(e,t)=>e.some(e=>s2(t,e)),not_regex:(e,t)=>e.every(e=>!s2(t,e)),exact:(e,t)=>e.some(e=>t===e),is_not:(e,t)=>e.every(e=>t!==e)};function s7(e){return null!=e?e:"icontains"}class s9{constructor(e){J(this,"_isFetchingSurveys",!1),J(this,"_isInitializingSurveys",!1),J(this,"_surveyCallbacks",[]),this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;
1if(L(t))return s4.warn("Decide not loaded yet. Not loading surveys.");var i=P(t);this._hasSurveys=i?t.length>0:t,s4.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate"),(()=>{for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);null!=i&&i.startsWith("seenSurvey_")&&e.push(i)}return e})().forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager){if(this._isInitializingSurveys)s4.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)s4.info("Disabled. Not loading surveys.");else{var e=null==g?void 0:g.__PosthogExtensions__;if(e){if(this._hasSurveys){this._isInitializingSurveys=!0;try{var t=e.generateSurveys;if(t)this._surveyManager=t(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new s6(this.instance),s4.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var i=e.loadExternalDependency;if(i)i(this.instance,"surveys",t=>{if(t||!e.generateSurveys)return s4.error("Could not load surveys script",t),void(this._isInitializingSurveys=!1);this._surveyManager=e.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new s6(this.instance),s4.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";s4.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(e){throw s4.error("Error initializing surveys",e),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),e}}else s4.info("No surveys to load.")}else s4.error("PostHog Extensions not found.")}}}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return s4.info("Disabled. Not loading surveys."),e([]);var i=this.instance.get_property(eM);if(i&&!t)return e(i,{isLoaded:!0});if(this._isFetchingSurveys)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:t=>{this._isFetchingSurveys=!1;var i=t.statusCode;if(200!==i||!t.json){var r="Surveys API could not be loaded, status: ".concat(i);return s4.error(r),e([],{isLoaded:!1,error:r})}var s,n,o=t.json.surveys||[],a=o.filter(e=>{var t,i,r,s,n,o,a,l,c,u,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===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0});return a.length>0&&(null===(n=this._surveyEventReceiver)||void 0===n||n.register(a)),null===(s=this.instance.persistence)||void 0===s||s.register({[eM]:o}),e(o,{isLoaded:!0})}})}catch(e){throw this._isFetchingSurveys=!1,e}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(e){s4.error("Error in survey callback",e)}}isSurveyFeatureFlagEnabled(e){return!e||this.instance.featureFlags.isFeatureEnabled(e)}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=>{if(!e.conditions)return!0;var t,i=function(e){if(null===(t=e.conditions)||void 0===t||!t.url)return!0;var t,i,r,n=null==s||null===(i=s.location)||void 0===i?void 0:i.href;if(!n)return!1;var o=[e.conditions.url];return s8[s7(null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)](o,n)}(e),r=null===(t=e.conditions)||void 0===t||!t.selector||(null==u?void 0:u.querySelector(e.conditions.selector)),n=function(e){if(null===(t=e.conditions)||void 0===t||!t.deviceTypes||0===(null===(i=e.conditions)||void 0===i?void 0:i.deviceTypes.length))return!0;
1if(!v)return!1;var t,i,r,s=su.deviceType(v);return s8[s7(null===(r=e.conditions)||void 0===r?void 0:r.deviceTypesMatchType)](e.conditions.deviceTypes,s)}(e);return i&&r&&n}),n=null===(i=this._surveyEventReceiver)||void 0===i?void 0:i.getSurveys();return e(r.filter(e=>{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 t,i,r,s,o,a,l,c,u,d=this.isSurveyFeatureFlagEnabled(e.linked_flag_key),h=this.isSurveyFeatureFlagEnabled(e.targeting_flag_key),_=(null!==(i=null===(r=e.conditions)||void 0===r||null===(s=r.events)||void 0===s||null===(o=s.values)||void 0===o?void 0:o.length)&&void 0!==i?i:0)>0,p=(null!==(a=null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c||null===(u=c.values)||void 0===u?void 0:u.length)&&void 0!==a?a:0)>0,v=!_&&!p||(null==n?void 0:n.includes(e.id)),g=this._canActivateRepeatedly(e)||this.isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key),f=this.checkFlags(e);return d&&h&&g&&v&&f}))},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)})}_canActivateRepeatedly(e){var t;return L(null===(t=g.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(s4.warn("init was not called"),!1):g.__PosthogExtensions__.canActivateRepeatedly(e)}
1canRenderSurvey(e){if(L(this._surveyManager))return s4.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=null;return this.getSurveys(i=>{var r=i.filter(t=>t.id===e)[0];t=r?G({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),t}renderSurvey(e,t){L(this._surveyManager)?s4.warn("init was not called"):this.getSurveys(i=>{var r=i.filter(t=>t.id===e)[0];this._surveyManager.renderSurvey(r,null==u?void 0:u.querySelector(t))})}}var ne=j("[RateLimiter]");class nt{constructor(e){var t,i;J(this,"serverLimits",{}),J(this,"lastEventRateLimited",!1),J(this,"checkForLimiting",e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{ne.info("".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void ne.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(eN))&&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(eN,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var ni=j("[RemoteConfig]");class nr{constructor(e){this.instance=e}get remoteConfig(){var e,t;return null===(e=g._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.config}_loadRemoteConfigJs(e){var t,i,r;null!==(t=g.__PosthogExtensions__)&&void 0!==t&&t.loadExternalDependency?null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadExternalDependency)||void 0===r||r.call(i,this.instance,"remote-config",()=>e(this.remoteConfig)):(ni.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(){try{if(this.remoteConfig)return ni.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void ni.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return ni.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this.onRemoteConfig(e)});this.onRemoteConfig(e)})}catch(e){ni.error("Error loading remote config",e)}}onRemoteConfig(e){e?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this.instance.featureFlags.ensureFlagsLoaded()):ni.info("__preview_remote_config is disabled. Logging config instead",e):ni.error("Failed to fetch remote config from PostHog.")}}var ns=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),A(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},nn=!!_||!!h,no="text/plain",na=(e,t)=>{var[i,r]=e.split("?"),s=G({},t);
1null==r||r.split("&").forEach(e=>{var[t]=e.split("=");delete s[t]});var n=tu(s);return n=n?(r?r+"&":"")+n:r,"".concat(i,"?").concat(n)},nl=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),nc=e=>{var{data:t,compression:i}=e;if(t){if(i===r.GZipJS){var s=iZ(i0(nl(t)),{mtime:0}),n=new Blob([s],{type:no});return{contentType:no,body:n,estimatedSize:n.size}}if(i===r.Base64){var o,a="data="+encodeURIComponent("string"==typeof(o=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=ns(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,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s);while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(nl(t)))?o:nl(o));return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=nl(t);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},nu=[];h&&nu.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=nc(e))&&void 0!==t?t:{},o=new Headers;X(e.headers,function(e,t){o.append(t,e)}),r&&o.append("Content-Type",r);var a=e.url,l=null;if(p){var c=new p;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}h(a,G({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:s,signal:null===(i=l)||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){U.error(e)}null===(r=e.callback)||void 0===r||r.call(e,s)})).catch(t=>{var i;U.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),_&&nu.push({transport:"XHR",method:e=>{var t,i=new _;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=nc(e))&&void 0!==t?t:{};X(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)}}),null!=c&&c.sendBeacon&&nu.push({transport:"sendBeacon",method:e=>{var t=na(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=nc(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;c.sendBeacon(t,n)}catch(e){}}});
1class nd{constructor(e,t){J(this,"isPaused",!0),J(this,"queue",[]),this.flushTimeoutMs=ig((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,"flush interval",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=Object.values(this.queue.length>0?this.formatQueue():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.sendRequest(G(G({},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();for(var i in t)!function(i){var r=t[i],s=(new Date).getTime();r.data&&P(r.data)&&X(r.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.sendRequest(r)}(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return X(this.queue,t=>{var i,r=(t?t.batchKey:null)||t.url;$(e[r])&&(e[r]=G(G({},t),{},{data:[]})),null===(i=e[r].data)||void 0===i||i.push(t.data)}),this.queue=[],e}}var nh=["retriesPerformedSoFar"];class n_{constructor(e){J(this,"isPolling",!1),J(this,"pollIntervalMs",3e3),J(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!$(s)&&"onLine"in s.navigator&&(this.areWeOnline=s.navigator.onLine,ea(s,"online",()=>{this.areWeOnline=!0,this.flush()}),ea(s,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=Y(e,nh);D(t)&&t>0&&(i.url=na(i.url,{retry_count:t})),this.instance._send_request(G(G({},i),{},{callback:e=>{var r;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue(G({retriesPerformedSoFar:t},i)):null===(r=i.callback)||void 0===r||r.call(i,e)}}))}enqueue(e){var t,i,r,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var n=(r=(Math.random()-.5)*((i=Math.min(18e5,t=3e3*Math.pow(2,s)))-t/2),Math.ceil(i+r)),o=Date.now()+n;this.queue.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in ".concat(n);navigator.onLine||(a+=" (Browser is offline)"),U.warn(a),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(G(G({},e),{},{transport:"sendBeacon"}))}catch(e){U.error(e)}this.queue=[]}}class np{constructor(e){J(this,"_updateScrollData",()=>{this.context||(this.context={});var e,t,i,r,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(){ea(s,"scroll",this._updateScrollData,{capture:!0}),ea(s,"scrollend",this._updateScrollData,{capture:!0}),ea(s,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==s?void 0:s.document.documentElement;for(var e of P(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]){var t=null==s?void 0:s.document.querySelector(e);if(t)return t}}scrollY(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var nv=e=>su.personInfo({maskPersonalDataProperties:null==e?void 0:e.config.mask_personal_data_properties,customPersonalDataProperties:null==e?void 0:e.config.custom_personal_data_properties});
1class ng{constructor(e,t,i,r){J(this,"_onSessionIdCallback",e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[eq]:i})}}),this.instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=r||nv,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[eq]}getSetOnceProps(){var e,t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?su.personPropsFromInfo(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return X(es(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_".concat(k(i))]=t}),e}}var nf=j("[SessionId]");class nm{constructor(e,t,i){if(J(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw 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||tx,this._windowIdGenerator=i||tx;var r,s=this.config.persistence_name||this.config.token,n=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ig(n,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=tD.parse(this._window_id_storage_key),a=tD.parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:tD.remove(this._window_id_storage_key),tD.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 Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){nf.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return $(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&&tD.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&tD.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?tD.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({[ex]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[ex];return P(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){ea(s,"beforeunload",()=>{this._canUseSessionStorage()&&tD.remove(this._primary_window_exists_storage_key)},{capture:!1})}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 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=D(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!e&&Math.abs(i-r)>this.sessionTimeoutMs;c||u||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),nf.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,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),e||this.resetIdleTimer(),l&&this._sessionIdChangedH
1andlers.forEach(e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:h,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var ny=["$set_once","$set"],nb=j("[SiteApps]");class nw{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))}}get siteAppLoaders(){var e,t;return null===(e=g._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(t=e[this.instance.config.token])||void 0===t?void 0:t.siteApps}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,r,s,n,o,a,l={},c=this.instance.get_property("$groups")||[];for(var[u,d]of Object.entries(this.instance.get_property("$stored_group_properties")||{}))l[u]={id:c[u],type:u,properties:d};var{$set_once:h,$set:_}=e;return{event:G(G({},Y(e,ny)),{},{properties:G(G(G({},e.properties),_?{$set:G(G({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),_)}:{}),h?{$set_once:G(G({},null!==(r=null===(s=e.properties)||void 0===s?void 0:s.$set_once)&&void 0!==r?r:{}),h)}:{}),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=this.apps[e.id],i=()=>{var i;!t.errored&&this.bufferedInvocations.length&&(nb.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)}),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this.stopBuffering)||void 0===i||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,nb.info("Site app with id ".concat(e.id," ").concat(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this.instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(t){nb.error("Error while initializing PostHog app with config id ".concat(e.id),t),s(!1)}if(r&&t.loaded)try{i()}catch(i){nb.error("Error while processing buffered events PostHog app with config id ".concat(e.id),i),t.errored=!0}}setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t,i=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{null===(t=r.processEvent)||void 0===t||t.call(r,i)}catch(t){nb.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!==(t=this.siteAppLoaders)&&void 0!==t&&t.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",e=>this.onCapturedEvent(e))):void nb.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.stopBuffering)||void 0===i||i.call(this),null!==(r=e.siteApps)&&void 0!==r&&r.length){if(this.isEnabled){var n=function(e,t){var i,r;g["__$$ph_site_app_".concat(e)]=s.instance,null===(i=g.__PosthogExtensions__)||void 0===i||null===(r=i.loadSiteApp)||void 0===r||r.call(i,s.instance,t,t=>{if(t)return nb.error("Error while initializing PostHog app with config id ".concat(e),t)})};for(var{id:o,url:a}of e.siteApps)n(o,a)}else nb.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}var nS,nk,nE,nx,nI,nC,nP,nF=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hub
1spot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],nT=function(e,t){if(!e)return!1;var i=e.toLowerCase();return nF.concat(t||[]).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})},nR=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&nT(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>nT(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function n$(e,t,i){return nl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}(nW=nP||(nP={})).US="us",nW.EU="eu",nW.CUSTOM="custom";var nO="i.posthog.com";class nM{constructor(e){J(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(nO),".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]=nP.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=nP.EU:this._regionCache[this.apiHost]=nP.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===nP.CUSTOM)return this.apiHost+t;var i=nO+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var nA={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&s2(t.href,e),not_regex:(e,t)=>!!s&&!s2(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nL{constructor(e){var t=this;J(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.getWebExperiments(e=>{nL.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){t._flagToExperiments&&(nL.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 i,r=t.instance.getFeatureFlag(e.feature_flag_key);O(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];nL.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())nL.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(L(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nL.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=nL.getWindowLocation();if(null!=e&&e.search){var t=td(null==e?void 0:e.search,"__experiment_id"),i=td(null==e?void 0:e.search,"__experiment_variant");t&&i&&(nL.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",callback:t=>200===t.statusCode&&t.json?e(t.json.experiments||[]):e([])})}showPreviewWebExperiment(e,t,i){var r=i.filter(t=>t.id===e);r&&r.length>0&&(nL.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(r[0].name,t,r[0].variants[t].transforms))}static matchesTestVariant(e){return!L(e.conditions)&&nL.matchUrlConditions(e)&&nL.matchUTMConditions(e)}static matchUrlConditions(e){if(L(e.conditions)||L(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;var t,i,r,s,n=nL.getWindowLocation();return!!n&&(null===(i=e.conditions)||void 0===i||!i.url||nA[null!==(r=null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}
1static getWindowLocation(){return null==s?void 0:s.location}static matchUTMConditions(e){if(L(e.conditions)||L(null===(i=e.conditions)||void 0===i?void 0:i.utm))return!0;var t=su.campaignParams();if(t.utm_source){var i,r,s,n,o,a,l,c,u,d,h,_,p,v,g,f,m,y=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)==t.utm_campaign,b=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(c=e.conditions)||void 0===c||null===(u=c.utm)||void 0===u?void 0:u.utm_source)==t.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)==t.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)==t.utm_term;return y&&w&&S&&b}return!1}static logInfo(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];U.info("[WebExperiments] ".concat(e),i)}applyTransforms(e,t,i){this._is_bot()?nL.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){nL.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),i);var r,s=null===(r=document)||void 0===r?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):nL.logInfo("Control variants leave the page unmodified.")}_is_bot(){return c&&this.instance?nR(c,this.instance.config.custom_blocked_useragents):void 0}}var nD={},nq=()=>{},nN="posthog",nB=!nn&&-1===(null==v?void 0:v.indexOf("MSIE"))&&-1===(null==v?void 0:v.indexOf("Mozilla")),nH=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!O(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of en)if(i===r)return!1;return!0}(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",loaded:nq,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:d&&O(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null===(e=s.location)||void 0===e?void 0:e.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;U.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:3e3},_onCapture:nq}},nU=e=>{var t={};$(e.process_person)||(t.person_profiles=e.process_person),$(e.xhr_headers)||(t.request_headers=e.xhr_headers),$(e.cookie_name)||(t.persistence_name=e.cookie_name),$(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),$(e.store_google)||(t.save_campaign_params=e.store_google),$(e.verbose)||(t.debug=e.verbose);var i=Z({},t,e);return P(e.property_blacklist)&&($(e.property_denylist)?i.property_denylist=e.property_blacklist:P(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:U.error("Invalid value for property_denylist config: "+e.property_denylist)),i};
1class nj{constructor(){J(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class nz{get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){J(this,"webPerformance",new nj),J(this,"_personProcessingSetOncePropertiesSent",!1),J(this,"version",f.LIB_VERSION),J(this,"_internalEventEmitter",new s3),this.config=nH(),this.SentryIntegration=rr,this.sentryIntegration=e=>{var t;return t=ri(this,e),{name:rt,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedIdentify=null,this.featureFlags=new sy(this),this.toolbar=new ru(this),this.scrollManager=new np(this),this.pageViewManager=new rm(this),this.surveys=new s9(this),this.experiments=new nL(this),this.exceptions=new ry(this),this.rateLimiter=new nt(this),this.requestRouter=new nM(this),this.consent=new tq(this),this.people={set:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>U.info('send "'.concat(null==e?void 0:e.event,'"'),e))}init(e,t,i){if(i&&i!==nN){var r,s=null!==(r=nD[i])&&void 0!==r?r:new nz;return s._init(e,t,i),nD[i]=s,nD[nN][i]=s,s}return this._init(e,t,i)}_init(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if($(e)||M(e))return U.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 U.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(Z({},nH(),nU(n),{name:o,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:r.GZipJS,this.persistence=new sw(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sw(G(G({},this.config),{},{persistence:"sessionStorage"}));var a=G({},this.persistence.props),l=G({},this.sessionPersistence.props);if(this._requestQueue=new nd(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new n_(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new nm(this),this.sessionPropsManager=new ng(this,this.sessionManager,this.persistence)),new rh(this).startIfEnabledOrStop(),this.siteApps=new nw(this),null===(t=this.siteApps)||void 0===t||t.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new i9(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new tg(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new rf(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new rp(this),this.exceptionObserver=new tz(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new tU(this,tH),this.deadClicksAutocapture.startIfEnabled(),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&U.info("Starting in debug mode",{this:this,config:n,thisC:G({},this.config),p:a,s:l}),this._sync_opt_out_with_persistence(),void 0!==(null===(i=n.bootstrap)||void 0===i?void 0:i.distinctID)){var c,u,d=this.config.get_device_id(tx()),h=null!==(c=n.bootstrap)&&void 0!==c&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(eD,null!==(u=n.bootstrap)&&void 0!==u&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var _,p,v=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)=>
1{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},{}),g=Object.keys((null===(p=n.bootstrap)||void 0===p?void 0:p.featureFlagPayloads)||{}).filter(e=>v[e]).reduce((e,t)=>{var i,r,s,o;return 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]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:g})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:eW,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(tx());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(eD,"anonymous")}return ea(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?function(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()||tx();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(eD,"identified")),t()},s=i.user();"then"in s&&F(s.then)?s.then(e=>r(e)):r(s)}(e,()=>{var r;i.register((Promise&&Promise.resolve||re.warn("This browser does not have Promise support, and can not use the segment integration"),r=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(re.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(re.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r,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},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>r(e,e.event.event),page:e=>r(e,"$pageview"),identify:e=>r(e,"$identify"),screen:e=>r(e,"$screen")})).then(()=>{t()})})}(this,()=>this._loaded()):this._loaded(),F(this.config._onCapture)&&this.config._onCapture!==nq&&(U.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,s,n,o,a,l,c;if(!u||!u.body)return U.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=w(e.supportedCompression,r.GZipJS)?r.GZipJS:w(e.supportedCompression,r.Base64)?r.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),null===(i=this.siteApps)||void 0===i||i.onRemoteConfig(e),null===(s=this.sessionRecording)||void 0===s||s.onRemoteConfig(e),null===(n=this.autocapture)||void 0===n||n.onRemoteConfig(e),null===(o=this.heatmaps)||void 0===o||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.onRemoteConfig(e),null===(l=this.exceptionObserver)||void 0===l||l.onRemoteConfig(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new nr(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()||Q(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&&(nB?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=na(e.url,{ip:this.config.ip?1:0}),e.headers=G({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,
1(e=>{var t,i,r,s=G({},e);s.timeout=s.timeout||6e4,s.url=na(s.url,{_:(new Date).getTime().toString(),ver:f.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=null!==(i=null===(r=eo(nu,e=>e.transport===n))||void 0===r?void 0:r.method)&&void 0!==i?i:nu[0].method;if(!o)throw Error("No available transport method");o(s)})(G(G({},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=[];Q(e,e=>{e&&(P(t=e[0])?s.push(e):F(e)?e.call(this):P(e)&&"alias"===t?i.push(e):P(e)&&-1!==t.indexOf("capture")&&F(this[t])?s.push(e):r.push(e))});var n=function(e,t){Q(e,function(e){if(P(e[0])){var i=t;X(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(!$(e)&&O(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){null!=t&&t.$current_url&&!O(null==t?void 0:t.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var n,o,a,l,c=new Date,u=(null==i?void 0:i.timestamp)||c,d=tx(),h={uuid:d,event:e,properties:this._calculate_event_properties(e,t||{},u,d)};s&&(h.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==i?void 0:i.$set)&&(h.$set=null==i?void 0:i.$set);var _=this._calculate_set_once_properties(null==i?void 0:i.$set_once);_&&(h.$set_once=_),(n=h,o=null!=i&&i._noTruncate?null:this.config.properties_string_max_length,a=e=>O(e)&&!A(o)?e.slice(0,o):e,l=new Set,h=function e(t,i){var r;return t!==Object(t)?a?a(t,i):t:l.has(t)?void 0:(l.add(t),P(t)?(r=[],Q(t,t=>{r.push(e(t))})):(r={},X(t,(t,i)=>{l.has(t)||(r[i]=e(t,i))})),r)}(n)).timestamp=u,$(null==i?void 0:i.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=c);var p=G(G({},h.properties.$set),h.$set);if(R(p)||this.setPersonPropertiesForFlags(p),!L(this.config.before_send)){var v=this._runBeforeSend(h);if(!v)return;h=v}this._internalEventEmitter.emit("eventCaptured",h);var g={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:h,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(g):this._requestQueue.enqueue(g),h}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}}else U.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}_calculate_event_properties(e,t,i,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s,n,o=this.persistence.remove_event_timer(e),a=G({},t);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),"$snapshot"===e){var l=G(G({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!D(a.distinct_id)||M(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c=su.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&Z(a,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&(a.$recording_status=this.sessionRecording.status,a.$sdk_debug_replay_internal_buffer_length=this.sessionRecording.buffer.data.length,a.$sdk_debug_replay_internal_buffer_size=this.sessionRecording.buffer.size),a.$sdk_debug_retry_queue_size=null===(s=this._retryQueue)||void 0===s||null===(n=s.queue)||void 0===n?void 0:n.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===nP.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),a=Z(a,"$pageview"===e?this.pageViewM
1anager.doPageView(i,r):"$pageleave"===e?this.pageViewManager.doPageLeave(i):this.pageViewManager.doEvent()),"$pageview"===e&&u&&(a.title=u.title),!$(o)){var _=i.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}v&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Z({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),P(this.config.property_denylist)?X(this.config.property_denylist,function(e){delete a[e]}):U.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&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=p(a,e));var g=this._hasPersonProcessing();return a.$process_person_profile=g,g&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return e;var t,i=Z({},this.persistence.get_initial_props(),(null===(t=this.sessionPropsManager)||void 0===t?void 0:t.getSetOnceProps())||{},e||{}),r=this.config.sanitize_properties;return r&&(U.error("sanitize_properties is deprecated. Use before_send instead"),i=r(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,R(i)?void 0:i}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],i=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(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){return this.surveys.canRenderSurvey(e)}identify(e,t,i){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(D(e)&&(e=e.toString(),U.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()))U.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(ec)&&(this.unregister(ec),this.register({distinct_id:e}));var s="anonymous"===(this.persistence.get_property(eD)||"anonymous");e!==r&&s?(this.persistence.set_property(eD,"identified"),this.setPersonPropertiesForFlags(G(G({},i||{}),t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(r),this._cachedIdentify=n$(e,t,i)):(t||i)&&(this._cachedIdentify!==n$(e,t,i)?(this.setPersonProperties(t,i),this._cachedIdentify=n$(e,t,i)):U.info("A duplicate posthog.identify call was made with the same properties. It has been ignored.")),e!==r&&(this.reloadFeatureFlags(),this.unregister(eL))}}else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(G(G({},t||{}),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:G(G({},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 U.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){if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var t,i,r,s,n=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(),this.surveys.reset(),null===(r=this.persistence)||void 0===r||r.set_property(eD,"anonymous"),null===(s=this.sessionManager)||void 0===s||s.resetSessionId(),this._cachedIdentify=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:eW,$device_id:null},"");else{var o=this.config.get_device_id(tx());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}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(el)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?($(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ec,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,r,s,n=G({},this.config);T(e)&&(Z(this.config,nU(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 sw(G(G({},this.config),{},{persistence:"sessionStorage"})),tR.is_supported()&&"true"===tR.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(f.DEBUG=!0,U.info("set_config",JSON.stringify({config:e,oldConfig:n,newConfig:G({},this.config)},null,2))),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,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null===(t=this.sessionManager)||void 0===t||t.checkAndGetSessionAndWindowId(),a.sampling&&(null===(i=this.sessionRecording)||void 0===i||i.overrideSampling()),a.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),a.url_trigger&&(null===(s=this.sessionRecording)||void 0===s||s.overrideTrigger("url")),a.event_trigger&&(null===(n=this.sessionRecording)||void 0===n||n.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=Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(G(G({},function(e,t){var{error:i,event:r}=e,s={$exception_list:[]},n=i||r;if(tJ(n)||tG(n,"DOMException")){if("stack"in n)s=it(n,t);else{var o=n.name||(tJ(n)?"DOMError":"DOMException"),a=n.message?"".concat(o,": ").concat(n.message):o,l=tJ(n)?"DOMError":"DOMException";s=ii(a,G(G({},t),{},{overrideExceptionType:l,defaultExceptionMessage:a}))}return"code"in n&&(s.$exception_DOMException_code="".concat(n.code)),s}if(tG(n,"ErrorEvent")&&n.error)return it(n.error,t);if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object E
1xception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return tV(e,Error)}}(n))return it(n,t);if(tG(n,"Object")||tW(n))return function(e,t){var i,r,s,n=null===(r=null==t?void 0:t.handled)||void 0===r||r,o=null===(s=null==t?void 0:t.synthetic)||void 0===s||s,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:tW(e)?e.constructor.name:"Error",value:"Non-Error 'exception' captured with keys: ".concat(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:"".concat(s.slice(0,t),"...")}return""}(e)),mechanism:{handled:n,synthetic:o}};if(null!=t&&t.syntheticException){var l=t9(null==t?void 0:t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:O(i=e.level)&&!M(i)&&b.indexOf(i)>=0?e.level:"error"}}(n,t);if($(i)&&O(r)){var c="Error",u=r,d=r.match(t7);return d&&(c=d[1],u=d[2]),ii(u,G(G({},t),{},{overrideExceptionType:c,defaultExceptionMessage:u}))}return ii(n,t)}(e instanceof Error?{error:e,event:e.message}:{event:e},{syntheticException:i})),t))}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:nN;return t!==nN&&(t=nN+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(eD))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(eD))}_hasPersonProcessing(){var e,t,i,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&R(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[ec])&&(null===(i=this.persistence)||void 0===i||null===(r=i.props)||void 0===r||!r[ej]))}_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?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ej,!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(),($(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 c?nR(c,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){u&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:u.title},{send_instantly:!0}))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==s||s.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(L(this.config.before_send))return e;var t=P(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(L(i=r(i))){var s="Event '".concat(e.event,"' was rejected in beforeSend function");return B(e.event)?U.warn("".concat(s,". This can cause unexpected behavior.")):U.info(s),null}i.properties&&!R(i.properties)||U.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}getPageViewId(){var e;
1return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=er(e.prototype[t[i]])}(nz,["identify"]);var nW,nV,nG=(nV=nD[nN]=new nz,function(){function e(){e.done||(e.done=!0,nB=!1,X(nD,function(e){e._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?e():ea(u,"DOMContentLoaded",e,{capture:!1}):s&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nV)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.