posthog-js 1.433.2 → 1.433.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/array.full.es5.js +1 -1
  3. package/dist/array.full.es5.js.map +1 -1
  4. package/dist/array.full.js +1 -1
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -1
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -1
  9. package/dist/array.js.map +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/array.no-external.js.map +1 -1
  12. package/dist/customizations.full.js +1 -1
  13. package/dist/customizations.js +1 -1
  14. package/dist/default-extensions.js +1 -1
  15. package/dist/default-extensions.js.map +1 -1
  16. package/dist/extension-bundles.js +1 -1
  17. package/dist/lazy-recorder.js +1 -1
  18. package/dist/main.js +1 -1
  19. package/dist/main.js.map +1 -1
  20. package/dist/module.full.cjs +1 -1
  21. package/dist/module.full.js +1 -1
  22. package/dist/module.full.js.map +1 -1
  23. package/dist/module.full.no-external.cjs +1 -1
  24. package/dist/module.full.no-external.js +1 -1
  25. package/dist/module.full.no-external.js.map +1 -1
  26. package/dist/module.js +1 -1
  27. package/dist/module.js.map +1 -1
  28. package/dist/module.mjs +1 -1
  29. package/dist/module.mjs.map +1 -1
  30. package/dist/module.no-external.cjs +1 -1
  31. package/dist/module.no-external.js +1 -1
  32. package/dist/module.no-external.js.map +1 -1
  33. package/dist/module.slim.js +1 -1
  34. package/dist/module.slim.js.map +1 -1
  35. package/dist/module.slim.no-external.js +1 -1
  36. package/dist/module.slim.no-external.js.map +1 -1
  37. package/dist/posthog-recorder.js +1 -1
  38. package/lib/package.json +1 -1
  39. package/lib/src/request.js +3 -1
  40. package/lib/src/request.js.map +1 -1
  41. package/package.json +6 -6
