posthog-js 1.424.1 → 1.425.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +2 -0
- package/dist/module.full.d.ts +2 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +2 -0
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +2 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +2 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/src/posthog-core.d.ts +2 -0
- package/lib/package.json +3 -3
- package/lib/src/customizations/posthogReduxLogger.js.map +1 -1
- package/lib/src/entrypoints/dead-clicks-autocapture.js +0 -1
- package/lib/src/entrypoints/dead-clicks-autocapture.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/IdentificationFormView.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/NewConversationButton.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/RestoreRequestView.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/RichContent.js +0 -1
- package/lib/src/extensions/conversations/external/components/RichContent.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/TicketListItem.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/TicketListView.js.map +1 -1
- package/lib/src/extensions/conversations/external/index.js +26 -11
- package/lib/src/extensions/conversations/external/index.js.map +1 -1
- package/lib/src/extensions/replay/external/triggerMatching.js +0 -2
- package/lib/src/extensions/replay/external/triggerMatching.js.map +1 -1
- package/lib/src/posthog-core.d.ts +2 -0
- package/lib/src/posthog-core.js +5 -0
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-persistence.js +0 -1
- package/lib/src/posthog-persistence.js.map +1 -1
- package/lib/src/utils/event-receiver.js +0 -2
- package/lib/src/utils/event-receiver.js.map +1 -1
- package/package.json +9 -9
package/dist/module.slim.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],g=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),m=["$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"],w=["token"],y=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],b=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return y.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function x(t,e){return-1!==t.indexOf(e)}var E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,T=S.hasOwnProperty,k=S.toString,R=Array.isArray||function(t){return"[object Array]"===k.call(t)},P=t=>"function"==typeof t,O=t=>t===Object(t)&&!R(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,M=t=>"[object String]"==k.call(t),D=t=>M(t)&&0===t.trim().length,A=t=>null===t,N=t=>C(t)||A(t),U=t=>"[object Number]"==k.call(t)&&t==t,F=t=>U(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>t instanceof FormData,j=t=>x(m,t),z=t=>x(w,t),q=[!0,"true",1,"1","yes"],H=t=>x(q,t),G=[!1,"false",0,"0","no"];function W(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),U(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),W(s||i,e,i,r))}var V="Mobile",J="iOS",Y="Android",K="Tablet",X=Y+" "+K,Q="iPad",Z="Apple",tt=Z+" Watch",et="Safari",it="BlackBerry",rt="Samsung",st=rt+"Browser",nt=rt+" Internet",ot="Chrome",at=ot+" OS",ht=ot+" "+J,lt="Internet Explorer",ut=lt+" "+V,dt="Opera",vt=dt+" Mini",ct="Edge",_t="Microsoft "+ct,pt="Firefox",ft=pt+" "+J,gt="Nintendo",mt="PlayStation",wt="Xbox",yt=Y+" "+V,bt=V+" "+et,$t="Windows",xt=$t+" Phone",Et="Nokia",St="Ouya",Tt="Generic",kt=Tt+" "+V.toLowerCase(),Rt=Tt+" "+K.toLowerCase(),Pt="Konqueror",Ot="Oculus Browser",It="Vivaldi",Ct="Yandex",Mt="Whale",Dt="DuckDuckGo",At="Pale Moon",Nt="Waterfox",Ut="Brave",Ft="Claude",Bt="Codex",Lt="ChatGPT",jt="Google Search App",zt="(\\d+(\\.\\d+)?)",qt=new RegExp("Version/"+zt),Ht=new RegExp("("+Ft+"|"+Bt+"|"+Lt+")\\/"+zt),Gt=new RegExp(wt,"i"),Wt=new RegExp(mt+" \\w+","i"),Vt=new RegExp(gt+" \\w+","i"),Jt=new RegExp(it+"|PlayBook|BB10","i"),Yt={"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"},Kt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ut:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?jt:x(t," OPR/")&&x(t,"Mini")?vt:x(t," OPR/")?dt:Jt.test(t)?it:x(t,"IE"+V)||x(t,"WPDesktop")?ut:x(t,"OculusBrowser")?Ot:x(t,st)?nt:x(t,ct)||x(t,"Edg/")?_t:x(t,It+"/")?It:x(t,"YaBrowser/")?Ct:x(t,Mt+"/")?Mt:x(t,Dt+"/")||x(t,"Ddg/")?Dt:x(t,Ft+"/")?Ft:x(t,Bt+"/")?Bt:x(t,Lt+"/")?Lt:x(t,"FBIOS")?"Facebook "+V:x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?ht:x(t,"CrMo")||x(t,ot)?ot:x(t,Y)&&x(t,et)?yt:x(t,"FxiOS")?ft:x(t.toLowerCase(),Pt.toLowerCase())?Pt:x(t,Ut+"/")?Ut:((t,e)=>e&&x(e,Z)||function(t){return x(t,et)&&!x(t,ot)&&!x(t,Y)}(t))(t,e)?x(t,V)?bt:et:x(t,"PaleMoon/")?At:x(t,Nt+"/")?Nt:x(t,pt)?pt:x(t,"MSIE")||x(t,"Trident/")?lt:x(t,"Gecko")?pt:"")},Xt={[ut]:[new RegExp("rv:"+zt)],[_t]:[new RegExp(ct+"?\\/"+zt)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+zt)],[ht]:[new RegExp("CriOS\\/"+zt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+zt)],[et]:[qt],[bt]:[qt],[dt]:[new RegExp("(Opera|OPR)\\/"+zt)],[pt]:[new RegExp(pt+"\\/"+zt)],[ft]:[new RegExp("FxiOS\\/"+zt)],[Pt]:[new RegExp("Konqueror[:/]?"+zt,"i")],[it]:[new RegExp(it+" "+zt),qt],[yt]:[new RegExp("android\\s"+zt,"i")],[nt]:[new RegExp(st+"\\/"+zt)],[Ot]:[new RegExp("OculusBrowser\\/"+zt)],[It]:[new RegExp(It+"\\/"+zt)],[Ct]:[new RegExp("YaBrowser\\/"+zt)],[Mt]:[new RegExp(Mt+"\\/"+zt)],[Ut]:[new RegExp(Ut+"\\/"+zt)],[Ft]:[Ht],[Bt]:[Ht],[Lt]:[Ht],[Dt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+zt)],[At]:[new RegExp("PaleMoon\\/"+zt)],[Nt]:[new RegExp(Nt+"\\/"+zt)],[jt]:[new RegExp("GSA\\/"+zt)],[lt]:[new RegExp("(rv:|MSIE )"+zt)],Mozilla:[new RegExp("rv:"+zt)]},Qt=function(t,e,i,r){var s=Kt(t,e,i,r),n=Xt[s];if(C(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Zt=[[new RegExp(wt+"; "+wt+" (.*?)[);]","i"),t=>[wt,t&&t[1]||""]],[new RegExp(gt,"i"),[gt,""]],[new RegExp(mt,"i"),[mt,""]],[Jt,[it,""]],[new RegExp($t,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[xt,""];if(new RegExp(V).test(e)&&!/IEMobile\b/.test(e))return[$t+" "+V,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Yt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[$t,r]}return[$t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[J,[t[3],t[4],t[5]||"0"].join(".")]:[J,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Y+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Y+")","i"),t=>t&&t[2]?[Y,[t[2],t[3],t[4]||"0"].join(".")]:[Y,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[at,""]],[/Linux|debian/i,["Linux",""]]],te=function(t){return Vt.test(t)?gt:Wt.test(t)?mt:Gt.test(t)?wt:new RegExp(St,"i").test(t)?St:new RegExp("("+xt+"|WPDesktop)","i").test(t)?xt:/iPad/.test(t)?Q:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?tt:Jt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Et,"i").test(t)?Et:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(V).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Y:X:new RegExp("(pda|"+V+")","i").test(t)?kt:new RegExp(K,"i").test(t)&&!new RegExp(K+" pc","i").test(t)?Rt:""},ee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ie(t,e){return"string"==typeof(i=t)&&ee.test(i)?t:e();var i}function re(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function se(t){return t?t.split("#")[0]:t}var ne,oe="NativeGzipValidationError",ae=t=>t.length>=2&&31===t[0]&&139===t[1],he=(t,e)=>t===g.GZipJS||e===g.GZipJS||"gzip"===e,le=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ue=t=>{throw re(oe,"Native gzip produced invalid output: "+t)},de=function(){var t=_((function*(t,e){18>t.size&&ue("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ae(i)&&8===i[2]||ue("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(ne)return ne;ne=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;ne[t]=e>>>0}return ne})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&ue("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&ue("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function ve(){return ve=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield de(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),ve.apply(this,arguments)}var ce=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={q(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!C(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>ce(e+" "+t,i)};return s},_e=ce("[PostHog.js]"),pe=_e.createLogger,fe=pe("[ExternalScriptsLoader]"),ge=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},me=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ge(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ge(e))return me(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},we={},ye=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=we[s];if("fallback"===r&&n){if(ge(n))return void me(t,n,i);delete we[s]}me(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ye(t,e);we[s]=a;var h=ge(s);null==h||null==(o=h.parentNode)||o.removeChild(h),me(t,a,i)}else i(void 0,n)}:i)}else me(t,ye(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");me(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);me(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.424.1",v.LIB_NAME="web";var be="$people_distinct_id",$e="distinct_id",xe="$device_id",Ee="$device_model",Se="__alias",Te="__timers",ke="$dead_clicks_enabled_server_side",Re="$session_recording_remote_config",Pe="$sesid",Oe="$session_is_sampled",Ie="$enabled_feature_flags",Ce="$active_feature_flags",Me="$feature_flag_details",De="$feature_flag_payloads",Ae="$feature_flag_request_id",Ne="$minimal_flag_called_events",Ue="$stored_person_properties",Fe="$stored_group_properties",Be="$groups",Le="$surveys_loaded_at",je="$flag_call_reported",ze="$feature_flag_errors",qe="$feature_flag_evaluated_at",He="$user_state",Ge="$client_session_props",We="$capture_rate_limit",Ve="$initial_campaign_params",Je="$initial_referrer_info",Ye="$initial_person_info",Ke="$epp",Xe="$posthog_cookieless",Qe="$cookieless_mode",Ze="$sdk_debug_extensions_init_method",ti="$sdk_debug_extensions_init_time_ms",ei="on_reject",ii="always",ri="anonymous",si="identified",ni="identified_only",oi="visibilitychange",ai="beforeunload",hi="$pageview",li="$pageleave",ui="$identify",di="$groupidentify";function vi(t,e){R(t)&&t.forEach(e)}function ci(t,e){if(!N(t))if(R(t))t.forEach(e);else if(L(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)T.call(t,i)&&e(t[i],i)}var _i=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},pi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(t)}}},fi=function(t){var e={};return ci(t,(function(t,i){(M(t)&&t.length>0||U(t))&&(e[i]=t)})),e};var gi=["herokuapp.com","vercel.app","netlify.app"];function mi(t){var e=null==t?void 0:t.hostname;if(!M(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of gi)if(i===r)return!1;return!0}function wi(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var yi=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return U(t)&&isFinite(t)&&Math.floor(t)===t});class bi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,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 bi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new bi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class $i{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Yr=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Yr)this.Yr=t,this.Kr();else{if(this.Yr>=t+1e4)return;this.Xr++,this.Xr>4398046511103&&(this.Yr++,this.Kr())}return bi.fromFieldsV7(this.Yr,Math.trunc(this.Xr/Math.pow(2,30)),this.Xr&Math.pow(2,30)-1,this.ei.nextUint32())}Kr(){this.Xr=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Yr=0,this.Xr=0,this.ei=new Si}}var xi,Ei=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(Ei=t=>crypto.getRandomValues(t));class Si{nextUint32(){return this.Dt.length>this.ti||(Ei(this.Dt),this.ti=0),this.Dt[this.ti++]}constructor(){this.Dt=new Uint32Array(8),this.ti=1/0}}var Ti=()=>ki().toString(),ki=()=>(xi||(xi=new $i)).generate(),Ri="",Pi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Oi=null,Ii={ri(){if(!A(Oi))return Oi;if(Oi=!1,r)try{var t="__ph_cookie_support_"+Ti();Ii.ii(t,"xyz"),Oi='"xyz"'===yi(t),Ii.ai(t)}catch(t){Oi=!1}return Oi},oi(t){_e.error("cookieStore error: "+t)},ni:yi,si(t){var e;try{e=JSON.parse(Ii.ni(t))||{}}catch(t){}return e},ii(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ri)return Ri;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ti();!Ri&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ri=o)}return Ri}(t);if(!i){var s=(t=>{var e=t.match(Pi);return e?e[0]:""})(t);s!==i&&_e.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},ai(t,e){if(null!=r&&r.cookie)try{Ii.ii(t,"",-1,e)}catch(t){return}}},Ci=null,Mi={ri(){if(!A(Ci))return Ci;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";Mi.ii(i,"xyz"),'"xyz"'!==Mi.ni(i)&&(e=!1),Mi.ai(i)}catch(t){e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),Ci=e,e},oi(t){_e.error("localStorage error: "+t)},ni(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Mi.oi(t)}return null},si(t){try{return JSON.parse(Mi.ni(t))||{}}catch(t){}return null},ii(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Mi.oi(t)}return!1},ai(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Mi.oi(t)}}},Di=[Ue,Ce,Ie,Me,De,Ae,qe,ze,je],Ai=[xe,$e,Pe,Oe,Ke,Ye,He],Ni=t=>t+"_cpm",Ui=["__proto__","constructor","prototype"],Fi=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ui.indexOf(i)&&(e[i]=t[i])})),e},Bi=function(t,e){void 0===e&&(e=[]);var i={};return[...Ai,...e].forEach((e=>{var r=t[e];C(r)||A(r)||""===r||(i[e]=r)})),i},Li=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},ji=(t,e)=>({p:e,f:Li(JSON.stringify(t))}),zi=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Ii.si(Ni(t)),r=(null==i?void 0:i.f)===Li(e)&&R(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},qi=(t,e)=>e+"|"+(Ii.ni(Ni(t))||""),Hi={},Gi={ri:()=>!0,oi(t){_e.error("memoryStorage error: "+t)},ni:t=>t in Hi?Hi[t]:null,si:t=>t in Hi?Hi[t]:null,ii:(t,e)=>(Hi[t]=e,!0),ai(t){delete Hi[t]}},Wi=null,Vi={ri(){if(!A(Wi))return Wi;if(Wi=!0,C(t))Wi=!1;else try{var e="__support__";Vi.ii(e,"xyz"),'"xyz"'!==Vi.ni(e)&&(Wi=!1),Vi.ai(e)}catch(t){Wi=!1}return Wi},oi(t){_e.error("sessionStorage error: ",t)},ni(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Vi.oi(t)}return null},si(t){try{return JSON.parse(Vi.ni(t))||null}catch(t){}return null},ii(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Vi.oi(t)}return!1},ai(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Vi.oi(t)}}};class Ji{constructor(t){this._instance=t}get gn(){return this._instance.config}get consent(){return this.Ws()?0:this.Vs}isOptedOut(){return this.gn.cookieless_mode===ii||this.isRejected()||-1===this.consent&&this.gn.cookieless_mode===ei}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.gn.opt_out_capturing_by_default}optInOut(t){this.Gs.ii(this.Zs,t?1:0,this.gn.cookie_expiration,this.gn.cross_subdomain_cookie,this.gn.secure_cookie)}reset(){this.Gs.ai(this.Zs,this.gn.cross_subdomain_cookie)}get Zs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Vs(){var t=this.Gs.ni(this.Zs);return H(t)?1:x(G,t)?0:-1}get Gs(){var t=this.gn.opt_out_capturing_persistence_type,e="localStorage"===t?Mi:Ii,i=e.ri()?e:Gi;if(!this.Qs||this.Qs!==i){this.Qs=i;var r="localStorage"===t?Ii:Mi;r.ni(this.Zs)&&(this.Qs.ni(this.Zs)||this.optInOut(H(r.ni(this.Zs))),r.ai(this.Zs,this.gn.cross_subdomain_cookie))}return this.Qs}Ws(){return!!this.gn.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some((t=>H(t)))}}var Yi=["next","previous","prev",">","<","+","-","−","–"];pe("[Dead Clicks]");var Ki=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(ke)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Xi=pe("[SegmentIntegration]");var Qi="posthog-js";function Zi(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class tr{constructor(t,e,i,r,s,n){this.name=Qi,this.setupOnce=function(o){o(Zi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class er{constructor(t){this.Xs=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ta=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ea()}ea(){var t;this.ia=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Xs)}destroy(){var t;null==(t=this.ia)||t.call(this),this.ia=void 0}doPageView(e,i){var r,s=this.ra(e,i);return this.ta={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.ra(t,null==(e=this.ta)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ta)?void 0:t.pageViewId}}ra(t,e){var i=this.ta;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(h)||C(l)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?W(o/n,0,1,_e):1,v=n>1?W(a/n,0,1,_e):1,c=h>1?W(l/h,0,1,_e):1,_=h>1?W(u/h,0,1,_e):1;r=_i(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var ir=["flags","surveys"],rr={[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Te]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$logs_capture_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[ke]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[Re]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Oe]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>A(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ie]:{exposure:"hidden",storageGroup:"flags"},[Ce]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags"},[De]:{exposure:"hidden",storageGroup:"flags"},[Ae]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ne]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[Le]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[je]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Be]:{exposure:"event"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[Ze]:{exposure:"event"},[ti]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},sr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],nr=t=>{var e=rr[t];if(e)return e;for(var i of sr){var r=i[1];if(0===t.indexOf(i[0]))return r}},or=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},ar=t=>{var e=null==r?void 0:r.createElement("a");return C(e)?null:(e.href=t,e)},hr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!R(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){_e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},lr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");R(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},ur="https?://(.*)",dr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...dr],cr="<masked>",_r=["li_fat_id"];function pr(t,e){var i=vr.concat(e||[]),r={};return ci(i,(function(e){var i=hr(t,e);r[e]=i||null})),r}function fr(t){var e=function(t){return t?0===t.search(ur+"google.([^/?]*)")?"google":0===t.search(ur+"bing.com")?"bing":0===t.search(ur+"yahoo.com")?"yahoo":0===t.search(ur+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!A(e)){s.$search_engine=e;var n=r?hr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function gr(){return navigator.language||navigator.userLanguage}var mr="$direct";function wr(){return(null==r?void 0:r.referrer)||mr}function yr(t,e,i){void 0===i&&(i=!1);var r=t?[...dr,...e||[]]:[],n=i?se(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:wr().substring(0,1e3),u:o?lr(o,r,cr):void 0}}function br(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?se(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==mr?mr:null==(i=ar(r))?void 0:i.host};if(n){o.$current_url=n;var a=ar(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=pr(n);_i(o,h)}if(r){var l=fr(r);_i(o,l)}return o}function $r(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function xr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Er={flags:qe,surveys:Le},Sr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Tr=t=>t+"_cookie_identity_change_pending",kr="main",Rr=[Ie,Ce,Me,De,Ae,qe,Ne,Ue],Pr=t=>-1!==Rr.indexOf(t),Or=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Ir=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},Cr=(t,e)=>{ci(t,((i,r)=>{var s=nr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class Mr{constructor(e,i,r){if(void 0===r&&(r=!0),this.na={},this.sa=!1,this.aa=!1,this.oa=!1,this.la=!1,this.ua=new Map,this.ha=!1,this.da=!1,this.va=!1,this.ca=new Set,this.gn=e,this.fa=r,this.props={},this.pa=void 0,this.ga=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Gs=this.ma(e),this.aa=this.ya(e),this.load(),this.ba(),e.debug&&_e.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();wi(t,"beforeunload",s,{capture:!1}),wi(t,"pagehide",s,{capture:!1}),this._a=e=>{if(this.sa&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ga){if(this.aa){var i=ir.find((t=>e.key===this.wa(t)));i&&this.ka(e.key,i)}}else this.ka(e.key,kr)},wi(t,"storage",this._a)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var e=t[0],i=t[1],r=this.ua.get(e);if(Pr(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach((t=>s.add(t))),s.size&&this.Sa(e,s)}else this.Sa(e,!0)}))}onCrossTabFeatureFlagChange(t){return this.ca.add(t),()=>this.ca.delete(t)}destroy(){this._a&&t&&(t.removeEventListener("storage",this._a),this._a=void 0),this.ca.clear()}ka(t,e,i){if(void 0===i&&(i=!0),this.xa)return!1;var r,s;try{if(s=Mi.ni(t),A(s)){var n=this.Ca(e);return n.storageValue=null,e!==kr&&(n.persisted=!1),!1}r=Ir(s)}catch(t){return!1}var o=e===kr?r:Mi.si(this.ga);if(o&&this.Ta(o))return!1;var a=this.Ma(r,e,i);return e===kr&&this.aa&&!Or(this.Ea().main,r)||this.Ia(r,e,!0,s),a}Ta(t){var e=this.props[$e],i=t[$e];return!C(e)&&!C(i)&&e!==i}Ia(t,e,i,r){var s=this.Ca(e);s.storageValue=r,e!==kr&&(s.persisted=i);try{s.fingerprint=this.Ra(t,e)}catch(t){s.fingerprint=void 0}}Ma(t,e,i){var r=!1;return Rr.forEach((i=>{var s,n=null==(s=nr(i))?void 0:s.storageGroup;if(!(e===kr&&this.aa&&n||e!==kr&&n!==e)){var o=i in t,a=this.Pa(i,o?t[i]:void 0),h=this.ua.has(i)?i in this.props:o;h===i in this.props&&Or(a,this.props[i])||(h?this.Aa(i,a,!1):this.Fa(i,!1),r=!0)}})),r&&i&&this.ca.forEach((t=>t())),r}Oa(){if(!this.sa)return!1;try{this.va=!1;var t,e=Mi.ni(this.ga),i=this.Ca(kr),r=!1,s=!1;if(e!==i.storageValue)if(A(e))i.storageValue=null;else{if(t=Ir(e),this.va=!this.da&&this.Ta(t),this.va)return!1;s=this.Ma(t,kr,!1),!this.aa||Or(this.Ea().main,t)?this.Ia(t,kr,!0,e):i.storageValue=e,r=!0}return this.aa&&ir.forEach((e=>{var i=Mi.ni(this.wa(e)),n=this.Ca(e),o=t||{},a=r&&Rr.some((t=>{var i;return(null==(i=nr(t))?void 0:i.storageGroup)===e&&t in o}));if(i!==n.storageValue||a){if(A(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ma(o,e,!1)||s));var h=Ir(i);s=this.Ma(h,e,!1)||s,this.Ia(h,e,!0,i)}})),s}catch(t){return!1}}Sa(t,e){this.ua.set(t,e);var i=nr(t);null!=i&&i.volatile||(this.Ca((this.aa?null==i?void 0:i.storageGroup:void 0)||kr).fingerprint=void 0,this.La(t))}Da(){Rr.forEach((t=>this.ua.set(t,!0)))}ba(){if(this.sa)try{var t=Mi.ni(this.ga),e=Ir(t);this.Ca(kr).storageValue=t,Rr.forEach((t=>{var i,r=this.aa?null==(i=nr(t))?void 0:i.storageGroup:void 0,s=r?Mi.ni(this.wa(r)):null;if(r){var n=this.Ca(r);n.storageValue=s,n.persisted=!A(s)}var o=r&&!A(s)?Ir(s):e;t in this.props?this.$a(t,o[t],this.props[t]):t in o&&this.Sa(t,!0)}))}catch(t){}}Pa(t,e){var i=this.ua.get(t);if(!i)return e;if(!0===i)return this.props[t];if(t===Ce){var r=new Set(R(e)?e:[]),s=new Set(R(this.props[t])?this.props[t]:[]);return i.forEach((t=>s.has(t)?r.add(t):r.delete(t))),Array.from(r)}var n=O(e)?p({},e):{},o=O(this.props[t])?this.props[t]:{};return i.forEach((t=>{t in o?n[t]=o[t]:delete n[t]})),n}$a(t,e,i){if(Pr(t)){var r=this.ua.get(t);if(!0!==r){var s=e;if(this.sa)try{var n,o=this.aa?null==(n=nr(t))?void 0:n.storageGroup:void 0,a=o?this.wa(o):this.ga;s=Ir(Mi.ni(a))[t]}catch(t){}var h=new Set(r||[]);if(t===Ce){if(!C(e)&&!R(e)||!C(s)&&!R(s)||!R(i))return void this.Sa(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach((t=>{l.has(t)!==d.has(t)&&h.add(t)})),h.forEach((t=>{u.has(t)===d.has(t)&&h.delete(t)}))}else{if(!O(i))return void(Or(s,i)?this.ua.delete(t):this.Sa(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.Sa(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach((t=>{t in v==t in i&&Or(v[t],i[t])||h.add(t)})),h.forEach((t=>{t in c==t in i&&Or(c[t],i[t])&&h.delete(t)}))}h.size?this.Sa(t,h):this.ua.delete(t)}}}Na(){var t,e=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0?e:0}qa(t){if(this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase())if(t)try{var e=Bi(t,this.gn.cookie_persisted_properties||[]),i=ji(e,this.gn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ii.ni(this.ga)||void 0;s&&qi(this.ga,s)===r&&(this.ja=r,this.Ba=s)}catch(t){}else try{var n=Ii.ni(this.ga)||void 0;this.ja=n?qi(this.ga,n):void 0,this.Ba=n}catch(t){}}syncCookieProperties(){return this.Ha(this.gn)}Ha(t,e){if(void 0===e&&(e=!1),this.xa&&!e||this.la||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Ii.ni(this.ga)||void 0}catch(t){}if(!i||i===this.Ba)return!1;var r,s=qi(this.ga,i);try{r=Fi(JSON.parse(i))}catch(t){return!1}if((Ii.ni(this.ga)||void 0)!==i)return!1;this.ja=s,this.Ba=i;var n=zi(this.ga,i),o=[...Ai,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(C(e)||A(e)||""===e||t===He&&e!==ri&&e!==si)&&(a[t]=!0,delete r[t])})),I(r))return!1;var h=$e in r||r[He]===ri||r[He]===si,l=this.props,u=l[$e],d=l[He],v=_i({},l);[...Ai,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==$e&&t!==He)){var e=v[t];!n.isValid&&-1!==Ai.indexOf(t)&&(!1===e||0===e)||delete v[t]}})),this.props=_i(v,r),Rr.forEach((t=>{var e=t in this.props;t in l===e&&Or(l[t],this.props[t])||(e?this.$a(t,l[t],this.props[t]):this.Sa(t,!0))})),!h||He in r||He in this.props||this.Aa(He,ri);var c=this.props[$e],_=this.props[He];return!h||c===u&&_===d||(this.da=!0,this.oa=!0,Vi.ii(Tr(this.ga),!0),this.Fa(Ue),this.Fa(Ce),this.Fa(Ie),this.Fa(Me),this.Fa(De),this.Fa(Ae),this.Fa(qe),this.Fa(ze),this.Fa(je),_===ri&&(d===si||r[He]===ri||!C(u)&&c!==u)&&(Cr(this.props,r),this.Fa(Fe)),_===si?this.props.$user_id=c:delete this.props.$user_id,this.Fa(Se)),!0}consumeCookieIdentityChange(){var t=Tr(this.ga),e=this.oa||!!Vi.ni(t);return this.oa=!1,e&&Vi.ai(t),e}za(t){return void 0===t&&(t=!1),!(this.la||this.xa&&!t||!this.gn.cookieWinsOnConflict||"localstorage+cookie"!==this.gn.persistence.toLowerCase()||(this.la=!0,0))}Ua(){this.la&&(C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),delete this.na[kr],this.Va(!0))}Ga(t){if(void 0===t&&(t=!0),this.la)try{t?this.Ua():C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0)}finally{this.la=!1}}isDisabled(){return!!this.xa}ma(e){-1===Sr.indexOf(e.persistence.toLowerCase())&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Ai,...e];return p({},Mi,{si(t){try{var e,s={};try{e=Ii.ni(t)||void 0,s=e?Fi(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Mi.ni(t)||"{}");if(i){var a=zi(t,e),h=[...Ai,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];A(e)||""===e||t===He&&e!==ri&&e!==si||(l[t]=e)}));var u=$e in l||l[He]===ri||l[He]===si;if(Object.keys(l).length>0){var d,v=o[$e],c=null!==(d=o[He])&&void 0!==d?d:ri;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==$e&&t!==He)){var e=o[t];!a.isValid&&-1!==Ai.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||He in s||He in o||(o[He]=ri),!u||($e in l?l[$e]:o[$e])===v&&(He in l?l[He]:o[He])===c||(Di.forEach((t=>delete o[t])),l[He]===si&&$e in l?o.$user_id=l[$e]:delete o.$user_id,l[He]!==si&&(delete o[Be],delete o[Fe]),delete o.__alias)}n=_i(o,l)}else n=_i(s,o);return Mi.ii(t,n),n}catch(t){}return null},ii(t,r,s,n,o,a){var h=Mi.ii(t,r,void 0,void 0,a);try{var l=Bi(r,e);if(Object.keys(l).length){if(i){var u=Ni(t),d=ji(l,e);if(Ii.ii(u,d,s,n,o,a),Ii.ni(u)!==JSON.stringify(d)){Ii.ai(u,n);var v=Bi(r);return Ii.ii(t,v,s,n,o,a),h}}Ii.ii(t,l,s,n,o,a)}}catch(t){Mi.oi(t)}return h},ai(e,i){try{null==t||t.localStorage.removeItem(e),Ii.ai(e,i),Ii.ai(Ni(e),i)}catch(t){Mi.oi(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Mi.ri()?(i=Mi,s=!0):"localstorage+cookie"===n&&r.ri()?(i=r,s=!0):"sessionstorage"===n&&Vi.ri()?i=Vi:"memory"===n?i=Gi:"cookie"===n&&Ii.ri()?i=Ii:r.ri()?(i=r,s=!0):i=Ii.ri()?Ii:Gi,this.sa=s,i}wa(t){return this.ga+"__"+t}ya(t){return this.sa&&!!t.split_storage}properties(){var t={};return ci(this.props,((e,i)=>{var r=nr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.xa||t){var e=this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase(),i=e?Mi.si(this.ga):null,r={};if(e)try{ci(r=Fi(Ii.si(this.ga)),((t,e)=>{(C(t)||A(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Gs.si(this.ga);if(s&&(this.props=_i({},s)),this.aa&&this.Za(),e&&s){var n,o,a=null==i?void 0:i[$e],h=null!==(n=null==i?void 0:i[He])&&void 0!==n?n:ri,l=s[$e],u=null!==(o=s[He])&&void 0!==o?o:ri;if(l!==a||u!==h){this.oa=!0,Vi.ii(Tr(this.ga),!0);var d=_i({},this.props);Di.forEach((t=>delete d[t])),u===ri&&(h===si||r[He]===ri||!C(a)&&l!==a)&&(Cr(d,r),delete d[Fe]),this.props=d;var v=new Set;Di.forEach((t=>{var e,i=null==(e=nr(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};ci(this.props,((i,r)=>{var s;(null==(s=nr(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),I(e)?(Mi.ai(this.wa(t)),this.na[t]={}):Mi.ii(this.wa(t),e)&&(this.na[t]={persisted:!0,fingerprint:this.Ra(e,t)})}))}}Vi.ni(Tr(this.ga))&&(this.oa=!0)}}Za(){for(var t of ir){var e=Mi.si(this.wa(t));if(e&&!I(e)){var i=this.Ca(t);i.persisted=!0,this.Qa(t)||(i.fingerprint=this.Ra(e,t)),this.Ja(t,e)||_i(this.props,e)}}}Qa(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=nr(e))?void 0:i.storageGroup)===t}))}Ja(t,e){var i=Er[t];if(!i)return!1;var r=e[i],s=this.props[i];return U(r)&&U(s)&&s>r}refreshKey(t){var e;if(!this.xa){var i=this.aa?null==(e=nr(t))?void 0:e.storageGroup:void 0,r=i?Mi.si(this.wa(i)):this.Gs.si(this.ga);if(r&&t in r)this.Aa(t,r[t]);else{if(i){var s=this.Gs.si(this.ga);if(s&&t in s)return void this.Aa(t,s[t])}this.Fa(t)}}}save(){if(!this.xa){var t=this.Na();t>0?C(this.Wa)&&(this.Wa=setTimeout((()=>{this.Wa=void 0,this.Va()}),t)):this.Va()}}flush(){C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0,this.Va())}Va(t){if(void 0===t&&(t=!1),!(this.xa||this.la&&!t)){t||this.syncCookieProperties();var e=!t&&!this.ha;e||(this.va=!1);var i=!!e&&this.Oa();if(this.va)this.gn.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.aa)return this.Ka(),void(i&&this.ca.forEach((t=>t())));var r=this.Ya(this.Gs,this.ga,this.props,kr);"written"===r&&this.qa(this.props),"failed"!==r&&(this.ua.clear(),this.da=!1),i&&this.ca.forEach((t=>t()))}}}Ka(){var t=this,e=this.Ea(),i=e.main,r=e.groups,s=this.Ya(this.Gs,this.ga,i,kr);"written"===s&&this.qa(i),"failed"!==s&&(this.da=!1,Rr.forEach((t=>{var e;null!=(e=nr(t))&&e.storageGroup||this.ua.delete(t)})));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.na[e])||!i.persisted))return Rr.forEach((i=>{var r;(null==(r=nr(i))?void 0:r.storageGroup)===e&&t.ua.delete(i)})),1;var n=t.Ya(Mi,t.wa(e),s,e);"failed"!==n&&Rr.forEach((i=>{var r=nr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.ua.delete(i)}))};for(var o of ir)n(o)}Ea(){var t={},e={flags:{},surveys:{}};return ci(this.props,((i,r)=>{var s,n=null==(s=nr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ra(t,e){if(e===kr)return JSON.stringify(t)+"|"+this.Xa+"|"+this.eo+"|"+this.io;var i={};return ci(t,((t,e)=>{var r;i[e]=null!=(r=nr(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Ya(t,e,i,r){var s,n=this.Ca(r);if(r!==kr&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.Ra(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ii(e,i,this.Xa,this.eo,this.io,this.gn.debug)?(n.dirty=!1,r!==kr&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.sa&&(n.storageValue=Mi.ni(e)),"written"):(this.gn.debug&&_e.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.Da(),C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),this.Gs.ai(this.ga,!1),this.Gs.ai(this.ga,!0),!i&&this.fa)for(var r of ir)Mi.ai(this.wa(r));i?delete this.na[kr]:this.na={},this.ja=void 0,this.Ba=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Xa=C(i)?this.ro:i;var r=!1;if(ci(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Aa(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Xa=C(e)?this.ro:e;var i=!1;if(ci(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||R(e))&&(this.Aa(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.Fa(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.pa){var e=function(t,e,i){if(!r)return{};var s,n=e?[...dr,...i||[]]:[],o=pr(lr(r.URL,n,cr),t),a=(s={},ci(_r,(function(t){var e=yi(t);s[t]=e||null})),s);return _i(a,o)}(this.gn.custom_campaign_params,this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties);I(fi(e))||this.register(e),this.pa=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?fr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:wr(),$referring_domain:null!=r&&r.referrer&&(null==(t=ar(r.referrer))?void 0:t.host)||mr},void 0)}set_initial_person_info(){this.props[Ve]||this.props[Je]||this.register_once({[Ye]:yr(this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties,this.gn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ci([Je,Ve],(e=>{var i=this.props[e];i&&ci(i,(function(e,i){t["$initial_"+E(i)]=e}))}));var e=this.props[Ye];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=br(t,e),r={};return ci(i,(function(t,e){r["$initial_"+E(e)]=t})),r}(e,this.gn.disable_capture_url_hashes);_i(t,i)}return t}safe_merge(t){return ci(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.xa&&!a;a||this.Ha(e,h),this.gn=t,!a&&(r||s||o)&&(this.ja=void 0,this.Ba=void 0,this.Ha(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.ma(t):this.Gs,u=this.ya(t),d=n||u!==this.aa,v=!a&&(d||t.cross_subdomain_cookie!==this.eo||t.secure_cookie!==this.io)&&this.za(h);this.ha=d;try{if(this.ro=this.Xa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.Gs=l,this.aa=u,this.props=c,this.save()}else o&&(this.Gs=l,a||(delete this.na[kr],this.Va()))}finally{this.ha=!1,v&&this.Ga()}}set_disabled(t){this.xa=t,this.xa?this.remove():this.save()}set_cross_subdomain(t){t!==this.eo&&(this.eo=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.io&&(this.io=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[Te]||{};i[t]=e,this.Aa(Te,i),this.save()}remove_event_timer(t){var e=this.props[Te]||{},i=e[t];return C(i)||(delete e[t],this.Aa(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Aa(t,e),this.save()}Aa(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&(t!==$e&&t!==He||s===e||(this.da=!0),this.$a(t,s,e),null!=(r=nr(t))&&r.volatile||this.La(t))}Fa(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(Pr(t)&&this.Sa(t,!0),this.La(t))}La(t){var e,i=null==(e=nr(t))?void 0:e.storageGroup;i&&(this.Ca(i).dirty=!0)}Ca(t){return this.na[t]||(this.na[t]={})}}function Dr(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&P(i.then)&&i.then(void 0,(()=>{}))}}}}var Ar={GZipJS:"gzip-js",Base64:"base64"},Nr={Activation:"events",Cancellation:"cancelEvents"},Ur={Button:"button",Tab:"tab",Selector:"selector"},Fr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Br={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Lr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},jr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},zr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},qr={Once:"once",Recurring:"recurring",Always:"always"},Hr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Gr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Wr={Popover:"popover",Inline:"inline"},Vr={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Jr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Yr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Kr=pe("[RateLimiter]");class Xr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Kr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Kr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(We))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(U(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.no(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(We,a),{isRateLimited:h,remainingTokens:a.tokens}}so(t){var e=this.instance.config.property_denylist;return!R(e)||!e.includes(t)}ao(){var t;if(this.so("$current_url")&&this.so("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}no(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ao(),o=this.so("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Qr=pe("[RemoteConfig]");class Zr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}oo(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}lo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Qr.info("Using preloaded remote config",this.remoteConfig),void this.uo(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Qr.warn("Remote config is disabled. Falling back to local config.");this.oo((t=>{if(!t)return Qr.info("No config found after loading remote JS config. Falling back to JSON."),void this.lo((t=>{this.uo(t.json,t)}));this.uo(t)}))}catch(t){Qr.error("Error loading remote config",t),this.uo()}}uo(t,e){!t&&e&&(0===e.statusCode?e.error||Qr.warn("Failed to fetch remote config from PostHog."):Qr.error("Failed to fetch remote config from PostHog."));try{this._instance.uo(t?{ok:!0,config:t}:{ok:!1})}catch(t){Qr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){Qr.error("Error loading feature flags",t)}}}var ts=["fatal","error","warning","log","info","debug"],es=Uint8Array,is=Uint16Array,rs=Uint32Array,ss=new es([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]),ns=new es([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]),os=new es([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),as=function(t,e){for(var i=new is(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new rs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},hs=as(ss,2),ls=hs[1];hs[0][28]=258,ls[258]=28;for(var us=as(ns,0)[1],ds=new is(32768),vs=0;32768>vs;++vs){var cs=(43690&vs)>>>1|(21845&vs)<<1;ds[vs]=((65280&(cs=(61680&(cs=(52428&cs)>>>2|(13107&cs)<<2))>>>4|(3855&cs)<<4))>>>8|(255&cs)<<8)>>>1}var _s=function(t,e,i){for(var r=t.length,s=0,n=new is(e);r>s;++s)++n[t[s]-1];var o,a=new is(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new is(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[ds[d]>>>h]=l}else for(o=new is(r),s=0;r>s;++s)o[s]=ds[a[t[s]-1]++]>>>15-t[s];return o},ps=new es(288);for(vs=0;144>vs;++vs)ps[vs]=8;for(vs=144;256>vs;++vs)ps[vs]=9;for(vs=256;280>vs;++vs)ps[vs]=7;for(vs=280;288>vs;++vs)ps[vs]=8;var fs=new es(32);for(vs=0;32>vs;++vs)fs[vs]=5;var gs=_s(ps,9,0),ms=_s(fs,5,0),ws=function(t){return(t/8>>0)+(7&t&&1)},ys=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof is?is:t instanceof rs?rs:es)(i-e);return r.set(t.subarray(e,i)),r},bs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},$s=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},xs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new es(0),0];if(1==s){var o=new es(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new is(v+1),_=Es(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new es(c),_]},Es=function(t,e,i){return-1==t.s?Math.max(Es(t.l,e,i+1),Es(t.r,e,i+1)):e[t.s]=i},Ss=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new is(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++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=t[a]}return[i.subarray(0,r),e]},Ts=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},ks=function(t,e,i){var r=i.length,s=ws(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Rs=function(t,e,i,r,s,n,o,a,h,l,u){bs(e,u++,i),++s[256];for(var d=xs(s,15),v=d[0],c=d[1],_=xs(n,15),p=_[0],f=_[1],g=Ss(v),m=g[0],w=g[1],y=Ss(p),b=y[0],x=y[1],E=new is(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=xs(E,7),k=T[0],R=T[1],P=19;P>4&&!k[os[P-1]];--P);var O,I,C,M,D=l+5<<3,A=Ts(s,ps)+Ts(n,fs)+o,N=Ts(s,v)+Ts(n,p)+o+14+3*P+Ts(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(A>=D&&N>=D)return ks(e,u,t.subarray(h,h+l));if(bs(e,u,1+(A>N)),u+=2,A>N){O=_s(v,c,0),I=v,C=_s(p,f,0),M=p;var U=_s(k,R,0);for(bs(e,u,w-257),bs(e,u+5,x-1),bs(e,u+10,P-4),u+=14,S=0;P>S;++S)bs(e,u+3*S,k[os[S]]);u+=3*P;for(var F=[m,b],B=0;2>B;++B){var L=F[B];for(S=0;L.length>S;++S)bs(e,u,U[j=31&L[S]]),u+=k[j],j>15&&(bs(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=gs,I=ps,C=ms,M=fs;for(S=0;a>S;++S)if(r[S]>255){var j;$s(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(bs(e,u,r[S]>>>23&31),u+=ss[j]);var z=31&r[S];$s(e,u,C[z]),u+=M[z],z>3&&($s(e,u,r[S]>>>5&8191),u+=ns[z])}else $s(e,u,O[r[S]]),u+=I[r[S]];return $s(e,u,O[256]),u+I[256]},Ps=new rs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Os=function(){for(var t=new rs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Is=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Cs(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Os[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new es(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=ks(h,l,t.subarray(u,d)):(h[u]=!0,l=ks(h,l,t.subarray(u,o)))}else{for(var v=Ps[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new is(32768),g=new is(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new rs(25e3),x=new is(288),E=new is(32),S=0,T=0,k=(u=0,0),R=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=R){var M=o-u;if((S>7e3||k>24576)&&M>423){l=Rs(t,h,0,b,x,E,T,k,P,u-P,l),k=S=T=0,P=u;for(var D=0;286>D;++D)x[D]=0;for(D=0;30>D;++D)E[D]=0}var A=2,N=0,U=_,F=I-C&32767;if(M>2&&O==y(u-F))for(var B=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=F&&--U&&I!=C;){if(t[u+A]==t[u+A-F]){for(var z=0;j>z&&t[u+z]==t[u+z-F];++z);if(z>A){if(A=z,N=F,z>B)break;var q=Math.min(F,z-2),H=0;for(D=0;q>D;++D){var G=u-F+D+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}F+=(I=C)-(C=f[I])+32768&32767}if(N){b[k++]=268435456|ls[A]<<18|us[N];var V=31&ls[A],J=31&us[N];T+=ss[V]+ns[J],++x[257+V],++E[J],R=u+A,++S}else b[k++]=t[u],++x[t[u]]}}l=Rs(t,h,!0,b,x,E,T,k,P,u-P,l)}return ys(a,0,r+ws(l)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Is(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),Is(l,u-8,i.d()),Is(l,u-4,r),l}var Ms=!!o||!!n,Ds="text/plain",As=!1,Ns=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Us=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return ci(t,(function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},Fs=t=>{if(t.do)return t.do;var e=t.data,i=t.compression;if(e){if(i===Ar.GZipJS){var r=Cs(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new es(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new es(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return ys(r,0,s)}(or(e)),{mtime:0});return{contentType:Ds,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ar.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(or(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:or(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=or(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Bs=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:Us(t.url,{compression:Ar.Base64}),encodedBody:Fs(p({},t,{compression:Ar.Base64,do:void 0}))}:{url:Ns(t.url,"compression"),encodedBody:Fs(p({},t,{compression:void 0,do:void 0}))};try{e=Fs(t)}catch(e){if(he(t.compression,hr(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&he(t.compression,hr(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?ae(new Uint8Array(i)):ArrayBuffer.isView(i)&&ae(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(As=!0,r()):{url:t.url,encodedBody:e}},Ls=t=>{try{return Bs(t)}catch(e){return _e.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},js=function(){var t=_((function*(t){var e=or(t.data),i=yield function(t,e,i){return ve.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{do:{contentType:Ds,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),zs=/Failed to fetch|NetworkError|Load failed/i,qs=t=>"TypeError"===(null==t?void 0:t.name)&&zs.test((null==t?void 0:t.message)||""),Hs=t=>{var e=Ls(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;ci(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e;v=!0,c.abort(re("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||qs(e)?_e.warn(e):_e.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.vo&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){_e.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Gs=t=>{try{var e,r=Bs(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=R(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(R(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>R(t.data)?e:p({},t.data,{batch:e});return Gs(p({},t,{data:v(u.slice(0,d))})),void Gs(p({},t,{data:v(u.slice(d))}))}_e.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),Hs(p({},t,{vo:!0}))}catch(t){_e.warn("Beacon send failed",t)}},Ws=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return Us(i===Ar.GZipJS?Ns(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Ar.GZipJS?{}:{compression:i}))},Vs=[];n&&Vs.push({transport:"fetch",method:Hs}),o&&Vs.push({transport:"XHR",method(t){var e=Ls(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ci(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Vs.push({transport:"sendBeacon",method:Gs});var Js=3e3;class Ys{constructor(t,e){this.co=!0,this.fo=[],this.po=W((null==e?void 0:e.flush_interval_ms)||Js,250,5e3,_e.createLogger("flush interval"),Js),this.mo=t}enqueue(t){this.fo.push(t),this.yo||this.bo()}unload(){this._o();var t=this.fo.length>0?this.wo():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ko(p({},t,{transport:"sendBeacon"}))}))}enable(){this.co=!1,this.bo()}bo(){var t=this;this.co||(this.yo=setTimeout((()=>{if(this._o(),this.fo.length>0){var e=this.wo(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&R(i.data)&&ci(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ko(i)};for(var r in e)i()}}),this.po))}ko(t){try{this.mo(t)}catch(t){_e.error(t)}}_o(){clearTimeout(this.yo),this.yo=void 0}wo(){var t={};return ci(this.fo,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.fo=[],t}}var Ks=["retriesPerformedSoFar"];class Xs{constructor(e){this.So=!1,this.xo=3e3,this.fo=[],this._instance=e,this.fo=[],this.Co=!0,!C(t)&&"onLine"in t.navigator&&(this.Co=t.navigator.onLine,this.To=()=>{this.Co=!0,this.Mo()},this.Eo=()=>{this.Co=!1},wi(t,"online",this.To),wi(t,"offline",this.Eo))}get length(){return this.fo.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ks);F(e)&&(i.url=Us(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.es(p({retriesPerformedSoFar:e},i));0===t.statusCode&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}es(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.fo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),_e.warn(s),this.So||(this.So=!0,this.Io())}Io(){if(this.Ro&&clearTimeout(this.Ro),0===this.fo.length)return this.So=!1,void(this.Ro=void 0);this.Ro=setTimeout((()=>{this.Co&&this.fo.length>0&&this.Mo(),this.Io()}),this.xo)}Mo(){var t=Date.now(),e=[],i=this.fo.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.fo=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Ro&&(clearTimeout(this.Ro),this.Ro=void 0),this.So=!1,C(t)||(this.To&&(t.removeEventListener("online",this.To),this.To=void 0),this.Eo&&(t.removeEventListener("offline",this.Eo),this.Eo=void 0)),this.fo)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){_e.error(t)}}this.fo=[]}}class Qs{constructor(t){this.Po=()=>{var t,e,i,r;this.Ao||(this.Ao={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),h=(null==s?void 0:s.scrollHeight)||0;this.Ao.lastScrollY=Math.ceil(n),this.Ao.maxScrollY=Math.max(n,null!==(t=this.Ao.maxScrollY)&&void 0!==t?t:0),this.Ao.maxScrollHeight=Math.max(o,null!==(e=this.Ao.maxScrollHeight)&&void 0!==e?e:0),this.Ao.lastContentY=a,this.Ao.maxContentY=Math.max(a,null!==(i=this.Ao.maxContentY)&&void 0!==i?i:0),this.Ao.maxContentHeight=Math.max(h,null!==(r=this.Ao.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Fo(){return this._instance.config.scroll_root_selector}getContext(){return this.Ao}resetContext(){var t=this.Ao;return setTimeout(this.Po,0),t}startMeasuringScrollPosition(){wi(t,"scroll",this.Po,{capture:!0}),wi(t,"scrollend",this.Po,{capture:!0}),wi(t,"resize",this.Po)}scrollElement(){if(!this.Fo)return null==t?void 0:t.document.documentElement;var e=R(this.Fo)?this.Fo:[this.Fo];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Oo(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.Fo){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Oo("y")}scrollX(){return this.Oo("x")}}var Zs=t=>yr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class tn{constructor(t,e,i,r){this.Tt=t=>{var e=this.Lo();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Do(this._instance)};this.$o.register({[Ge]:i})}},this._instance=t,this.No=e,this.$o=i,this.Do=r||Zs,this.No.onSessionId(this.Tt)}Lo(){return this.$o.props[Ge]}getSetOnceProps(){var t,e=null==(t=this.Lo())?void 0:t.props;return e?"r"in e?br(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return ci(fi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+E(i)]=e})),t}}class en{on(t,e){return this.qo[t]||(this.qo[t]=[]),this.qo[t].push(e),()=>{this.qo[t]=this.qo[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.qo[t]||[])i(e);for(var r of this.qo["*"]||[])r(t,e)}constructor(){this.qo={}}}var rn=pe("[SessionId]"),sn=864e5;class nn{on(t,e){return this.jo.on(t,e)}constructor(t,e,i){var r;if(this.Bo=null,this.Ho=null,this.zo=[],this.Uo=void 0,this.Wo=!1,this.jo=new en,this.Vo=(t,e)=>!(!F(t)||!F(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ii)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.gn=t.config,this.$o=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Go=void 0,this._sessionActivityTimestamp=null,this.Zo=e||Ti,this.Qo=i||Ti;var s=this.gn.persistence_name||this.gn.token;if(this._sessionTimeoutMs=1e3*W(this.gn.session_idle_timeout_seconds||1800,60,36e3,rn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Jo(),this.Ko="ph_"+s+"_window_id",this.Yo="ph_"+s+"_primary_window_exists",this.Xo()){var n=Vi.si(this.Ko),o=Vi.si(this.Yo);n&&!o?this.It=n:Vi.ai(this.Ko),Vi.ii(this.Yo,!0)}null!=(r=this.gn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.gn.bootstrap.sessionID),this.tl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.zo)&&(this.zo=[]),this.zo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.zo=this.zo.filter((e=>e!==t))}}Xo(){return"memory"!==this.gn.persistence&&!this.$o.xa&&Vi.ri()}el(t){t!==this.It&&(this.It=t,this.Xo()&&Vi.ii(this.Ko,t))}il(){return this.It?this.It:this.Xo()?Vi.si(this.Ko):null}rl(t){var e=this.Bo;return!A(e)&&!A(t)&&5e3>Math.abs(t-e)}nl(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Pe||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Pe=t,s&&!r||s&&this.rl(e)||(this.Bo=e,this.$o.register({[Pe]:[e,t,i]}))}sl(){var t,e=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0}al(){this.sl()?this.$o.refreshKey(Pe):(this.$o.flush(),this.$o.load())}ol(){var t;if(!A(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Bo){this.al();var e=this.ll();e[1]===this.Pe&&e[2]===this._sessionStartTimestamp&&(this.Bo=this._sessionActivityTimestamp,this.$o.register({[Pe]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.$o.flush())}}ul(){var t=this.ll()[0],e=F(t)?t:0,i=F(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}hl(t){return this.al(),this.Vo(t,this.ul())}ll(){var t=this.$o.props[Pe];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Bo=null,this.Go=void 0,clearTimeout(this.dl),this.dl=void 0,this.nl(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void rn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void rn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Go={sessionId:t,sessionStartTimestamp:i}:this.nl(t,(new Date).getTime(),i),!0)}destroy(){this.Wo=!0,this.ol(),clearTimeout(this.dl),this.dl=void 0,this.Uo&&t&&(t.removeEventListener(ai,this.Uo,{capture:!1}),this.Uo=void 0),this.zo=[]}tl(){this.Uo=()=>{this.ol(),this.Xo()&&Vi.ai(this.Yo)},wi(t,ai,this.Uo,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.gn.cookieless_mode===ii)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Pe;if(i)this.Ho=r;else if(A(this.Ho)||this.Ho>r||r-this.Ho>=1e3){var n,o;null==(n=(o=this.$o).syncCookieProperties)||n.call(o),this.Ho=r}var a=this.ll(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.ul(),v=this.il(),c=this.Go,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>sn),p=c?_:F(l)&&Math.abs(r-l)>sn,f=!1,g=u,m=!h||!!c,w=h,y=!m&&!t&&this.Vo(r,d);if(y){(y=this.hl(r))||rn.info("cross-tab refresh kept the session alive",{sessionId:h});var b=this.ll();h=b[1],l=b[2]}if(m||y||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Zo(),v=this.Qo(),rn.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.Go=void 0,f=!0}else v||(v=this.Qo(),f=!0),(g=g||h!==w)&&(rn.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=F(d)&&t&&!p?d:r,S=F(l)?l:(new Date).getTime();this.el(v),this.nl(h,E,S),t||this.Jo();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.zo.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}Jo(){this.Wo||(clearTimeout(this.dl),this.dl=setTimeout((()=>{if(!this.Wo)if(this.hl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.jo.emit("forcedIdleReset",{idleSessionId:t})}else this.Jo()}),1.1*this.sessionTimeoutMs))}}function on(){return(on=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return M(r)&&r.length>0?r:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function an(t,e,i){return or({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var hn="custom",ln="i.posthog.com",un=/^\/static\//,dn=["/s/","/e/","/i/"];class vn{constructor(t){this.vl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+ln,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.vl[this.apiHost]||(this.vl[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":hn),this.vl[this.apiHost]}cl(t){if(un.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}fl(t){var e=ar(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}pl(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ar(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&dn.some((t=>0===e.indexOf(t)))){var a=this.fl(r);if(a){var h,l=this.apiHost,u=this.gl;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this.gl=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.gl,i=this.fl(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.pl(t,e,this.uiHost+e);if("flags"===t)return this.pl(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.cl(e);if(i)return this.pl(t,e,""+i+e)}if(this.region===hn)return this.pl(t,e,this.apiHost+e);var r=ln+e;switch(t){case"assets":return this.pl(t,e,"https://"+this.region+"-assets."+r);case"api":return this.pl(t,e,"https://"+this.region+"."+r)}}}var cn=pe("[Surveys]"),_n={ignoreConditions:!1,ignoreDelay:!1,displayType:Wr.Popover},pn=pe("[PostHog ExternalIntegrations]"),fn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class gn{constructor(t){this._instance=t}Ks(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return pn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ks(fn[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class mn{constructor(t,e){this.A=t,this.$s=e,this.ml=new Map,this.Fs=!1}add(t){var e=this;return _((function*(){if(e.Fs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.ml.set(t.name,t);try{var i=t.setup(e.$s);i&&(yield i)}catch(i){var r=e.ml.get(t.name)===t;r&&e.ml.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.yl(t)}}))()}getExtension(t){return this.ml.get(t)}dispose(){if(!this.Fs){this.Fs=!0;var t=Array.from(this.ml.values()).reverse();for(var e of(this.ml.clear(),t))this.yl(e)}}yl(t){try{var e=null==t.dispose?void 0:t.dispose();e&&P(e.then)&&e.then(void 0,(e=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class wn{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var yn="extensionsRemoteConfig";class bn{constructor(t){this.Fs=!1,this.instance=t,this.A=_e,this.bl=t._l,this.kv=new wn(t),this.onEvent=t=>Dr(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Fs)return Dr((()=>{}));var e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.wl.on(yn,e);return this.bl&&e(this.bl),Dr(i)},this.kl=new mn(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(xe))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(xe);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.kl.add(t)}getExtension(t){return this.kl.getExtension(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Dr(this.instance.Sl(t))}handleRemoteConfig(t){this.Fs||(this.bl=t,this.instance.wl.emit(yn,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?Us(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?g.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Fs||(this.Fs=!0,this.kl.dispose())}}var $n,xn={},En=0,Sn=()=>{},Tn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',kn="Surveys module not available",Rn="sanitize_properties is deprecated. Use before_send instead",Pn="Invalid value for property_denylist config: ",On=["token","distinct_id",Qe],In="posthog",Cn=!Ms&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),Mn=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Dn=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:mi(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Sn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&M(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){_e.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ni,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Js},error_tracking:{},_onCapture:Sn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Yi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Mn(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},An=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Nn=t=>{var e={};for(var i of An){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=_i({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),M(o)&&C(t.asset_host)&&(n.asset_host=o)),R(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:R(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(Pn+t.property_denylist)),n};class Un{constructor(){this.__forceAllowLocalhost=!1}get xl(){return this.__forceAllowLocalhost}set xl(t){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Fn{Cl(t){if(t){var e=this.ml.indexOf(t);-1!==e&&this.ml.splice(e,1)}}Tl(t,e){return this.Cl(t),this.ml.push(e),null==e.initialize||e.initialize(),e}Ml(){return this.config.cookieless_mode===ii||this.config.cookieless_mode===ei&&this.consent.isRejected()}El(){if(!this.Il&&!this.config.segment&&!this.Ml()){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Rl||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Il=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}Pl(){if(!this.Ml()&&this.get_distinct_id()===Xe){var t=this.persistence;if(t){this.Al()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Xe){var i=this.config.get_device_id(Ti());this.register({distinct_id:i,$device_id:i}),t.set_property(He,ri)}this.Fl()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Un,this.Ol=!1,this.version=v.LIB_VERSION,this.Ll=new Set,this.Dl="",this.wl=new en,this.ml=[],this.$l=[],this.Rl=!1,this.Il=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Dn(),this.SentryIntegration=tr,this.sentryIntegration=t=>function(t,e){var i=Zi(t,e);return{name:Qi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nl=!1,this.ql=null,this.jl=null,this.Bl=null,this.scrollManager=new Qs(this),this.pageViewManager=new er(this),this.rateLimiter=new Xr(this),this.requestRouter=new vn(this),this.consent=new Ji(this),this.externalIntegrations=new gn(this);var e=null!==(t=Fn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=M(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=M(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>_e.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==In){var r,s=null!==(r=xn[i])&&void 0!==r?r:new Fn;return s._init(t,e,i),xn[i]=s,xn[In][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n,o;void 0===i&&(i={});var a,h=M(e)?e.trim():"";if(!h)return _e.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Dn(i.defaults),i.debug=this.Hl(i.debug),this.zl=i,this.Ul=[],i.person_profiles?this.jl=i.person_profiles:i.process_person&&(this.jl=i.process_person);var l=Dn(i.defaults),u=Nn(i),d=_i({},l,u,{name:r,token:h});O(l.rageclick)&&O(u.rageclick)&&(d.rageclick=_i({},l.rageclick,u.rageclick)),O(l.session_recording)&&O(u.session_recording)&&(d.session_recording=_i({},l.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ar.GZipJS;var c=this.Al();if(this.persistence=new Mr(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mr(p({},this.config,{persistence:"sessionStorage"}),c,!1),this.Dl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Vi.ri()){var _=Vi.si(this.Dl);R(_)&&_.forEach((t=>{M(t)&&this.Ll.add(t)}))}else Vi.ai(this.Dl);var f=p({},this.persistence.props),g=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Wl=new Ys((t=>this.Vl(t)),this.config.request_queue_config),this.Gl=new Xs(this),this.__request_queue=[];var m=this.Ml();m||(this.sessionManager=new nn(this),this.sessionPropsManager=new tn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Zl()}))),this.Ql(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Jl(m)}),0)):(_e.info("Initializing extensions synchronously"),this.Jl(m)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&_e.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Rl=!!w&&!D(w),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,b=this.get_distinct_id(),x=this.persistence.get_property(He);if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===ri)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===si)_e.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var E=this.config.get_device_id(Ti()),S=i.bootstrap.isIdentifiedID?E:y;this.persistence.set_property(He,i.bootstrap.isIdentifiedID?si:ri),this.register({distinct_id:y,$device_id:S})}}if(m)this.register_once({distinct_id:Xe,$device_id:null},"");else if(!this.get_distinct_id()){var T=this.config.get_device_id(Ti());this.register_once({distinct_id:T,$device_id:T},""),this.persistence.set_property(He,ri)}return wi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Ti();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(He,si)),e()},s=i.user();"then"in s&&P(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Xi.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Xi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Xi.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,hi),identify:t=>e(t,ui),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Kl())):this.Kl(),P(this.config._onCapture)&&this.config._onCapture!==Sn&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&_e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return on.apply(this,arguments)}().then((t=>{t&&this.register({[Ee]:t})})).catch(Sn),this}Yl(t){var e=t;return M(e.name)&&P(e.setup)}Xl(t,e){this.Yl(t)?e.push((()=>{this.tu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{_e.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.ml.push(t)}Ql(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Fn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.eu)||r.call(this),this.eu=void 0,this.featureFlags=new o(this)),P(this.featureFlags.onReloading)&&P(this.featureFlags.setup)?this.eu||(this.eu=this.featureFlags.onReloading((()=>{this.wl.emit("featureFlagsReloading",!0)})),this.tu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Jl(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Fn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.ml.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.ml.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.ml.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.ml.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.ml.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.Xl(this.autocapture=new l.autocapture(this),u),l.surveys&&this.Xl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.Xl(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this),u),l.metrics&&this.ml.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.ml.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.ml.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.ml.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.ml.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.ml.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.ml.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Ki)),l.toolbar&&this.ml.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.ml.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.ml.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.iu){var t=this.iu;this.iu=void 0,this.ml.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ru(u,h)}ru(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ru(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){_e.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ze]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ti]:r}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+r+"ms)")}uo(t){var e;if(!r||!r.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.uo(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.iu=t),this._l=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=x(s.supportedCompression,Ar.GZipJS)?Ar.GZipJS:x(s.supportedCompression,Ar.Base64)?Ar.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.jl?this.jl:ni}),null==(e=this.nu)||e.handleRemoteConfig(t),this.ml.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Kl(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.su(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ml())&&this.au()}),1),this.ou=new Zr(this),this.ou.load()}su(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Wl)||t.enable())}_dom_loaded(){this.is_capturing()&&vi(this.__request_queue,(t=>this.Vl(t))),this.__request_queue=[],this.su()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.lu()&&this.capture(li),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Wl)||r.unload(),null==(s=this.Gl)||s.unload()):this.lu()&&this.capture(li,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?Cn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(s.compression)&&s.data&&(s.compression=Ar.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(R(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),R(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ws(s.url,s.method,s.compression,s.timestampMode);var v=Vs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){qs(t)?_e.warn(t):_e.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Ar.GZipJS&&h&&"undefined"!=typeof Promise&&!As?js(s).then((t=>{_(t)})).catch((e=>{if(le(e))return As=!0,void _(p({},s,{compression:void 0,url:Ws(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return le(t)||e===oe})(e)&&(As=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vl(t){this.Gl?this.Gl.retriableRequest(t):this._send_request(t)}_execute_array(t){En++;try{var e,i=[],r=[],s=[];vi(t,(t=>{if(t)if(R(e=t[0]))s.push(t);else if(P(t))try{t.call(this)}catch(e){_e.error("Error executing queued PostHog call",t,e)}else R(t)&&"alias"===e?i.push(t):R(t)&&-1!==e.indexOf("capture")&&P(this[e])?s.push(t):r.push(t)}));var n=function(t,e){vi(t,(function(t){try{if(R(t[0])){var i=e;ci(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){_e.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{En--}}push(t){if(En>0&&R(t)&&M(t[0])){var e=Fn.prototype[t[0]];P(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Wl){if(this.is_capturing())if(!C(t)&&M(t)){this.Pl();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!M(null==e?void 0:e.$current_url)&&(_e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||_e.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var u=new Date,d=(null==i?void 0:i.timestamp)||u,v=ie(null==i?void 0:i.uuid,Ti),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===hi&&this.config.__preview_capture_bot_pageviews&&h&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),l&&(c.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ne);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(c.$unset=g);var m,w,y,b=_?void 0:this.hu(null==i?void 0:i.$set_once,t!==di,t===ui);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>M(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),R(e))r=[],vi(e,(e=>{r.push(t(e))}));else{var s={};ci(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,C(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return f.forEach(r),e.forEach(r),i}(c.properties,On)),t===Hr.DISMISSED||t===Hr.SENT){var x=null==e?void 0:e[Gr.SURVEY_ID],E=null==e?void 0:e[Gr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){cn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Hr.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Hr.SHOWN&&(c.$set=p({},c.$set,{[Gr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Jr.SHOWN){var S=null==e?void 0:e[Yr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Yr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(I(T)||this.setPersonPropertiesForFlags(T),!N(this.config.before_send)){var k=this.Xn(c);if(!k)return;(c=k).uuid=ie(c.uuid,Ti)}this.wl.emit("eventCaptured",c);var P=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:P,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Vl(O):this.Wl.enqueue(O),c}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.nu)?void 0:e.getExtension(t)}tu(){var t;return null!==(t=this.nu)&&void 0!==t?t:this.nu=new bn(this)}Sl(t){this.$l.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$l.indexOf(t);-1!==i&&this.$l.splice(i,1)}}}du(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Bl=null,this.persistence.get_property(He)===ri&&(null==(r=this.sessionPersistence)||r.clear(),this.Ll.clear(),this.vu()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.du();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Ml()&&(u[Qe]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!M(u.distinct_id)&&!U(u.distinct_id)||D(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[...dr,...i||[]]:[],_=function(t){for(var e=0;Zt.length>e;e++){var i=Zt[e],r=i[1],s=i[0].exec(t),n=s&&(P(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};C(r)||(m.detectGoogleSearchApp=r);var w={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;C(y)||(w.userAgentDataPlatform=y),C(b)||(w.maxTouchPoints=b),C(x)||(w.screenWidth=x),C(E)||(w.screenHeight=E),C(S)||(w.devicePixelRatio=S);var T,k,R,O,I,M,D,A,N=_i(fi({$os:p,$os_version:f,$browser:Kt(l,navigator.vendor,g,m),$device:te(l),$device_type:(k=l,R=w,A=te(k),A===Q||A===X||"Kobo"===A||"Kindle Fire"===A||A===Rt?K:A===gt||A===wt||A===mt||A===St?"Console":A===tt?"Wearable":A?V:"Android"===(null==R?void 0:R.userAgentDataPlatform)&&(null!==(O=null==R?void 0:R.maxTouchPoints)&&void 0!==O?O:0)>0?600>Math.min(null!==(I=null==R?void 0:R.screenWidth)&&void 0!==I?I:0,null!==(M=null==R?void 0:R.screenHeight)&&void 0!==M?M:0)/(null!==(D=null==R?void 0:R.devicePixelRatio)&&void 0!==D?D:1)?V:K:"Desktop"),$timezone:$r(),$timezone_offset:xr()}),{$current_url:lr(n?se(null==s?void 0:s.href):null==s?void 0:s.href,c,cr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:Qt(l,navigator.vendor,g,m),$browser_language:gr(),$browser_language_prefix:(T=gr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=v.SDK_DIST_CHANNEL),N}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&_i(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&_i(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Gl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===hn&&(u.$lib_custom_api_host=this.config.api_host),c=e!==hi||a?e!==li||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=_i(u,c),e===hi&&r&&(u.title=r.title),!C(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();ci(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.$l.length>0)for(var E of this.$l.slice())try{_i(x,E())}catch(t){_e.error("Failed to produce browser extension event properties",t)}(u=_i({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),R(this.config.property_denylist)?ci(this.config.property_denylist,(function(t){delete u[t]})):_e.error(Pn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(_e.error(Rn),u=S(u,e));var T=this.cu();return u.$process_person_profile=T,T&&!a&&this.fu("_calculate_event_properties"),u}hu(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.cu())return t;if(this.Ol&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=_i({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(_e.error(Rn),o=a(o,"$set_once")),e&&(this.Ol=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.du(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.Ll.add(t))),this.vu()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.Ll.delete(t),this.vu()}pu(t,e){this.register({[t]:e})}Zl(){this.Ll.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.Ll.clear(),this.vu()}vu(){var t;if(this.Dl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.xa||!Vi.ri())Vi.ai(this.Dl);else{var e=[];this.Ll.forEach((t=>e.push(t))),e.length>0?Vi.ii(this.Dl,e):Vi.ai(this.Dl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.wl.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:kn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:kn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:kn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=_n),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:kn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:kn})}gu(t){return!t||D(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t===Xe?(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(U(t)&&(t=t.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gu(t)&&this.fu("posthog.identify")){this.Pl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.du(!1),o=this.persistence.za(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(xe)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(Se)&&(this.unregister(Se),this.register({distinct_id:t}));var l,u=(this.persistence.get_property(He)||ri)===ri,d=t!==h,v=!d&&u;if(d&&u)this.persistence.set_property(He,si),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture(ui,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Bl=an(t,e,i),null==(l=this.featureFlags)||l.setAnonymousDistinctId(h);else if(v){this.persistence.set_property(He,si);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture("$set",{$set:c,$set_once:_}),this.Bl=an(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(je)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ga(a)}}}setPersonProperties(t,e){if((t||e)&&this.fu("posthog.setPersonProperties")){var i=an(this.get_distinct_id(),t,e);this.Bl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Bl=i):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(R(t)?t:[t]).filter((t=>M(t)&&t.length>0));0!==i.length&&this.fu("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Bl=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.du();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(di,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.fu("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=B(t)?t:null==t?void 0:t.resetDeviceID,i=B(t)||null==t?void 0:t.bootstrap;this.mu(e,!1,i)}mu(t,e,i){var r,s,n;if(void 0===e&&(e=!1),_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.zl)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(xe),h=this.get_property(Ee),l=this.get_property(Re),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.za?void 0:n.za(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Ll.clear(),this.vu(),C(l)||null==(E=this.persistence)||E.register({[Re]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(y=this.metrics)||y.reset(),null==(b=this.persistence)||b.set_property(He,ri),null==(x=this.sessionManager)||x.resetSessionId(),this.Bl=null,this.config.cookieless_mode===ii)this.register_once({distinct_id:Xe,$device_id:null},"");else{var R=this.config.get_device_id(Ti());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||C(h)||this.register({[Ee]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Ml()||(null==(k=this.persistence)||k.set_property(He,i.isIdentifiedID?si:ri),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(C(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.Ga||O.Ga(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.tu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Wl)||s.unload(),null==(n=e.Gl)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){_e.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else _e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(be)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.fu("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.pu(Se,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(O(t)){var i,r,s,n,o,a,h,l,u,d,c,_;_i(this.config,Nn(t));var f=this.Al();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mr(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Hl(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Mi.ri()&&Mi.ii("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Mi.ri()&&Mi.ai("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.Fl(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Fn._u}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:In;return e!==In&&(e=In+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(He))===si||(null==(e=this.sessionPersistence)?void 0:e.get_property(He))===si}cu(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ni&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Se])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ke]))}lu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.cu()||this.fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fu(t){return"never"===this.config.person_profiles?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.El(),this.pu(Ke,!0),!0)}Al(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ei)}Fl(){var t,e,i,r,s,n=this.Al();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(t=this.persistence)?void 0:t.xa)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.xa)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Ll.clear(),this.vu()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==ii){if(this.Ml()){var i,r,s,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this.mu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new nn(this),this.pageViewManager=new er(this),this.persistence&&(this.sessionPropsManager=new tn(this,this.sessionManager,this.persistence));var h,l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Fn.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Tl(this.sessionRecording,new l(this)),this._l&&(null==(h=this.sessionRecording)||null==h.onRemoteConfig||h.onRemoteConfig(this._l)))}var u,d;this.consent.optInOut(!0),this.Fl(),this.su(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ei&&(null==(u=this.surveys)||u.loadIfEnabled()),(C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.au()}else _e.warn(Tn)}opt_out_capturing(){if(this.config.cookieless_mode!==ii){var t,e,i=this.config.cookieless_mode===ei?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ei&&this.consent.isOptedIn()&&this.mu(!0,!0),this.consent.optInOut(!1),this.Fl(),this.config.cookieless_mode===ei&&(this.register({distinct_id:Xe,$device_id:null}),this.Cl(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.au(),this.su())}else _e.warn(Tn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ii||(this.config.cookieless_mode===ei?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fl()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&b(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>b(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}au(){r&&("visible"===r.visibilityState?this.Nl||(this.Nl=!0,this.capture(hi,{title:r.title},{send_instantly:!0}),this.ql&&(r.removeEventListener(oi,this.ql),this.ql=null)):this.ql||(this.ql=this.au.bind(this),wi(r,oi,this.ql)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var t=this.zl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(_e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}Xn(t){var e;if(N(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(z),r=R(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),N(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return j(t.event)?_e.warn(o+". This can cause unexpected behavior."):_e.info(o),null}s.properties&&!I(s.properties)||_e.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return _e.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&N(s.properties[a]))return _e.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ta)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Hl(t){var e=B(t)&&!t,i=Mi.ri()&&"true"===Mi.ni("ph_debug");return!e&&(!!i||t)}}Fn.__defaultExtensionClasses={},Fn._u={trace:$n=()=>{},debug:$n,info:$n,warn:$n,error:$n,fatal:$n},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=pi(t.prototype[e[i]])}(Fn,["identify"]);var Bn=function(){v.SDK_DIST_CHANNEL="npm";var e=xn[In]=new Fn;return function(){function e(){e.done||(e.done=!0,Cn=!1,ci(xn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():wi(r,"DOMContentLoaded",e,{capture:!1}):t&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Ar as Compression,Vr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Wr as DisplaySurveyType,Fn as PostHog,Jr as ProductTourEventName,Yr as ProductTourEventProperties,Hr as SurveyEventName,Gr as SurveyEventProperties,Nr as SurveyEventType,Fr as SurveyPosition,zr as SurveyQuestionBranchingType,jr as SurveyQuestionType,qr as SurveySchedule,Br as SurveyTabPosition,Lr as SurveyType,Ur as SurveyWidgetType,Bn as default,Bn as posthog,ts as severityLevels};
|
|
1
|
+
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],g=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),m=["$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"],w=["token"],y=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],b=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return y.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function x(t,e){return-1!==t.indexOf(e)}var E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,T=S.hasOwnProperty,k=S.toString,R=Array.isArray||function(t){return"[object Array]"===k.call(t)},P=t=>"function"==typeof t,O=t=>t===Object(t)&&!R(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,M=t=>"[object String]"==k.call(t),D=t=>M(t)&&0===t.trim().length,A=t=>null===t,N=t=>C(t)||A(t),U=t=>"[object Number]"==k.call(t)&&t==t,F=t=>U(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>t instanceof FormData,j=t=>x(m,t),z=t=>x(w,t),q=[!0,"true",1,"1","yes"],H=t=>x(q,t),G=[!1,"false",0,"0","no"];function W(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),U(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),W(s||i,e,i,r))}var V="Mobile",J="iOS",Y="Android",K="Tablet",X=Y+" "+K,Q="iPad",Z="Apple",tt=Z+" Watch",et="Safari",it="BlackBerry",rt="Samsung",st=rt+"Browser",nt=rt+" Internet",ot="Chrome",at=ot+" OS",ht=ot+" "+J,lt="Internet Explorer",ut=lt+" "+V,dt="Opera",vt=dt+" Mini",ct="Edge",_t="Microsoft "+ct,pt="Firefox",ft=pt+" "+J,gt="Nintendo",mt="PlayStation",wt="Xbox",yt=Y+" "+V,bt=V+" "+et,$t="Windows",xt=$t+" Phone",Et="Nokia",St="Ouya",Tt="Generic",kt=Tt+" "+V.toLowerCase(),Rt=Tt+" "+K.toLowerCase(),Pt="Konqueror",Ot="Oculus Browser",It="Vivaldi",Ct="Yandex",Mt="Whale",Dt="DuckDuckGo",At="Pale Moon",Nt="Waterfox",Ut="Brave",Ft="Claude",Bt="Codex",Lt="ChatGPT",jt="Google Search App",zt="(\\d+(\\.\\d+)?)",qt=new RegExp("Version/"+zt),Ht=new RegExp("("+Ft+"|"+Bt+"|"+Lt+")\\/"+zt),Gt=new RegExp(wt,"i"),Wt=new RegExp(mt+" \\w+","i"),Vt=new RegExp(gt+" \\w+","i"),Jt=new RegExp(it+"|PlayBook|BB10","i"),Yt={"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"},Kt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ut:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?jt:x(t," OPR/")&&x(t,"Mini")?vt:x(t," OPR/")?dt:Jt.test(t)?it:x(t,"IE"+V)||x(t,"WPDesktop")?ut:x(t,"OculusBrowser")?Ot:x(t,st)?nt:x(t,ct)||x(t,"Edg/")?_t:x(t,It+"/")?It:x(t,"YaBrowser/")?Ct:x(t,Mt+"/")?Mt:x(t,Dt+"/")||x(t,"Ddg/")?Dt:x(t,Ft+"/")?Ft:x(t,Bt+"/")?Bt:x(t,Lt+"/")?Lt:x(t,"FBIOS")?"Facebook "+V:x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?ht:x(t,"CrMo")||x(t,ot)?ot:x(t,Y)&&x(t,et)?yt:x(t,"FxiOS")?ft:x(t.toLowerCase(),Pt.toLowerCase())?Pt:x(t,Ut+"/")?Ut:((t,e)=>e&&x(e,Z)||function(t){return x(t,et)&&!x(t,ot)&&!x(t,Y)}(t))(t,e)?x(t,V)?bt:et:x(t,"PaleMoon/")?At:x(t,Nt+"/")?Nt:x(t,pt)?pt:x(t,"MSIE")||x(t,"Trident/")?lt:x(t,"Gecko")?pt:"")},Xt={[ut]:[new RegExp("rv:"+zt)],[_t]:[new RegExp(ct+"?\\/"+zt)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+zt)],[ht]:[new RegExp("CriOS\\/"+zt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+zt)],[et]:[qt],[bt]:[qt],[dt]:[new RegExp("(Opera|OPR)\\/"+zt)],[pt]:[new RegExp(pt+"\\/"+zt)],[ft]:[new RegExp("FxiOS\\/"+zt)],[Pt]:[new RegExp("Konqueror[:/]?"+zt,"i")],[it]:[new RegExp(it+" "+zt),qt],[yt]:[new RegExp("android\\s"+zt,"i")],[nt]:[new RegExp(st+"\\/"+zt)],[Ot]:[new RegExp("OculusBrowser\\/"+zt)],[It]:[new RegExp(It+"\\/"+zt)],[Ct]:[new RegExp("YaBrowser\\/"+zt)],[Mt]:[new RegExp(Mt+"\\/"+zt)],[Ut]:[new RegExp(Ut+"\\/"+zt)],[Ft]:[Ht],[Bt]:[Ht],[Lt]:[Ht],[Dt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+zt)],[At]:[new RegExp("PaleMoon\\/"+zt)],[Nt]:[new RegExp(Nt+"\\/"+zt)],[jt]:[new RegExp("GSA\\/"+zt)],[lt]:[new RegExp("(rv:|MSIE )"+zt)],Mozilla:[new RegExp("rv:"+zt)]},Qt=function(t,e,i,r){var s=Kt(t,e,i,r),n=Xt[s];if(C(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Zt=[[new RegExp(wt+"; "+wt+" (.*?)[);]","i"),t=>[wt,t&&t[1]||""]],[new RegExp(gt,"i"),[gt,""]],[new RegExp(mt,"i"),[mt,""]],[Jt,[it,""]],[new RegExp($t,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[xt,""];if(new RegExp(V).test(e)&&!/IEMobile\b/.test(e))return[$t+" "+V,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Yt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[$t,r]}return[$t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[J,[t[3],t[4],t[5]||"0"].join(".")]:[J,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Y+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Y+")","i"),t=>t&&t[2]?[Y,[t[2],t[3],t[4]||"0"].join(".")]:[Y,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[at,""]],[/Linux|debian/i,["Linux",""]]],te=function(t){return Vt.test(t)?gt:Wt.test(t)?mt:Gt.test(t)?wt:new RegExp(St,"i").test(t)?St:new RegExp("("+xt+"|WPDesktop)","i").test(t)?xt:/iPad/.test(t)?Q:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?tt:Jt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Et,"i").test(t)?Et:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(V).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Y:X:new RegExp("(pda|"+V+")","i").test(t)?kt:new RegExp(K,"i").test(t)&&!new RegExp(K+" pc","i").test(t)?Rt:""},ee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ie(t,e){return"string"==typeof(i=t)&&ee.test(i)?t:e();var i}function re(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function se(t){return t?t.split("#")[0]:t}var ne,oe="NativeGzipValidationError",ae=t=>t.length>=2&&31===t[0]&&139===t[1],he=(t,e)=>t===g.GZipJS||e===g.GZipJS||"gzip"===e,le=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ue=t=>{throw re(oe,"Native gzip produced invalid output: "+t)},de=function(){var t=_((function*(t,e){18>t.size&&ue("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ae(i)&&8===i[2]||ue("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(ne)return ne;ne=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;ne[t]=e>>>0}return ne})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&ue("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&ue("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function ve(){return ve=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield de(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),ve.apply(this,arguments)}var ce=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={q(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!C(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>ce(e+" "+t,i)};return s},_e=ce("[PostHog.js]"),pe=_e.createLogger,fe=pe("[ExternalScriptsLoader]"),ge=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},me=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ge(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ge(e))return me(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},we={},ye=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=we[s];if("fallback"===r&&n){if(ge(n))return void me(t,n,i);delete we[s]}me(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ye(t,e);we[s]=a;var h=ge(s);null==h||null==(o=h.parentNode)||o.removeChild(h),me(t,a,i)}else i(void 0,n)}:i)}else me(t,ye(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");me(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);me(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.425.0",v.LIB_NAME="web";var be="$people_distinct_id",$e="distinct_id",xe="$device_id",Ee="$device_model",Se="__alias",Te="__timers",ke="$dead_clicks_enabled_server_side",Re="$session_recording_remote_config",Pe="$sesid",Oe="$session_is_sampled",Ie="$enabled_feature_flags",Ce="$active_feature_flags",Me="$feature_flag_details",De="$feature_flag_payloads",Ae="$feature_flag_request_id",Ne="$minimal_flag_called_events",Ue="$stored_person_properties",Fe="$stored_group_properties",Be="$groups",Le="$surveys_loaded_at",je="$flag_call_reported",ze="$feature_flag_errors",qe="$feature_flag_evaluated_at",He="$user_state",Ge="$client_session_props",We="$capture_rate_limit",Ve="$initial_campaign_params",Je="$initial_referrer_info",Ye="$initial_person_info",Ke="$epp",Xe="$posthog_cookieless",Qe="$cookieless_mode",Ze="$sdk_debug_extensions_init_method",ti="$sdk_debug_extensions_init_time_ms",ei="on_reject",ii="always",ri="anonymous",si="identified",ni="identified_only",oi="visibilitychange",ai="beforeunload",hi="$pageview",li="$pageleave",ui="$identify",di="$groupidentify";function vi(t,e){R(t)&&t.forEach(e)}function ci(t,e){if(!N(t))if(R(t))t.forEach(e);else if(L(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)T.call(t,i)&&e(t[i],i)}var _i=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},pi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(t)}}},fi=function(t){var e={};return ci(t,(function(t,i){(M(t)&&t.length>0||U(t))&&(e[i]=t)})),e};var gi=["herokuapp.com","vercel.app","netlify.app"];function mi(t){var e=null==t?void 0:t.hostname;if(!M(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of gi)if(i===r)return!1;return!0}function wi(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var yi=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return U(t)&&isFinite(t)&&Math.floor(t)===t});class bi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,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 bi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new bi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class $i{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Yr=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Yr)this.Yr=t,this.Kr();else{if(this.Yr>=t+1e4)return;this.Xr++,this.Xr>4398046511103&&(this.Yr++,this.Kr())}return bi.fromFieldsV7(this.Yr,Math.trunc(this.Xr/Math.pow(2,30)),this.Xr&Math.pow(2,30)-1,this.ei.nextUint32())}Kr(){this.Xr=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Yr=0,this.Xr=0,this.ei=new Si}}var xi,Ei=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(Ei=t=>crypto.getRandomValues(t));class Si{nextUint32(){return this.Dt.length>this.ti||(Ei(this.Dt),this.ti=0),this.Dt[this.ti++]}constructor(){this.Dt=new Uint32Array(8),this.ti=1/0}}var Ti=()=>ki().toString(),ki=()=>(xi||(xi=new $i)).generate(),Ri="",Pi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Oi=null,Ii={ri(){if(!A(Oi))return Oi;if(Oi=!1,r)try{var t="__ph_cookie_support_"+Ti();Ii.ii(t,"xyz"),Oi='"xyz"'===yi(t),Ii.ai(t)}catch(t){Oi=!1}return Oi},oi(t){_e.error("cookieStore error: "+t)},ni:yi,si(t){var e;try{e=JSON.parse(Ii.ni(t))||{}}catch(t){}return e},ii(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ri)return Ri;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ti();!Ri&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ri=o)}return Ri}(t);if(!i){var s=(t=>{var e=t.match(Pi);return e?e[0]:""})(t);s!==i&&_e.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},ai(t,e){if(null!=r&&r.cookie)try{Ii.ii(t,"",-1,e)}catch(t){return}}},Ci=null,Mi={ri(){if(!A(Ci))return Ci;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";Mi.ii(i,"xyz"),'"xyz"'!==Mi.ni(i)&&(e=!1),Mi.ai(i)}catch(t){e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),Ci=e,e},oi(t){_e.error("localStorage error: "+t)},ni(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Mi.oi(t)}return null},si(t){try{return JSON.parse(Mi.ni(t))||{}}catch(t){}return null},ii(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Mi.oi(t)}return!1},ai(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Mi.oi(t)}}},Di=[Ue,Ce,Ie,Me,De,Ae,qe,ze,je],Ai=[xe,$e,Pe,Oe,Ke,Ye,He],Ni=t=>t+"_cpm",Ui=["__proto__","constructor","prototype"],Fi=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ui.indexOf(i)&&(e[i]=t[i])})),e},Bi=function(t,e){void 0===e&&(e=[]);var i={};return[...Ai,...e].forEach((e=>{var r=t[e];C(r)||A(r)||""===r||(i[e]=r)})),i},Li=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},ji=(t,e)=>({p:e,f:Li(JSON.stringify(t))}),zi=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Ii.si(Ni(t)),r=(null==i?void 0:i.f)===Li(e)&&R(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},qi=(t,e)=>e+"|"+(Ii.ni(Ni(t))||""),Hi={},Gi={ri:()=>!0,oi(t){_e.error("memoryStorage error: "+t)},ni:t=>t in Hi?Hi[t]:null,si:t=>t in Hi?Hi[t]:null,ii:(t,e)=>(Hi[t]=e,!0),ai(t){delete Hi[t]}},Wi=null,Vi={ri(){if(!A(Wi))return Wi;if(Wi=!0,C(t))Wi=!1;else try{var e="__support__";Vi.ii(e,"xyz"),'"xyz"'!==Vi.ni(e)&&(Wi=!1),Vi.ai(e)}catch(t){Wi=!1}return Wi},oi(t){_e.error("sessionStorage error: ",t)},ni(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Vi.oi(t)}return null},si(t){try{return JSON.parse(Vi.ni(t))||null}catch(t){}return null},ii(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Vi.oi(t)}return!1},ai(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Vi.oi(t)}}};class Ji{constructor(t){this._instance=t}get gn(){return this._instance.config}get consent(){return this.Ws()?0:this.Vs}isOptedOut(){return this.gn.cookieless_mode===ii||this.isRejected()||-1===this.consent&&this.gn.cookieless_mode===ei}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.gn.opt_out_capturing_by_default}optInOut(t){this.Gs.ii(this.Zs,t?1:0,this.gn.cookie_expiration,this.gn.cross_subdomain_cookie,this.gn.secure_cookie)}reset(){this.Gs.ai(this.Zs,this.gn.cross_subdomain_cookie)}get Zs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Vs(){var t=this.Gs.ni(this.Zs);return H(t)?1:x(G,t)?0:-1}get Gs(){var t=this.gn.opt_out_capturing_persistence_type,e="localStorage"===t?Mi:Ii,i=e.ri()?e:Gi;if(!this.Qs||this.Qs!==i){this.Qs=i;var r="localStorage"===t?Ii:Mi;r.ni(this.Zs)&&(this.Qs.ni(this.Zs)||this.optInOut(H(r.ni(this.Zs))),r.ai(this.Zs,this.gn.cross_subdomain_cookie))}return this.Qs}Ws(){return!!this.gn.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some((t=>H(t)))}}var Yi=["next","previous","prev",">","<","+","-","−","–"];pe("[Dead Clicks]");var Ki=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(ke)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Xi=pe("[SegmentIntegration]");var Qi="posthog-js";function Zi(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class tr{constructor(t,e,i,r,s,n){this.name=Qi,this.setupOnce=function(o){o(Zi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class er{constructor(t){this.Xs=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ta=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ea()}ea(){var t;this.ia=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Xs)}destroy(){var t;null==(t=this.ia)||t.call(this),this.ia=void 0}doPageView(e,i){var r,s=this.ra(e,i);return this.ta={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.ra(t,null==(e=this.ta)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ta)?void 0:t.pageViewId}}ra(t,e){var i=this.ta;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(h)||C(l)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?W(o/n,0,1,_e):1,v=n>1?W(a/n,0,1,_e):1,c=h>1?W(l/h,0,1,_e):1,_=h>1?W(u/h,0,1,_e):1;r=_i(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var ir=["flags","surveys"],rr={[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Te]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$logs_capture_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[ke]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[Re]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Oe]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>A(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ie]:{exposure:"hidden",storageGroup:"flags"},[Ce]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags"},[De]:{exposure:"hidden",storageGroup:"flags"},[Ae]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ne]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[Le]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[je]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Be]:{exposure:"event"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[Ze]:{exposure:"event"},[ti]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},sr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],nr=t=>{var e=rr[t];if(e)return e;for(var i of sr){var r=i[1];if(0===t.indexOf(i[0]))return r}},or=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},ar=t=>{var e=null==r?void 0:r.createElement("a");return C(e)?null:(e.href=t,e)},hr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!R(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){_e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},lr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");R(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},ur="https?://(.*)",dr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...dr],cr="<masked>",_r=["li_fat_id"];function pr(t,e){var i=vr.concat(e||[]),r={};return ci(i,(function(e){var i=hr(t,e);r[e]=i||null})),r}function fr(t){var e=function(t){return t?0===t.search(ur+"google.([^/?]*)")?"google":0===t.search(ur+"bing.com")?"bing":0===t.search(ur+"yahoo.com")?"yahoo":0===t.search(ur+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!A(e)){s.$search_engine=e;var n=r?hr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function gr(){return navigator.language||navigator.userLanguage}var mr="$direct";function wr(){return(null==r?void 0:r.referrer)||mr}function yr(t,e,i){void 0===i&&(i=!1);var r=t?[...dr,...e||[]]:[],n=i?se(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:wr().substring(0,1e3),u:o?lr(o,r,cr):void 0}}function br(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?se(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==mr?mr:null==(i=ar(r))?void 0:i.host};if(n){o.$current_url=n;var a=ar(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=pr(n);_i(o,h)}if(r){var l=fr(r);_i(o,l)}return o}function $r(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function xr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Er={flags:qe,surveys:Le},Sr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Tr=t=>t+"_cookie_identity_change_pending",kr="main",Rr=[Ie,Ce,Me,De,Ae,qe,Ne,Ue],Pr=t=>-1!==Rr.indexOf(t),Or=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Ir=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},Cr=(t,e)=>{ci(t,((i,r)=>{var s=nr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class Mr{constructor(e,i,r){if(void 0===r&&(r=!0),this.na={},this.sa=!1,this.aa=!1,this.oa=!1,this.la=!1,this.ua=new Map,this.ha=!1,this.da=!1,this.va=!1,this.ca=new Set,this.gn=e,this.fa=r,this.props={},this.pa=void 0,this.ga=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Gs=this.ma(e),this.aa=this.ya(e),this.load(),this.ba(),e.debug&&_e.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();wi(t,"beforeunload",s,{capture:!1}),wi(t,"pagehide",s,{capture:!1}),this._a=e=>{if(this.sa&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ga){if(this.aa){var i=ir.find((t=>e.key===this.wa(t)));i&&this.ka(e.key,i)}}else this.ka(e.key,kr)},wi(t,"storage",this._a)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var e=t[0],i=t[1],r=this.ua.get(e);if(Pr(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach((t=>s.add(t))),s.size&&this.Sa(e,s)}else this.Sa(e,!0)}))}onCrossTabFeatureFlagChange(t){return this.ca.add(t),()=>this.ca.delete(t)}destroy(){this._a&&t&&(t.removeEventListener("storage",this._a),this._a=void 0),this.ca.clear()}ka(t,e,i){if(void 0===i&&(i=!0),this.xa)return!1;var r,s;try{if(s=Mi.ni(t),A(s)){var n=this.Ca(e);return n.storageValue=null,e!==kr&&(n.persisted=!1),!1}r=Ir(s)}catch(t){return!1}var o=e===kr?r:Mi.si(this.ga);if(o&&this.Ta(o))return!1;var a=this.Ma(r,e,i);return e===kr&&this.aa&&!Or(this.Ea().main,r)||this.Ia(r,e,!0,s),a}Ta(t){var e=this.props[$e],i=t[$e];return!C(e)&&!C(i)&&e!==i}Ia(t,e,i,r){var s=this.Ca(e);s.storageValue=r,e!==kr&&(s.persisted=i);try{s.fingerprint=this.Ra(t,e)}catch(t){s.fingerprint=void 0}}Ma(t,e,i){var r=!1;return Rr.forEach((i=>{var s,n=null==(s=nr(i))?void 0:s.storageGroup;if(!(e===kr&&this.aa&&n||e!==kr&&n!==e)){var o=i in t,a=this.Pa(i,o?t[i]:void 0),h=this.ua.has(i)?i in this.props:o;h===i in this.props&&Or(a,this.props[i])||(h?this.Aa(i,a,!1):this.Fa(i,!1),r=!0)}})),r&&i&&this.ca.forEach((t=>t())),r}Oa(){if(!this.sa)return!1;try{this.va=!1;var t,e=Mi.ni(this.ga),i=this.Ca(kr),r=!1,s=!1;if(e!==i.storageValue)if(A(e))i.storageValue=null;else{if(t=Ir(e),this.va=!this.da&&this.Ta(t),this.va)return!1;s=this.Ma(t,kr,!1),!this.aa||Or(this.Ea().main,t)?this.Ia(t,kr,!0,e):i.storageValue=e,r=!0}return this.aa&&ir.forEach((e=>{var i=Mi.ni(this.wa(e)),n=this.Ca(e),o=t||{},a=r&&Rr.some((t=>{var i;return(null==(i=nr(t))?void 0:i.storageGroup)===e&&t in o}));if(i!==n.storageValue||a){if(A(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ma(o,e,!1)||s));var h=Ir(i);s=this.Ma(h,e,!1)||s,this.Ia(h,e,!0,i)}})),s}catch(t){return!1}}Sa(t,e){this.ua.set(t,e);var i=nr(t);null!=i&&i.volatile||(this.Ca((this.aa?null==i?void 0:i.storageGroup:void 0)||kr).fingerprint=void 0,this.La(t))}Da(){Rr.forEach((t=>this.ua.set(t,!0)))}ba(){if(this.sa)try{var t=Mi.ni(this.ga),e=Ir(t);this.Ca(kr).storageValue=t,Rr.forEach((t=>{var i,r=this.aa?null==(i=nr(t))?void 0:i.storageGroup:void 0,s=r?Mi.ni(this.wa(r)):null;if(r){var n=this.Ca(r);n.storageValue=s,n.persisted=!A(s)}var o=r&&!A(s)?Ir(s):e;t in this.props?this.$a(t,o[t],this.props[t]):t in o&&this.Sa(t,!0)}))}catch(t){}}Pa(t,e){var i=this.ua.get(t);if(!i)return e;if(!0===i)return this.props[t];if(t===Ce){var r=new Set(R(e)?e:[]),s=new Set(R(this.props[t])?this.props[t]:[]);return i.forEach((t=>s.has(t)?r.add(t):r.delete(t))),Array.from(r)}var n=O(e)?p({},e):{},o=O(this.props[t])?this.props[t]:{};return i.forEach((t=>{t in o?n[t]=o[t]:delete n[t]})),n}$a(t,e,i){if(Pr(t)){var r=this.ua.get(t);if(!0!==r){var s=e;if(this.sa)try{var n,o=this.aa?null==(n=nr(t))?void 0:n.storageGroup:void 0,a=o?this.wa(o):this.ga;s=Ir(Mi.ni(a))[t]}catch(t){}var h=new Set(r||[]);if(t===Ce){if(!C(e)&&!R(e)||!C(s)&&!R(s)||!R(i))return void this.Sa(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach((t=>{l.has(t)!==d.has(t)&&h.add(t)})),h.forEach((t=>{u.has(t)===d.has(t)&&h.delete(t)}))}else{if(!O(i))return void(Or(s,i)?this.ua.delete(t):this.Sa(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.Sa(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach((t=>{t in v==t in i&&Or(v[t],i[t])||h.add(t)})),h.forEach((t=>{t in c==t in i&&Or(c[t],i[t])&&h.delete(t)}))}h.size?this.Sa(t,h):this.ua.delete(t)}}}Na(){var t,e=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0?e:0}qa(t){if(this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase())if(t)try{var e=Bi(t,this.gn.cookie_persisted_properties||[]),i=ji(e,this.gn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ii.ni(this.ga)||void 0;s&&qi(this.ga,s)===r&&(this.ja=r,this.Ba=s)}catch(t){}else try{var n=Ii.ni(this.ga)||void 0;this.ja=n?qi(this.ga,n):void 0,this.Ba=n}catch(t){}}syncCookieProperties(){return this.Ha(this.gn)}Ha(t,e){if(void 0===e&&(e=!1),this.xa&&!e||this.la||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Ii.ni(this.ga)||void 0}catch(t){}if(!i||i===this.Ba)return!1;var r,s=qi(this.ga,i);try{r=Fi(JSON.parse(i))}catch(t){return!1}if((Ii.ni(this.ga)||void 0)!==i)return!1;this.ja=s,this.Ba=i;var n=zi(this.ga,i),o=[...Ai,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(C(e)||A(e)||""===e||t===He&&e!==ri&&e!==si)&&(a[t]=!0,delete r[t])})),I(r))return!1;var h=$e in r||r[He]===ri||r[He]===si,l=this.props,u=l[$e],d=l[He],v=_i({},l);[...Ai,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==$e&&t!==He)){var e=v[t];!n.isValid&&-1!==Ai.indexOf(t)&&(!1===e||0===e)||delete v[t]}})),this.props=_i(v,r),Rr.forEach((t=>{var e=t in this.props;t in l===e&&Or(l[t],this.props[t])||(e?this.$a(t,l[t],this.props[t]):this.Sa(t,!0))})),!h||He in r||He in this.props||this.Aa(He,ri);var c=this.props[$e],_=this.props[He];return!h||c===u&&_===d||(this.da=!0,this.oa=!0,Vi.ii(Tr(this.ga),!0),this.Fa(Ue),this.Fa(Ce),this.Fa(Ie),this.Fa(Me),this.Fa(De),this.Fa(Ae),this.Fa(qe),this.Fa(ze),this.Fa(je),_===ri&&(d===si||r[He]===ri||!C(u)&&c!==u)&&(Cr(this.props,r),this.Fa(Fe)),_===si?this.props.$user_id=c:delete this.props.$user_id,this.Fa(Se)),!0}consumeCookieIdentityChange(){var t=Tr(this.ga),e=this.oa||!!Vi.ni(t);return this.oa=!1,e&&Vi.ai(t),e}za(t){return void 0===t&&(t=!1),!(this.la||this.xa&&!t||!this.gn.cookieWinsOnConflict||"localstorage+cookie"!==this.gn.persistence.toLowerCase()||(this.la=!0,0))}Ua(){this.la&&(C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),delete this.na[kr],this.Va(!0))}Ga(t){if(void 0===t&&(t=!0),this.la)try{t?this.Ua():C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0)}finally{this.la=!1}}isDisabled(){return!!this.xa}ma(e){-1===Sr.indexOf(e.persistence.toLowerCase())&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Ai,...e];return p({},Mi,{si(t){try{var e,s={};try{e=Ii.ni(t)||void 0,s=e?Fi(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Mi.ni(t)||"{}");if(i){var a=zi(t,e),h=[...Ai,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];A(e)||""===e||t===He&&e!==ri&&e!==si||(l[t]=e)}));var u=$e in l||l[He]===ri||l[He]===si;if(Object.keys(l).length>0){var d,v=o[$e],c=null!==(d=o[He])&&void 0!==d?d:ri;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==$e&&t!==He)){var e=o[t];!a.isValid&&-1!==Ai.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||He in s||He in o||(o[He]=ri),!u||($e in l?l[$e]:o[$e])===v&&(He in l?l[He]:o[He])===c||(Di.forEach((t=>delete o[t])),l[He]===si&&$e in l?o.$user_id=l[$e]:delete o.$user_id,l[He]!==si&&(delete o[Be],delete o[Fe]),delete o.__alias)}n=_i(o,l)}else n=_i(s,o);return Mi.ii(t,n),n}catch(t){}return null},ii(t,r,s,n,o,a){var h=Mi.ii(t,r,void 0,void 0,a);try{var l=Bi(r,e);if(Object.keys(l).length){if(i){var u=Ni(t),d=ji(l,e);if(Ii.ii(u,d,s,n,o,a),Ii.ni(u)!==JSON.stringify(d)){Ii.ai(u,n);var v=Bi(r);return Ii.ii(t,v,s,n,o,a),h}}Ii.ii(t,l,s,n,o,a)}}catch(t){Mi.oi(t)}return h},ai(e,i){try{null==t||t.localStorage.removeItem(e),Ii.ai(e,i),Ii.ai(Ni(e),i)}catch(t){Mi.oi(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Mi.ri()?(i=Mi,s=!0):"localstorage+cookie"===n&&r.ri()?(i=r,s=!0):"sessionstorage"===n&&Vi.ri()?i=Vi:"memory"===n?i=Gi:"cookie"===n&&Ii.ri()?i=Ii:r.ri()?(i=r,s=!0):i=Ii.ri()?Ii:Gi,this.sa=s,i}wa(t){return this.ga+"__"+t}ya(t){return this.sa&&!!t.split_storage}properties(){var t={};return ci(this.props,((e,i)=>{var r=nr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.xa||t){var e=this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase(),i=e?Mi.si(this.ga):null,r={};if(e)try{ci(r=Fi(Ii.si(this.ga)),((t,e)=>{(C(t)||A(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Gs.si(this.ga);if(s&&(this.props=_i({},s)),this.aa&&this.Za(),e&&s){var n,o,a=null==i?void 0:i[$e],h=null!==(n=null==i?void 0:i[He])&&void 0!==n?n:ri,l=s[$e],u=null!==(o=s[He])&&void 0!==o?o:ri;if(l!==a||u!==h){this.oa=!0,Vi.ii(Tr(this.ga),!0);var d=_i({},this.props);Di.forEach((t=>delete d[t])),u===ri&&(h===si||r[He]===ri||!C(a)&&l!==a)&&(Cr(d,r),delete d[Fe]),this.props=d;var v=new Set;Di.forEach((t=>{var e,i=null==(e=nr(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};ci(this.props,((i,r)=>{var s;(null==(s=nr(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),I(e)?(Mi.ai(this.wa(t)),this.na[t]={}):Mi.ii(this.wa(t),e)&&(this.na[t]={persisted:!0,fingerprint:this.Ra(e,t)})}))}}Vi.ni(Tr(this.ga))&&(this.oa=!0)}}Za(){for(var t of ir){var e=Mi.si(this.wa(t));if(e&&!I(e)){var i=this.Ca(t);i.persisted=!0,this.Qa(t)||(i.fingerprint=this.Ra(e,t)),this.Ja(t,e)||_i(this.props,e)}}}Qa(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=nr(e))?void 0:i.storageGroup)===t}))}Ja(t,e){var i=Er[t];if(!i)return!1;var r=e[i],s=this.props[i];return U(r)&&U(s)&&s>r}refreshKey(t){var e;if(!this.xa){var i=this.aa?null==(e=nr(t))?void 0:e.storageGroup:void 0,r=i?Mi.si(this.wa(i)):this.Gs.si(this.ga);if(r&&t in r)this.Aa(t,r[t]);else{if(i){var s=this.Gs.si(this.ga);if(s&&t in s)return void this.Aa(t,s[t])}this.Fa(t)}}}save(){if(!this.xa){var t=this.Na();t>0?C(this.Wa)&&(this.Wa=setTimeout((()=>{this.Wa=void 0,this.Va()}),t)):this.Va()}}flush(){C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0,this.Va())}Va(t){if(void 0===t&&(t=!1),!(this.xa||this.la&&!t)){t||this.syncCookieProperties();var e=!t&&!this.ha;e||(this.va=!1);var i=!!e&&this.Oa();if(this.va)this.gn.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.aa)return this.Ka(),void(i&&this.ca.forEach((t=>t())));var r=this.Ya(this.Gs,this.ga,this.props,kr);"written"===r&&this.qa(this.props),"failed"!==r&&(this.ua.clear(),this.da=!1),i&&this.ca.forEach((t=>t()))}}}Ka(){var t=this,e=this.Ea(),i=e.main,r=e.groups,s=this.Ya(this.Gs,this.ga,i,kr);"written"===s&&this.qa(i),"failed"!==s&&(this.da=!1,Rr.forEach((t=>{var e;null!=(e=nr(t))&&e.storageGroup||this.ua.delete(t)})));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.na[e])||!i.persisted))return Rr.forEach((i=>{var r;(null==(r=nr(i))?void 0:r.storageGroup)===e&&t.ua.delete(i)})),1;var n=t.Ya(Mi,t.wa(e),s,e);"failed"!==n&&Rr.forEach((i=>{var r=nr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.ua.delete(i)}))};for(var o of ir)n(o)}Ea(){var t={},e={flags:{},surveys:{}};return ci(this.props,((i,r)=>{var s,n=null==(s=nr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ra(t,e){if(e===kr)return JSON.stringify(t)+"|"+this.Xa+"|"+this.eo+"|"+this.io;var i={};return ci(t,((t,e)=>{var r;i[e]=null!=(r=nr(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Ya(t,e,i,r){var s,n=this.Ca(r);if(r!==kr&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.Ra(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ii(e,i,this.Xa,this.eo,this.io,this.gn.debug)?(n.dirty=!1,r!==kr&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.sa&&(n.storageValue=Mi.ni(e)),"written"):(this.gn.debug&&_e.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.Da(),C(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),this.Gs.ai(this.ga,!1),this.Gs.ai(this.ga,!0),!i&&this.fa)for(var r of ir)Mi.ai(this.wa(r));i?delete this.na[kr]:this.na={},this.ja=void 0,this.Ba=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Xa=C(i)?this.ro:i;var r=!1;if(ci(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Aa(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Xa=C(e)?this.ro:e;var i=!1;if(ci(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||R(e))&&(this.Aa(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.Fa(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.pa){var e=function(t,e,i){if(!r)return{};var s,n=e?[...dr,...i||[]]:[],o=pr(lr(r.URL,n,cr),t),a=(s={},ci(_r,(function(t){var e=yi(t);s[t]=e||null})),s);return _i(a,o)}(this.gn.custom_campaign_params,this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties);I(fi(e))||this.register(e),this.pa=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?fr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:wr(),$referring_domain:null!=r&&r.referrer&&(null==(t=ar(r.referrer))?void 0:t.host)||mr},void 0)}set_initial_person_info(){this.props[Ve]||this.props[Je]||this.register_once({[Ye]:yr(this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties,this.gn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ci([Je,Ve],(e=>{var i=this.props[e];i&&ci(i,(function(e,i){t["$initial_"+E(i)]=e}))}));var e=this.props[Ye];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=br(t,e),r={};return ci(i,(function(t,e){r["$initial_"+E(e)]=t})),r}(e,this.gn.disable_capture_url_hashes);_i(t,i)}return t}safe_merge(t){return ci(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.xa&&!a;a||this.Ha(e,h),this.gn=t,!a&&(r||s||o)&&(this.ja=void 0,this.Ba=void 0,this.Ha(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.ma(t):this.Gs,u=this.ya(t),d=n||u!==this.aa,v=!a&&(d||t.cross_subdomain_cookie!==this.eo||t.secure_cookie!==this.io)&&this.za(h);this.ha=d;try{if(this.ro=this.Xa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.Gs=l,this.aa=u,this.props=c,this.save()}else o&&(this.Gs=l,a||(delete this.na[kr],this.Va()))}finally{this.ha=!1,v&&this.Ga()}}set_disabled(t){this.xa=t,this.xa?this.remove():this.save()}set_cross_subdomain(t){t!==this.eo&&(this.eo=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.io&&(this.io=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[Te]||{};i[t]=e,this.Aa(Te,i),this.save()}remove_event_timer(t){var e=this.props[Te]||{},i=e[t];return C(i)||(delete e[t],this.Aa(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Aa(t,e),this.save()}Aa(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&(t!==$e&&t!==He||s===e||(this.da=!0),this.$a(t,s,e),null!=(r=nr(t))&&r.volatile||this.La(t))}Fa(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(Pr(t)&&this.Sa(t,!0),this.La(t))}La(t){var e,i=null==(e=nr(t))?void 0:e.storageGroup;i&&(this.Ca(i).dirty=!0)}Ca(t){return this.na[t]||(this.na[t]={})}}function Dr(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&P(i.then)&&i.then(void 0,(()=>{}))}}}}var Ar={GZipJS:"gzip-js",Base64:"base64"},Nr={Activation:"events",Cancellation:"cancelEvents"},Ur={Button:"button",Tab:"tab",Selector:"selector"},Fr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Br={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Lr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},jr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},zr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},qr={Once:"once",Recurring:"recurring",Always:"always"},Hr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Gr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Wr={Popover:"popover",Inline:"inline"},Vr={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Jr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Yr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Kr=pe("[RateLimiter]");class Xr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Kr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Kr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(We))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(U(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.no(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(We,a),{isRateLimited:h,remainingTokens:a.tokens}}so(t){var e=this.instance.config.property_denylist;return!R(e)||!e.includes(t)}ao(){var t;if(this.so("$current_url")&&this.so("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}no(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ao(),o=this.so("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Qr=pe("[RemoteConfig]");class Zr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}oo(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}lo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Qr.info("Using preloaded remote config",this.remoteConfig),void this.uo(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Qr.warn("Remote config is disabled. Falling back to local config.");this.oo((t=>{if(!t)return Qr.info("No config found after loading remote JS config. Falling back to JSON."),void this.lo((t=>{this.uo(t.json,t)}));this.uo(t)}))}catch(t){Qr.error("Error loading remote config",t),this.uo()}}uo(t,e){!t&&e&&(0===e.statusCode?e.error||Qr.warn("Failed to fetch remote config from PostHog."):Qr.error("Failed to fetch remote config from PostHog."));try{this._instance.uo(t?{ok:!0,config:t}:{ok:!1})}catch(t){Qr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){Qr.error("Error loading feature flags",t)}}}var ts=["fatal","error","warning","log","info","debug"],es=Uint8Array,is=Uint16Array,rs=Uint32Array,ss=new es([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]),ns=new es([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]),os=new es([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),as=function(t,e){for(var i=new is(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new rs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},hs=as(ss,2),ls=hs[1];hs[0][28]=258,ls[258]=28;for(var us=as(ns,0)[1],ds=new is(32768),vs=0;32768>vs;++vs){var cs=(43690&vs)>>>1|(21845&vs)<<1;ds[vs]=((65280&(cs=(61680&(cs=(52428&cs)>>>2|(13107&cs)<<2))>>>4|(3855&cs)<<4))>>>8|(255&cs)<<8)>>>1}var _s=function(t,e,i){for(var r=t.length,s=0,n=new is(e);r>s;++s)++n[t[s]-1];var o,a=new is(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new is(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[ds[d]>>>h]=l}else for(o=new is(r),s=0;r>s;++s)o[s]=ds[a[t[s]-1]++]>>>15-t[s];return o},ps=new es(288);for(vs=0;144>vs;++vs)ps[vs]=8;for(vs=144;256>vs;++vs)ps[vs]=9;for(vs=256;280>vs;++vs)ps[vs]=7;for(vs=280;288>vs;++vs)ps[vs]=8;var fs=new es(32);for(vs=0;32>vs;++vs)fs[vs]=5;var gs=_s(ps,9,0),ms=_s(fs,5,0),ws=function(t){return(t/8>>0)+(7&t&&1)},ys=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof is?is:t instanceof rs?rs:es)(i-e);return r.set(t.subarray(e,i)),r},bs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},$s=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},xs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new es(0),0];if(1==s){var o=new es(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new is(v+1),_=Es(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new es(c),_]},Es=function(t,e,i){return-1==t.s?Math.max(Es(t.l,e,i+1),Es(t.r,e,i+1)):e[t.s]=i},Ss=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new is(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++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=t[a]}return[i.subarray(0,r),e]},Ts=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},ks=function(t,e,i){var r=i.length,s=ws(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Rs=function(t,e,i,r,s,n,o,a,h,l,u){bs(e,u++,i),++s[256];for(var d=xs(s,15),v=d[0],c=d[1],_=xs(n,15),p=_[0],f=_[1],g=Ss(v),m=g[0],w=g[1],y=Ss(p),b=y[0],x=y[1],E=new is(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=xs(E,7),k=T[0],R=T[1],P=19;P>4&&!k[os[P-1]];--P);var O,I,C,M,D=l+5<<3,A=Ts(s,ps)+Ts(n,fs)+o,N=Ts(s,v)+Ts(n,p)+o+14+3*P+Ts(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(A>=D&&N>=D)return ks(e,u,t.subarray(h,h+l));if(bs(e,u,1+(A>N)),u+=2,A>N){O=_s(v,c,0),I=v,C=_s(p,f,0),M=p;var U=_s(k,R,0);for(bs(e,u,w-257),bs(e,u+5,x-1),bs(e,u+10,P-4),u+=14,S=0;P>S;++S)bs(e,u+3*S,k[os[S]]);u+=3*P;for(var F=[m,b],B=0;2>B;++B){var L=F[B];for(S=0;L.length>S;++S)bs(e,u,U[j=31&L[S]]),u+=k[j],j>15&&(bs(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=gs,I=ps,C=ms,M=fs;for(S=0;a>S;++S)if(r[S]>255){var j;$s(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(bs(e,u,r[S]>>>23&31),u+=ss[j]);var z=31&r[S];$s(e,u,C[z]),u+=M[z],z>3&&($s(e,u,r[S]>>>5&8191),u+=ns[z])}else $s(e,u,O[r[S]]),u+=I[r[S]];return $s(e,u,O[256]),u+I[256]},Ps=new rs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Os=function(){for(var t=new rs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Is=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Cs(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Os[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new es(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=ks(h,l,t.subarray(u,d)):(h[u]=!0,l=ks(h,l,t.subarray(u,o)))}else{for(var v=Ps[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new is(32768),g=new is(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new rs(25e3),x=new is(288),E=new is(32),S=0,T=0,k=(u=0,0),R=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=R){var M=o-u;if((S>7e3||k>24576)&&M>423){l=Rs(t,h,0,b,x,E,T,k,P,u-P,l),k=S=T=0,P=u;for(var D=0;286>D;++D)x[D]=0;for(D=0;30>D;++D)E[D]=0}var A=2,N=0,U=_,F=I-C&32767;if(M>2&&O==y(u-F))for(var B=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=F&&--U&&I!=C;){if(t[u+A]==t[u+A-F]){for(var z=0;j>z&&t[u+z]==t[u+z-F];++z);if(z>A){if(A=z,N=F,z>B)break;var q=Math.min(F,z-2),H=0;for(D=0;q>D;++D){var G=u-F+D+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}F+=(I=C)-(C=f[I])+32768&32767}if(N){b[k++]=268435456|ls[A]<<18|us[N];var V=31&ls[A],J=31&us[N];T+=ss[V]+ns[J],++x[257+V],++E[J],R=u+A,++S}else b[k++]=t[u],++x[t[u]]}}l=Rs(t,h,!0,b,x,E,T,k,P,u-P,l)}return ys(a,0,r+ws(l)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Is(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),Is(l,u-8,i.d()),Is(l,u-4,r),l}var Ms=!!o||!!n,Ds="text/plain",As=!1,Ns=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Us=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return ci(t,(function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},Fs=t=>{if(t.do)return t.do;var e=t.data,i=t.compression;if(e){if(i===Ar.GZipJS){var r=Cs(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new es(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new es(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return ys(r,0,s)}(or(e)),{mtime:0});return{contentType:Ds,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ar.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(or(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:or(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=or(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Bs=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:Us(t.url,{compression:Ar.Base64}),encodedBody:Fs(p({},t,{compression:Ar.Base64,do:void 0}))}:{url:Ns(t.url,"compression"),encodedBody:Fs(p({},t,{compression:void 0,do:void 0}))};try{e=Fs(t)}catch(e){if(he(t.compression,hr(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&he(t.compression,hr(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?ae(new Uint8Array(i)):ArrayBuffer.isView(i)&&ae(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(As=!0,r()):{url:t.url,encodedBody:e}},Ls=t=>{try{return Bs(t)}catch(e){return _e.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},js=function(){var t=_((function*(t){var e=or(t.data),i=yield function(t,e,i){return ve.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{do:{contentType:Ds,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),zs=/Failed to fetch|NetworkError|Load failed/i,qs=t=>"TypeError"===(null==t?void 0:t.name)&&zs.test((null==t?void 0:t.message)||""),Hs=t=>{var e=Ls(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;ci(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e;v=!0,c.abort(re("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||qs(e)?_e.warn(e):_e.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.vo&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){_e.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Gs=t=>{try{var e,r=Bs(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=R(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(R(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>R(t.data)?e:p({},t.data,{batch:e});return Gs(p({},t,{data:v(u.slice(0,d))})),void Gs(p({},t,{data:v(u.slice(d))}))}_e.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),Hs(p({},t,{vo:!0}))}catch(t){_e.warn("Beacon send failed",t)}},Ws=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return Us(i===Ar.GZipJS?Ns(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Ar.GZipJS?{}:{compression:i}))},Vs=[];n&&Vs.push({transport:"fetch",method:Hs}),o&&Vs.push({transport:"XHR",method(t){var e=Ls(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ci(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Vs.push({transport:"sendBeacon",method:Gs});var Js=3e3;class Ys{constructor(t,e){this.co=!0,this.fo=[],this.po=W((null==e?void 0:e.flush_interval_ms)||Js,250,5e3,_e.createLogger("flush interval"),Js),this.mo=t}enqueue(t){this.fo.push(t),this.yo||this.bo()}unload(){this._o();var t=this.fo.length>0?this.wo():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ko(p({},t,{transport:"sendBeacon"}))}))}enable(){this.co=!1,this.bo()}bo(){var t=this;this.co||(this.yo=setTimeout((()=>{if(this._o(),this.fo.length>0){var e=this.wo(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&R(i.data)&&ci(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ko(i)};for(var r in e)i()}}),this.po))}ko(t){try{this.mo(t)}catch(t){_e.error(t)}}_o(){clearTimeout(this.yo),this.yo=void 0}wo(){var t={};return ci(this.fo,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.fo=[],t}}var Ks=["retriesPerformedSoFar"];class Xs{constructor(e){this.So=!1,this.xo=3e3,this.fo=[],this._instance=e,this.fo=[],this.Co=!0,!C(t)&&"onLine"in t.navigator&&(this.Co=t.navigator.onLine,this.To=()=>{this.Co=!0,this.Mo()},this.Eo=()=>{this.Co=!1},wi(t,"online",this.To),wi(t,"offline",this.Eo))}get length(){return this.fo.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ks);F(e)&&(i.url=Us(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.es(p({retriesPerformedSoFar:e},i));0===t.statusCode&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}es(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.fo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),_e.warn(s),this.So||(this.So=!0,this.Io())}Io(){if(this.Ro&&clearTimeout(this.Ro),0===this.fo.length)return this.So=!1,void(this.Ro=void 0);this.Ro=setTimeout((()=>{this.Co&&this.fo.length>0&&this.Mo(),this.Io()}),this.xo)}Mo(){var t=Date.now(),e=[],i=this.fo.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.fo=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Ro&&(clearTimeout(this.Ro),this.Ro=void 0),this.So=!1,C(t)||(this.To&&(t.removeEventListener("online",this.To),this.To=void 0),this.Eo&&(t.removeEventListener("offline",this.Eo),this.Eo=void 0)),this.fo)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){_e.error(t)}}this.fo=[]}}class Qs{constructor(t){this.Po=()=>{var t,e,i,r;this.Ao||(this.Ao={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),h=(null==s?void 0:s.scrollHeight)||0;this.Ao.lastScrollY=Math.ceil(n),this.Ao.maxScrollY=Math.max(n,null!==(t=this.Ao.maxScrollY)&&void 0!==t?t:0),this.Ao.maxScrollHeight=Math.max(o,null!==(e=this.Ao.maxScrollHeight)&&void 0!==e?e:0),this.Ao.lastContentY=a,this.Ao.maxContentY=Math.max(a,null!==(i=this.Ao.maxContentY)&&void 0!==i?i:0),this.Ao.maxContentHeight=Math.max(h,null!==(r=this.Ao.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Fo(){return this._instance.config.scroll_root_selector}getContext(){return this.Ao}resetContext(){var t=this.Ao;return setTimeout(this.Po,0),t}startMeasuringScrollPosition(){wi(t,"scroll",this.Po,{capture:!0}),wi(t,"scrollend",this.Po,{capture:!0}),wi(t,"resize",this.Po)}scrollElement(){if(!this.Fo)return null==t?void 0:t.document.documentElement;var e=R(this.Fo)?this.Fo:[this.Fo];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Oo(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.Fo){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Oo("y")}scrollX(){return this.Oo("x")}}var Zs=t=>yr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class tn{constructor(t,e,i,r){this.Tt=t=>{var e=this.Lo();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Do(this._instance)};this.$o.register({[Ge]:i})}},this._instance=t,this.No=e,this.$o=i,this.Do=r||Zs,this.No.onSessionId(this.Tt)}Lo(){return this.$o.props[Ge]}getSetOnceProps(){var t,e=null==(t=this.Lo())?void 0:t.props;return e?"r"in e?br(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return ci(fi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+E(i)]=e})),t}}class en{on(t,e){return this.qo[t]||(this.qo[t]=[]),this.qo[t].push(e),()=>{this.qo[t]=this.qo[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.qo[t]||[])i(e);for(var r of this.qo["*"]||[])r(t,e)}constructor(){this.qo={}}}var rn=pe("[SessionId]"),sn=864e5;class nn{on(t,e){return this.jo.on(t,e)}constructor(t,e,i){var r;if(this.Bo=null,this.Ho=null,this.zo=[],this.Uo=void 0,this.Wo=!1,this.jo=new en,this.Vo=(t,e)=>!(!F(t)||!F(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ii)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.gn=t.config,this.$o=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Go=void 0,this._sessionActivityTimestamp=null,this.Zo=e||Ti,this.Qo=i||Ti;var s=this.gn.persistence_name||this.gn.token;if(this._sessionTimeoutMs=1e3*W(this.gn.session_idle_timeout_seconds||1800,60,36e3,rn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Jo(),this.Ko="ph_"+s+"_window_id",this.Yo="ph_"+s+"_primary_window_exists",this.Xo()){var n=Vi.si(this.Ko),o=Vi.si(this.Yo);n&&!o?this.It=n:Vi.ai(this.Ko),Vi.ii(this.Yo,!0)}null!=(r=this.gn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.gn.bootstrap.sessionID),this.tl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.zo)&&(this.zo=[]),this.zo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.zo=this.zo.filter((e=>e!==t))}}Xo(){return"memory"!==this.gn.persistence&&!this.$o.xa&&Vi.ri()}el(t){t!==this.It&&(this.It=t,this.Xo()&&Vi.ii(this.Ko,t))}il(){return this.It?this.It:this.Xo()?Vi.si(this.Ko):null}rl(t){var e=this.Bo;return!A(e)&&!A(t)&&5e3>Math.abs(t-e)}nl(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Pe||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Pe=t,s&&!r||s&&this.rl(e)||(this.Bo=e,this.$o.register({[Pe]:[e,t,i]}))}sl(){var t,e=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0}al(){this.sl()?this.$o.refreshKey(Pe):(this.$o.flush(),this.$o.load())}ol(){var t;if(!A(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Bo){this.al();var e=this.ll();e[1]===this.Pe&&e[2]===this._sessionStartTimestamp&&(this.Bo=this._sessionActivityTimestamp,this.$o.register({[Pe]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.$o.flush())}}ul(){var t=this.ll()[0],e=F(t)?t:0,i=F(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}hl(t){return this.al(),this.Vo(t,this.ul())}ll(){var t=this.$o.props[Pe];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Bo=null,this.Go=void 0,clearTimeout(this.dl),this.dl=void 0,this.nl(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void rn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void rn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Go={sessionId:t,sessionStartTimestamp:i}:this.nl(t,(new Date).getTime(),i),!0)}destroy(){this.Wo=!0,this.ol(),clearTimeout(this.dl),this.dl=void 0,this.Uo&&t&&(t.removeEventListener(ai,this.Uo,{capture:!1}),this.Uo=void 0),this.zo=[]}tl(){this.Uo=()=>{this.ol(),this.Xo()&&Vi.ai(this.Yo)},wi(t,ai,this.Uo,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.gn.cookieless_mode===ii)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Pe;if(i)this.Ho=r;else if(A(this.Ho)||this.Ho>r||r-this.Ho>=1e3){var n,o;null==(n=(o=this.$o).syncCookieProperties)||n.call(o),this.Ho=r}var a=this.ll(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.ul(),v=this.il(),c=this.Go,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>sn),p=c?_:F(l)&&Math.abs(r-l)>sn,f=!1,g=u,m=!h||!!c,w=h,y=!m&&!t&&this.Vo(r,d);if(y){(y=this.hl(r))||rn.info("cross-tab refresh kept the session alive",{sessionId:h});var b=this.ll();h=b[1],l=b[2]}if(m||y||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Zo(),v=this.Qo(),rn.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.Go=void 0,f=!0}else v||(v=this.Qo(),f=!0),(g=g||h!==w)&&(rn.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=F(d)&&t&&!p?d:r,S=F(l)?l:(new Date).getTime();this.el(v),this.nl(h,E,S),t||this.Jo();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.zo.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}Jo(){this.Wo||(clearTimeout(this.dl),this.dl=setTimeout((()=>{if(!this.Wo)if(this.hl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.jo.emit("forcedIdleReset",{idleSessionId:t})}else this.Jo()}),1.1*this.sessionTimeoutMs))}}function on(){return(on=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return M(r)&&r.length>0?r:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function an(t,e,i){return or({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var hn="custom",ln="i.posthog.com",un=/^\/static\//,dn=["/s/","/e/","/i/"];class vn{constructor(t){this.vl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+ln,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.vl[this.apiHost]||(this.vl[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":hn),this.vl[this.apiHost]}cl(t){if(un.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}fl(t){var e=ar(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}pl(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ar(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&dn.some((t=>0===e.indexOf(t)))){var a=this.fl(r);if(a){var h,l=this.apiHost,u=this.gl;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this.gl=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.gl,i=this.fl(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.pl(t,e,this.uiHost+e);if("flags"===t)return this.pl(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.cl(e);if(i)return this.pl(t,e,""+i+e)}if(this.region===hn)return this.pl(t,e,this.apiHost+e);var r=ln+e;switch(t){case"assets":return this.pl(t,e,"https://"+this.region+"-assets."+r);case"api":return this.pl(t,e,"https://"+this.region+"."+r)}}}var cn=pe("[Surveys]"),_n={ignoreConditions:!1,ignoreDelay:!1,displayType:Wr.Popover},pn=pe("[PostHog ExternalIntegrations]"),fn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class gn{constructor(t){this._instance=t}Ks(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return pn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ks(fn[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class mn{constructor(t,e){this.A=t,this.$s=e,this.ml=new Map,this.Fs=!1}add(t){var e=this;return _((function*(){if(e.Fs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.ml.set(t.name,t);try{var i=t.setup(e.$s);i&&(yield i)}catch(i){var r=e.ml.get(t.name)===t;r&&e.ml.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.yl(t)}}))()}getExtension(t){return this.ml.get(t)}dispose(){if(!this.Fs){this.Fs=!0;var t=Array.from(this.ml.values()).reverse();for(var e of(this.ml.clear(),t))this.yl(e)}}yl(t){try{var e=null==t.dispose?void 0:t.dispose();e&&P(e.then)&&e.then(void 0,(e=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class wn{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var yn="extensionsRemoteConfig";class bn{constructor(t){this.Fs=!1,this.instance=t,this.A=_e,this.bl=t._l,this.kv=new wn(t),this.onEvent=t=>Dr(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Fs)return Dr((()=>{}));var e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.wl.on(yn,e);return this.bl&&e(this.bl),Dr(i)},this.kl=new mn(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(xe))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(xe);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.kl.add(t)}getExtension(t){return this.kl.getExtension(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Dr(this.instance.Sl(t))}handleRemoteConfig(t){this.Fs||(this.bl=t,this.instance.wl.emit(yn,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?Us(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?g.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Fs||(this.Fs=!0,this.kl.dispose())}}var $n,xn={},En=0,Sn=()=>{},Tn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',kn="Surveys module not available",Rn="sanitize_properties is deprecated. Use before_send instead",Pn="Invalid value for property_denylist config: ",On=["token","distinct_id",Qe],In="posthog",Cn=!Ms&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),Mn=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Dn=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:mi(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Sn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&M(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){_e.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ni,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Js},error_tracking:{},_onCapture:Sn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Yi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Mn(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},An=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Nn=t=>{var e={};for(var i of An){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=_i({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),M(o)&&C(t.asset_host)&&(n.asset_host=o)),R(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:R(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(Pn+t.property_denylist)),n};class Un{constructor(){this.__forceAllowLocalhost=!1}get xl(){return this.__forceAllowLocalhost}set xl(t){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Fn{Cl(t){if(t){var e=this.ml.indexOf(t);-1!==e&&this.ml.splice(e,1)}}Tl(t,e){return this.Cl(t),this.ml.push(e),null==e.initialize||e.initialize(),e}Ml(){return this.config.cookieless_mode===ii||this.config.cookieless_mode===ei&&this.consent.isRejected()}El(){if(!this.Il&&!this.config.segment&&!this.Ml()){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Rl||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Il=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}Pl(){if(!this.Ml()&&this.get_distinct_id()===Xe){var t=this.persistence;if(t){this.Al()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Xe){var i=this.config.get_device_id(Ti());this.register({distinct_id:i,$device_id:i}),t.set_property(He,ri)}this.Fl()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Un,this.Ol=!1,this.version=v.LIB_VERSION,this.Ll=new Set,this.Dl="",this.wl=new en,this.ml=[],this.$l=[],this.Rl=!1,this.Il=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Dn(),this.SentryIntegration=tr,this.sentryIntegration=t=>function(t,e){var i=Zi(t,e);return{name:Qi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nl=!1,this.ql=null,this.jl=null,this.Bl=null,this.scrollManager=new Qs(this),this.pageViewManager=new er(this),this.rateLimiter=new Xr(this),this.requestRouter=new vn(this),this.consent=new Ji(this),this.externalIntegrations=new gn(this);var e=null!==(t=Fn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=M(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=M(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>_e.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==In){var r,s=null!==(r=xn[i])&&void 0!==r?r:new Fn;return s._init(t,e,i),xn[i]=s,xn[In][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n,o;void 0===i&&(i={});var a,h=M(e)?e.trim():"";if(!h)return _e.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Dn(i.defaults),i.debug=this.Hl(i.debug),this.zl=i,this.Ul=[],i.person_profiles?this.jl=i.person_profiles:i.process_person&&(this.jl=i.process_person);var l=Dn(i.defaults),u=Nn(i),d=_i({},l,u,{name:r,token:h});O(l.rageclick)&&O(u.rageclick)&&(d.rageclick=_i({},l.rageclick,u.rageclick)),O(l.session_recording)&&O(u.session_recording)&&(d.session_recording=_i({},l.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ar.GZipJS;var c=this.Al();if(this.persistence=new Mr(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mr(p({},this.config,{persistence:"sessionStorage"}),c,!1),this.Dl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Vi.ri()){var _=Vi.si(this.Dl);R(_)&&_.forEach((t=>{M(t)&&this.Ll.add(t)}))}else Vi.ai(this.Dl);var f=p({},this.persistence.props),g=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Wl=new Ys((t=>this.Vl(t)),this.config.request_queue_config),this.Gl=new Xs(this),this.__request_queue=[];var m=this.Ml();m||(this.sessionManager=new nn(this),this.sessionPropsManager=new tn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Zl()}))),this.Ql(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Jl(m)}),0)):(_e.info("Initializing extensions synchronously"),this.Jl(m)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&_e.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Rl=!!w&&!D(w),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,b=this.get_distinct_id(),x=this.persistence.get_property(He);if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===ri)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===si)_e.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var E=this.config.get_device_id(Ti()),S=i.bootstrap.isIdentifiedID?E:y;this.persistence.set_property(He,i.bootstrap.isIdentifiedID?si:ri),this.register({distinct_id:y,$device_id:S})}}if(m)this.register_once({distinct_id:Xe,$device_id:null},"");else if(!this.get_distinct_id()){var T=this.config.get_device_id(Ti());this.register_once({distinct_id:T,$device_id:T},""),this.persistence.set_property(He,ri)}return wi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Ti();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(He,si)),e()},s=i.user();"then"in s&&P(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Xi.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Xi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Xi.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,hi),identify:t=>e(t,ui),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Kl())):this.Kl(),P(this.config._onCapture)&&this.config._onCapture!==Sn&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&_e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return on.apply(this,arguments)}().then((t=>{t&&this.register({[Ee]:t})})).catch(Sn),this}Yl(t){var e=t;return M(e.name)&&P(e.setup)}Xl(t,e){this.Yl(t)?e.push((()=>{this.tu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{_e.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.ml.push(t)}Ql(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Fn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.eu)||r.call(this),this.eu=void 0,this.featureFlags=new o(this)),P(this.featureFlags.onReloading)&&P(this.featureFlags.setup)?this.eu||(this.eu=this.featureFlags.onReloading((()=>{this.wl.emit("featureFlagsReloading",!0)})),this.tu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Jl(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Fn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.ml.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.ml.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.ml.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.ml.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.ml.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.Xl(this.autocapture=new l.autocapture(this),u),l.surveys&&this.Xl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.Xl(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this),u),l.metrics&&this.ml.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.ml.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.ml.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.ml.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.ml.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.ml.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.ml.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Ki)),l.toolbar&&this.ml.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.ml.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.ml.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.iu){var t=this.iu;this.iu=void 0,this.ml.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ru(u,h)}ru(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ru(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){_e.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ze]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ti]:r}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+r+"ms)")}uo(t){var e;if(!r||!r.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.uo(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.iu=t),this._l=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=x(s.supportedCompression,Ar.GZipJS)?Ar.GZipJS:x(s.supportedCompression,Ar.Base64)?Ar.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.jl?this.jl:ni}),null==(e=this.nu)||e.handleRemoteConfig(t),this.ml.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Kl(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.su(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ml())&&this.au()}),1),this.ou=new Zr(this),this.ou.load()}su(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Wl)||t.enable())}_dom_loaded(){this.is_capturing()&&vi(this.__request_queue,(t=>this.Vl(t))),this.__request_queue=[],this.su()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.lu()&&this.capture(li),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Wl)||r.unload(),null==(s=this.Gl)||s.unload()):this.lu()&&this.capture(li,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?Cn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(s.compression)&&s.data&&(s.compression=Ar.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(R(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),R(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ws(s.url,s.method,s.compression,s.timestampMode);var v=Vs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){qs(t)?_e.warn(t):_e.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Ar.GZipJS&&h&&"undefined"!=typeof Promise&&!As?js(s).then((t=>{_(t)})).catch((e=>{if(le(e))return As=!0,void _(p({},s,{compression:void 0,url:Ws(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return le(t)||e===oe})(e)&&(As=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vl(t){this.Gl?this.Gl.retriableRequest(t):this._send_request(t)}_execute_array(t){En++;try{var e,i=[],r=[],s=[];vi(t,(t=>{if(t)if(R(e=t[0]))s.push(t);else if(P(t))try{t.call(this)}catch(e){_e.error("Error executing queued PostHog call",t,e)}else R(t)&&"alias"===e?i.push(t):R(t)&&-1!==e.indexOf("capture")&&P(this[e])?s.push(t):r.push(t)}));var n=function(t,e){vi(t,(function(t){try{if(R(t[0])){var i=e;ci(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){_e.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{En--}}push(t){if(En>0&&R(t)&&M(t[0])){var e=Fn.prototype[t[0]];P(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Wl){if(this.is_capturing())if(!C(t)&&M(t)){this.Pl();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!M(null==e?void 0:e.$current_url)&&(_e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||_e.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var u=new Date,d=(null==i?void 0:i.timestamp)||u,v=ie(null==i?void 0:i.uuid,Ti),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===hi&&this.config.__preview_capture_bot_pageviews&&h&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),l&&(c.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ne);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(c.$unset=g);var m,w,y,b=_?void 0:this.hu(null==i?void 0:i.$set_once,t!==di,t===ui);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>M(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),R(e))r=[],vi(e,(e=>{r.push(t(e))}));else{var s={};ci(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,C(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return f.forEach(r),e.forEach(r),i}(c.properties,On)),t===Hr.DISMISSED||t===Hr.SENT){var x=null==e?void 0:e[Gr.SURVEY_ID],E=null==e?void 0:e[Gr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){cn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Hr.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Hr.SHOWN&&(c.$set=p({},c.$set,{[Gr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Jr.SHOWN){var S=null==e?void 0:e[Yr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Yr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(I(T)||this.setPersonPropertiesForFlags(T),!N(this.config.before_send)){var k=this.Xn(c);if(!k)return;(c=k).uuid=ie(c.uuid,Ti)}this.wl.emit("eventCaptured",c);var P=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:P,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Vl(O):this.Wl.enqueue(O),c}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.nu)?void 0:e.getExtension(t)}tu(){var t;return null!==(t=this.nu)&&void 0!==t?t:this.nu=new bn(this)}Sl(t){this.$l.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$l.indexOf(t);-1!==i&&this.$l.splice(i,1)}}}du(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Bl=null,this.persistence.get_property(He)===ri&&(null==(r=this.sessionPersistence)||r.clear(),this.Ll.clear(),this.vu()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.du();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Ml()&&(u[Qe]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!M(u.distinct_id)&&!U(u.distinct_id)||D(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[...dr,...i||[]]:[],_=function(t){for(var e=0;Zt.length>e;e++){var i=Zt[e],r=i[1],s=i[0].exec(t),n=s&&(P(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};C(r)||(m.detectGoogleSearchApp=r);var w={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;C(y)||(w.userAgentDataPlatform=y),C(b)||(w.maxTouchPoints=b),C(x)||(w.screenWidth=x),C(E)||(w.screenHeight=E),C(S)||(w.devicePixelRatio=S);var T,k,R,O,I,M,D,A,N=_i(fi({$os:p,$os_version:f,$browser:Kt(l,navigator.vendor,g,m),$device:te(l),$device_type:(k=l,R=w,A=te(k),A===Q||A===X||"Kobo"===A||"Kindle Fire"===A||A===Rt?K:A===gt||A===wt||A===mt||A===St?"Console":A===tt?"Wearable":A?V:"Android"===(null==R?void 0:R.userAgentDataPlatform)&&(null!==(O=null==R?void 0:R.maxTouchPoints)&&void 0!==O?O:0)>0?600>Math.min(null!==(I=null==R?void 0:R.screenWidth)&&void 0!==I?I:0,null!==(M=null==R?void 0:R.screenHeight)&&void 0!==M?M:0)/(null!==(D=null==R?void 0:R.devicePixelRatio)&&void 0!==D?D:1)?V:K:"Desktop"),$timezone:$r(),$timezone_offset:xr()}),{$current_url:lr(n?se(null==s?void 0:s.href):null==s?void 0:s.href,c,cr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:Qt(l,navigator.vendor,g,m),$browser_language:gr(),$browser_language_prefix:(T=gr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=v.SDK_DIST_CHANNEL),N}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&_i(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&_i(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Gl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===hn&&(u.$lib_custom_api_host=this.config.api_host),c=e!==hi||a?e!==li||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=_i(u,c),e===hi&&r&&(u.title=r.title),!C(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();ci(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.$l.length>0)for(var E of this.$l.slice())try{_i(x,E())}catch(t){_e.error("Failed to produce browser extension event properties",t)}(u=_i({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),R(this.config.property_denylist)?ci(this.config.property_denylist,(function(t){delete u[t]})):_e.error(Pn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(_e.error(Rn),u=S(u,e));var T=this.cu();return u.$process_person_profile=T,T&&!a&&this.fu("_calculate_event_properties"),u}hu(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.cu())return t;if(this.Ol&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=_i({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(_e.error(Rn),o=a(o,"$set_once")),e&&(this.Ol=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.du(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.Ll.add(t))),this.vu()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.Ll.delete(t),this.vu()}pu(t,e){this.register({[t]:e})}Zl(){this.Ll.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.Ll.clear(),this.vu()}vu(){var t;if(this.Dl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.xa||!Vi.ri())Vi.ai(this.Dl);else{var e=[];this.Ll.forEach((t=>e.push(t))),e.length>0?Vi.ii(this.Dl,e):Vi.ai(this.Dl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.wl.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:kn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:kn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:kn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=_n),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:kn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:kn})}gu(t){return!t||D(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t===Xe?(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(U(t)&&(t=t.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gu(t)&&this.fu("posthog.identify")){this.Pl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.du(!1),o=this.persistence.za(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(xe)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(Se)&&(this.unregister(Se),this.register({distinct_id:t}));var l,u=(this.persistence.get_property(He)||ri)===ri,d=t!==h,v=!d&&u;if(d&&u)this.persistence.set_property(He,si),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture(ui,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Bl=an(t,e,i),null==(l=this.featureFlags)||l.setAnonymousDistinctId(h);else if(v){this.persistence.set_property(He,si);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture("$set",{$set:c,$set_once:_}),this.Bl=an(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(je)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ga(a)}}}setPersonProperties(t,e){if((t||e)&&this.fu("posthog.setPersonProperties")){var i=an(this.get_distinct_id(),t,e);this.Bl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Bl=i):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(R(t)?t:[t]).filter((t=>M(t)&&t.length>0));0!==i.length&&this.fu("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Bl=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.du();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(di,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.fu("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=B(t)?t:null==t?void 0:t.resetDeviceID,i=B(t)||null==t?void 0:t.bootstrap;this.mu(e,!1,i)}mu(t,e,i){var r,s,n;if(void 0===e&&(e=!1),_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.zl)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(xe),h=this.get_property(Ee),l=this.get_property(Re),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.za?void 0:n.za(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Ll.clear(),this.vu(),C(l)||null==(E=this.persistence)||E.register({[Re]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(y=this.metrics)||y.reset(),null==(b=this.persistence)||b.set_property(He,ri),null==(x=this.sessionManager)||x.resetSessionId(),this.Bl=null,this.config.cookieless_mode===ii)this.register_once({distinct_id:Xe,$device_id:null},"");else{var R=this.config.get_device_id(Ti());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||C(h)||this.register({[Ee]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Ml()||(null==(k=this.persistence)||k.set_property(He,i.isIdentifiedID?si:ri),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(C(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.Ga||O.Ga(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.tu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Wl)||s.unload(),null==(n=e.Gl)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){_e.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else _e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(be)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.fu("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.pu(Se,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(O(t)){var i,r,s,n,o,a,h,l,u,d,c,_;_i(this.config,Nn(t));var f=this.Al();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mr(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Hl(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Mi.ri()&&Mi.ii("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Mi.ri()&&Mi.ai("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.Fl(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Fn._u}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:In;return e!==In&&(e=In+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(He))===si||(null==(e=this.sessionPersistence)?void 0:e.get_property(He))===si}cu(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ni&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Se])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ke]))}lu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.cu()||this.fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fu(t){return"never"===this.config.person_profiles?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.El(),this.pu(Ke,!0),!0)}Al(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ei)}Fl(){var t,e,i,r,s,n=this.Al();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(t=this.persistence)?void 0:t.xa)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.xa)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Ll.clear(),this.vu()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==ii){if(this.Ml()){var i,r,s,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this.mu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new nn(this),this.pageViewManager=new er(this),this.persistence&&(this.sessionPropsManager=new tn(this,this.sessionManager,this.persistence));var h,l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Fn.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Tl(this.sessionRecording,new l(this)),this._l&&(null==(h=this.sessionRecording)||null==h.onRemoteConfig||h.onRemoteConfig(this._l)))}var u,d;this.consent.optInOut(!0),this.Fl(),this.su(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ei&&(null==(u=this.surveys)||u.loadIfEnabled()),(C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.au()}else _e.warn(Tn)}opt_out_capturing(){if(this.config.cookieless_mode!==ii){var t,e,i=this.config.cookieless_mode===ei?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ei&&this.consent.isOptedIn()&&this.mu(!0,!0),this.consent.optInOut(!1),this.Fl(),this.config.cookieless_mode===ei&&(this.register({distinct_id:Xe,$device_id:null}),this.Cl(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.au(),this.su())}else _e.warn(Tn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ii||(this.config.cookieless_mode===ei?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fl()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&b(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>b(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}au(){r&&("visible"===r.visibilityState?this.Nl||(this.Nl=!0,this.capture(hi,{title:r.title},{send_instantly:!0}),this.ql&&(r.removeEventListener(oi,this.ql),this.ql=null)):this.ql||(this.ql=this.au.bind(this),wi(r,oi,this.ql)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var t=this.zl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(_e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}Xn(t){var e;if(N(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(z),r=R(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),N(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return j(t.event)?_e.warn(o+". This can cause unexpected behavior."):_e.info(o),null}s.properties&&!I(s.properties)||_e.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return _e.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&N(s.properties[a]))return _e.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ta)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Hl(t){var e=B(t)&&!t,i=Mi.ri()&&"true"===Mi.ni("ph_debug");return!e&&(!!i||t)}}Fn.__defaultExtensionClasses={},Fn._u={trace:$n=()=>{},debug:$n,info:$n,warn:$n,error:$n,fatal:$n},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=pi(t.prototype[e[i]])}(Fn,["identify"]);var Bn=function(){v.SDK_DIST_CHANNEL="npm";var e=xn[In]=new Fn;return function(){function e(){e.done||(e.done=!0,Cn=!1,ci(xn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():wi(r,"DOMContentLoaded",e,{capture:!1}):t&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Ar as Compression,Vr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Wr as DisplaySurveyType,Fn as PostHog,Jr as ProductTourEventName,Yr as ProductTourEventProperties,Hr as SurveyEventName,Gr as SurveyEventProperties,Nr as SurveyEventType,Fr as SurveyPosition,zr as SurveyQuestionBranchingType,jr as SurveyQuestionType,qr as SurveySchedule,Br as SurveyTabPosition,Lr as SurveyType,Ur as SurveyWidgetType,Bn as default,Bn as posthog,ts as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.js.map
|