@@ -1,2 +1,2 @@
1
- var t,e=["retriesPerformedSoFar"];function i(){return i=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},i.apply(null,arguments)}function r(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 s(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var o=t.apply(e,i);function a(t){r(o,s,n,a,h,"next",t)}function h(t){r(o,s,n,a,h,"throw",t)}a(void 0)})}}var n="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:n,a=null==o?void 0:o.navigator,h=null==o?void 0:o.document,l=null==o?void 0:o.location,u=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,v=null==o?void 0:o.AbortController,c=null==o?void 0:o.CompressionStream,_=null==a?void 0:a.userAgent,p="undefined"!=typeof globalThis?globalThis:n;p&&"undefined"==typeof self&&(p.self=p),p&&"undefined"==typeof File&&(p.File=function(){});var f=null!=n?n:{},g="0.8.3",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"browser-common",JS_SDK_VERSION:g},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),y=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],w=["token"];function S(t,e){return-1!==t.indexOf(e)}var x=function(t){return t.replace(/^\$/,"")},E=Object.prototype,T=E.hasOwnProperty,k=E.toString,P=Array.isArray||function(t){return"[object Array]"===k.call(t)},R=t=>"function"==typeof t,I=t=>t===Object(t)&&!P(t),O=t=>{if(I(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,N=t=>null===t,D=t=>C(t)||N(t),F=t=>"[object Number]"==k.call(t)&&t==t,U=t=>F(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>S(y,t),j=t=>S(w,t);function z(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Error)}}var W=[!0,"true",1,"1","yes"],G=t=>S(W,t),q=[!1,"false",0,"0","no"],H=["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"],V=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return H.concat(e).some(t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)})};function J(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),F(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),J(null!=s?s:i,e,i,r))}var K="Mobile",Y="Android",X="Tablet",Q="Android Tablet",Z="iPad",tt="Apple Watch",et="Safari",it="BlackBerry",rt="Samsung Internet",st="Chrome",nt="Chrome iOS",ot="Internet Explorer",at="Internet Explorer Mobile",ht="Opera",lt="Microsoft Edge",ut="Firefox",dt="Firefox iOS",vt="Nintendo",ct="PlayStation",_t="Xbox",pt="Android Mobile",ft="Mobile Safari",gt="Windows",mt="Windows Phone",bt="Nokia",yt="Ouya",wt="Generic "+K.toLowerCase(),$t="Generic "+X.toLowerCase(),St="Konqueror",xt="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",It="Waterfox",Ot="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Nt="Google Search App",Dt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ft=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ut=new RegExp(_t,"i"),Bt=new RegExp("PlayStation \\w+","i"),Lt=new RegExp("Nintendo \\w+","i"),jt=new RegExp("BlackBerry|PlayBook|BB10","i"),zt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Wt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ot:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&S(t,"GSA/")?Nt:S(t," OPR/")&&S(t,"Mini")?"Opera Mini":S(t," OPR/")?ht:jt.test(t)?it:S(t,"IEMobile")||S(t,"WPDesktop")?at:S(t,"OculusBrowser")?xt:S(t,"SamsungBrowser")?rt:S(t,"Edge")||S(t,"Edg/")?lt:S(t,"Vivaldi/")?Et:S(t,"YaBrowser/")?Tt:S(t,"Whale/")?kt:S(t,"DuckDuckGo/")||S(t,"Ddg/")?Pt:S(t,"Claude/")?Ct:S(t,"Codex/")?At:S(t,"ChatGPT/")?Mt:S(t,"FBIOS")?"Facebook Mobile":S(t,"UCWEB")||S(t,"UCBrowser")?"UC Browser":S(t,"CriOS")?nt:S(t,"CrMo")||S(t,st)?st:S(t,Y)&&S(t,et)?pt:S(t,"FxiOS")?dt:S(t.toLowerCase(),St.toLowerCase())?St:S(t,"Brave/")?Ot:((t,e)=>e&&S(e,"Apple")||function(t){return S(t,et)&&!S(t,st)&&!S(t,Y)}(t))(t,e)?S(t,K)?ft:et:S(t,"PaleMoon/")?Rt:S(t,"Waterfox/")?It:S(t,ut)?ut:S(t,"MSIE")||S(t,"Trident/")?ot:S(t,"Gecko")?ut:"")},Gt={[at]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[lt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[st]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[nt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[et]:[Dt],[ft]:[Dt],[ht]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Dt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},qt=function(t,e,i,r){var s=Gt[Wt(t,e,i,r)];if(C(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Ht=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[_t,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[jt,[it,""]],[new RegExp(gt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mt,""];if(new RegExp(K).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[gt,r]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(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("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Vt=function(t){return Lt.test(t)?vt:Bt.test(t)?ct:Ut.test(t)?_t:new RegExp(yt,"i").test(t)?yt:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?Z:/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(bt,"i").test(t)?bt:/(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(K).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:Q:new RegExp("(pda|Mobile)","i").test(t)?wt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Kt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Jt],[/\bFBAN\/EMA\b/i,"Facebook Lite",Jt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Jt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Yt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xt(t,e){return"string"==typeof(i=t)&&Yt.test(i)?t:e();var i}function Qt(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 Zt(t){return t?t.split("#")[0]:t}var te,ee=["$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"],ie="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw Qt(ie,"Native gzip produced invalid output: "+t)},ae=function(){var t=s(function*(t,e){18>t.size&&oe("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(i)&&8===i[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;te[t]=e>>>0}return te})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&oe("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(e,i){return t.apply(this,arguments)}}();function he(){return he=s(function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=s(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(e){return t.apply(this,arguments)}}()),h=new Response(n.readable).blob(),l=(yield Promise.all([h,a]))[0];return yield ae(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}}),he.apply(this,arguments)}var le=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={N(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];n&&(m.DEBUG||n.POSTHOG_DEBUG||i)&&!C(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>le(t+" "+e,i)};return r},ue=le("[PostHog.js]"),de=ue.createLogger,ve=de("[ExternalScriptsLoader]"),ce=t=>{var e=null==h?void 0:h.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]},_e=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ve.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=ce(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,i(t)}))}var n=()=>{if(!h)return i("document not found");if(ce(e))return _e(t,e,i);var r=h.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)h.head.appendChild(r);else{var s,n=h.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):h.body.appendChild(r)}};null!=h&&h.body?n():null==h||h.addEventListener("DOMContentLoaded",n)},pe={},fe=(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)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__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=pe[s];if("fallback"===r&&n){if(ce(n))return void _e(t,n,i);delete pe[s]}_e(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=fe(t,e);pe[s]=a;var h=ce(s);null==h||null==(o=h.parentNode)||o.removeChild(h),_e(t,a,i)}else i(void 0,n)}:i)}else _e(t,fe(t,e),i)}else _e(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),i)},f.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{_e(t,t.requestRouter.endpointFor("api",e),i)},m.DEBUG=!1,m.LIB_VERSION="1.433.2",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",ye="$device_id",we="$device_model",$e="__alias",Se="__cmpns",xe="$fbc",Ee="$fbc_persistence",Te="$fbp",ke="$fbp_persistence",Pe="__timers",Re="$autocapture_disabled_server_side",Ie="$heatmaps_enabled_server_side",Oe="$exception_capture_enabled_server_side",Ce="$error_tracking_suppression_rules",Ae="$error_tracking_capture_extension_exceptions",Me="$web_vitals_enabled_server_side",Ne="$dead_clicks_enabled_server_side",De="$product_tours_enabled_server_side",Fe="$logs_capture_enabled_server_side",Ue="$web_vitals_allowed_metrics",Be="$session_recording_remote_config",Le="$session_recording_enabled_server_side",je="$replay_sample_rate",ze="$replay_override_sampling",We="$replay_override_linked_flag",Ge="$replay_override_url_trigger",qe="$replay_override_event_trigger",He="$sesid",Ve="$session_is_sampled",Je="$session_past_minimum_duration",Ke="$session_recording_url_trigger_activated_session",Ye="$session_recording_event_trigger_activated_session",Xe="$debug_first_full_snapshot_timestamp",Qe="$sess_rec_flush_size",Ze="$enabled_feature_flags",ti="$active_feature_flags",ei="$early_access_features",ii="$feature_flag_details",ri="$feature_flag_payloads",si="$feature_flag_request_id",ni="$minimal_flag_called_events",oi="$override_feature_flags",ai="$override_feature_flag_payloads",hi="$stored_person_properties",li="$stored_group_properties",ui="$groups",di="$surveys",vi="$surveys_loaded_at",ci="$surveys_activated",_i="$surveys_activated_session",pi="$surveys_activated_timestamps",fi="ph_product_tours",gi="$product_tours_activated",mi="$product_tours_activated_session",bi="$conversations_widget_session_id",yi="$conversations_ticket_id",wi="$conversations_widget_state",$i="$conversations_user_traits",Si="$flag_call_reported",xi="$flag_call_reported_session_id",Ei="$feature_flag_errors",Ti="$feature_flag_evaluated_at",ki="$user_state",Pi="$client_session_props",Ri="$capture_rate_limit",Ii="$initial_campaign_params",Oi="$initial_referrer_info",Ci="$initial_person_info",Ai="$epp",Mi="$posthog_cookieless",Ni="$cookieless_mode",Di="$sdk_debug_extensions_init_method",Fi="$sdk_debug_extensions_init_time_ms",Ui="$sdk_debug_recording_script_not_loaded",Bi="$sdk_debug_replay_event_trigger_status",Li="$sdk_debug_replay_linked_flag_trigger_status",ji="$sdk_debug_replay_matched_recording_trigger_groups",zi="$sdk_debug_replay_pending_trigger_conditions",Wi="$sdk_debug_replay_remote_trigger_matching_config",Gi="$sdk_debug_replay_trigger_groups_count",qi="$sdk_debug_replay_url_trigger_status",Hi="$session_recording_start_reason",Vi="anonymous",Ji="identified",Ki="identified_only",Yi="visibilitychange",Xi="beforeunload",Qi="$pageview",Zi="$pageleave",tr="$identify",er="$groupidentify";function ir(t,e){P(t)&&t.forEach(e)}function rr(t,e){if(!D(t))if(P(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)T.call(t,i)&&e(t[i],i)}var sr=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},nr=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){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},or=function(t){var e={};return rr(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function ar(t){var e=i({},t);for(var r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch(t){}return e}var hr=["herokuapp.com","vercel.app","netlify.app"];function lr(t){var e=null==t?void 0:t.hostname;if(!A(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of hr)if(i===r)return!1;return!0}function ur(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 dr=t=>{if(h){try{for(var e=t+"=",i=h.cookie.split(";").filter(t=>t.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.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 F(t)&&isFinite(t)&&Math.floor(t)===t});var vr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>i||0>r||0>s||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}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 t(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}},cr=class{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Ct=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t,e=(t=Date.now(),F(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return vr.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new fr}},_r=t=>{if("u">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};n&&!C(n.crypto)&&crypto.getRandomValues&&(_r=t=>crypto.getRandomValues(t));var pr,fr=class{nextUint32(){return this.Rt.length>this.$t||(_r(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},gr=()=>mr().toString(),mr=()=>(pr||(pr=new cr)).generate(),br="",yr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var wr=null,$r={Et(){if(!N(wr))return wr;if(wr=!1,h)try{var t="__ph_cookie_support_"+gr();$r.At(t,"xyz"),wr='"xyz"'===dr(t),$r.Lt(t)}catch(t){wr=!1}return wr},Pt(t){ue.error("cookieStore error: "+t)},Ot:dr,Dt(t){var e;try{e=JSON.parse($r.Ot(t))||{}}catch(t){}return e},At(t,e,i,r,s){if(!h)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=h),br)return br;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+gr();!br&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",br=n)}return br}(t);if(!i){var r=(t=>{var e=t.match(yr);return e?e[0]:""})(t);r!==i&&ue.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(h.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+u.length),h.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null!=h&&h.cookie)try{$r.At(t,"",-1,e)}catch(t){return}}},Sr=null,xr={Et(){if(!N(Sr))return Sr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";xr.At(e,"xyz"),'"xyz"'!==xr.Ot(e)&&(t=!1),xr.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),Sr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){xr.Pt(t)}return null},Dt(t){try{return JSON.parse(xr.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){xr.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){xr.Pt(t)}}},Er=[hi,ti,Ze,ii,ri,si,Ti,Ei,Si],Tr=[ye,be,He,Ve,Ai,Ci,Ee,ki],kr=t=>t+"_cpm",Pr=["__proto__","constructor","prototype"],Rr=t=>{if(!I(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Pr.indexOf(i)&&(e[i]=t[i])}),e},Ir=function(t,e){void 0===e&&(e=[]);var i={};return[...Tr,...e].forEach(e=>{var r=t[e];C(r)||N(r)||""===r||(i[e]=r)}),i},Or=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)},Cr=(t,e)=>({p:e,f:Or(JSON.stringify(t))}),Ar=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=$r.Dt(kr(t)),r=(null==i?void 0:i.f)===Or(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Mr=(t,e)=>e+"|"+($r.Ot(kr(t))||""),Nr={},Dr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Nr?Nr[t]:null,Dt:t=>t in Nr?Nr[t]:null,At:(t,e)=>(Nr[t]=e,!0),Lt(t){delete Nr[t]}},Fr=null,Ur={Et(){if(!N(Fr))return Fr;if(Fr=!0,C(n))Fr=!1;else try{var t="__support__";Ur.At(t,"xyz"),'"xyz"'!==Ur.Ot(t)&&(Fr=!1),Ur.Lt(t)}catch(t){Fr=!1}return Fr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Ur.Pt(t)}return null},Dt(t){try{return JSON.parse(Ur.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Ur.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Ur.Pt(t)}}},Br=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){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 Ao(){var t=this.Fo.Ot(this.Oo);return G(t)?1:S(q,t)?0:-1}get Fo(){var t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?xr:$r,i=e.Et()?e:Dr;if(!this.Do||this.Do!==i){this.Do=i;var r="localStorage"===t?$r:xr;r.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(G(r.Ot(this.Oo))),r.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>G(t))}},Lr=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var jr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ne)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!I(r)||i},zr=de("[SegmentIntegration]");function Wr(t,e,r){void 0===r&&(r=!0);var s=t.config.segment;if(!s)return e();var n,o=(t=>R(t.register))(n=s)?{analytics:n}:n,a=o.analytics,h=o.filterProperties;!function(t,e,i,r){var s=e=>{var s=()=>e.anonymousId()||gr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(ki,Ji)),i(r?void 0:e.anonymousId()||void 0)},n=e.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,a,r=>{a.register(function(t,e,r){var s=(void 0===r?{}:r).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||zr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(r,n)=>{if(!n)return r;var o=!!e&&r.event.anonymousId===e&&!r.event.userId;o||r.event.userId||r.event.anonymousId===t.get_distinct_id()||(zr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(zr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!D(s)){var h=r.event.properties||{},l={};for(var u of Object.keys(a))T.call(h,u)||(l[u]=a[u]);var d=((t,e)=>{var r=P(t)?t:[t],s=i({},e);for(var n of r)try{if(s=n(s),D(s))return null}catch(t){return zr.error("Error in Segment filterProperties:",t),null}return s})(s,l);if(D(d))return r;a=d}return r.event.properties=Object.assign({},a,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,Qi)},identify(t){return n(t,tr)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:h})).then(()=>{e()},t=>{zr.error("Failed to register the Segment integration",t),e()})},r)}var Gr="posthog-js";function qr(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,h=void 0===a?["error"]:a,l=r.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var r,a,l,d,v,c;if("*"!==h&&!h.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var _=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=_,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(r=e.exception)?void 0:r.values)||[],f=p.map(t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>i({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(l=p[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}var Hr=class{constructor(t,e,i,r,s,n){this.name=Gr,this.setupOnce=function(o){o(qr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Vr=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.jo)}destroy(){var t;null==(t=this.zo)||t.call(this),this.zo=void 0}doPageView(t,e){var i,r=this.Uo(t,e);return this.Bo={pathname:null!==(i=null==n?void 0:n.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Uo(t,null==(e=this.Bo)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Bo)?void 0:t.pageViewId}}Uo(t,e){var i=this.Bo;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?J(o/n,0,1,ue):1,v=n>1?J(a/n,0,1,ue):1,c=h>1?J(l/h,0,1,ue):1,_=h>1?J(u/h,0,1,ue):1;r=sr(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}},Jr=["flags","surveys"],Kr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Re]:{exposure:"event"},[Ie]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Oe]:{exposure:"event"},[Ce]:{exposure:"hidden"},[Ae]:{exposure:"event"},[Me]:{exposure:"event"},[Ne]:{exposure:"event"},[De]:{exposure:"hidden"},[Ue]:{exposure:"event"},[Be]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ve]:{exposure:"event"},[je]:{exposure:"event",shouldSkipFromEventProperties:t=>N(t)},[Je]:{exposure:"event"},[Ke]:{exposure:"event"},[Ye]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"hidden"},[Ze]:{exposure:"hidden",storageGroup:"flags"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden"},[ii]:{exposure:"hidden",storageGroup:"flags"},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ni]:{exposure:"hidden",storageGroup:"flags"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[li]:{exposure:"hidden"},[di]:{exposure:"hidden",storageGroup:"surveys"},[vi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ci]:{exposure:"event"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[bi]:{exposure:"event"},[yi]:{exposure:"event"},[wi]:{exposure:"event"},[$i]:{exposure:"event"},[Si]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[ui]:{exposure:"event"},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Ge]:{exposure:"event"},[qe]:{exposure:"event"},[Di]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[Gi]:{exposure:"event"},[qi]:{exposure:"event"},[Hi]:{exposure:"event"}},Yr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Xr=t=>{var e=Kr[t];if(e)return e;for(var i of Yr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Qr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,ar(e)),i.get(e)):"bigint"==typeof e?e.toString():e,e)}catch(e){return s=[],null!==(r=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(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(e))return"[Circular]";s.push(e)}return e}}))&&void 0!==r?r:"null"}var r,s},Zr=t=>{var e=null==h?void 0:h.createElement("a");return C(e)?null:(e.href=t,e)},ts=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(!P(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},es=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("=");P(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},is=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...is],ss="<masked>",ns=["li_fat_id"];function os(t,e){var i=rs.concat(e||[]),r={};return rr(i,function(e){var i=ts(t,e);r[e]=i||null}),r}function as(t){var e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!N(e)){r.$search_engine=e;var s=h?ts(h.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function hs(){return navigator.language||navigator.userLanguage}var ls="$direct";function us(){return(null==h?void 0:h.referrer)||ls}function ds(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...is,...e||[]]:[],n=null==(r=i?Zt(null==l?void 0:l.href):null==l?void 0:l.href)?void 0:r.substring(0,1e3);return{r:us().substring(0,1e3),u:n?es(n,s,ss):void 0}}function vs(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Zt(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ls?ls:null==(i=Zr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Zr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,sr(o,os(n))}return r&&sr(o,as(r)),o}function cs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function _s(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ps={flags:Ti,surveys:vi},fs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gs=t=>t+"_cookie_identity_change_pending",ms=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},bs="main",ys=[Ze,ti,ii,ri,si,Ti,ni,hi],ws=t=>-1!==ys.indexOf(t),$s=[Ee,ke],Ss=t=>-1!==$s.indexOf(t),xs=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Es=t=>{if(!t)return{};var e=JSON.parse(t);return I(e)?e:{}},Ts=(t,e)=>{rr(t,(i,r)=>{var s=Xr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},ks=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=new Set,this.il=new Set,this.Mr=t,this.nl=r,this.props={},this.sl=void 0,this.rl=(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"})(t),this.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();ur(n,"beforeunload",s,{capture:!1}),ur(n,"pagehide",s,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){var e=Jr.find(e=>t.key===this.hl(e));e&&this.cl(t.key,e)}}else this.cl(t.key,bs)},ur(n,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.Ko.get(e);if(ws(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(e,s)}else this.dl(e,!0)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&n&&(n.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=xr.Ot(t),N(s)){var n=this.vl(e);return n.storageValue=null,e!==bs&&(n.persisted=!1),!1}r=Es(s)}catch(t){return!1}var o=e===bs?r:xr.Dt(this.rl);if(o&&this.fl(o))return!1;var a=this.pl(r,e,i);return e===bs&&this.Zo&&!xs(this.gl().main,r)||this.ml(r,e,!0,s),a}fl(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}ml(t,e,i,r){var s=this.vl(e);s.storageValue=r,e!==bs&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){var r=!1;return ys.forEach(i=>{var s,n=null==(s=Xr(i))?void 0:s.storageGroup;if(!(e===bs&&this.Zo&&n||e!==bs&&n!==e)){var o=i in t,a=this.bl(i,o?t[i]:void 0),h=this.Ko.has(i)?i in this.props:o;h===i in this.props&&xs(a,this.props[i])||(h?this._l(i,a,!1):this.wl(i,!1),r=!0)}}),r&&i&&this.il.forEach(t=>t()),r}kl(){if(!this.Vo)return!1;try{this.tl=!1;var t,e=xr.Ot(this.rl),i=this.vl(bs),r=!1,s=!1;if(e!==i.storageValue)if(N(e))i.storageValue=null;else{if(t=Es(e),this.tl=!this.Yo&&this.fl(t),this.tl)return!1;s=this.pl(t,bs,!1),!this.Zo||xs(this.gl().main,t)?this.ml(t,bs,!0,e):i.storageValue=e,r=!0}return this.Zo&&Jr.forEach(e=>{var i=xr.Ot(this.hl(e)),n=this.vl(e),o=t||{},a=r&&ys.some(t=>{var i;return(null==(i=Xr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(N(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.pl(o,e,!1)||s));var h=Es(i);s=this.pl(h,e,!1)||s,this.ml(h,e,!0,i)}}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);var i=Xr(t);null!=i&&i.volatile||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||bs).fingerprint=void 0,this.Sl(t))}xl(){ys.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{var t=xr.Ot(this.rl),e=Es(t);this.vl(bs).storageValue=t,ys.forEach(t=>{var i,r=this.Zo?null==(i=Xr(t))?void 0:i.storageGroup:void 0,s=r?xr.Ot(this.hl(r)):null;if(r){var n=this.vl(r);n.storageValue=s,n.persisted=!N(s)}var o=r&&!N(s)?Es(s):e;t in this.props?this.Cl(t,o[t],this.props[t]):t in o&&this.dl(t,!0)})}catch(t){}}bl(t,e){var r=this.Ko.get(t);if(!r)return e;if(!0===r)return this.props[t];if("$active_feature_flags"===t){var s=new Set(P(e)?e:[]),n=new Set(P(this.props[t])?this.props[t]:[]);return r.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=I(e)?i({},e):{},a=I(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Cl(t,e,i){if(ws(t)){var r=this.Ko.get(t);if(!0!==r){var s=e;if(this.Vo)try{var n,o=this.Zo?null==(n=Xr(t))?void 0:n.storageGroup:void 0,a=o?this.hl(o):this.rl;s=Es(xr.Ot(a))[t]}catch(t){}var h=new Set(r||[]);if("$active_feature_flags"===t){if(!C(e)&&!P(e)||!C(s)&&!P(s)||!P(i))return void this.dl(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(!I(i))return void(xs(s,i)?this.Ko.delete(t):this.dl(t,!0));if(!C(e)&&!I(e)||C(e)&&O(i)&&C(s))return void this.dl(t,!0);var v=I(e)?e:{},c=I(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&xs(v[t],i[t])||h.add(t)}),h.forEach(t=>{t in c==t in i&&xs(c[t],i[t])&&h.delete(t)})}h.size?this.dl(t,h):this.Ko.delete(t)}}}$l(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{var e=Ir(t,this.Mr.cookie_persisted_properties||[]),i=Cr(e,this.Mr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=$r.Ot(this.rl)||void 0;s&&Mr(this.rl,s)===r&&(this.Il=r,this.Ml=s)}catch(t){}else try{var n=$r.Ot(this.rl)||void 0;this.Il=n?Mr(this.rl,n):void 0,this.Ml=n}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=$r.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;var r,s=Mr(this.rl,i);try{r=Rr(JSON.parse(i))}catch(t){return!1}if(($r.Ot(this.rl)||void 0)!==i)return!1;this.Il=s,this.Ml=i;var n=Ar(this.rl,i),o=[...Tr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||N(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),O(r))return!1;var h="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,l=this.props,u=l[be],d=l[ki],v=sr({},l);[...Tr,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||"distinct_id"!==t&&"$user_state"!==t)){var e=v[t];(n.isValid||-1===Tr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=sr(v,r),ys.forEach(t=>{var e=t in this.props;t in l===e&&xs(l[t],this.props[t])||(e?this.Cl(t,l[t],this.props[t]):this.dl(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this._l(ki,Vi);var c=this.props[be],_=this.props[ki];return!h||c===u&&_===d||(this.Yo=!0,this.Qo=!0,Ur.At(gs(this.rl),!0),this.wl(hi),this.wl(ti),this.wl(Ze),this.wl(ii),this.wl(ri),this.wl(si),this.wl(Ti),this.wl(Ei),this.wl(Si),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||(Ts(this.props,r),this.wl(li)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.wl($e)),!0}consumeCookieIdentityChange(){var t=gs(this.rl),e=this.Qo||!!Ur.Ot(t);return this.Qo=!1,e&&Ur.Lt(t),e}Pl(t){return void 0===t&&(t=!1),!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[bs],this.Fl(!0))}Ol(t){if(void 0===t&&(t=!0),this.Jo)try{t?this.Rl():C(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===fs.indexOf(t.persistence.toLowerCase())&&(ue.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Tr,...t];return i({},xr,{Dt(t){try{var i,s={};try{i=$r.Ot(t)||void 0,s=i?Rr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse(xr.Ot(t)||"{}");if(e){var a=Ar(t,i),h=[...Tr,...a.properties],l={};Object.keys(s).forEach(t=>{var e=s[t];N(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(l[t]=e)});var u="distinct_id"in l||"anonymous"===l.$user_state||"identified"===l.$user_state;if(Object.keys(l).length>0){var d,v=o[be],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";r.forEach(t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var e=o[t];(a.isValid||-1===Tr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[ki]=Vi),!u||("distinct_id"in l?l[be]:o[be])===v&&("$user_state"in l?l[ki]:o[ki])===c||(Er.forEach(t=>delete o[t]),"identified"===l.$user_state&&"distinct_id"in l?o.$user_id=l[be]:delete o.$user_id,"identified"!==l.$user_state&&(delete o[ui],delete o[li]),delete o.__alias)}n=sr(o,l)}else n=sr(s,o);return xr.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var h=xr.At(i,r,void 0,void 0,a);try{var l=Ir(r,t);if(Object.keys(l).length){if(e){var u=kr(i),d=Cr(l,t);if($r.At(u,d,s,n,o,a),$r.Ot(u)!==JSON.stringify(d)){$r.Lt(u,n);var v=Ir(r);return $r.At(i,v,s,n,o,a),h}}$r.At(i,l,s,n,o,a)}}catch(t){xr.Pt(t)}return h},Lt(t,e){try{null==n||n.localStorage.removeItem(t),$r.Lt(t,e),$r.Lt(kr(t),e)}catch(t){xr.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&xr.Et()?(e=xr,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Ur.Et()?e=Ur:"memory"===a?e=Dr:"cookie"===a&&$r.Et()?(e=$r,s=!0):r.Et()?(e=r,o=!0,s=!0):$r.Et()?(e=$r,s=!0):e=Dr,this.Vo=o,this.Go=s,e}hl(t){return this.rl+"__"+t}ll(t){return this.Vo&&!!t.split_storage}properties(){var t={};return rr(this.props,(e,i)=>{var r=Xr(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.pi||t){var e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?xr.Dt(this.rl):null,r={};if(e)try{rr(r=Rr($r.Dt(this.rl)),(t,e)=>{(C(t)||N(t)||""===t)&&delete r[e]})}catch(t){}var s=this.Fo.Dt(this.rl);if(s&&(this.props=sr({},s)),this.Zo&&this.Dl(),e&&s){var n,o,a=null==i?void 0:i[be],h=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",l=s[be],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(l!==a||u!==h){this.Qo=!0,Ur.At(gs(this.rl),!0);var d=sr({},this.props);Er.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==h&&"anonymous"!==r.$user_state&&(C(a)||l===a)||(Ts(d,r),delete d[li]),this.props=d;var v=new Set;Er.forEach(t=>{var e,i=null==(e=Xr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};rr(this.props,(i,r)=>{var s;(null==(s=Xr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),O(e)?(xr.Lt(this.hl(t)),this.Wo[t]={}):xr.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Ur.Ot(gs(this.rl))&&(this.Qo=!0)}}Dl(){for(var t of Jr){var e=xr.Dt(this.hl(t));if(e&&!O(e)){var i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||sr(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Xr(e))?void 0:i.storageGroup)===t})}Nl(t,e){var i=ps[t];if(!i)return!1;var r=e[i],s=this.props[i];return F(r)&&F(s)&&s>r}refreshKey(t){var e;if(!this.pi&&!this.el.has(t)){var i=this.Zo?null==(e=Xr(t))?void 0:e.storageGroup:void 0,r=i?xr.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(r&&t in r)this._l(t,r[t],!1);else{if(i){var s=this.Fo.Dt(this.rl);if(s&&t in s)return void this._l(t,s[t],!1)}this.wl(t,!1)}}}save(){if(!this.pi){var t=this.$l();t>0?C(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}}flush(){C(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t){if(void 0===t&&(t=!1),!(this.pi||this.Jo&&!t)){t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||$s.forEach(t=>this.refreshKey(t)));var e=!t&&!this.Xo;e||(this.tl=!1);var i=!!e&&this.kl();if(this.tl)this.Mr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));var r=this.jl(this.Fo,this.rl,this.props,bs);"written"===r&&this.Tl(this.props),"failed"!==r&&(this.Ko.clear(),this.Yo=!1,this.el.clear()),i&&this.il.forEach(t=>t())}}}ql(){var t=this,e=this.gl(),i=e.main,r=e.groups,s=this.jl(this.Fo,this.rl,i,bs);"written"===s&&this.Tl(i),"failed"!==s&&(this.Yo=!1,this.el.clear(),ys.forEach(t=>{var e;null!=(e=Xr(t))&&e.storageGroup||this.Ko.delete(t)}));var n=function(e){var i,s=r[e];if(O(s)&&(null==(i=t.Wo[e])||!i.persisted))return ys.forEach(i=>{var r;(null==(r=Xr(i))?void 0:r.storageGroup)===e&&t.Ko.delete(i)}),1;var n=t.jl(xr,t.hl(e),s,e);"failed"!==n&&ys.forEach(i=>{var r=Xr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.Ko.delete(i)})};for(var o of Jr)if(n(o))continue}gl(){var t={},e={flags:{},surveys:{}};return rr(this.props,(i,r)=>{var s,n=null==(s=Xr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}yl(t,e){if(e===bs)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;var i={};return rr(t,(t,e)=>{var r;i[e]=null!=(r=Xr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,r){var s,n=this.vl(r);if(r!==bs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.yl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,r!==bs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.Vo&&(n.storageValue=xr.Ot(e)),"written"):(this.Mr.debug&&ue.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.xl(),C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!i&&this.nl)for(var r of Jr)xr.Lt(this.hl(r));i?delete this.Wo[bs]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(I(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Bl=C(i)?this.Ul:i;var r=!1;if(rr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(I(t)){this.syncCookieProperties(),this.Bl=C(e)?this.Ul:e;var i=!1;if(rr(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||I(e)||P(e))&&(this._l(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.wl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.sl){var e=function(t,e,i){if(!h)return{};var r,s=e?[...is,...i||[]]:[],n=os(es(h.URL,s,ss),t);return sr((r={},rr(ns,function(t){var e=dr(t);r[t]=e||null}),r),n)}(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!O(or(e));return i&&this.register(e),this.sl=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?as(t):{})}update_referrer_info(){var t;this.register_once({$referrer:us(),$referring_domain:null!=h&&h.referrer&&(null==(t=Zr(h.referrer))?void 0:t.host)||ls},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=ds(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Ci]:this.Go?{r:ms(t.r),u:t.u?ms(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};rr([Oi,Ii],e=>{var i=this.props[e];i&&rr(i,function(e,i){t["$initial_"+x(i)]=e})});var e=this.props[Ci];return e&&sr(t,function(t,e){void 0===e&&(e=!1);var i=vs(t,e),r={};return rr(i,function(t,e){r["$initial_"+x(e)]=t}),r}(e,this.Mr.disable_capture_url_hashes)),t}safe_merge(t){return rr(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((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||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,h=t.disable_persistence||!!r,l=!!this.pi&&!h;h||this.El(e,l),this.Mr=t,!h&&(s||n||a)&&(this.Il=void 0,this.Ml=void 0,this.El(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=o||a?this.ol(t):this.Fo;this.Wl();var d=this.ll(t),v=o||d!==this.Zo,c=!h&&(v||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(l);this.Xo=v;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(h),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var _=this.props;this.clear(),this.Fo=u,this.Zo=d,this.props=_,this.save()}else a&&(this.Fo=u,h||(delete this.Wo[bs],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){var t=this.props[Ci];if(this.Go&&I(t)&&"string"==typeof t.r){var e=ms(t.r),r="string"==typeof t.u?ms(t.u):t.u;e===t.r&&r===t.u||this._l(Ci,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this._l(Pe,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this._l(Pe,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),Ss(t)&&!xs(s,e)&&this.el.add(t),this.Cl(t,s,e),null!=(r=Xr(t))&&r.volatile||this.Sl(t))}wl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(ws(t)&&this.dl(t,!0),Ss(t)&&this.el.add(t),this.Sl(t))}Sl(t){var e,i=null==(e=Xr(t))?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}},Ps={GZipJS:"gzip-js",Base64:"base64"},Rs={Activation:"events",Cancellation:"cancelEvents"},Is={Button:"button",Tab:"tab",Selector:"selector"},Os={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"},Cs={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},As={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ms={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ns={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ds={Once:"once",Recurring:"recurring",Always:"always"},Fs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Us={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"},Bs={Popover:"popover",Inline:"inline"};function Ls(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var js={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},zs={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"},Ws={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"},Gs=de("[RateLimiter]"),qs=class{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=>{Gs.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Gs.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("$capture_rate_limit"))&&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=(F(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Vl(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(Ri,a),{isRateLimited:h,remainingTokens:a.tokens}}Gl(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&null!=l&&l.pathname)return""+(null!==(t=l.origin)&&void 0!==t?t:"")+l.pathname}Vl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Zl(),o=this.Gl("$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}},Hs=de("[RemoteConfig]"),Vs=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=f._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ql(t){var e,i;null!=(e=f.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(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 Hs.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Hs.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return Hs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){Hs.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||Hs.warn("Failed to fetch remote config from PostHog."):Hs.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){Hs.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){Hs.error("Error loading feature flags",t)}}},Js=["fatal","error","warning","log","info","debug"],Ks=Uint8Array,Ys=Uint16Array,Xs=Uint32Array,Qs=new Ks([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]),Zs=new Ks([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]),tn=new Ks([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),en=function(t,e){for(var i=new Ys(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Xs(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]},rn=en(Qs,2),sn=rn[1];rn[0][28]=258,sn[258]=28;for(var nn=en(Zs,0)[1],on=new Ys(32768),an=0;32768>an;++an){var hn=(43690&an)>>>1|(21845&an)<<1;on[an]=((65280&(hn=(61680&(hn=(52428&hn)>>>2|(13107&hn)<<2))>>>4|(3855&hn)<<4))>>>8|(255&hn)<<8)>>>1}var ln=function(t,e,i){for(var r=t.length,s=0,n=new Ys(e);r>s;++s)++n[t[s]-1];var o,a=new Ys(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Ys(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[on[d]>>>h]=l}else for(o=new Ys(r),s=0;r>s;++s)o[s]=on[a[t[s]-1]++]>>>15-t[s];return o},un=new Ks(288);for(an=0;144>an;++an)un[an]=8;for(an=144;256>an;++an)un[an]=9;for(an=256;280>an;++an)un[an]=7;for(an=280;288>an;++an)un[an]=8;var dn=new Ks(32);for(an=0;32>an;++an)dn[an]=5;var vn=ln(un,9,0),cn=ln(dn,5,0),_n=function(t){return(t/8|0)+(7&t&&1)},pn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Ys?Ys:t instanceof Xs?Xs:Ks)(i-e);return r.set(t.subarray(e,i)),r},fn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},gn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},mn=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 Ks(0),0];if(1==s){var o=new Ks(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 Ys(v+1),_=bn(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 b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Ks(c),_]},bn=function(t,e,i){return-1==t.s?Math.max(bn(t.l,e,i+1),bn(t.r,e,i+1)):e[t.s]=i},yn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Ys(++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]},wn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},$n=function(t,e,i){var r=i.length,s=_n(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)},Sn=function(t,e,i,r,s,n,o,a,h,l,u){fn(e,u++,i),++s[256];for(var d=mn(s,15),v=d[0],c=d[1],_=mn(n,15),p=_[0],f=_[1],g=yn(v),m=g[0],b=g[1],y=yn(p),w=y[0],S=y[1],x=new Ys(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var T=mn(x,7),k=T[0],P=T[1],R=19;R>4&&!k[tn[R-1]];--R);var I,O,C,A,M=l+5<<3,N=wn(s,un)+wn(n,dn)+o,D=wn(s,v)+wn(n,p)+o+14+3*R+wn(x,k)+(2*x[16]+3*x[17]+7*x[18]);if(N>=M&&D>=M)return $n(e,u,t.subarray(h,h+l));if(fn(e,u,1+(N>D)),u+=2,N>D){I=ln(v,c,0),O=v,C=ln(p,f,0),A=p;var F=ln(k,P,0);for(fn(e,u,b-257),fn(e,u+5,S-1),fn(e,u+10,R-4),u+=14,E=0;R>E;++E)fn(e,u+3*E,k[tn[E]]);u+=3*R;for(var U=[m,w],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)fn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(fn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else I=vn,O=un,C=cn,A=dn;for(E=0;a>E;++E)if(r[E]>255){var j;gn(e,u,I[257+(j=r[E]>>>18&31)]),u+=O[j+257],j>7&&(fn(e,u,r[E]>>>23&31),u+=Qs[j]);var z=31&r[E];gn(e,u,C[z]),u+=A[z],z>3&&(gn(e,u,r[E]>>>5&8191),u+=Zs[z])}else gn(e,u,I[r[E]]),u+=O[r[E]];return gn(e,u,I[256]),u+O[256]},xn=new Xs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),En=new Ks(0),Tn=function(){for(var t=new Xs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),kn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Pn(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=Tn[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,u=(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 Ks(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=$n(h,l,t.subarray(u,d)):(h[u]=n,l=$n(h,l,t.subarray(u,o)))}else{for(var v=xn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Ys(32768),g=new Ys(p+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},w=new Xs(25e3),S=new Ys(288),x=new Ys(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var I=y(u),O=32767&u,C=g[I];if(f[O]=C,g[I]=O,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){l=Sn(t,h,0,w,S,x,T,k,R,u-R,l),k=E=T=0,R=u;for(var M=0;286>M;++M)S[M]=0;for(M=0;30>M;++M)x[M]=0}var N=2,D=0,F=_,U=O-C&32767;if(A>2&&I==y(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&O!=C;){if(t[u+N]==t[u+N-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>N){if(N=z,D=U,z>B)break;var W=Math.min(U,z-2),G=0;for(M=0;W>M;++M){var q=u-U+M+32768&32767,H=q-f[q]+32768&32767;H>G&&(G=H,C=q)}}}U+=(O=C)-(C=f[O])+32768&32767}if(D){w[k++]=268435456|sn[N]<<18|nn[D];var V=31&sn[N],J=31&nn[D];T+=Qs[V]+Zs[J],++S[257+V],++x[J],P=u+N,++E}else w[k++]=t[u],++S[t[u]]}}l=Sn(t,h,n,w,S,x,T,k,R,u-R,l),n||(l=$n(h,l,En))}return pn(a,0,r+_n(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,!l)),d=u.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&&kn(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)}}(u,e),kn(u,d-8,i.d()),kn(u,d-4,r),u}var Rn=!!d||!!u,In=new WeakMap,On="text/plain",Cn=0,An=!1,Mn=(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:"")},Nn=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],h=i({},e),l=null!==(s=null==a?void 0:a.split("&").map(t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=h[s])&&void 0!==e?e:i[1];return delete h[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return rr(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)}(h);return u&&l.push(u),l.length>0?o+"?"+l.join("&"):o},Dn=t=>{if(t.Yl)return t.Yl;var e=t.data,i=t.compression;if(e){if(i===Ps.GZipJS){var r=Pn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Ks(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},n=0;e>n;++n){if(r+5>i.length){var o=new Ks(r+8+(e-n<<1));o.set(i),i=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return pn(i,0,r)}(Qr(e)),{mtime:0});return{contentType:On,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ps.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Qr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Qr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Qr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Fn=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Nn(t.url,{compression:Ps.Base64}),encodedBody:Dn(i({},t,{compression:Ps.Base64,Yl:void 0}))}:{url:Mn(t.url,"compression"),encodedBody:Dn(i({},t,{compression:void 0,Yl:void 0}))};try{e=Dn(t)}catch(e){if(se(t.compression,ts(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,ts(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(An=!0,s()):{url:t.url,encodedBody:e}},Un=t=>{try{return Fn(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Bn=function(){var t=s(function*(t){var e=yield function(t,e,i){return he.apply(this,arguments)}(Qr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Yl:{contentType:On,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Ln=/Failed to fetch|NetworkError|Load failed/i,jn=t=>"TypeError"===(null==t?void 0:t.name)&&Ln.test((null==t?void 0:t.message)||""),zn=t=>{try{var e=function(t,e){if(void 0===e&&(e=Date.now()),"string"==typeof t&&t){var i=t.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){var s=1e3*Math.min(Number(r),300);return s>0?s:void 0}if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r)){var n=/^\w{3} \w{3} /.test(r)?r+" GMT":r,o=Date.parse(n)-e;if(Number.isFinite(o)&&o>0)return Math.min(o,3e5)}}}(t());return C(e)?void 0:Math.min(e,3e4)}catch(t){return}},Wn=t=>{var e=Un(t);if(e){var i=new d;In.set(i,!0);var r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;rr(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,zn(()=>i.getResponseHeader("Retry-After")))}},i.send(o)}},Gn=t=>{var e=Un(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,h=n.estimatedSize,l=new Headers;rr(t.headers,function(t,e){l.append(e,t)}),o&&l.append("Content-Type",o);var d=null,c=!1;if(v){var _=new v;d={signal:_.signal,timeout:setTimeout(()=>{var e;c=!0,_.abort(Qt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))},t.timeout)}}var p=e=>{c&&"AbortError"===(null==e?void 0:e.name)||jn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})},f=0,g=()=>{Cn-=f,f=0,d&&clearTimeout(d.timeout)};try{var m,b=i({method:(null==t?void 0:t.method)||"GET",headers:l,body:a,signal:null==(m=d)?void 0:m.signal},t.fetchOptions),y=null!=h?h:C(a)?0:void 0;b.keepalive="POST"===b.method&&!t.ta&&!1!==b.keepalive&&b.body===a&&!C(y)&&y>=0&&52428.8>Cn+y,b.keepalive&&(Cn+=f=y),u(r,b).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){ue.error(t)}g(),null==t.callback||t.callback(r,zn(()=>e.headers.get("Retry-After")))})).catch(t=>{g(),p(t)}).finally(g)}catch(t){g(),p(t)}}},qn=t=>{try{var e,r=Fn(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},h=o.body,l=o.estimatedSize;if(!h)return;var d=h instanceof Blob?h:new Blob([h],{type:o.contentType});if(a.sendBeacon(s,d))return;var v=P(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(P(v)&&v.length>1&&(null!=l?l:0)>16384){var c=Math.ceil(v.length/2),_=e=>P(t.data)?e:i({},t.data,{batch:e});return qn(i({},t,{data:_(v.slice(0,c))})),void qn(i({},t,{data:_(v.slice(c))}))}ue.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(u?"fetch":"XHR")),u?Gn(i({},t,{ta:!0})):Wn(t)}catch(t){ue.warn("Beacon send failed",t)}},Hn=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Nn(r===Ps.GZipJS?Mn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ps.GZipJS?{}:{compression:r}))},Vn=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Gn}),d&&t.push({transport:"XHR",method:Wn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:qn}),t})(),Jn=!Rn&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla"));function Kn(t,e,r){var s;r&&(e=i({},e,{callback:t=>r(t)})),t.__loaded?Jn?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=i({},t.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(s=t.compression)&&void 0!==s?s:e.compressionFallback:e.compression,(C(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var r,s,n,o=i({},t,{callback:null!=e?e:e=>null==t.callback?void 0:t.callback(e)});o.timeout=o.timeout||6e4;var a,h,l,u,d,v=null!==(r=o.transport)&&void 0!==r?r:"fetch";"sendBeacon"===v&&C(o.compression)&&o.data&&(o.compression=Ps.Base64),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!==(h=null==(d=(u=(P(a=o.data)?a:[a]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=d.properties)?void 0:l.token)&&void 0!==h?h:null==d?void 0:d.token,batch:u,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(o.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),P(t)?t.map(t=>i({},t,{sent_at:e})):i({},t,{sent_at:e})}(o.data))),o.url=Hn(o.url,o.method,o.compression,o.timestampMode);var _=Vn.filter(t=>!o.disableTransport||!t.transport||!o.disableTransport.includes(t.transport)),p=null!==(s=null==(n=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(_,t=>t.transport===v))?void 0:n.method)&&void 0!==s?s:_[0].method;if(!p)throw new Error("No available transport method");var f=t=>{try{p(t)}catch(t){jn(t)?ue.warn(t):ue.error(t),null==o.callback||o.callback({statusCode:0,error:t})}};"sendBeacon"!==v&&o.data&&o.compression===Ps.GZipJS&&c&&"undefined"!=typeof Promise&&!An?Bn(o).then(t=>{f(t)}).catch(e=>{if(ne(e))return An=!0,void f(i({},o,{compression:void 0,url:Hn(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 ne(t)||e===ie})(e)&&(An=!0),f(o)}):p(o)})(e,(i,s)=>{t.rateLimiter.checkForLimiting(i),400>i.statusCode||null==t.config.on_request_error||t.config.on_request_error(i),r?r(i,s):null==e.callback||e.callback(i)})):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}var Yn=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();var t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(t,"sendBeacon")})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){var t=this.aa();for(var e in t)this.ua(t[e])}},this.na))}ua(t,e){try{this.sa(t,e)}catch(t){ue.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){var t={};return rr(this.ia,e=>{var r,s=e,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?":"+s.batchGroup:"");C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.ia=[],t}},Xn=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.da=n.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},ur(n,"online",this.va),ur(n,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t,r){var s=t.retriesPerformedSoFar,n=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,e);U(s)&&(n.url=Nn(n.url,{retry_count:s})),Kn(this._instance,r?i({},n,{transport:r}):n,(t,e)=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.Ls(i({retriesPerformedSoFar:s},n),e);0===t.statusCode&&ue.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!=s?s:0)+" retries.")}null==n.callback||n.callback(t)})}Ls(t,e){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var r=Math.max(function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(i),null!=e?e:0),s=Date.now()+r;this.ia.push({retryAt:s,requestOptions:t});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),ue.warn(n),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){var t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,C(n)||(this.va&&(n.removeEventListener("online",this.va),this.va=void 0),this.pa&&(n.removeEventListener("offline",this.pa),this.pa=void 0)),this.ia)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.ia=[]}},Qn=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,r;this.ba||(this.ba={});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.ba.lastScrollY=Math.ceil(n),this.ba.maxScrollY=Math.max(n,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(h,null!==(r=this.ba.maxContentHeight)&&void 0!==r?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){var t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){ur(n,"scroll",this.ya,{capture:!0}),ur(n,"scrollend",this.ya,{capture:!0}),ur(n,"resize",this.ya)}scrollElement(){var t;if(!this._a)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this._a)?this._a:[this._a]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}wa(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this._a){var s=this.scrollElement();return s&&s[r]||0}return n?"y"===t?n.scrollY||n.pageYOffset||(null==(e=n.document)||null==(e=e.documentElement)?void 0:e.scrollTop)||0:n.scrollX||n.pageXOffset||(null==(i=n.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}},Zn=t=>ds(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),to=class{constructor(t,e,i,r){this.je=t=>{var e=this.ka();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Pi]:i})}},this._instance=t,this.Ca=e,this.xa=i,this.Sa=r||Zn,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Pi]}getSetOnceProps(){var t,e=null==(t=this.ka())?void 0:t.props;return e?"r"in e?vs(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 rr(or(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+x(i)]=e}),t}},eo=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.$a[t]||[])i(e);for(var r of this.$a["*"]||[])r(t,e)}constructor(){this.$a={}}},io=de("[SessionId]"),ro=864e5,so=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var r;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new eo,this.Aa=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||gr,this.Da=i||gr;var s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*J(this.Mr.session_idle_timeout_seconds||1800,60,36e3,io.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){var n=Ur.Dt(this.Na),o=Ur.Dt(this.qa);n&&!o?this.Be=n:Ur.Lt(this.Na),Ur.At(this.qa,!0)}null!=(r=this.Mr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Ur.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Ur.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Ur.Dt(this.Na):null}Ua(t){var e=this.Ia;return!N(e)&&!N(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!r||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[He]:[e,t,i]}))}Va(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(He):(this.xa.flush(),this.xa.load())}Za(){var t;if(!N(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ia){this.Ga();var e=this.Qa();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[He]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}}Ja(){var t=this.Qa()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){var t=this.xa.props[He];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(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 io.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void io.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&n&&(n.removeEventListener(Xi,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ur.Lt(this.qa)},ur(n,Xi,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=r;else if(N(this.Ma)||this.Ma>r||r-this.Ma>=1e3){var n,o;null==(n=(o=this.xa).syncCookieProperties)||n.call(o),this.Ma=r}var a=this.Qa(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.Ja(),v=this.za(),c=this.Fa,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>ro),p=c?_:U(l)&&Math.abs(r-l)>ro,f=!1,g=u,m=!h||!!c,b=h,y=!m&&!t&&this.Aa(r,d);if(y){(y=this.Ka(r))||io.info("cross-tab refresh kept the session alive",{sessionId:h});var w=this.Qa();h=w[1],l=w[2]}if(m||y||p){g=!1;var S=c&&!_;h=S?c.sessionId:this.Oa(),v=this.Da(),io.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=S?c.sessionStartTimestamp:r,this.Fa=void 0,f=!0}else v||(v=this.Da(),f=!0),(g=g||h!==b)&&(io.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var x=U(d)&&t&&!p?d:r,E=U(l)?l:(new Date).getTime();this.Ha(v),this.Wa(h,x,E),t||this.La();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ea.forEach(t=>t(h,v,T)),{sessionId:h,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};function no(){return(no=s(function*(){var t=null==a?void 0:a.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e,i=null==(e=yield t.getHighEntropyValues(["model"]))?void 0:e.model;return A(i)&&i.length>0?i:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function oo(t,e){var i="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(i="$survey_"+e+"/"+t.id+"/"+t.current_iteration),i}function ao(t,e,i){return Qr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var ho,lo="custom",uo="i.posthog.com",vo=/^\/static\//,co=["/s/","/e/","/i/"],_o=class{constructor(t){this.Ya={},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("."+uo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[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":lo),this.Ya[this.apiHost]}tu(t){if(vo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}eu(t){var e=Zr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Zr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&co.some(t=>0===e.indexOf(t))){var a=this.eu(r);if(a){var h,l=this.apiHost,u=this.nu;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(this.nu=u={apiHost:l,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.nu,i=this.eu(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.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.tu(e);if(i)return this.iu(t,e,""+i+e)}if(this.region===lo)return this.iu(t,e,this.apiHost+e);var r=uo+e;switch(t){case"assets":return this.iu(t,e,"https://"+this.region+"-assets."+r);case"api":return this.iu(t,e,"https://"+this.region+"."+r)}}},po=de("[Surveys]"),fo={ignoreConditions:!1,ignoreDelay:!1,displayType:Bs.Popover},go=de("[PostHog ExternalIntegrations]"),mo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bo=class{constructor(t){this._instance=t}No(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return go.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=f.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.No(mo[n],()=>{var e;null==(e=f.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=f.__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()}}},yo=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return s(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.su.set(t.name,t);try{var i=t.setup(e.po);i&&(yield i)}catch(i){var r=e.su.get(t.name)===t;r&&e.su.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(!this.So){this.So=!0;var t=Array.from(this.su.values()).reverse();for(var e of(this.su.clear(),t))this.ru(e)}}ru(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,e=>{this.$.error('Failed to dispose browser extension "'+t.name+'"',e)})}catch(e){this.$.error('Failed to dispose browser extension "'+t.name+'"',e)}}},wo=class{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)}},$o="extensionsRemoteConfig",So=class{constructor(t){this.instance=t,this.So=!1,this.$=ue,this.ou=t.lu,this.kv=new wo(t),this.onEvent=t=>Ls(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return Ls(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on($o,e);return this.ou&&e(this.ou),Ls(i)},this.uu=new yo(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ye);return"string"==typeof t?t:void 0}get library(){return{name:ge.LIB_NAME,version:ge.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.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var r=this;return s(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 Ls(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit($o,t))}sendRequest(t,e){var i=this;return s(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?Nn(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?b.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.So||(this.So=!0,this.uu.dispose())}},xo={},Eo=0,To=()=>{},ko='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Po="Surveys module not available",Ro="sanitize_properties is deprecated. Use before_send instead",Io="Invalid value for property_denylist config: ",Oo=/^[A-Za-z0-9_-]{1,400}$/,Co=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ao=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Mo=["token","distinct_id",Ni],No="posthog",Do=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},Fo=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:lr(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:To,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&A(null==l?void 0:l.search)&&-1!==l.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(e=n.location)?void 0:e.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){ue.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:Ki,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:To},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Lr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Do(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)}))(t))},Uo=[["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"]],Bo=t=>{var e={};for(var i of Uo){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=sr({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),A(o)&&C(t.asset_host)&&(n.asset_host=o)),P(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:P(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error(Io+t.property_denylist)),n},Lo=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},jo=(t=class t{du(t){if(t){var e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}}vu(t,e){return this.du(t),this.su.push(e),null==e.initialize||e.initialize(),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(!(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.mu||(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', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!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)))}}yu(){if(!this.fu()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.bu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(gr());this.register({distinct_id:i,$device_id:i}),t.set_property(ki,Vi)}this._u()}}}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 e;this.wu=!1,this.ku=!1,this.webPerformance=new Lo,this.Su=!1,this.version=ge.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new eo,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Fo(),this.SentryIntegration=Hr,this.sentryIntegration=t=>function(t,e){var i=qr(t,e);return{name:Gr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Qn(this),this.pageViewManager=new Vr(this),this.rateLimiter=new qs(this),this.requestRouter=new _o(this),this.consent=new Br(this),this.externalIntegrations=new bo(this);var i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t))}init(e,i,r){if(r&&r!==No){var s,n=null!==(s=xo[r])&&void 0!==s?s:new t;return n._init(e,i,r),xo[r]=n,xo[No][r]=n,n}return this._init(e,i,r)}_init(t,e,r){var s,o,a;void 0===e&&(e={});var h,l=A(t)?t.trim():"";if(!l)return ue.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 l!==(null==(h=this.config)?void 0:h.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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Fo(e.defaults),e.debug=this.Pu(e.debug),this.Ru=e,this.Au=[],e.person_profiles?this.Mu=e.person_profiles:e.process_person&&(this.Mu=e.process_person);var u=Fo(e.defaults),d=Bo(e),v=sr({},u,d,{name:r,token:l});I(u.rageclick)&&I(d.rageclick)&&(v.rageclick=sr({},u.rageclick,d.rageclick)),I(u.session_recording)&&I(d.session_recording)&&(v.session_recording=sr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ps.GZipJS;var c=this.bu();if(this.persistence=new ks(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ks(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Ur.Et()){var _=Ur.Dt(this.Cu);P(_)&&_.forEach(t=>{A(t)&&this.xu.add(t)})}else Ur.Lt(this.Cu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Yn((t,e)=>this.Ou(t,e),this.config.request_queue_config),this.Du=new Xn(this),this.__request_queue=[];var g=this.fu();g||(this.sessionManager=new so(this),this.sessionPropsManager=new to(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(g)},0)):(ue.info("Initializing extensions synchronously"),this.qu(g)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&ue.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:f}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(o=e.bootstrap)?void 0:o.distinctID;if(this.mu=!!m&&!M(m),null!=(a=e.bootstrap)&&a.distinctID){var b=e.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(ki);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"anonymous"===w)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"identified"===w)ue.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 S=this.config.get_device_id(gr()),x=e.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(ki,e.bootstrap.isIdentifiedID?Ji:Vi),this.register({distinct_id:b,$device_id:x})}}if(g)this.register_once({distinct_id:Mi,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(gr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(ki,Vi)}return ur(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ur(n,"pageshow",()=>{var t;this.wu=!1,this.ku||null==(t=this.Du)||t.resume()}),e.segment?Wr(this,()=>this.ju()):this.ju(),R(this.config._onCapture)&&this.config._onCapture!==To&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ue.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 no.apply(this,arguments)}().then(t=>{t&&this.register({[we]:t})}).catch(To),this}Bu(t){var e=t;return A(e.name)&&R(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.su.push(t)}Nu(){var e,i,r,s,n,o,a=null!==(e=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==e?e:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.Uu)||o.call(this),this.Uu=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}qu(e){var r,s,n,o,a,h,l,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.su.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.su.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.su.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.su.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Hu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Hu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Hu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.su.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.su.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.su.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.su.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.su.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,jr)),d.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new d.toolbar(this)),d.experiments&&this.su.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new d.experiments(this)),this.su.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Wu){var t=this.Wu;this.Wu=void 0,this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.Vu(v,u)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Di]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fi]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Kl(t){var e;if(!h||!h.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=S(r.supportedCompression,Ps.GZipJS)?Ps.GZipJS:S(r.supportedCompression,Ps.Base64)?Ps.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Ki}),null==(e=this.Gu)||e.handleRemoteConfig(t),this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}ju(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&null!=l&&l.hostname){var t=l.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.fu())&&this.Qu()},1),this.Ju=new Vs(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Fu)||t.enable())}_dom_loaded(){this.is_capturing()&&ir(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,r,s;this.wu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Zi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Fu)||r.unload(),null==(s=this.Du)||s.unload()):this.Ku()&&this.capture(Zi,null,{transport:"sendBeacon"})}_send_request(t){Kn(this,t)}Ou(t,e){this.Du?this.Du.retriableRequest(t,e):this._send_request(e?i({},t,{transport:e}):t)}_execute_array(t){Eo++;try{var e,i=[],r=[],s=[];ir(t,t=>{if(t)if(P(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else P(t)&&"alias"===e?i.push(t):P(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)});var n=function(t,e){ir(t,function(t){try{if(P(t[0])){var i=e;rr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}})};n(i,this),n(r,this),n(s,this)}finally{Eo--}}push(e){if(Eo>0&&P(e)&&A(e[0])){var i=t.prototype[e[0]];R(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}get Xu(){return{property:xe,persistenceKey:Ee,cookieName:"_fbc",pattern:Co,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Ee]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(Ee)}}}get Yu(){return{property:Te,persistenceKey:ke,cookieName:"_fbp",pattern:Ao,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[ke]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(ke)}}}th(t){var e,i=null==(e=this.persistence)?void 0:e.get_property(t.persistenceKey);return A(i)&&t.pattern.test(i)?{value:i,delivered:!1}:I(i)&&A(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}eh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ih(t){if(this.config.save_campaign_params&&!this.fu()){var e=dr(t.cookieName);return A(e)&&t.pattern.test(e)?e:void 0}}nh(t,e,i,r){if(this.persistence){var s=this.Xu;this.persistence.refreshKey(s.persistenceKey);var n=this.th(s);if(!r){if(i)return A(e)&&Co.test(e)?this.eh(s,e,n):void s.unregister();var o=A(t)&&Oo.test(t)?t:void 0,a=this.ih(s);return a&&((t,e,i)=>{var r=t.split(".");if(e)return r[3]===e;if(!i)return!0;var s=i.value.split(".");return r[3]===s[3]||Number(r[2])>Number(s[2])})(a,o,n)?this.eh(s,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this.eh(s,"fb.1."+Date.now()+"."+o,n):n?{value:n.value,pending:!n.delivered}:void 0}s.unregister()}}sh(t,e,i){if(this.persistence){var r=this.Yu;this.persistence.refreshKey(r.persistenceKey);var s=this.th(r);if(!i){if(e)return A(t)&&Ao.test(t)?this.eh(r,t,s):void r.unregister();var n=this.ih(r);return n?this.eh(r,n,s):s?{value:s.value,pending:!s.delivered}:void 0}r.unregister()}}rh(t,e){if(this.persistence){this.persistence.refreshKey(t.persistenceKey);var i=this.th(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}}capture(t,e,r){var s,n,o,a,h,l,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu){if(this.is_capturing())if(!C(t)&&A(t)){this.yu();var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var v=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){var c;null!=e&&e.$current_url&&!A(null==e?void 0:e.$current_url)&&(ue.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!=r&&r._originatedFromCaptureException||ue.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&&(c=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 _=new Date,p=(null==r?void 0:r.timestamp)||_,f=Xt(null==r?void 0:r.uuid,gr),g={uuid:f,event:t,properties:this.calculateEventProperties(t,e||{},p,f)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&d&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),v&&(g.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var m="$feature_flag_called"===t&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!m&&(g.$set=null==r?void 0:r.$set);var b=I(null==e?void 0:e.$set)?e.$set:void 0,y=P(null==e?void 0:e.$unset)?e.$unset:[],w=(null==r?void 0:r.$unset)||[],S=t=>{var e,i=!(null==r||!r.$set)&&t in r.$set;return{hasProvided:i||!!b&&t in b,provided:i?null==r||null==(e=r.$set)?void 0:e[t]:null==b?void 0:b[t],unset:-1!==y.indexOf(t)||-1!==w.indexOf(t)}},x=S(xe),E=S(Te),T=[{channel:this.Xu,hasProvided:x.hasProvided,update:this.nh(null==(s=c)?void 0:s.fbclid,x.provided,x.hasProvided,x.unset)},{channel:this.Yu,hasProvided:E.hasProvided,update:this.sh(E.provided,E.hasProvided,E.unset)}];for(var k of T){var R=k.channel,M=k.update;M&&!0===g.properties.$process_person_profile&&M.pending&&!k.hasProvided&&!m&&(g.$set=i({[R.property]:M.value},g.$set))}var N=null==r?void 0:r.$unset;N&&(g.$unset=N);var F=m?void 0:this.ah(null==r?void 0:r.$set_once,t!==er,t===tr);if(F&&(g.$set_once=F),null!=r&&r._noTruncate||(a=this.config.properties_string_max_length,h=g,l=t=>A(t)?t.slice(0,a):t,u=new Set,g=function t(e,i){if(e!==Object(e))return l?l(e):e;if(!u.has(e)){var r;if(u.add(e),P(e))r=[],ir(e,e=>{r.push(t(e))});else{var s={};rr(z(e)?ar(e):e,(e,i)=>{u.has(e)||(s[i]=t(e,i))}),r=s}return r}}(h)),g.timestamp=p,C(null==r?void 0:r.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=_),m&&(g.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ee.forEach(r),e.forEach(r),i}(g.properties,Mo)),t===Fs.DISMISSED||t===Fs.SENT){var U=null==e?void 0:e[Us.SURVEY_ID],B=null==e?void 0:e[Us.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){po.error("Failed to persist survey seen state",t)}})({id:U,current_iteration:B}),g.$set=i({},g.$set,{[oo({id:U,current_iteration:B},t===Fs.SENT?"responded":"dismissed")]:!0})}else t===Fs.SHOWN&&(g.$set=i({},g.$set,{[Us.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===zs.SHOWN){var L=null==e?void 0:e[Ws.TOUR_TYPE];L&&(g.$set=i({},g.$set,{[Ws.TOUR_LAST_SEEN_DATE+"/"+L]:(new Date).toISOString()}))}var j=i({},g.properties.$set,g.$set);if(O(j)||this.setPersonPropertiesForFlags(j),!D(this.config.before_send)){var W=this.Os(g);if(!W)return;(g=W).uuid=Xt(g.uuid,gr)}var G=T.filter(t=>{var e,i,r,s=t.channel,n=t.update,o=null!==(e=null==(i=g.$set)?void 0:i[s.property])&&void 0!==e?e:I(null==(r=g.properties)?void 0:r.$set)?g.properties.$set[s.property]:void 0;return(null==n?void 0:n.pending)&&o===n.value});this.au.emit("eventCaptured",g);var q,H,V=null!==(n=null==r?void 0:r._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),J="recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(V),K=i({method:"POST",url:V,data:g,compression:"best-available",timestampMode:J?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},J&&null!=(o=g.properties)&&o.$session_id?{batchGroup:g.properties.$session_id+(g.properties.$window_id?"-"+g.properties.$window_id:"")}:{},null!=r&&r.transport?{transport:r.transport}:{},G.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(var e of G)this.rh(e.channel,e.update.value)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||G.length?(!K.transport&&!K.callback&&O(null!==(q=this.config.request_headers)&&void 0!==q?q:{})&&this.wu&&(H="sendBeacon"),this.Ou(K,H)):this.Fu.enqueue(K),g}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null==(e=this.Gu)?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new So(this)}hu(t){this.$u.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}}uh(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.xu.clear(),this.hh()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.uh();var a=o?void 0:this.persistence.remove_event_timer(t),u=i({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.fu()&&(u[Ni]=!0),"$snapshot"===t){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!A(u.distinct_id)&&!F(u.distinct_id)||M(u.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,c=function(t,e,i,r){var s,o,a,h;if(void 0===r&&(r=!1),!_)return{};var u,d=t?[...is,...e||[]]:[],v=function(t){for(var e=0;Ht.length>e;e++){var i=Ht[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(_),c=v[0],p=v[1],f=function(t){for(var e=0;Kt.length>e;e++){var i,r=Kt[e],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(i=n&&t.match(n)||o)?void 0:i[1])||""]}return["",""]}(_),g=f[0],b=f[1],y=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},w={};C(i)||(w.detectGoogleSearchApp=i);var S={},x=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,T=null==n||null==(a=n.screen)?void 0:a.width,k=null==n||null==(h=n.screen)?void 0:h.height,P=null==n?void 0:n.devicePixelRatio;C(x)||(S.userAgentDataPlatform=x),C(E)||(S.maxTouchPoints=E),C(T)||(S.screenWidth=T),C(k)||(S.screenHeight=k),C(P)||(S.devicePixelRatio=P);var I,O,A,M,N,D,F,U,B=sr(or({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,y,w),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(O=_,A=S,U=Vt(O),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===yt?"Console":U===tt?"Wearable":U?K:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(M=null==A?void 0:A.maxTouchPoints)&&void 0!==M?M:0)>0?600>Math.min(null!==(N=null==A?void 0:A.screenWidth)&&void 0!==N?N:0,null!==(D=null==A?void 0:A.screenHeight)&&void 0!==D?D:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?K:X:"Desktop"),$timezone:cs(),$timezone_offset:_s()}),{$current_url:es(r?Zt(null==l?void 0:l.href):null==l?void 0:l.href,d,ss),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:qt(_,navigator.vendor,y,w),$browser_language:hs(),$browser_language_prefix:(I=hs(),"string"==typeof I?I.split("-")[0]:void 0),$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(B.$sdk_dist_channel=m.SDK_DIST_CHANNEL),B}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),f=p.windowId;u.$session_id=p.sessionId,u.$window_id=f}this.sessionPropsManager&&sr(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&sr(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Du)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===lo&&(u.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||o?"$pageleave"!==t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=sr(u,v),"$pageview"===t&&h&&(u.title=h.title),!C(a)){var b=r.getTime()-a;u.$duration=parseFloat((b/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),w=this.sessionPersistence.properties(),S=u.$groups,x=y.$groups;I(S)&&!O(S)&&(u.$groups=i({},I(x)?x:{},S)),rr(["$referrer","$referring_domain"],t=>{t in y&&delete w[t]});var E={};if(this.$u.length>0)for(var T of this.$u.slice())try{sr(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=sr({},c,y,w,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?rr(this.config.property_denylist,function(t){delete u[t]}):ue.error(Io+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(Ro),u=k(u,t));var N=this.dh();return u.$process_person_profile=N,N&&!o&&this.fh("_calculate_event_properties"),u}ah(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.dh())return t;if(this.Su&&!i)return t;var s=sr({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(Ro),s=n(s,"$set_once")),e&&(this.Su=!0),O(s)?void 0:s}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.uh(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.hh()}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.xu.delete(t),this.hh()}ph(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.xu.clear(),this.hh()}hh(){var t;if(this.Cu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Ur.Et())Ur.Lt(this.Cu);else{var e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Ur.At(this.Cu,e):Ur.Lt(this.Cu)}}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.au.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:Po}),()=>{})}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:Po})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Po})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=fo),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:Po}}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:Po})}gh(t){return!t||M(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ue.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())||(ue.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 ue.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gh(t)&&this.fh("posthog.identify")){this.yu();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.uh(!1),o=this.persistence.Pl(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property("__alias")&&(this.unregister($e),this.register({distinct_id:t}));var l=(this.persistence.get_property("$user_state")||"anonymous")===Vi,u=t!==h,d=!u&&l;if(u&&l){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:h};this.persistence.set_property(ki,Ji),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",c,{$set:e||{},$set_once:i||{}})&&(this.Eu=ao(t,e,i)),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(ki,Ji);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:_,$set_once:p})&&(this.Eu=ao(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Si)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}}setPersonProperties(t,e){if((t||e)&&this.fh("posthog.setPersonProperties")){var i=ao(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Eu=i)):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(P(t)?t:[t]).filter(t=>A(t)&&t.length>0);0!==i.length&&this.fh("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.uh();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.dh()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(er,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ue.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.fh("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.mh(e,!1,i)}mh(t,e,r){var s,n,o,a;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Ru)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var l=this.get_property(ye),u=this.get_property(we),d=this.get_property(Be);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),e||!v||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 c=null==(a=this.persistence)||null==a.Pl?void 0:a.Pl(),_=!1;try{var p,f,g,m,b,y,w,S,x,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.xu.clear(),this.hh(),C(d)||null==(g=this.persistence)||g.register({[Be]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(S=this.metrics)||S.reset(),null==(x=this.persistence)||x.set_property(ki,Vi),null==(E=this.sessionManager)||E.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Mi,$device_id:null},"");else{var R=this.config.get_device_id(gr());this.register_once({distinct_id:R,$device_id:t?R:l},""),t||C(u)||this.register({[we]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.fu()&&(null==(P=this.persistence)||P.set_property(ki,r.isIdentifiedID?Ji:Vi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(D(h)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(h,!0))){var I=i({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var O;c&&(null==(O=this.persistence)||null==O.Ol||O.Ol(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a,h;if(e.__loaded){e.ku=!0,e.zu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.metrics)||s.dispose(),null==(n=e.Fu)||n.unload(),null==(o=e.Du)||o.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(a=e.persistence)||a.destroy(),null==(h=e.sessionPersistence)||h.destroy()}else ue.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("$people_distinct_id")?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.fh("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.ph($e,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(I(t)){var r,s,n,o,a,h,l,u,d,v,c,_,p,f;sr(this.config,Bo(t));var g=this.bu();null==(r=this.persistence)||r.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ks(i({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.Pu(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,xr.Et()&&xr.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,xr.Et()&&xr.Lt("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.metrics)||a.onConfigChange(),null==(h=this.sessionRecording)||h.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._u(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Wr(this,To,!1)}}_overrideSDKInfo(t,e){ge.LIB_NAME=t,ge.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){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},r,e))}catch(t){return}}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 e,i;return null!==(e=null==(i=this.logs)?void 0:i.logger)&&void 0!==e?e:t._h}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:No;return e!==No&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(e=this.sessionPersistence)?void 0:e.get_property("$user_state"))}dh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&O(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.dh()||this.fh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fh(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ph(Ai,!0),!0)}bu(){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&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e,i,r,s,n=this.bu();return this.is_capturing()||null==(t=this.logs)||t._onOptOut(),(null==(e=this.persistence)?void 0:e.pi)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.pi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.xu.clear(),this.hh()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,o,a,h,l,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.mh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new so(this),this.pageViewManager=new Vr(this),this.persistence&&(this.sessionPropsManager=new to(this,this.sessionManager,this.persistence));var d,v=null!==(h=null==(l=this.config.__extensionClasses)?void 0:l.sessionRecording)&&void 0!==h?h:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.vu(this.sessionRecording,new v(this)),this.lu&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ue.warn(ko)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,e,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.mh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Mi,$device_id:null}),this.du(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.Qu(),this.Zu())}else ue.warn(ko)}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"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return a?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&V(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>V(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver}(a,this.config.custom_blocked_useragents):void 0}Qu(){h&&("visible"===h.visibilityState?this.Tu||(this.Tu=!0,this.capture(Qi,{title:h.title},{send_instantly:!0}),this.Iu&&(h.removeEventListener(Yi,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),ur(h,Yi,this.Iu)))}debug(t){!1===t?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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.Ru||{};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?(ue.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&&!D(t[e]),o=i in t&&!D(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,ue)}Os(t){var e;if(D(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=P(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),D(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!O(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return ue.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&D(s.properties[a]))return ue.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.Bo)?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)})}Pu(t){var e=B(t)&&!t,i=xr.Et()&&"true"===xr.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t._h={trace:ho=()=>{},debug:ho,info:ho,warn:ho,error:ho,fatal:ho},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=nr(t.prototype[e[i]])}(jo,["identify"]);var zo=function(){ge.SDK_DIST_CHANNEL="npm";var t=xo[No]=new jo;return function(){function t(){t.done||(t.done=!0,Jn=!1,rr(xo,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():ur(h,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ps as Compression,js as DEFAULT_PRODUCT_TOUR_APPEARANCE,Bs as DisplaySurveyType,jo as PostHog,zs as ProductTourEventName,Ws as ProductTourEventProperties,Fs as SurveyEventName,Us as SurveyEventProperties,Rs as SurveyEventType,Os as SurveyPosition,Ns as SurveyQuestionBranchingType,Ms as SurveyQuestionType,Ds as SurveySchedule,Cs as SurveyTabPosition,As as SurveyType,Is as SurveyWidgetType,zo as default,zo as posthog,Js as severityLevels};
1
+ var t,e=["retriesPerformedSoFar"];function i(){return i=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},i.apply(null,arguments)}function r(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 s(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var o=t.apply(e,i);function a(t){r(o,s,n,a,h,"next",t)}function h(t){r(o,s,n,a,h,"throw",t)}a(void 0)})}}var n="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:n,a=null==o?void 0:o.navigator,h=null==o?void 0:o.document,l=null==o?void 0:o.location,u=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,v=null==o?void 0:o.AbortController,c=null==o?void 0:o.CompressionStream,_=null==a?void 0:a.userAgent,p="undefined"!=typeof globalThis?globalThis:n;p&&"undefined"==typeof self&&(p.self=p),p&&"undefined"==typeof File&&(p.File=function(){});var f=null!=n?n:{},g="0.8.3",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"browser-common",JS_SDK_VERSION:g},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),y=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],w=["token"];function S(t,e){return-1!==t.indexOf(e)}var x=function(t){return t.replace(/^\$/,"")},E=Object.prototype,T=E.hasOwnProperty,k=E.toString,P=Array.isArray||function(t){return"[object Array]"===k.call(t)},R=t=>"function"==typeof t,I=t=>t===Object(t)&&!P(t),O=t=>{if(I(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,N=t=>null===t,D=t=>C(t)||N(t),F=t=>"[object Number]"==k.call(t)&&t==t,U=t=>F(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>S(y,t),j=t=>S(w,t);function z(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Error)}}var W=[!0,"true",1,"1","yes"],G=t=>S(W,t),q=[!1,"false",0,"0","no"],H=["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"],V=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return H.concat(e).some(t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)})};function J(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),F(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),J(null!=s?s:i,e,i,r))}var K="Mobile",Y="Android",X="Tablet",Q="Android Tablet",Z="iPad",tt="Apple Watch",et="Safari",it="BlackBerry",rt="Samsung Internet",st="Chrome",nt="Chrome iOS",ot="Internet Explorer",at="Internet Explorer Mobile",ht="Opera",lt="Microsoft Edge",ut="Firefox",dt="Firefox iOS",vt="Nintendo",ct="PlayStation",_t="Xbox",pt="Android Mobile",ft="Mobile Safari",gt="Windows",mt="Windows Phone",bt="Nokia",yt="Ouya",wt="Generic "+K.toLowerCase(),$t="Generic "+X.toLowerCase(),St="Konqueror",xt="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",It="Waterfox",Ot="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Nt="Google Search App",Dt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ft=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ut=new RegExp(_t,"i"),Bt=new RegExp("PlayStation \\w+","i"),Lt=new RegExp("Nintendo \\w+","i"),jt=new RegExp("BlackBerry|PlayBook|BB10","i"),zt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Wt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ot:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&S(t,"GSA/")?Nt:S(t," OPR/")&&S(t,"Mini")?"Opera Mini":S(t," OPR/")?ht:jt.test(t)?it:S(t,"IEMobile")||S(t,"WPDesktop")?at:S(t,"OculusBrowser")?xt:S(t,"SamsungBrowser")?rt:S(t,"Edge")||S(t,"Edg/")?lt:S(t,"Vivaldi/")?Et:S(t,"YaBrowser/")?Tt:S(t,"Whale/")?kt:S(t,"DuckDuckGo/")||S(t,"Ddg/")?Pt:S(t,"Claude/")?Ct:S(t,"Codex/")?At:S(t,"ChatGPT/")?Mt:S(t,"FBIOS")?"Facebook Mobile":S(t,"UCWEB")||S(t,"UCBrowser")?"UC Browser":S(t,"CriOS")?nt:S(t,"CrMo")||S(t,st)?st:S(t,Y)&&S(t,et)?pt:S(t,"FxiOS")?dt:S(t.toLowerCase(),St.toLowerCase())?St:S(t,"Brave/")?Ot:((t,e)=>e&&S(e,"Apple")||function(t){return S(t,et)&&!S(t,st)&&!S(t,Y)}(t))(t,e)?S(t,K)?ft:et:S(t,"PaleMoon/")?Rt:S(t,"Waterfox/")?It:S(t,ut)?ut:S(t,"MSIE")||S(t,"Trident/")?ot:S(t,"Gecko")?ut:"")},Gt={[at]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[lt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[st]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[nt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[et]:[Dt],[ft]:[Dt],[ht]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Dt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},qt=function(t,e,i,r){var s=Gt[Wt(t,e,i,r)];if(C(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Ht=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[_t,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[jt,[it,""]],[new RegExp(gt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mt,""];if(new RegExp(K).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[gt,r]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(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("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Vt=function(t){return Lt.test(t)?vt:Bt.test(t)?ct:Ut.test(t)?_t:new RegExp(yt,"i").test(t)?yt:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?Z:/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(bt,"i").test(t)?bt:/(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(K).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:Q:new RegExp("(pda|Mobile)","i").test(t)?wt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Kt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Jt],[/\bFBAN\/EMA\b/i,"Facebook Lite",Jt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Jt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Yt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xt(t,e){return"string"==typeof(i=t)&&Yt.test(i)?t:e();var i}function Qt(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 Zt(t){return t?t.split("#")[0]:t}var te,ee=["$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"],ie="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw Qt(ie,"Native gzip produced invalid output: "+t)},ae=function(){var t=s(function*(t,e){18>t.size&&oe("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(i)&&8===i[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;te[t]=e>>>0}return te})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&oe("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(e,i){return t.apply(this,arguments)}}();function he(){return he=s(function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=s(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(e){return t.apply(this,arguments)}}()),h=new Response(n.readable).blob(),l=(yield Promise.all([h,a]))[0];return yield ae(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}}),he.apply(this,arguments)}var le=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={N(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];n&&(m.DEBUG||n.POSTHOG_DEBUG||i)&&!C(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>le(t+" "+e,i)};return r},ue=le("[PostHog.js]"),de=ue.createLogger,ve=de("[ExternalScriptsLoader]"),ce=t=>{var e=null==h?void 0:h.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]},_e=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ve.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=ce(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,i(t)}))}var n=()=>{if(!h)return i("document not found");if(ce(e))return _e(t,e,i);var r=h.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)h.head.appendChild(r);else{var s,n=h.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):h.body.appendChild(r)}};null!=h&&h.body?n():null==h||h.addEventListener("DOMContentLoaded",n)},pe={},fe=(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)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__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=pe[s];if("fallback"===r&&n){if(ce(n))return void _e(t,n,i);delete pe[s]}_e(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=fe(t,e);pe[s]=a;var h=ce(s);null==h||null==(o=h.parentNode)||o.removeChild(h),_e(t,a,i)}else i(void 0,n)}:i)}else _e(t,fe(t,e),i)}else _e(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),i)},f.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{_e(t,t.requestRouter.endpointFor("api",e),i)},m.DEBUG=!1,m.LIB_VERSION="1.433.3",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",ye="$device_id",we="$device_model",$e="__alias",Se="__cmpns",xe="$fbc",Ee="$fbc_persistence",Te="$fbp",ke="$fbp_persistence",Pe="__timers",Re="$autocapture_disabled_server_side",Ie="$heatmaps_enabled_server_side",Oe="$exception_capture_enabled_server_side",Ce="$error_tracking_suppression_rules",Ae="$error_tracking_capture_extension_exceptions",Me="$web_vitals_enabled_server_side",Ne="$dead_clicks_enabled_server_side",De="$product_tours_enabled_server_side",Fe="$logs_capture_enabled_server_side",Ue="$web_vitals_allowed_metrics",Be="$session_recording_remote_config",Le="$session_recording_enabled_server_side",je="$replay_sample_rate",ze="$replay_override_sampling",We="$replay_override_linked_flag",Ge="$replay_override_url_trigger",qe="$replay_override_event_trigger",He="$sesid",Ve="$session_is_sampled",Je="$session_past_minimum_duration",Ke="$session_recording_url_trigger_activated_session",Ye="$session_recording_event_trigger_activated_session",Xe="$debug_first_full_snapshot_timestamp",Qe="$sess_rec_flush_size",Ze="$enabled_feature_flags",ti="$active_feature_flags",ei="$early_access_features",ii="$feature_flag_details",ri="$feature_flag_payloads",si="$feature_flag_request_id",ni="$minimal_flag_called_events",oi="$override_feature_flags",ai="$override_feature_flag_payloads",hi="$stored_person_properties",li="$stored_group_properties",ui="$groups",di="$surveys",vi="$surveys_loaded_at",ci="$surveys_activated",_i="$surveys_activated_session",pi="$surveys_activated_timestamps",fi="ph_product_tours",gi="$product_tours_activated",mi="$product_tours_activated_session",bi="$conversations_widget_session_id",yi="$conversations_ticket_id",wi="$conversations_widget_state",$i="$conversations_user_traits",Si="$flag_call_reported",xi="$flag_call_reported_session_id",Ei="$feature_flag_errors",Ti="$feature_flag_evaluated_at",ki="$user_state",Pi="$client_session_props",Ri="$capture_rate_limit",Ii="$initial_campaign_params",Oi="$initial_referrer_info",Ci="$initial_person_info",Ai="$epp",Mi="$posthog_cookieless",Ni="$cookieless_mode",Di="$sdk_debug_extensions_init_method",Fi="$sdk_debug_extensions_init_time_ms",Ui="$sdk_debug_recording_script_not_loaded",Bi="$sdk_debug_replay_event_trigger_status",Li="$sdk_debug_replay_linked_flag_trigger_status",ji="$sdk_debug_replay_matched_recording_trigger_groups",zi="$sdk_debug_replay_pending_trigger_conditions",Wi="$sdk_debug_replay_remote_trigger_matching_config",Gi="$sdk_debug_replay_trigger_groups_count",qi="$sdk_debug_replay_url_trigger_status",Hi="$session_recording_start_reason",Vi="anonymous",Ji="identified",Ki="identified_only",Yi="visibilitychange",Xi="beforeunload",Qi="$pageview",Zi="$pageleave",tr="$identify",er="$groupidentify";function ir(t,e){P(t)&&t.forEach(e)}function rr(t,e){if(!D(t))if(P(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)T.call(t,i)&&e(t[i],i)}var sr=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},nr=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){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},or=function(t){var e={};return rr(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function ar(t){var e=i({},t);for(var r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch(t){}return e}var hr=["herokuapp.com","vercel.app","netlify.app"];function lr(t){var e=null==t?void 0:t.hostname;if(!A(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of hr)if(i===r)return!1;return!0}function ur(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 dr=t=>{if(h){try{for(var e=t+"=",i=h.cookie.split(";").filter(t=>t.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.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 F(t)&&isFinite(t)&&Math.floor(t)===t});var vr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>i||0>r||0>s||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}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 t(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}},cr=class{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Ct=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t,e=(t=Date.now(),F(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return vr.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new fr}},_r=t=>{if("u">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};n&&!C(n.crypto)&&crypto.getRandomValues&&(_r=t=>crypto.getRandomValues(t));var pr,fr=class{nextUint32(){return this.Rt.length>this.$t||(_r(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},gr=()=>mr().toString(),mr=()=>(pr||(pr=new cr)).generate(),br="",yr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var wr=null,$r={Et(){if(!N(wr))return wr;if(wr=!1,h)try{var t="__ph_cookie_support_"+gr();$r.At(t,"xyz"),wr='"xyz"'===dr(t),$r.Lt(t)}catch(t){wr=!1}return wr},Pt(t){ue.error("cookieStore error: "+t)},Ot:dr,Dt(t){var e;try{e=JSON.parse($r.Ot(t))||{}}catch(t){}return e},At(t,e,i,r,s){if(!h)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=h),br)return br;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+gr();!br&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",br=n)}return br}(t);if(!i){var r=(t=>{var e=t.match(yr);return e?e[0]:""})(t);r!==i&&ue.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(h.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+u.length),h.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null!=h&&h.cookie)try{$r.At(t,"",-1,e)}catch(t){return}}},Sr=null,xr={Et(){if(!N(Sr))return Sr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";xr.At(e,"xyz"),'"xyz"'!==xr.Ot(e)&&(t=!1),xr.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),Sr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){xr.Pt(t)}return null},Dt(t){try{return JSON.parse(xr.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){xr.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){xr.Pt(t)}}},Er=[hi,ti,Ze,ii,ri,si,Ti,Ei,Si],Tr=[ye,be,He,Ve,Ai,Ci,Ee,ki],kr=t=>t+"_cpm",Pr=["__proto__","constructor","prototype"],Rr=t=>{if(!I(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Pr.indexOf(i)&&(e[i]=t[i])}),e},Ir=function(t,e){void 0===e&&(e=[]);var i={};return[...Tr,...e].forEach(e=>{var r=t[e];C(r)||N(r)||""===r||(i[e]=r)}),i},Or=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)},Cr=(t,e)=>({p:e,f:Or(JSON.stringify(t))}),Ar=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=$r.Dt(kr(t)),r=(null==i?void 0:i.f)===Or(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Mr=(t,e)=>e+"|"+($r.Ot(kr(t))||""),Nr={},Dr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Nr?Nr[t]:null,Dt:t=>t in Nr?Nr[t]:null,At:(t,e)=>(Nr[t]=e,!0),Lt(t){delete Nr[t]}},Fr=null,Ur={Et(){if(!N(Fr))return Fr;if(Fr=!0,C(n))Fr=!1;else try{var t="__support__";Ur.At(t,"xyz"),'"xyz"'!==Ur.Ot(t)&&(Fr=!1),Ur.Lt(t)}catch(t){Fr=!1}return Fr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Ur.Pt(t)}return null},Dt(t){try{return JSON.parse(Ur.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Ur.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Ur.Pt(t)}}},Br=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){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 Ao(){var t=this.Fo.Ot(this.Oo);return G(t)?1:S(q,t)?0:-1}get Fo(){var t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?xr:$r,i=e.Et()?e:Dr;if(!this.Do||this.Do!==i){this.Do=i;var r="localStorage"===t?$r:xr;r.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(G(r.Ot(this.Oo))),r.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>G(t))}},Lr=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var jr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ne)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!I(r)||i},zr=de("[SegmentIntegration]");function Wr(t,e,r){void 0===r&&(r=!0);var s=t.config.segment;if(!s)return e();var n,o=(t=>R(t.register))(n=s)?{analytics:n}:n,a=o.analytics,h=o.filterProperties;!function(t,e,i,r){var s=e=>{var s=()=>e.anonymousId()||gr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(ki,Ji)),i(r?void 0:e.anonymousId()||void 0)},n=e.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,a,r=>{a.register(function(t,e,r){var s=(void 0===r?{}:r).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||zr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(r,n)=>{if(!n)return r;var o=!!e&&r.event.anonymousId===e&&!r.event.userId;o||r.event.userId||r.event.anonymousId===t.get_distinct_id()||(zr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(zr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!D(s)){var h=r.event.properties||{},l={};for(var u of Object.keys(a))T.call(h,u)||(l[u]=a[u]);var d=((t,e)=>{var r=P(t)?t:[t],s=i({},e);for(var n of r)try{if(s=n(s),D(s))return null}catch(t){return zr.error("Error in Segment filterProperties:",t),null}return s})(s,l);if(D(d))return r;a=d}return r.event.properties=Object.assign({},a,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,Qi)},identify(t){return n(t,tr)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:h})).then(()=>{e()},t=>{zr.error("Failed to register the Segment integration",t),e()})},r)}var Gr="posthog-js";function qr(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,h=void 0===a?["error"]:a,l=r.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var r,a,l,d,v,c;if("*"!==h&&!h.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var _=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=_,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(r=e.exception)?void 0:r.values)||[],f=p.map(t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>i({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(l=p[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}var Hr=class{constructor(t,e,i,r,s,n){this.name=Gr,this.setupOnce=function(o){o(qr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Vr=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.jo)}destroy(){var t;null==(t=this.zo)||t.call(this),this.zo=void 0}doPageView(t,e){var i,r=this.Uo(t,e);return this.Bo={pathname:null!==(i=null==n?void 0:n.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Uo(t,null==(e=this.Bo)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Bo)?void 0:t.pageViewId}}Uo(t,e){var i=this.Bo;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?J(o/n,0,1,ue):1,v=n>1?J(a/n,0,1,ue):1,c=h>1?J(l/h,0,1,ue):1,_=h>1?J(u/h,0,1,ue):1;r=sr(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}},Jr=["flags","surveys"],Kr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Re]:{exposure:"event"},[Ie]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Oe]:{exposure:"event"},[Ce]:{exposure:"hidden"},[Ae]:{exposure:"event"},[Me]:{exposure:"event"},[Ne]:{exposure:"event"},[De]:{exposure:"hidden"},[Ue]:{exposure:"event"},[Be]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ve]:{exposure:"event"},[je]:{exposure:"event",shouldSkipFromEventProperties:t=>N(t)},[Je]:{exposure:"event"},[Ke]:{exposure:"event"},[Ye]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"hidden"},[Ze]:{exposure:"hidden",storageGroup:"flags"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden"},[ii]:{exposure:"hidden",storageGroup:"flags"},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ni]:{exposure:"hidden",storageGroup:"flags"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[li]:{exposure:"hidden"},[di]:{exposure:"hidden",storageGroup:"surveys"},[vi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ci]:{exposure:"event"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[bi]:{exposure:"event"},[yi]:{exposure:"event"},[wi]:{exposure:"event"},[$i]:{exposure:"event"},[Si]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[ui]:{exposure:"event"},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Ge]:{exposure:"event"},[qe]:{exposure:"event"},[Di]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[Gi]:{exposure:"event"},[qi]:{exposure:"event"},[Hi]:{exposure:"event"}},Yr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Xr=t=>{var e=Kr[t];if(e)return e;for(var i of Yr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Qr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,ar(e)),i.get(e)):"bigint"==typeof e?e.toString():e,e)}catch(e){return s=[],null!==(r=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(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(e))return"[Circular]";s.push(e)}return e}}))&&void 0!==r?r:"null"}var r,s},Zr=t=>{var e=null==h?void 0:h.createElement("a");return C(e)?null:(e.href=t,e)},ts=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(!P(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},es=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("=");P(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},is=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...is],ss="<masked>",ns=["li_fat_id"];function os(t,e){var i=rs.concat(e||[]),r={};return rr(i,function(e){var i=ts(t,e);r[e]=i||null}),r}function as(t){var e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!N(e)){r.$search_engine=e;var s=h?ts(h.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function hs(){return navigator.language||navigator.userLanguage}var ls="$direct";function us(){return(null==h?void 0:h.referrer)||ls}function ds(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...is,...e||[]]:[],n=null==(r=i?Zt(null==l?void 0:l.href):null==l?void 0:l.href)?void 0:r.substring(0,1e3);return{r:us().substring(0,1e3),u:n?es(n,s,ss):void 0}}function vs(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Zt(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ls?ls:null==(i=Zr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Zr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,sr(o,os(n))}return r&&sr(o,as(r)),o}function cs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function _s(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ps={flags:Ti,surveys:vi},fs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gs=t=>t+"_cookie_identity_change_pending",ms=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},bs="main",ys=[Ze,ti,ii,ri,si,Ti,ni,hi],ws=t=>-1!==ys.indexOf(t),$s=[Ee,ke],Ss=t=>-1!==$s.indexOf(t),xs=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Es=t=>{if(!t)return{};var e=JSON.parse(t);return I(e)?e:{}},Ts=(t,e)=>{rr(t,(i,r)=>{var s=Xr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},ks=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=new Set,this.il=new Set,this.Mr=t,this.nl=r,this.props={},this.sl=void 0,this.rl=(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"})(t),this.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();ur(n,"beforeunload",s,{capture:!1}),ur(n,"pagehide",s,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){var e=Jr.find(e=>t.key===this.hl(e));e&&this.cl(t.key,e)}}else this.cl(t.key,bs)},ur(n,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.Ko.get(e);if(ws(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(e,s)}else this.dl(e,!0)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&n&&(n.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=xr.Ot(t),N(s)){var n=this.vl(e);return n.storageValue=null,e!==bs&&(n.persisted=!1),!1}r=Es(s)}catch(t){return!1}var o=e===bs?r:xr.Dt(this.rl);if(o&&this.fl(o))return!1;var a=this.pl(r,e,i);return e===bs&&this.Zo&&!xs(this.gl().main,r)||this.ml(r,e,!0,s),a}fl(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}ml(t,e,i,r){var s=this.vl(e);s.storageValue=r,e!==bs&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){var r=!1;return ys.forEach(i=>{var s,n=null==(s=Xr(i))?void 0:s.storageGroup;if(!(e===bs&&this.Zo&&n||e!==bs&&n!==e)){var o=i in t,a=this.bl(i,o?t[i]:void 0),h=this.Ko.has(i)?i in this.props:o;h===i in this.props&&xs(a,this.props[i])||(h?this._l(i,a,!1):this.wl(i,!1),r=!0)}}),r&&i&&this.il.forEach(t=>t()),r}kl(){if(!this.Vo)return!1;try{this.tl=!1;var t,e=xr.Ot(this.rl),i=this.vl(bs),r=!1,s=!1;if(e!==i.storageValue)if(N(e))i.storageValue=null;else{if(t=Es(e),this.tl=!this.Yo&&this.fl(t),this.tl)return!1;s=this.pl(t,bs,!1),!this.Zo||xs(this.gl().main,t)?this.ml(t,bs,!0,e):i.storageValue=e,r=!0}return this.Zo&&Jr.forEach(e=>{var i=xr.Ot(this.hl(e)),n=this.vl(e),o=t||{},a=r&&ys.some(t=>{var i;return(null==(i=Xr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(N(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.pl(o,e,!1)||s));var h=Es(i);s=this.pl(h,e,!1)||s,this.ml(h,e,!0,i)}}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);var i=Xr(t);null!=i&&i.volatile||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||bs).fingerprint=void 0,this.Sl(t))}xl(){ys.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{var t=xr.Ot(this.rl),e=Es(t);this.vl(bs).storageValue=t,ys.forEach(t=>{var i,r=this.Zo?null==(i=Xr(t))?void 0:i.storageGroup:void 0,s=r?xr.Ot(this.hl(r)):null;if(r){var n=this.vl(r);n.storageValue=s,n.persisted=!N(s)}var o=r&&!N(s)?Es(s):e;t in this.props?this.Cl(t,o[t],this.props[t]):t in o&&this.dl(t,!0)})}catch(t){}}bl(t,e){var r=this.Ko.get(t);if(!r)return e;if(!0===r)return this.props[t];if("$active_feature_flags"===t){var s=new Set(P(e)?e:[]),n=new Set(P(this.props[t])?this.props[t]:[]);return r.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=I(e)?i({},e):{},a=I(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Cl(t,e,i){if(ws(t)){var r=this.Ko.get(t);if(!0!==r){var s=e;if(this.Vo)try{var n,o=this.Zo?null==(n=Xr(t))?void 0:n.storageGroup:void 0,a=o?this.hl(o):this.rl;s=Es(xr.Ot(a))[t]}catch(t){}var h=new Set(r||[]);if("$active_feature_flags"===t){if(!C(e)&&!P(e)||!C(s)&&!P(s)||!P(i))return void this.dl(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(!I(i))return void(xs(s,i)?this.Ko.delete(t):this.dl(t,!0));if(!C(e)&&!I(e)||C(e)&&O(i)&&C(s))return void this.dl(t,!0);var v=I(e)?e:{},c=I(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&xs(v[t],i[t])||h.add(t)}),h.forEach(t=>{t in c==t in i&&xs(c[t],i[t])&&h.delete(t)})}h.size?this.dl(t,h):this.Ko.delete(t)}}}$l(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{var e=Ir(t,this.Mr.cookie_persisted_properties||[]),i=Cr(e,this.Mr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=$r.Ot(this.rl)||void 0;s&&Mr(this.rl,s)===r&&(this.Il=r,this.Ml=s)}catch(t){}else try{var n=$r.Ot(this.rl)||void 0;this.Il=n?Mr(this.rl,n):void 0,this.Ml=n}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=$r.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;var r,s=Mr(this.rl,i);try{r=Rr(JSON.parse(i))}catch(t){return!1}if(($r.Ot(this.rl)||void 0)!==i)return!1;this.Il=s,this.Ml=i;var n=Ar(this.rl,i),o=[...Tr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||N(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),O(r))return!1;var h="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,l=this.props,u=l[be],d=l[ki],v=sr({},l);[...Tr,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||"distinct_id"!==t&&"$user_state"!==t)){var e=v[t];(n.isValid||-1===Tr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=sr(v,r),ys.forEach(t=>{var e=t in this.props;t in l===e&&xs(l[t],this.props[t])||(e?this.Cl(t,l[t],this.props[t]):this.dl(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this._l(ki,Vi);var c=this.props[be],_=this.props[ki];return!h||c===u&&_===d||(this.Yo=!0,this.Qo=!0,Ur.At(gs(this.rl),!0),this.wl(hi),this.wl(ti),this.wl(Ze),this.wl(ii),this.wl(ri),this.wl(si),this.wl(Ti),this.wl(Ei),this.wl(Si),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||(Ts(this.props,r),this.wl(li)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.wl($e)),!0}consumeCookieIdentityChange(){var t=gs(this.rl),e=this.Qo||!!Ur.Ot(t);return this.Qo=!1,e&&Ur.Lt(t),e}Pl(t){return void 0===t&&(t=!1),!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[bs],this.Fl(!0))}Ol(t){if(void 0===t&&(t=!0),this.Jo)try{t?this.Rl():C(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===fs.indexOf(t.persistence.toLowerCase())&&(ue.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Tr,...t];return i({},xr,{Dt(t){try{var i,s={};try{i=$r.Ot(t)||void 0,s=i?Rr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse(xr.Ot(t)||"{}");if(e){var a=Ar(t,i),h=[...Tr,...a.properties],l={};Object.keys(s).forEach(t=>{var e=s[t];N(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(l[t]=e)});var u="distinct_id"in l||"anonymous"===l.$user_state||"identified"===l.$user_state;if(Object.keys(l).length>0){var d,v=o[be],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";r.forEach(t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var e=o[t];(a.isValid||-1===Tr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[ki]=Vi),!u||("distinct_id"in l?l[be]:o[be])===v&&("$user_state"in l?l[ki]:o[ki])===c||(Er.forEach(t=>delete o[t]),"identified"===l.$user_state&&"distinct_id"in l?o.$user_id=l[be]:delete o.$user_id,"identified"!==l.$user_state&&(delete o[ui],delete o[li]),delete o.__alias)}n=sr(o,l)}else n=sr(s,o);return xr.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var h=xr.At(i,r,void 0,void 0,a);try{var l=Ir(r,t);if(Object.keys(l).length){if(e){var u=kr(i),d=Cr(l,t);if($r.At(u,d,s,n,o,a),$r.Ot(u)!==JSON.stringify(d)){$r.Lt(u,n);var v=Ir(r);return $r.At(i,v,s,n,o,a),h}}$r.At(i,l,s,n,o,a)}}catch(t){xr.Pt(t)}return h},Lt(t,e){try{null==n||n.localStorage.removeItem(t),$r.Lt(t,e),$r.Lt(kr(t),e)}catch(t){xr.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&xr.Et()?(e=xr,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Ur.Et()?e=Ur:"memory"===a?e=Dr:"cookie"===a&&$r.Et()?(e=$r,s=!0):r.Et()?(e=r,o=!0,s=!0):$r.Et()?(e=$r,s=!0):e=Dr,this.Vo=o,this.Go=s,e}hl(t){return this.rl+"__"+t}ll(t){return this.Vo&&!!t.split_storage}properties(){var t={};return rr(this.props,(e,i)=>{var r=Xr(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.pi||t){var e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?xr.Dt(this.rl):null,r={};if(e)try{rr(r=Rr($r.Dt(this.rl)),(t,e)=>{(C(t)||N(t)||""===t)&&delete r[e]})}catch(t){}var s=this.Fo.Dt(this.rl);if(s&&(this.props=sr({},s)),this.Zo&&this.Dl(),e&&s){var n,o,a=null==i?void 0:i[be],h=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",l=s[be],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(l!==a||u!==h){this.Qo=!0,Ur.At(gs(this.rl),!0);var d=sr({},this.props);Er.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==h&&"anonymous"!==r.$user_state&&(C(a)||l===a)||(Ts(d,r),delete d[li]),this.props=d;var v=new Set;Er.forEach(t=>{var e,i=null==(e=Xr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};rr(this.props,(i,r)=>{var s;(null==(s=Xr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),O(e)?(xr.Lt(this.hl(t)),this.Wo[t]={}):xr.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Ur.Ot(gs(this.rl))&&(this.Qo=!0)}}Dl(){for(var t of Jr){var e=xr.Dt(this.hl(t));if(e&&!O(e)){var i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||sr(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Xr(e))?void 0:i.storageGroup)===t})}Nl(t,e){var i=ps[t];if(!i)return!1;var r=e[i],s=this.props[i];return F(r)&&F(s)&&s>r}refreshKey(t){var e;if(!this.pi&&!this.el.has(t)){var i=this.Zo?null==(e=Xr(t))?void 0:e.storageGroup:void 0,r=i?xr.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(r&&t in r)this._l(t,r[t],!1);else{if(i){var s=this.Fo.Dt(this.rl);if(s&&t in s)return void this._l(t,s[t],!1)}this.wl(t,!1)}}}save(){if(!this.pi){var t=this.$l();t>0?C(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}}flush(){C(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t){if(void 0===t&&(t=!1),!(this.pi||this.Jo&&!t)){t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||$s.forEach(t=>this.refreshKey(t)));var e=!t&&!this.Xo;e||(this.tl=!1);var i=!!e&&this.kl();if(this.tl)this.Mr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));var r=this.jl(this.Fo,this.rl,this.props,bs);"written"===r&&this.Tl(this.props),"failed"!==r&&(this.Ko.clear(),this.Yo=!1,this.el.clear()),i&&this.il.forEach(t=>t())}}}ql(){var t=this,e=this.gl(),i=e.main,r=e.groups,s=this.jl(this.Fo,this.rl,i,bs);"written"===s&&this.Tl(i),"failed"!==s&&(this.Yo=!1,this.el.clear(),ys.forEach(t=>{var e;null!=(e=Xr(t))&&e.storageGroup||this.Ko.delete(t)}));var n=function(e){var i,s=r[e];if(O(s)&&(null==(i=t.Wo[e])||!i.persisted))return ys.forEach(i=>{var r;(null==(r=Xr(i))?void 0:r.storageGroup)===e&&t.Ko.delete(i)}),1;var n=t.jl(xr,t.hl(e),s,e);"failed"!==n&&ys.forEach(i=>{var r=Xr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.Ko.delete(i)})};for(var o of Jr)if(n(o))continue}gl(){var t={},e={flags:{},surveys:{}};return rr(this.props,(i,r)=>{var s,n=null==(s=Xr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}yl(t,e){if(e===bs)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;var i={};return rr(t,(t,e)=>{var r;i[e]=null!=(r=Xr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,r){var s,n=this.vl(r);if(r!==bs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.yl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,r!==bs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.Vo&&(n.storageValue=xr.Ot(e)),"written"):(this.Mr.debug&&ue.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.xl(),C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!i&&this.nl)for(var r of Jr)xr.Lt(this.hl(r));i?delete this.Wo[bs]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(I(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Bl=C(i)?this.Ul:i;var r=!1;if(rr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(I(t)){this.syncCookieProperties(),this.Bl=C(e)?this.Ul:e;var i=!1;if(rr(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||I(e)||P(e))&&(this._l(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.wl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.sl){var e=function(t,e,i){if(!h)return{};var r,s=e?[...is,...i||[]]:[],n=os(es(h.URL,s,ss),t);return sr((r={},rr(ns,function(t){var e=dr(t);r[t]=e||null}),r),n)}(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!O(or(e));return i&&this.register(e),this.sl=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?as(t):{})}update_referrer_info(){var t;this.register_once({$referrer:us(),$referring_domain:null!=h&&h.referrer&&(null==(t=Zr(h.referrer))?void 0:t.host)||ls},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=ds(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Ci]:this.Go?{r:ms(t.r),u:t.u?ms(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};rr([Oi,Ii],e=>{var i=this.props[e];i&&rr(i,function(e,i){t["$initial_"+x(i)]=e})});var e=this.props[Ci];return e&&sr(t,function(t,e){void 0===e&&(e=!1);var i=vs(t,e),r={};return rr(i,function(t,e){r["$initial_"+x(e)]=t}),r}(e,this.Mr.disable_capture_url_hashes)),t}safe_merge(t){return rr(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((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||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,h=t.disable_persistence||!!r,l=!!this.pi&&!h;h||this.El(e,l),this.Mr=t,!h&&(s||n||a)&&(this.Il=void 0,this.Ml=void 0,this.El(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=o||a?this.ol(t):this.Fo;this.Wl();var d=this.ll(t),v=o||d!==this.Zo,c=!h&&(v||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(l);this.Xo=v;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(h),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var _=this.props;this.clear(),this.Fo=u,this.Zo=d,this.props=_,this.save()}else a&&(this.Fo=u,h||(delete this.Wo[bs],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){var t=this.props[Ci];if(this.Go&&I(t)&&"string"==typeof t.r){var e=ms(t.r),r="string"==typeof t.u?ms(t.u):t.u;e===t.r&&r===t.u||this._l(Ci,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this._l(Pe,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this._l(Pe,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),Ss(t)&&!xs(s,e)&&this.el.add(t),this.Cl(t,s,e),null!=(r=Xr(t))&&r.volatile||this.Sl(t))}wl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(ws(t)&&this.dl(t,!0),Ss(t)&&this.el.add(t),this.Sl(t))}Sl(t){var e,i=null==(e=Xr(t))?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}},Ps={GZipJS:"gzip-js",Base64:"base64"},Rs={Activation:"events",Cancellation:"cancelEvents"},Is={Button:"button",Tab:"tab",Selector:"selector"},Os={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"},Cs={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},As={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ms={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ns={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ds={Once:"once",Recurring:"recurring",Always:"always"},Fs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Us={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"},Bs={Popover:"popover",Inline:"inline"};function Ls(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var js={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},zs={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"},Ws={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"},Gs=de("[RateLimiter]"),qs=class{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=>{Gs.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Gs.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("$capture_rate_limit"))&&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=(F(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Vl(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(Ri,a),{isRateLimited:h,remainingTokens:a.tokens}}Gl(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&null!=l&&l.pathname)return""+(null!==(t=l.origin)&&void 0!==t?t:"")+l.pathname}Vl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Zl(),o=this.Gl("$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}},Hs=de("[RemoteConfig]"),Vs=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=f._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ql(t){var e,i;null!=(e=f.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(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 Hs.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Hs.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return Hs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){Hs.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||Hs.warn("Failed to fetch remote config from PostHog."):Hs.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){Hs.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){Hs.error("Error loading feature flags",t)}}},Js=["fatal","error","warning","log","info","debug"],Ks=Uint8Array,Ys=Uint16Array,Xs=Uint32Array,Qs=new Ks([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]),Zs=new Ks([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]),tn=new Ks([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),en=function(t,e){for(var i=new Ys(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Xs(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]},rn=en(Qs,2),sn=rn[1];rn[0][28]=258,sn[258]=28;for(var nn=en(Zs,0)[1],on=new Ys(32768),an=0;32768>an;++an){var hn=(43690&an)>>>1|(21845&an)<<1;on[an]=((65280&(hn=(61680&(hn=(52428&hn)>>>2|(13107&hn)<<2))>>>4|(3855&hn)<<4))>>>8|(255&hn)<<8)>>>1}var ln=function(t,e,i){for(var r=t.length,s=0,n=new Ys(e);r>s;++s)++n[t[s]-1];var o,a=new Ys(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Ys(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[on[d]>>>h]=l}else for(o=new Ys(r),s=0;r>s;++s)o[s]=on[a[t[s]-1]++]>>>15-t[s];return o},un=new Ks(288);for(an=0;144>an;++an)un[an]=8;for(an=144;256>an;++an)un[an]=9;for(an=256;280>an;++an)un[an]=7;for(an=280;288>an;++an)un[an]=8;var dn=new Ks(32);for(an=0;32>an;++an)dn[an]=5;var vn=ln(un,9,0),cn=ln(dn,5,0),_n=function(t){return(t/8|0)+(7&t&&1)},pn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Ys?Ys:t instanceof Xs?Xs:Ks)(i-e);return r.set(t.subarray(e,i)),r},fn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},gn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},mn=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 Ks(0),0];if(1==s){var o=new Ks(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 Ys(v+1),_=bn(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 b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Ks(c),_]},bn=function(t,e,i){return-1==t.s?Math.max(bn(t.l,e,i+1),bn(t.r,e,i+1)):e[t.s]=i},yn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Ys(++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]},wn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},$n=function(t,e,i){var r=i.length,s=_n(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)},Sn=function(t,e,i,r,s,n,o,a,h,l,u){fn(e,u++,i),++s[256];for(var d=mn(s,15),v=d[0],c=d[1],_=mn(n,15),p=_[0],f=_[1],g=yn(v),m=g[0],b=g[1],y=yn(p),w=y[0],S=y[1],x=new Ys(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var T=mn(x,7),k=T[0],P=T[1],R=19;R>4&&!k[tn[R-1]];--R);var I,O,C,A,M=l+5<<3,N=wn(s,un)+wn(n,dn)+o,D=wn(s,v)+wn(n,p)+o+14+3*R+wn(x,k)+(2*x[16]+3*x[17]+7*x[18]);if(N>=M&&D>=M)return $n(e,u,t.subarray(h,h+l));if(fn(e,u,1+(N>D)),u+=2,N>D){I=ln(v,c,0),O=v,C=ln(p,f,0),A=p;var F=ln(k,P,0);for(fn(e,u,b-257),fn(e,u+5,S-1),fn(e,u+10,R-4),u+=14,E=0;R>E;++E)fn(e,u+3*E,k[tn[E]]);u+=3*R;for(var U=[m,w],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)fn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(fn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else I=vn,O=un,C=cn,A=dn;for(E=0;a>E;++E)if(r[E]>255){var j;gn(e,u,I[257+(j=r[E]>>>18&31)]),u+=O[j+257],j>7&&(fn(e,u,r[E]>>>23&31),u+=Qs[j]);var z=31&r[E];gn(e,u,C[z]),u+=A[z],z>3&&(gn(e,u,r[E]>>>5&8191),u+=Zs[z])}else gn(e,u,I[r[E]]),u+=O[r[E]];return gn(e,u,I[256]),u+O[256]},xn=new Xs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),En=new Ks(0),Tn=function(){for(var t=new Xs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),kn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Pn(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=Tn[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,u=(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 Ks(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=$n(h,l,t.subarray(u,d)):(h[u]=n,l=$n(h,l,t.subarray(u,o)))}else{for(var v=xn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Ys(32768),g=new Ys(p+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},w=new Xs(25e3),S=new Ys(288),x=new Ys(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var I=y(u),O=32767&u,C=g[I];if(f[O]=C,g[I]=O,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){l=Sn(t,h,0,w,S,x,T,k,R,u-R,l),k=E=T=0,R=u;for(var M=0;286>M;++M)S[M]=0;for(M=0;30>M;++M)x[M]=0}var N=2,D=0,F=_,U=O-C&32767;if(A>2&&I==y(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&O!=C;){if(t[u+N]==t[u+N-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>N){if(N=z,D=U,z>B)break;var W=Math.min(U,z-2),G=0;for(M=0;W>M;++M){var q=u-U+M+32768&32767,H=q-f[q]+32768&32767;H>G&&(G=H,C=q)}}}U+=(O=C)-(C=f[O])+32768&32767}if(D){w[k++]=268435456|sn[N]<<18|nn[D];var V=31&sn[N],J=31&nn[D];T+=Qs[V]+Zs[J],++S[257+V],++x[J],P=u+N,++E}else w[k++]=t[u],++S[t[u]]}}l=Sn(t,h,n,w,S,x,T,k,R,u-R,l),n||(l=$n(h,l,En))}return pn(a,0,r+_n(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,!l)),d=u.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&&kn(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)}}(u,e),kn(u,d-8,i.d()),kn(u,d-4,r),u}var Rn=!!d||!!u,In=new WeakMap,On="text/plain",Cn=0,An=!1,Mn=(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:"")},Nn=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],h=i({},e),l=null!==(s=null==a?void 0:a.split("&").map(t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=h[s])&&void 0!==e?e:i[1];return delete h[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return rr(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)}(h);return u&&l.push(u),l.length>0?o+"?"+l.join("&"):o},Dn=t=>{if(t.Yl)return t.Yl;var e=t.data,i=t.compression;if(e){if(i===Ps.GZipJS){var r=Pn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Ks(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},n=0;e>n;++n){if(r+5>i.length){var o=new Ks(r+8+(e-n<<1));o.set(i),i=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return pn(i,0,r)}(Qr(e)),{mtime:0});return{contentType:On,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ps.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Qr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Qr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Qr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Fn=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Nn(t.url,{compression:Ps.Base64}),encodedBody:Dn(i({},t,{compression:Ps.Base64,Yl:void 0}))}:{url:Mn(t.url,"compression"),encodedBody:Dn(i({},t,{compression:void 0,Yl:void 0}))};try{e=Dn(t)}catch(e){if(se(t.compression,ts(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,ts(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(An=!0,s()):{url:t.url,encodedBody:e}},Un=t=>{try{return Fn(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Bn=function(){var t=s(function*(t){var e=yield function(t,e,i){return he.apply(this,arguments)}(Qr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Yl:{contentType:On,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Ln=/Failed to fetch|NetworkError|Load failed/i,jn=t=>"TypeError"===(null==t?void 0:t.name)&&Ln.test((null==t?void 0:t.message)||""),zn=t=>{try{var e=function(t,e){if(void 0===e&&(e=Date.now()),"string"==typeof t&&t){var i=t.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){var s=1e3*Math.min(Number(r),300);return s>0?s:void 0}if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r)){var n=/^\w{3} \w{3} /.test(r)?r+" GMT":r,o=Date.parse(n)-e;if(Number.isFinite(o)&&o>0)return Math.min(o,3e5)}}}(t());return C(e)?void 0:Math.min(e,3e4)}catch(t){return}},Wn=t=>{var e=Un(t);if(e){var i=new d;In.set(i,!0);var r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;rr(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,zn(()=>i.getResponseHeader("Retry-After")))}},i.send(o)}},Gn=t=>{var e=Un(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,h=n.estimatedSize,l=new Headers;rr(t.headers,function(t,e){l.append(e,t)}),o&&l.append("Content-Type",o);var d=null,c=!1;if(v){var _=new v;d={signal:_.signal,timeout:setTimeout(()=>{var e;c=!0,_.abort(Qt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))},t.timeout)}}var p=e=>{c&&"AbortError"===(null==e?void 0:e.name)||jn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})},f=0,g=()=>{Cn-=f,f=0,d&&clearTimeout(d.timeout)};try{var m,b=i({method:(null==t?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:a,signal:null==(m=d)?void 0:m.signal},t.fetchOptions),y=null!=h?h:C(a)?0:void 0;b.keepalive="POST"===b.method&&!t.ta&&!1!==b.keepalive&&b.body===a&&!C(y)&&y>=0&&52428.8>Cn+y,b.keepalive&&(Cn+=f=y),u(r,b).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){ue.error(t)}g(),null==t.callback||t.callback(r,zn(()=>e.headers.get("Retry-After")))})).catch(t=>{g(),p(t)}).finally(g)}catch(t){g(),p(t)}}},qn=t=>{try{var e,r=Fn(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},h=o.body,l=o.estimatedSize;if(!h)return;var d=h instanceof Blob?h:new Blob([h],{type:o.contentType});if(a.sendBeacon(s,d))return;var v=P(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(P(v)&&v.length>1&&(null!=l?l:0)>16384){var c=Math.ceil(v.length/2),_=e=>P(t.data)?e:i({},t.data,{batch:e});return qn(i({},t,{data:_(v.slice(0,c))})),void qn(i({},t,{data:_(v.slice(c))}))}ue.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(u?"fetch":"XHR")),u?Gn(i({},t,{ta:!0})):Wn(t)}catch(t){ue.warn("Beacon send failed",t)}},Hn=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Nn(r===Ps.GZipJS?Mn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ps.GZipJS?{}:{compression:r}))},Vn=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Gn}),d&&t.push({transport:"XHR",method:Wn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:qn}),t})(),Jn=!Rn&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla"));function Kn(t,e,r){var s;r&&(e=i({},e,{callback:t=>r(t)})),t.__loaded?Jn?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=i({},t.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(s=t.compression)&&void 0!==s?s:e.compressionFallback:e.compression,(C(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var r,s,n,o=i({},t,{callback:null!=e?e:e=>null==t.callback?void 0:t.callback(e)});o.timeout=o.timeout||6e4;var a,h,l,u,d,v=null!==(r=o.transport)&&void 0!==r?r:"fetch";"sendBeacon"===v&&C(o.compression)&&o.data&&(o.compression=Ps.Base64),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!==(h=null==(d=(u=(P(a=o.data)?a:[a]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=d.properties)?void 0:l.token)&&void 0!==h?h:null==d?void 0:d.token,batch:u,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(o.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),P(t)?t.map(t=>i({},t,{sent_at:e})):i({},t,{sent_at:e})}(o.data))),o.url=Hn(o.url,o.method,o.compression,o.timestampMode);var _=Vn.filter(t=>!o.disableTransport||!t.transport||!o.disableTransport.includes(t.transport)),p=null!==(s=null==(n=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(_,t=>t.transport===v))?void 0:n.method)&&void 0!==s?s:_[0].method;if(!p)throw new Error("No available transport method");var f=t=>{try{p(t)}catch(t){jn(t)?ue.warn(t):ue.error(t),null==o.callback||o.callback({statusCode:0,error:t})}};"sendBeacon"!==v&&o.data&&o.compression===Ps.GZipJS&&c&&"undefined"!=typeof Promise&&!An?Bn(o).then(t=>{f(t)}).catch(e=>{if(ne(e))return An=!0,void f(i({},o,{compression:void 0,url:Hn(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 ne(t)||e===ie})(e)&&(An=!0),f(o)}):p(o)})(e,(i,s)=>{t.rateLimiter.checkForLimiting(i),400>i.statusCode||null==t.config.on_request_error||t.config.on_request_error(i),r?r(i,s):null==e.callback||e.callback(i)})):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}var Yn=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();var t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(t,"sendBeacon")})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){var t=this.aa();for(var e in t)this.ua(t[e])}},this.na))}ua(t,e){try{this.sa(t,e)}catch(t){ue.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){var t={};return rr(this.ia,e=>{var r,s=e,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?":"+s.batchGroup:"");C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.ia=[],t}},Xn=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.da=n.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},ur(n,"online",this.va),ur(n,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t,r){var s=t.retriesPerformedSoFar,n=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,e);U(s)&&(n.url=Nn(n.url,{retry_count:s})),Kn(this._instance,r?i({},n,{transport:r}):n,(t,e)=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.Ls(i({retriesPerformedSoFar:s},n),e);0===t.statusCode&&ue.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!=s?s:0)+" retries.")}null==n.callback||n.callback(t)})}Ls(t,e){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var r=Math.max(function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(i),null!=e?e:0),s=Date.now()+r;this.ia.push({retryAt:s,requestOptions:t});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),ue.warn(n),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){var t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,C(n)||(this.va&&(n.removeEventListener("online",this.va),this.va=void 0),this.pa&&(n.removeEventListener("offline",this.pa),this.pa=void 0)),this.ia)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.ia=[]}},Qn=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,r;this.ba||(this.ba={});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.ba.lastScrollY=Math.ceil(n),this.ba.maxScrollY=Math.max(n,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(h,null!==(r=this.ba.maxContentHeight)&&void 0!==r?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){var t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){ur(n,"scroll",this.ya,{capture:!0}),ur(n,"scrollend",this.ya,{capture:!0}),ur(n,"resize",this.ya)}scrollElement(){var t;if(!this._a)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this._a)?this._a:[this._a]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}wa(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this._a){var s=this.scrollElement();return s&&s[r]||0}return n?"y"===t?n.scrollY||n.pageYOffset||(null==(e=n.document)||null==(e=e.documentElement)?void 0:e.scrollTop)||0:n.scrollX||n.pageXOffset||(null==(i=n.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}},Zn=t=>ds(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),to=class{constructor(t,e,i,r){this.je=t=>{var e=this.ka();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Pi]:i})}},this._instance=t,this.Ca=e,this.xa=i,this.Sa=r||Zn,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Pi]}getSetOnceProps(){var t,e=null==(t=this.ka())?void 0:t.props;return e?"r"in e?vs(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 rr(or(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+x(i)]=e}),t}},eo=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.$a[t]||[])i(e);for(var r of this.$a["*"]||[])r(t,e)}constructor(){this.$a={}}},io=de("[SessionId]"),ro=864e5,so=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var r;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new eo,this.Aa=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||gr,this.Da=i||gr;var s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*J(this.Mr.session_idle_timeout_seconds||1800,60,36e3,io.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){var n=Ur.Dt(this.Na),o=Ur.Dt(this.qa);n&&!o?this.Be=n:Ur.Lt(this.Na),Ur.At(this.qa,!0)}null!=(r=this.Mr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Ur.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Ur.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Ur.Dt(this.Na):null}Ua(t){var e=this.Ia;return!N(e)&&!N(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!r||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[He]:[e,t,i]}))}Va(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(He):(this.xa.flush(),this.xa.load())}Za(){var t;if(!N(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ia){this.Ga();var e=this.Qa();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[He]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}}Ja(){var t=this.Qa()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){var t=this.xa.props[He];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(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 io.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void io.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&n&&(n.removeEventListener(Xi,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ur.Lt(this.qa)},ur(n,Xi,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=r;else if(N(this.Ma)||this.Ma>r||r-this.Ma>=1e3){var n,o;null==(n=(o=this.xa).syncCookieProperties)||n.call(o),this.Ma=r}var a=this.Qa(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.Ja(),v=this.za(),c=this.Fa,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>ro),p=c?_:U(l)&&Math.abs(r-l)>ro,f=!1,g=u,m=!h||!!c,b=h,y=!m&&!t&&this.Aa(r,d);if(y){(y=this.Ka(r))||io.info("cross-tab refresh kept the session alive",{sessionId:h});var w=this.Qa();h=w[1],l=w[2]}if(m||y||p){g=!1;var S=c&&!_;h=S?c.sessionId:this.Oa(),v=this.Da(),io.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=S?c.sessionStartTimestamp:r,this.Fa=void 0,f=!0}else v||(v=this.Da(),f=!0),(g=g||h!==b)&&(io.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var x=U(d)&&t&&!p?d:r,E=U(l)?l:(new Date).getTime();this.Ha(v),this.Wa(h,x,E),t||this.La();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ea.forEach(t=>t(h,v,T)),{sessionId:h,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};function no(){return(no=s(function*(){var t=null==a?void 0:a.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e,i=null==(e=yield t.getHighEntropyValues(["model"]))?void 0:e.model;return A(i)&&i.length>0?i:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function oo(t,e){var i="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(i="$survey_"+e+"/"+t.id+"/"+t.current_iteration),i}function ao(t,e,i){return Qr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var ho,lo="custom",uo="i.posthog.com",vo=/^\/static\//,co=["/s/","/e/","/i/"],_o=class{constructor(t){this.Ya={},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("."+uo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[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":lo),this.Ya[this.apiHost]}tu(t){if(vo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}eu(t){var e=Zr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Zr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&co.some(t=>0===e.indexOf(t))){var a=this.eu(r);if(a){var h,l=this.apiHost,u=this.nu;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(this.nu=u={apiHost:l,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.nu,i=this.eu(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.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.tu(e);if(i)return this.iu(t,e,""+i+e)}if(this.region===lo)return this.iu(t,e,this.apiHost+e);var r=uo+e;switch(t){case"assets":return this.iu(t,e,"https://"+this.region+"-assets."+r);case"api":return this.iu(t,e,"https://"+this.region+"."+r)}}},po=de("[Surveys]"),fo={ignoreConditions:!1,ignoreDelay:!1,displayType:Bs.Popover},go=de("[PostHog ExternalIntegrations]"),mo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bo=class{constructor(t){this._instance=t}No(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return go.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=f.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.No(mo[n],()=>{var e;null==(e=f.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=f.__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()}}},yo=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return s(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.su.set(t.name,t);try{var i=t.setup(e.po);i&&(yield i)}catch(i){var r=e.su.get(t.name)===t;r&&e.su.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(!this.So){this.So=!0;var t=Array.from(this.su.values()).reverse();for(var e of(this.su.clear(),t))this.ru(e)}}ru(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,e=>{this.$.error('Failed to dispose browser extension "'+t.name+'"',e)})}catch(e){this.$.error('Failed to dispose browser extension "'+t.name+'"',e)}}},wo=class{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)}},$o="extensionsRemoteConfig",So=class{constructor(t){this.instance=t,this.So=!1,this.$=ue,this.ou=t.lu,this.kv=new wo(t),this.onEvent=t=>Ls(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return Ls(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on($o,e);return this.ou&&e(this.ou),Ls(i)},this.uu=new yo(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ye);return"string"==typeof t?t:void 0}get library(){return{name:ge.LIB_NAME,version:ge.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.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var r=this;return s(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 Ls(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit($o,t))}sendRequest(t,e){var i=this;return s(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?Nn(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?b.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.So||(this.So=!0,this.uu.dispose())}},xo={},Eo=0,To=()=>{},ko='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Po="Surveys module not available",Ro="sanitize_properties is deprecated. Use before_send instead",Io="Invalid value for property_denylist config: ",Oo=/^[A-Za-z0-9_-]{1,400}$/,Co=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ao=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Mo=["token","distinct_id",Ni],No="posthog",Do=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},Fo=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:lr(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:To,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&A(null==l?void 0:l.search)&&-1!==l.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(e=n.location)?void 0:e.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){ue.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:Ki,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:To},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Lr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Do(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)}))(t))},Uo=[["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"]],Bo=t=>{var e={};for(var i of Uo){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=sr({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),A(o)&&C(t.asset_host)&&(n.asset_host=o)),P(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:P(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error(Io+t.property_denylist)),n},Lo=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},jo=(t=class t{du(t){if(t){var e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}}vu(t,e){return this.du(t),this.su.push(e),null==e.initialize||e.initialize(),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(!(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.mu||(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', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!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)))}}yu(){if(!this.fu()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.bu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(gr());this.register({distinct_id:i,$device_id:i}),t.set_property(ki,Vi)}this._u()}}}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 e;this.wu=!1,this.ku=!1,this.webPerformance=new Lo,this.Su=!1,this.version=ge.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new eo,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Fo(),this.SentryIntegration=Hr,this.sentryIntegration=t=>function(t,e){var i=qr(t,e);return{name:Gr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Qn(this),this.pageViewManager=new Vr(this),this.rateLimiter=new qs(this),this.requestRouter=new _o(this),this.consent=new Br(this),this.externalIntegrations=new bo(this);var i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t))}init(e,i,r){if(r&&r!==No){var s,n=null!==(s=xo[r])&&void 0!==s?s:new t;return n._init(e,i,r),xo[r]=n,xo[No][r]=n,n}return this._init(e,i,r)}_init(t,e,r){var s,o,a;void 0===e&&(e={});var h,l=A(t)?t.trim():"";if(!l)return ue.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 l!==(null==(h=this.config)?void 0:h.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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Fo(e.defaults),e.debug=this.Pu(e.debug),this.Ru=e,this.Au=[],e.person_profiles?this.Mu=e.person_profiles:e.process_person&&(this.Mu=e.process_person);var u=Fo(e.defaults),d=Bo(e),v=sr({},u,d,{name:r,token:l});I(u.rageclick)&&I(d.rageclick)&&(v.rageclick=sr({},u.rageclick,d.rageclick)),I(u.session_recording)&&I(d.session_recording)&&(v.session_recording=sr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ps.GZipJS;var c=this.bu();if(this.persistence=new ks(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ks(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Ur.Et()){var _=Ur.Dt(this.Cu);P(_)&&_.forEach(t=>{A(t)&&this.xu.add(t)})}else Ur.Lt(this.Cu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Yn((t,e)=>this.Ou(t,e),this.config.request_queue_config),this.Du=new Xn(this),this.__request_queue=[];var g=this.fu();g||(this.sessionManager=new so(this),this.sessionPropsManager=new to(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(g)},0)):(ue.info("Initializing extensions synchronously"),this.qu(g)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&ue.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:f}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(o=e.bootstrap)?void 0:o.distinctID;if(this.mu=!!m&&!M(m),null!=(a=e.bootstrap)&&a.distinctID){var b=e.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(ki);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"anonymous"===w)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"identified"===w)ue.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 S=this.config.get_device_id(gr()),x=e.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(ki,e.bootstrap.isIdentifiedID?Ji:Vi),this.register({distinct_id:b,$device_id:x})}}if(g)this.register_once({distinct_id:Mi,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(gr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(ki,Vi)}return ur(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ur(n,"pageshow",()=>{var t;this.wu=!1,this.ku||null==(t=this.Du)||t.resume()}),e.segment?Wr(this,()=>this.ju()):this.ju(),R(this.config._onCapture)&&this.config._onCapture!==To&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ue.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 no.apply(this,arguments)}().then(t=>{t&&this.register({[we]:t})}).catch(To),this}Bu(t){var e=t;return A(e.name)&&R(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.su.push(t)}Nu(){var e,i,r,s,n,o,a=null!==(e=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==e?e:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.Uu)||o.call(this),this.Uu=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}qu(e){var r,s,n,o,a,h,l,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.su.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.su.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.su.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.su.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Hu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Hu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Hu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.su.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.su.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.su.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.su.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.su.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,jr)),d.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new d.toolbar(this)),d.experiments&&this.su.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new d.experiments(this)),this.su.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Wu){var t=this.Wu;this.Wu=void 0,this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.Vu(v,u)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Di]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fi]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Kl(t){var e;if(!h||!h.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=S(r.supportedCompression,Ps.GZipJS)?Ps.GZipJS:S(r.supportedCompression,Ps.Base64)?Ps.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Ki}),null==(e=this.Gu)||e.handleRemoteConfig(t),this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}ju(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&null!=l&&l.hostname){var t=l.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.fu())&&this.Qu()},1),this.Ju=new Vs(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Fu)||t.enable())}_dom_loaded(){this.is_capturing()&&ir(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,r,s;this.wu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Zi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Fu)||r.unload(),null==(s=this.Du)||s.unload()):this.Ku()&&this.capture(Zi,null,{transport:"sendBeacon"})}_send_request(t){Kn(this,t)}Ou(t,e){this.Du?this.Du.retriableRequest(t,e):this._send_request(e?i({},t,{transport:e}):t)}_execute_array(t){Eo++;try{var e,i=[],r=[],s=[];ir(t,t=>{if(t)if(P(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else P(t)&&"alias"===e?i.push(t):P(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)});var n=function(t,e){ir(t,function(t){try{if(P(t[0])){var i=e;rr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}})};n(i,this),n(r,this),n(s,this)}finally{Eo--}}push(e){if(Eo>0&&P(e)&&A(e[0])){var i=t.prototype[e[0]];R(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}get Xu(){return{property:xe,persistenceKey:Ee,cookieName:"_fbc",pattern:Co,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Ee]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(Ee)}}}get Yu(){return{property:Te,persistenceKey:ke,cookieName:"_fbp",pattern:Ao,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[ke]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(ke)}}}th(t){var e,i=null==(e=this.persistence)?void 0:e.get_property(t.persistenceKey);return A(i)&&t.pattern.test(i)?{value:i,delivered:!1}:I(i)&&A(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}eh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ih(t){if(this.config.save_campaign_params&&!this.fu()){var e=dr(t.cookieName);return A(e)&&t.pattern.test(e)?e:void 0}}nh(t,e,i,r){if(this.persistence){var s=this.Xu;this.persistence.refreshKey(s.persistenceKey);var n=this.th(s);if(!r){if(i)return A(e)&&Co.test(e)?this.eh(s,e,n):void s.unregister();var o=A(t)&&Oo.test(t)?t:void 0,a=this.ih(s);return a&&((t,e,i)=>{var r=t.split(".");if(e)return r[3]===e;if(!i)return!0;var s=i.value.split(".");return r[3]===s[3]||Number(r[2])>Number(s[2])})(a,o,n)?this.eh(s,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this.eh(s,"fb.1."+Date.now()+"."+o,n):n?{value:n.value,pending:!n.delivered}:void 0}s.unregister()}}sh(t,e,i){if(this.persistence){var r=this.Yu;this.persistence.refreshKey(r.persistenceKey);var s=this.th(r);if(!i){if(e)return A(t)&&Ao.test(t)?this.eh(r,t,s):void r.unregister();var n=this.ih(r);return n?this.eh(r,n,s):s?{value:s.value,pending:!s.delivered}:void 0}r.unregister()}}rh(t,e){if(this.persistence){this.persistence.refreshKey(t.persistenceKey);var i=this.th(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}}capture(t,e,r){var s,n,o,a,h,l,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu){if(this.is_capturing())if(!C(t)&&A(t)){this.yu();var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var v=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){var c;null!=e&&e.$current_url&&!A(null==e?void 0:e.$current_url)&&(ue.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!=r&&r._originatedFromCaptureException||ue.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&&(c=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 _=new Date,p=(null==r?void 0:r.timestamp)||_,f=Xt(null==r?void 0:r.uuid,gr),g={uuid:f,event:t,properties:this.calculateEventProperties(t,e||{},p,f)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&d&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),v&&(g.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var m="$feature_flag_called"===t&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!m&&(g.$set=null==r?void 0:r.$set);var b=I(null==e?void 0:e.$set)?e.$set:void 0,y=P(null==e?void 0:e.$unset)?e.$unset:[],w=(null==r?void 0:r.$unset)||[],S=t=>{var e,i=!(null==r||!r.$set)&&t in r.$set;return{hasProvided:i||!!b&&t in b,provided:i?null==r||null==(e=r.$set)?void 0:e[t]:null==b?void 0:b[t],unset:-1!==y.indexOf(t)||-1!==w.indexOf(t)}},x=S(xe),E=S(Te),T=[{channel:this.Xu,hasProvided:x.hasProvided,update:this.nh(null==(s=c)?void 0:s.fbclid,x.provided,x.hasProvided,x.unset)},{channel:this.Yu,hasProvided:E.hasProvided,update:this.sh(E.provided,E.hasProvided,E.unset)}];for(var k of T){var R=k.channel,M=k.update;M&&!0===g.properties.$process_person_profile&&M.pending&&!k.hasProvided&&!m&&(g.$set=i({[R.property]:M.value},g.$set))}var N=null==r?void 0:r.$unset;N&&(g.$unset=N);var F=m?void 0:this.ah(null==r?void 0:r.$set_once,t!==er,t===tr);if(F&&(g.$set_once=F),null!=r&&r._noTruncate||(a=this.config.properties_string_max_length,h=g,l=t=>A(t)?t.slice(0,a):t,u=new Set,g=function t(e,i){if(e!==Object(e))return l?l(e):e;if(!u.has(e)){var r;if(u.add(e),P(e))r=[],ir(e,e=>{r.push(t(e))});else{var s={};rr(z(e)?ar(e):e,(e,i)=>{u.has(e)||(s[i]=t(e,i))}),r=s}return r}}(h)),g.timestamp=p,C(null==r?void 0:r.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=_),m&&(g.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ee.forEach(r),e.forEach(r),i}(g.properties,Mo)),t===Fs.DISMISSED||t===Fs.SENT){var U=null==e?void 0:e[Us.SURVEY_ID],B=null==e?void 0:e[Us.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){po.error("Failed to persist survey seen state",t)}})({id:U,current_iteration:B}),g.$set=i({},g.$set,{[oo({id:U,current_iteration:B},t===Fs.SENT?"responded":"dismissed")]:!0})}else t===Fs.SHOWN&&(g.$set=i({},g.$set,{[Us.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===zs.SHOWN){var L=null==e?void 0:e[Ws.TOUR_TYPE];L&&(g.$set=i({},g.$set,{[Ws.TOUR_LAST_SEEN_DATE+"/"+L]:(new Date).toISOString()}))}var j=i({},g.properties.$set,g.$set);if(O(j)||this.setPersonPropertiesForFlags(j),!D(this.config.before_send)){var W=this.Os(g);if(!W)return;(g=W).uuid=Xt(g.uuid,gr)}var G=T.filter(t=>{var e,i,r,s=t.channel,n=t.update,o=null!==(e=null==(i=g.$set)?void 0:i[s.property])&&void 0!==e?e:I(null==(r=g.properties)?void 0:r.$set)?g.properties.$set[s.property]:void 0;return(null==n?void 0:n.pending)&&o===n.value});this.au.emit("eventCaptured",g);var q,H,V=null!==(n=null==r?void 0:r._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),J="recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(V),K=i({method:"POST",url:V,data:g,compression:"best-available",timestampMode:J?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},J&&null!=(o=g.properties)&&o.$session_id?{batchGroup:g.properties.$session_id+(g.properties.$window_id?"-"+g.properties.$window_id:"")}:{},null!=r&&r.transport?{transport:r.transport}:{},G.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(var e of G)this.rh(e.channel,e.update.value)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||G.length?(!K.transport&&!K.callback&&O(null!==(q=this.config.request_headers)&&void 0!==q?q:{})&&this.wu&&(H="sendBeacon"),this.Ou(K,H)):this.Fu.enqueue(K),g}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null==(e=this.Gu)?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new So(this)}hu(t){this.$u.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}}uh(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.xu.clear(),this.hh()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.uh();var a=o?void 0:this.persistence.remove_event_timer(t),u=i({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.fu()&&(u[Ni]=!0),"$snapshot"===t){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!A(u.distinct_id)&&!F(u.distinct_id)||M(u.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,c=function(t,e,i,r){var s,o,a,h;if(void 0===r&&(r=!1),!_)return{};var u,d=t?[...is,...e||[]]:[],v=function(t){for(var e=0;Ht.length>e;e++){var i=Ht[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(_),c=v[0],p=v[1],f=function(t){for(var e=0;Kt.length>e;e++){var i,r=Kt[e],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(i=n&&t.match(n)||o)?void 0:i[1])||""]}return["",""]}(_),g=f[0],b=f[1],y=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},w={};C(i)||(w.detectGoogleSearchApp=i);var S={},x=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,T=null==n||null==(a=n.screen)?void 0:a.width,k=null==n||null==(h=n.screen)?void 0:h.height,P=null==n?void 0:n.devicePixelRatio;C(x)||(S.userAgentDataPlatform=x),C(E)||(S.maxTouchPoints=E),C(T)||(S.screenWidth=T),C(k)||(S.screenHeight=k),C(P)||(S.devicePixelRatio=P);var I,O,A,M,N,D,F,U,B=sr(or({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,y,w),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(O=_,A=S,U=Vt(O),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===yt?"Console":U===tt?"Wearable":U?K:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(M=null==A?void 0:A.maxTouchPoints)&&void 0!==M?M:0)>0?600>Math.min(null!==(N=null==A?void 0:A.screenWidth)&&void 0!==N?N:0,null!==(D=null==A?void 0:A.screenHeight)&&void 0!==D?D:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?K:X:"Desktop"),$timezone:cs(),$timezone_offset:_s()}),{$current_url:es(r?Zt(null==l?void 0:l.href):null==l?void 0:l.href,d,ss),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:qt(_,navigator.vendor,y,w),$browser_language:hs(),$browser_language_prefix:(I=hs(),"string"==typeof I?I.split("-")[0]:void 0),$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(B.$sdk_dist_channel=m.SDK_DIST_CHANNEL),B}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),f=p.windowId;u.$session_id=p.sessionId,u.$window_id=f}this.sessionPropsManager&&sr(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&sr(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Du)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===lo&&(u.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||o?"$pageleave"!==t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=sr(u,v),"$pageview"===t&&h&&(u.title=h.title),!C(a)){var b=r.getTime()-a;u.$duration=parseFloat((b/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),w=this.sessionPersistence.properties(),S=u.$groups,x=y.$groups;I(S)&&!O(S)&&(u.$groups=i({},I(x)?x:{},S)),rr(["$referrer","$referring_domain"],t=>{t in y&&delete w[t]});var E={};if(this.$u.length>0)for(var T of this.$u.slice())try{sr(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=sr({},c,y,w,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?rr(this.config.property_denylist,function(t){delete u[t]}):ue.error(Io+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(Ro),u=k(u,t));var N=this.dh();return u.$process_person_profile=N,N&&!o&&this.fh("_calculate_event_properties"),u}ah(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.dh())return t;if(this.Su&&!i)return t;var s=sr({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(Ro),s=n(s,"$set_once")),e&&(this.Su=!0),O(s)?void 0:s}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.uh(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.hh()}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.xu.delete(t),this.hh()}ph(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.xu.clear(),this.hh()}hh(){var t;if(this.Cu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Ur.Et())Ur.Lt(this.Cu);else{var e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Ur.At(this.Cu,e):Ur.Lt(this.Cu)}}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.au.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:Po}),()=>{})}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:Po})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Po})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=fo),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:Po}}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:Po})}gh(t){return!t||M(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ue.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())||(ue.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 ue.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gh(t)&&this.fh("posthog.identify")){this.yu();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.uh(!1),o=this.persistence.Pl(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property("__alias")&&(this.unregister($e),this.register({distinct_id:t}));var l=(this.persistence.get_property("$user_state")||"anonymous")===Vi,u=t!==h,d=!u&&l;if(u&&l){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:h};this.persistence.set_property(ki,Ji),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",c,{$set:e||{},$set_once:i||{}})&&(this.Eu=ao(t,e,i)),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(ki,Ji);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:_,$set_once:p})&&(this.Eu=ao(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Si)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}}setPersonProperties(t,e){if((t||e)&&this.fh("posthog.setPersonProperties")){var i=ao(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Eu=i)):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(P(t)?t:[t]).filter(t=>A(t)&&t.length>0);0!==i.length&&this.fh("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.uh();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.dh()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(er,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ue.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.fh("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.mh(e,!1,i)}mh(t,e,r){var s,n,o,a;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Ru)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var l=this.get_property(ye),u=this.get_property(we),d=this.get_property(Be);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),e||!v||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 c=null==(a=this.persistence)||null==a.Pl?void 0:a.Pl(),_=!1;try{var p,f,g,m,b,y,w,S,x,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.xu.clear(),this.hh(),C(d)||null==(g=this.persistence)||g.register({[Be]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(S=this.metrics)||S.reset(),null==(x=this.persistence)||x.set_property(ki,Vi),null==(E=this.sessionManager)||E.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Mi,$device_id:null},"");else{var R=this.config.get_device_id(gr());this.register_once({distinct_id:R,$device_id:t?R:l},""),t||C(u)||this.register({[we]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.fu()&&(null==(P=this.persistence)||P.set_property(ki,r.isIdentifiedID?Ji:Vi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(D(h)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(h,!0))){var I=i({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var O;c&&(null==(O=this.persistence)||null==O.Ol||O.Ol(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a,h;if(e.__loaded){e.ku=!0,e.zu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.metrics)||s.dispose(),null==(n=e.Fu)||n.unload(),null==(o=e.Du)||o.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(a=e.persistence)||a.destroy(),null==(h=e.sessionPersistence)||h.destroy()}else ue.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("$people_distinct_id")?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.fh("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.ph($e,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(I(t)){var r,s,n,o,a,h,l,u,d,v,c,_,p,f;sr(this.config,Bo(t));var g=this.bu();null==(r=this.persistence)||r.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ks(i({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.Pu(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,xr.Et()&&xr.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,xr.Et()&&xr.Lt("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.metrics)||a.onConfigChange(),null==(h=this.sessionRecording)||h.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._u(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Wr(this,To,!1)}}_overrideSDKInfo(t,e){ge.LIB_NAME=t,ge.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){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},r,e))}catch(t){return}}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 e,i;return null!==(e=null==(i=this.logs)?void 0:i.logger)&&void 0!==e?e:t._h}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:No;return e!==No&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(e=this.sessionPersistence)?void 0:e.get_property("$user_state"))}dh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&O(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.dh()||this.fh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fh(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ph(Ai,!0),!0)}bu(){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&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e,i,r,s,n=this.bu();return this.is_capturing()||null==(t=this.logs)||t._onOptOut(),(null==(e=this.persistence)?void 0:e.pi)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.pi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.xu.clear(),this.hh()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,o,a,h,l,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.mh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new so(this),this.pageViewManager=new Vr(this),this.persistence&&(this.sessionPropsManager=new to(this,this.sessionManager,this.persistence));var d,v=null!==(h=null==(l=this.config.__extensionClasses)?void 0:l.sessionRecording)&&void 0!==h?h:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.vu(this.sessionRecording,new v(this)),this.lu&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ue.warn(ko)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,e,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.mh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Mi,$device_id:null}),this.du(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.Qu(),this.Zu())}else ue.warn(ko)}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"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return a?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&V(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>V(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver}(a,this.config.custom_blocked_useragents):void 0}Qu(){h&&("visible"===h.visibilityState?this.Tu||(this.Tu=!0,this.capture(Qi,{title:h.title},{send_instantly:!0}),this.Iu&&(h.removeEventListener(Yi,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),ur(h,Yi,this.Iu)))}debug(t){!1===t?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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.Ru||{};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?(ue.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&&!D(t[e]),o=i in t&&!D(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,ue)}Os(t){var e;if(D(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=P(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),D(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!O(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return ue.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&D(s.properties[a]))return ue.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.Bo)?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)})}Pu(t){var e=B(t)&&!t,i=xr.Et()&&"true"===xr.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t._h={trace:ho=()=>{},debug:ho,info:ho,warn:ho,error:ho,fatal:ho},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=nr(t.prototype[e[i]])}(jo,["identify"]);var zo=function(){ge.SDK_DIST_CHANNEL="npm";var t=xo[No]=new jo;return function(){function t(){t.done||(t.done=!0,Jn=!1,rr(xo,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():ur(h,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ps as Compression,js as DEFAULT_PRODUCT_TOUR_APPEARANCE,Bs as DisplaySurveyType,jo as PostHog,zs as ProductTourEventName,Ws as ProductTourEventProperties,Fs as SurveyEventName,Us as SurveyEventProperties,Rs as SurveyEventType,Os as SurveyPosition,Ns as SurveyQuestionBranchingType,Ms as SurveyQuestionType,Ds as SurveySchedule,Cs as SurveyTabPosition,As as SurveyType,Is as SurveyWidgetType,zo as default,zo as posthog,Js as severityLevels};
2
2
  //# sourceMappingURL=module.slim.js.map