posthog-js 1.429.2 → 1.429.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.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.d.ts +2 -0
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +2 -0
- package/dist/module.full.d.ts +2 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +2 -0
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.d.ts +2 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +2 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/src/extensions/surveys.d.ts +2 -0
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.d.ts +2 -0
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/surveys.d.ts +2 -0
- package/lib/src/extensions/surveys.js +18 -1
- package/lib/src/extensions/surveys.js.map +1 -1
- package/lib/src/feature-flags-config.js +5 -5
- package/lib/src/feature-flags-config.js.map +1 -1
- package/lib/src/posthog-core.js +3 -7
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +4 -4
package/dist/module.slim.js
CHANGED
|
@@ -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.2",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}({}),w=["$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"],y=["token"];function x(t,e){return-1!==t.indexOf(e)}var S=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,O=t=>t===Object(t)&&!P(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,D=t=>null===t,N=t=>C(t)||D(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=>x(w,t),j=t=>x(y,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"],q=t=>x(W,t),G=[!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 Y="Mobile",K="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",wt="Ouya",yt="Generic "+Y.toLowerCase(),$t="Generic "+X.toLowerCase(),xt="Konqueror",St="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",Ot="Waterfox",It="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Dt="Google Search App",Nt=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?It:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?Dt:x(t," OPR/")&&x(t,"Mini")?"Opera Mini":x(t," OPR/")?ht:jt.test(t)?it:x(t,"IEMobile")||x(t,"WPDesktop")?at:x(t,"OculusBrowser")?St:x(t,"SamsungBrowser")?rt:x(t,"Edge")||x(t,"Edg/")?lt:x(t,"Vivaldi/")?Et:x(t,"YaBrowser/")?Tt:x(t,"Whale/")?kt:x(t,"DuckDuckGo/")||x(t,"Ddg/")?Pt:x(t,"Claude/")?Ct:x(t,"Codex/")?At:x(t,"ChatGPT/")?Mt:x(t,"FBIOS")?"Facebook Mobile":x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?nt:x(t,"CrMo")||x(t,st)?st:x(t,K)&&x(t,et)?pt:x(t,"FxiOS")?dt:x(t.toLowerCase(),xt.toLowerCase())?xt:x(t,"Brave/")?It:((t,e)=>e&&x(e,"Apple")||function(t){return x(t,et)&&!x(t,st)&&!x(t,K)}(t))(t,e)?x(t,Y)?ft:et:x(t,"PaleMoon/")?Rt:x(t,"Waterfox/")?Ot:x(t,ut)?ut:x(t,"MSIE")||x(t,"Trident/")?ot:x(t,"Gecko")?ut:"")},qt={[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]:[Nt],[ft]:[Nt],[ht]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gt=function(t,e,i,r){var s=qt[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(Y).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]?[K,[t[2],t[3],t[4]||"0"].join(".")]:[K,""]],[/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(wt,"i").test(t)?wt: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(Y).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)?K:Q:new RegExp("(pda|Mobile)","i").test(t)?yt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yt=[[/\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"]],Kt=/^[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)&&Kt.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.429.2",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",we="$device_id",ye="$device_model",$e="__alias",xe="__cmpns",Se="$fbc",Ee="$fbc_persistence",Te="__timers",ke="$autocapture_disabled_server_side",Pe="$heatmaps_enabled_server_side",Re="$exception_capture_enabled_server_side",Oe="$error_tracking_suppression_rules",Ie="$error_tracking_capture_extension_exceptions",Ce="$web_vitals_enabled_server_side",Ae="$dead_clicks_enabled_server_side",Me="$product_tours_enabled_server_side",De="$logs_capture_enabled_server_side",Ne="$web_vitals_allowed_metrics",Fe="$session_recording_remote_config",Ue="$session_recording_enabled_server_side",Be="$replay_sample_rate",Le="$replay_override_sampling",je="$replay_override_linked_flag",ze="$replay_override_url_trigger",We="$replay_override_event_trigger",qe="$sesid",Ge="$session_is_sampled",He="$session_past_minimum_duration",Ve="$session_recording_url_trigger_activated_session",Je="$session_recording_event_trigger_activated_session",Ye="$debug_first_full_snapshot_timestamp",Ke="$sess_rec_flush_size",Xe="$enabled_feature_flags",Qe="$active_feature_flags",Ze="$early_access_features",ti="$feature_flag_details",ei="$feature_flag_payloads",ii="$feature_flag_request_id",ri="$minimal_flag_called_events",si="$override_feature_flags",ni="$override_feature_flag_payloads",oi="$stored_person_properties",ai="$stored_group_properties",hi="$groups",li="$surveys",ui="$surveys_loaded_at",di="$surveys_activated",vi="$surveys_activated_session",ci="$surveys_activated_timestamps",_i="ph_product_tours",pi="$product_tours_activated",fi="$product_tours_activated_session",gi="$conversations_widget_session_id",mi="$conversations_ticket_id",bi="$conversations_widget_state",wi="$conversations_user_traits",yi="$flag_call_reported",$i="$flag_call_reported_session_id",xi="$feature_flag_errors",Si="$feature_flag_evaluated_at",Ei="$user_state",Ti="$client_session_props",ki="$capture_rate_limit",Pi="$initial_campaign_params",Ri="$initial_referrer_info",Oi="$initial_person_info",Ii="$epp",Ci="$posthog_cookieless",Ai="$cookieless_mode",Mi="$sdk_debug_extensions_init_method",Di="$sdk_debug_extensions_init_time_ms",Ni="$sdk_debug_recording_script_not_loaded",Fi="$sdk_debug_replay_event_trigger_status",Ui="$sdk_debug_replay_linked_flag_trigger_status",Bi="$sdk_debug_replay_matched_recording_trigger_groups",Li="$sdk_debug_replay_pending_trigger_conditions",ji="$sdk_debug_replay_remote_trigger_matching_config",zi="$sdk_debug_replay_trigger_groups_count",Wi="$sdk_debug_replay_url_trigger_status",qi="$session_recording_start_reason",Gi="anonymous",Hi="identified",Vi="identified_only",Ji="visibilitychange",Yi="beforeunload",Ki="$pageview",Xi="$pageleave",Qi="$identify",Zi="$groupidentify";function tr(t,e){P(t)&&t.forEach(e)}function er(t,e){if(!N(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 ir=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},rr=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)}}},sr=function(t){var e={};return er(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function nr(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 or=["herokuapp.com","vercel.app","netlify.app"];function ar(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 or)if(i===r)return!1;return!0}function hr(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 lr=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 ur=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}},dr=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 ur.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 _r}},vr=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&&(vr=t=>crypto.getRandomValues(t));var cr,_r=class{nextUint32(){return this.Rt.length>this.$t||(vr(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},pr=()=>fr().toString(),fr=()=>(cr||(cr=new dr)).generate(),gr="",mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var br=null,wr={Et(){if(!D(br))return br;if(br=!1,h)try{var t="__ph_cookie_support_"+pr();wr.At(t,"xyz"),br='"xyz"'===lr(t),wr.Lt(t)}catch(t){br=!1}return br},Pt(t){ue.error("cookieStore error: "+t)},Ot:lr,Dt(t){var e;try{e=JSON.parse(wr.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),gr)return gr;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_"+pr();!gr&&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",gr=n)}return gr}(t);if(!i){var r=(t=>{var e=t.match(mr);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{wr.At(t,"",-1,e)}catch(t){return}}},yr=null,$r={Et(){if(!D(yr))return yr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";$r.At(e,"xyz"),'"xyz"'!==$r.Ot(e)&&(t=!1),$r.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),yr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){$r.Pt(t)}return null},Dt(t){try{return JSON.parse($r.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){$r.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){$r.Pt(t)}}},xr=[oi,Qe,Xe,ti,ei,ii,Si,xi,yi],Sr=[we,be,qe,Ge,Ii,Oi,Ee,Ei],Er=t=>t+"_cpm",Tr=["__proto__","constructor","prototype"],kr=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Tr.indexOf(i)&&(e[i]=t[i])}),e},Pr=function(t,e){void 0===e&&(e=[]);var i={};return[...Sr,...e].forEach(e=>{var r=t[e];C(r)||D(r)||""===r||(i[e]=r)}),i},Rr=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)},Or=(t,e)=>({p:e,f:Rr(JSON.stringify(t))}),Ir=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=wr.Dt(Er(t)),r=(null==i?void 0:i.f)===Rr(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Cr=(t,e)=>e+"|"+(wr.Ot(Er(t))||""),Ar={},Mr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Ar?Ar[t]:null,Dt:t=>t in Ar?Ar[t]:null,At:(t,e)=>(Ar[t]=e,!0),Lt(t){delete Ar[t]}},Dr=null,Nr={Et(){if(!D(Dr))return Dr;if(Dr=!0,C(n))Dr=!1;else try{var t="__support__";Nr.At(t,"xyz"),'"xyz"'!==Nr.Ot(t)&&(Dr=!1),Nr.Lt(t)}catch(t){Dr=!1}return Dr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Nr.Pt(t)}return null},Dt(t){try{return JSON.parse(Nr.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Nr.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Nr.Pt(t)}}},Fr=class{constructor(t){this._instance=t}get Sr(){return this._instance.config}get consent(){return this.xo()?0:this.Co}isOptedOut(){return"always"===this.Sr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Sr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Sr.opt_out_capturing_by_default}optInOut(t){this.$o.At(this.To,t?1:0,this.Sr.cookie_expiration,this.Sr.cross_subdomain_cookie,this.Sr.secure_cookie)}reset(){this.$o.Lt(this.To,this.Sr.cross_subdomain_cookie)}get To(){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 Co(){var t=this.$o.Ot(this.To);return q(t)?1:x(G,t)?0:-1}get $o(){var t=this.Sr.opt_out_capturing_persistence_type,e="localStorage"===t?$r:wr,i=e.Et()?e:Mr;if(!this.Io||this.Io!==i){this.Io=i;var r="localStorage"===t?wr:$r;r.Ot(this.To)&&(this.Io.Ot(this.To)||this.optInOut(q(r.Ot(this.To))),r.Lt(this.To,this.Sr.cross_subdomain_cookie))}return this.Io}xo(){return!!this.Sr.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>q(t))}},Ur=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var Br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ae)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Lr=de("[SegmentIntegration]");function jr(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()||pr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ei,Hi)),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||Lr.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()||(Lr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(Lr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!N(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),N(s))return null}catch(t){return Lr.error("Error in Segment filterProperties:",t),null}return s})(s,l);if(N(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,Ki)},identify(t){return n(t,Qi)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:h})).then(()=>{e()},t=>{Lr.error("Failed to register the Segment integration",t),e()})},r)}var zr="posthog-js";function Wr(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 qr=class{constructor(t,e,i,r,s,n){this.name=zr,this.setupOnce=function(o){o(Wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Gr=class{constructor(t){this.Ro=(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.Ao=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Fo()}Fo(){var t;this.Oo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Ro)}destroy(){var t;null==(t=this.Oo)||t.call(this),this.Oo=void 0}doPageView(t,e){var i,r=this.Do(t,e);return this.Ao={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.Do(t,null==(e=this.Ao)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ao)?void 0:t.pageViewId}}Do(t,e){var i=this.Ao;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=ir(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}},Hr=["flags","surveys"],Vr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"event"},[Pe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Re]:{exposure:"event"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"event"},[Ce]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"hidden"},[Ne]:{exposure:"event"},[Fe]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Be]:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},[He]:{exposure:"event"},[Ve]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[Ze]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden",storageGroup:"flags"},[ii]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[li]:{exposure:"hidden",storageGroup:"surveys"},[ui]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[di]:{exposure:"event"},[vi]:{exposure:"hidden"},[ci]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"event"},[mi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[yi]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[hi]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Le]:{exposure:"event"},[je]:{exposure:"event"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Mi]:{exposure:"event"},[Di]:{exposure:"event"},[Ni]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[qi]:{exposure:"event"}},Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Yr=t=>{var e=Vr[t];if(e)return e;for(var i of Jr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Kr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,nr(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},Xr=t=>{var e=null==h?void 0:h.createElement("a");return C(e)?null:(e.href=t,e)},Qr=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," ")},Zr=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},ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],es=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ts],is="<masked>",rs=["li_fat_id"];function ss(t,e){var i=es.concat(e||[]),r={};return er(i,function(e){var i=Qr(t,e);r[e]=i||null}),r}function ns(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(!D(e)){r.$search_engine=e;var s=h?Qr(h.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function os(){return navigator.language||navigator.userLanguage}var as="$direct";function hs(){return(null==h?void 0:h.referrer)||as}function ls(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...ts,...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:hs().substring(0,1e3),u:n?Zr(n,s,is):void 0}}function us(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==as?as:null==(i=Xr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Xr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ir(o,ss(n))}return r&&ir(o,ns(r)),o}function ds(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cs={flags:Si,surveys:ui},_s=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ps=t=>t+"_cookie_identity_change_pending",fs=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},gs="main",ms=[Xe,Qe,ti,ei,ii,Si,ri,oi],bs=t=>-1!==ms.indexOf(t),ws=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},ys=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},$s=(t,e)=>{er(t,(i,r)=>{var s=Yr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},xs=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.Lo={},this.No=!1,this.qo=!1,this.jo=!1,this.Bo=!1,this.Ho=!1,this.zo=new Map,this.Uo=!1,this.Wo=!1,this.Vo=!1,this.Go=!1,this.Zo=new Set,this.Sr=t,this.Qo=r,this.props={},this.Jo=void 0,this.Ko=(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.$o=this.Yo(t),this.jo=this.Xo(t),this.load(),this.tl(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();hr(n,"beforeunload",s,{capture:!1}),hr(n,"pagehide",s,{capture:!1}),this.el=t=>{if(this.No&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.Ko){if(this.jo){var e=Hr.find(e=>t.key===this.il(e));e&&this.nl(t.key,e)}}else this.nl(t.key,gs)},hr(n,"storage",this.el)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.zo.get(e);if(bs(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.sl(e,s)}else this.sl(e,!0)})}onCrossTabFeatureFlagChange(t){return this.Zo.add(t),()=>this.Zo.delete(t)}destroy(){this.el&&n&&(n.removeEventListener("storage",this.el),this.el=void 0),this.Zo.clear()}nl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=$r.Ot(t),D(s)){var n=this.rl(e);return n.storageValue=null,e!==gs&&(n.persisted=!1),!1}r=ys(s)}catch(t){return!1}var o=e===gs?r:$r.Dt(this.Ko);if(o&&this.ol(o))return!1;var a=this.ll(r,e,i);return e===gs&&this.jo&&!ws(this.al().main,r)||this.ul(r,e,!0,s),a}ol(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}ul(t,e,i,r){var s=this.rl(e);s.storageValue=r,e!==gs&&(s.persisted=i);try{s.fingerprint=this.hl(t,e)}catch(t){s.fingerprint=void 0}}ll(t,e,i){var r=!1;return ms.forEach(i=>{var s,n=null==(s=Yr(i))?void 0:s.storageGroup;if(!(e===gs&&this.jo&&n||e!==gs&&n!==e)){var o=i in t,a=this.cl(i,o?t[i]:void 0),h=this.zo.has(i)?i in this.props:o;h===i in this.props&&ws(a,this.props[i])||(h?this.dl(i,a,!1):this.vl(i,!1),r=!0)}}),r&&i&&this.Zo.forEach(t=>t()),r}fl(){if(!this.No)return!1;try{this.Vo=!1;var t,e=$r.Ot(this.Ko),i=this.rl(gs),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=ys(e),this.Vo=!this.Wo&&this.ol(t),this.Vo)return!1;s=this.ll(t,gs,!1),!this.jo||ws(this.al().main,t)?this.ul(t,gs,!0,e):i.storageValue=e,r=!0}return this.jo&&Hr.forEach(e=>{var i=$r.Ot(this.il(e)),n=this.rl(e),o=t||{},a=r&&ms.some(t=>{var i;return(null==(i=Yr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.ll(o,e,!1)||s));var h=ys(i);s=this.ll(h,e,!1)||s,this.ul(h,e,!0,i)}}),s}catch(t){return!1}}sl(t,e){this.zo.set(t,e);var i=Yr(t);null!=i&&i.volatile||(this.rl((this.jo?null==i?void 0:i.storageGroup:void 0)||gs).fingerprint=void 0,this.pl(t))}gl(){ms.forEach(t=>this.zo.set(t,!0))}tl(){if(this.No)try{var t=$r.Ot(this.Ko),e=ys(t);this.rl(gs).storageValue=t,ms.forEach(t=>{var i,r=this.jo?null==(i=Yr(t))?void 0:i.storageGroup:void 0,s=r?$r.Ot(this.il(r)):null;if(r){var n=this.rl(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?ys(s):e;t in this.props?this.ml(t,o[t],this.props[t]):t in o&&this.sl(t,!0)})}catch(t){}}cl(t,e){var r=this.zo.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=O(e)?i({},e):{},a=O(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}ml(t,e,i){if(bs(t)){var r=this.zo.get(t);if(!0!==r){var s=e;if(this.No)try{var n,o=this.jo?null==(n=Yr(t))?void 0:n.storageGroup:void 0,a=o?this.il(o):this.Ko;s=ys($r.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.sl(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach(t=>{l.has(t)!==d.has(t)&&h.add(t)}),h.forEach(t=>{u.has(t)===d.has(t)&&h.delete(t)})}else{if(!O(i))return void(ws(s,i)?this.zo.delete(t):this.sl(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.sl(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&ws(v[t],i[t])||h.add(t)}),h.forEach(t=>{t in c==t in i&&ws(c[t],i[t])&&h.delete(t)})}h.size?this.sl(t,h):this.zo.delete(t)}}}yl(){var t,e=null==(t=this.Sr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}bl(t){if(this.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase())if(t)try{var e=Pr(t,this.Sr.cookie_persisted_properties||[]),i=Or(e,this.Sr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=wr.Ot(this.Ko)||void 0;s&&Cr(this.Ko,s)===r&&(this._l=r,this.wl=s)}catch(t){}else try{var n=wr.Ot(this.Ko)||void 0;this._l=n?Cr(this.Ko,n):void 0,this.wl=n}catch(t){}}syncCookieProperties(){return this.kl(this.Sr)}kl(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Ho||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=wr.Ot(this.Ko)||void 0}catch(t){}if(!i||i===this.wl)return!1;var r,s=Cr(this.Ko,i);try{r=kr(JSON.parse(i))}catch(t){return!1}if((wr.Ot(this.Ko)||void 0)!==i)return!1;this._l=s,this.wl=i;var n=Ir(this.Ko,i),o=[...Sr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),I(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[Ei],v=ir({},l);[...Sr,...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===Sr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=ir(v,r),ms.forEach(t=>{var e=t in this.props;t in l===e&&ws(l[t],this.props[t])||(e?this.ml(t,l[t],this.props[t]):this.sl(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this.dl(Ei,Gi);var c=this.props[be],_=this.props[Ei];return!h||c===u&&_===d||(this.Wo=!0,this.Bo=!0,Nr.At(ps(this.Ko),!0),this.vl(oi),this.vl(Qe),this.vl(Xe),this.vl(ti),this.vl(ei),this.vl(ii),this.vl(Si),this.vl(xi),this.vl(yi),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||($s(this.props,r),this.vl(ai)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.vl($e)),!0}consumeCookieIdentityChange(){var t=ps(this.Ko),e=this.Bo||!!Nr.Ot(t);return this.Bo=!1,e&&Nr.Lt(t),e}Sl(t){return void 0===t&&(t=!1),!(this.Ho||this.pi&&!t||!this.Sr.cookieWinsOnConflict||"localstorage+cookie"!==this.Sr.persistence.toLowerCase()||(this.Ho=!0,0))}xl(){this.Ho&&(C(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0),delete this.Lo[gs],this.$l(!0))}Tl(t){if(void 0===t&&(t=!0),this.Ho)try{t?this.xl():C(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0)}finally{this.Ho=!1}}isDisabled(){return!!this.pi}Yo(t){-1===_s.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=[...Sr,...t];return i({},$r,{Dt(t){try{var i,s={};try{i=wr.Ot(t)||void 0,s=i?kr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse($r.Ot(t)||"{}");if(e){var a=Ir(t,i),h=[...Sr,...a.properties],l={};Object.keys(s).forEach(t=>{var e=s[t];D(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===Sr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Ei]=Gi),!u||("distinct_id"in l?l[be]:o[be])===v&&("$user_state"in l?l[Ei]:o[Ei])===c||(xr.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[hi],delete o[ai]),delete o.__alias)}n=ir(o,l)}else n=ir(s,o);return $r.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var h=$r.At(i,r,void 0,void 0,a);try{var l=Pr(r,t);if(Object.keys(l).length){if(e){var u=Er(i),d=Or(l,t);if(wr.At(u,d,s,n,o,a),wr.Ot(u)!==JSON.stringify(d)){wr.Lt(u,n);var v=Pr(r);return wr.At(i,v,s,n,o,a),h}}wr.At(i,l,s,n,o,a)}}catch(t){$r.Pt(t)}return h},Lt(t,e){try{null==n||n.localStorage.removeItem(t),wr.Lt(t,e),wr.Lt(Er(t),e)}catch(t){$r.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&$r.Et()?(e=$r,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Nr.Et()?e=Nr:"memory"===a?e=Mr:"cookie"===a&&wr.Et()?(e=wr,s=!0):r.Et()?(e=r,o=!0,s=!0):wr.Et()?(e=wr,s=!0):e=Mr,this.No=o,this.qo=s,e}il(t){return this.Ko+"__"+t}Xo(t){return this.No&&!!t.split_storage}properties(){var t={};return er(this.props,(e,i)=>{var r=Yr(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.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase(),i=e?$r.Dt(this.Ko):null,r={};if(e)try{er(r=kr(wr.Dt(this.Ko)),(t,e)=>{(C(t)||D(t)||""===t)&&delete r[e]})}catch(t){}var s=this.$o.Dt(this.Ko);if(s&&(this.props=ir({},s)),this.jo&&this.Il(),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.Bo=!0,Nr.At(ps(this.Ko),!0);var d=ir({},this.props);xr.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==h&&"anonymous"!==r.$user_state&&(C(a)||l===a)||($s(d,r),delete d[ai]),this.props=d;var v=new Set;xr.forEach(t=>{var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};er(this.props,(i,r)=>{var s;(null==(s=Yr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),I(e)?($r.Lt(this.il(t)),this.Lo[t]={}):$r.At(this.il(t),e)&&(this.Lo[t]={persisted:!0,fingerprint:this.hl(e,t)})})}}Nr.Ot(ps(this.Ko))&&(this.Bo=!0)}}Il(){for(var t of Hr){var e=$r.Dt(this.il(t));if(e&&!I(e)){var i=this.rl(t);i.persisted=!0,this.Ml(t)||(i.fingerprint=this.hl(e,t)),this.El(t,e)||ir(this.props,e)}}}Ml(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Yr(e))?void 0:i.storageGroup)===t})}El(t,e){var i=cs[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||"$fbc_persistence"===t&&this.Go)){var i=this.jo?null==(e=Yr(t))?void 0:e.storageGroup:void 0,r=i?$r.Dt(this.il(i)):this.$o.Dt(this.Ko);if(r&&t in r)this.dl(t,r[t],!1);else{if(i){var s=this.$o.Dt(this.Ko);if(s&&t in s)return void this.dl(t,s[t],!1)}this.vl(t,!1)}}}save(){if(!this.pi){var t=this.yl();t>0?C(this.Cl)&&(this.Cl=setTimeout(()=>{this.Cl=void 0,this.$l()},t)):this.$l()}}flush(){C(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0,this.$l())}$l(t){if(void 0===t&&(t=!1),!(this.pi||this.Ho&&!t)){t||(this.syncCookieProperties(),this.Go||this.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase()||this.refreshKey(Ee));var e=!t&&!this.Uo;e||(this.Vo=!1);var i=!!e&&this.fl();if(this.Vo)this.Sr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.jo)return this.Pl(),void(i&&this.Zo.forEach(t=>t()));var r=this.Rl(this.$o,this.Ko,this.props,gs);"written"===r&&this.bl(this.props),"failed"!==r&&(this.zo.clear(),this.Wo=!1,this.Go=!1),i&&this.Zo.forEach(t=>t())}}}Pl(){var t=this,e=this.al(),i=e.main,r=e.groups,s=this.Rl(this.$o,this.Ko,i,gs);"written"===s&&this.bl(i),"failed"!==s&&(this.Wo=!1,this.Go=!1,ms.forEach(t=>{var e;null!=(e=Yr(t))&&e.storageGroup||this.zo.delete(t)}));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.Lo[e])||!i.persisted))return ms.forEach(i=>{var r;(null==(r=Yr(i))?void 0:r.storageGroup)===e&&t.zo.delete(i)}),1;var n=t.Rl($r,t.il(e),s,e);"failed"!==n&&ms.forEach(i=>{var r=Yr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.zo.delete(i)})};for(var o of Hr)if(n(o))continue}al(){var t={},e={flags:{},surveys:{}};return er(this.props,(i,r)=>{var s,n=null==(s=Yr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}hl(t,e){if(e===gs)return JSON.stringify(t)+"|"+this.Al+"|"+this.Fl+"|"+this.Ol;var i={};return er(t,(t,e)=>{var r;i[e]=null!=(r=Yr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}Rl(t,e,i,r){var s,n=this.rl(r);if(r!==gs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.hl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Al,this.Fl,this.Ol,this.Sr.debug)?(n.dirty=!1,r!==gs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.No&&(n.storageValue=$r.Ot(e)),"written"):(this.Sr.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.gl(),C(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0),this.$o.Lt(this.Ko,!1),this.$o.Lt(this.Ko,!0),!i&&this.Qo)for(var r of Hr)$r.Lt(this.il(r));i?delete this.Lo[gs]:this.Lo={},this._l=void 0,this.wl=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Al=C(i)?this.Dl:i;var r=!1;if(er(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.dl(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Al=C(e)?this.Dl:e;var i=!1;if(er(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||P(e))&&(this.dl(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.vl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.Jo){var e=function(t,e,i){if(!h)return{};var r,s=e?[...ts,...i||[]]:[],n=ss(Zr(h.URL,s,is),t);return ir((r={},er(rs,function(t){var e=lr(t);r[t]=e||null}),r),n)}(this.Sr.custom_campaign_params,this.Sr.mask_personal_data_properties,this.Sr.custom_personal_data_properties),i=!I(sr(e));return i&&this.register(e),this.Jo=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?ns(t):{})}update_referrer_info(){var t;this.register_once({$referrer:hs(),$referring_domain:null!=h&&h.referrer&&(null==(t=Xr(h.referrer))?void 0:t.host)||as},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=ls(this.Sr.mask_personal_data_properties,this.Sr.custom_personal_data_properties,this.Sr.disable_capture_url_hashes);this.register_once({[Oi]:this.qo?{r:fs(t.r),u:t.u?fs(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};er([Ri,Pi],e=>{var i=this.props[e];i&&er(i,function(e,i){t["$initial_"+S(i)]=e})});var e=this.props[Oi];return e&&ir(t,function(t,e){void 0===e&&(e=!1);var i=us(t,e),r={};return er(i,function(t,e){r["$initial_"+S(e)]=t}),r}(e,this.Sr.disable_capture_url_hashes)),t}safe_merge(t){return er(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.kl(e,l),this.Sr=t,!h&&(s||n||a)&&(this._l=void 0,this.wl=void 0,this.kl(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=o||a?this.Yo(t):this.$o;this.Ll();var d=this.Xo(t),v=o||d!==this.jo,c=!h&&(v||t.cross_subdomain_cookie!==this.Fl||t.secure_cookie!==this.Ol)&&this.Sl(l);this.Uo=v;try{if(this.Dl=this.Al=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.$o=u,this.jo=d,this.props=_,this.save()}else a&&(this.$o=u,h||(delete this.Lo[gs],this.$l()))}finally{this.Uo=!1,c&&this.Tl()}}Ll(){var t=this.props[Oi];if(this.qo&&O(t)&&"string"==typeof t.r){var e=fs(t.r),r="string"==typeof t.u?fs(t.u):t.u;e===t.r&&r===t.u||this.dl(Oi,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Fl&&(this.Fl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ol&&(this.Ol=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this.dl(Te,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this.dl(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.dl(t,e),this.save()}dl(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.Wo=!0),"$fbc_persistence"!==t||ws(s,e)||(this.Go=!0),this.ml(t,s,e),null!=(r=Yr(t))&&r.volatile||this.pl(t))}vl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(bs(t)&&this.sl(t,!0),"$fbc_persistence"===t&&(this.Go=!0),this.pl(t))}pl(t){var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&(this.rl(i).dirty=!0)}rl(t){return this.Lo[t]||(this.Lo[t]={})}},Ss={GZipJS:"gzip-js",Base64:"base64"},Es={Activation:"events",Cancellation:"cancelEvents"},Ts={Button:"button",Tab:"tab",Selector:"selector"},ks={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"},Ps={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Os={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Is={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Cs={Once:"once",Recurring:"recurring",Always:"always"},As={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ms={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"},Ds={Popover:"popover",Inline:"inline"};function Ns(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var Fs={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},Us={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"},Bs={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"},Ls=de("[RateLimiter]"),js=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=>{Ls.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ls.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.Nl(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(ki,a),{isRateLimited:h,remainingTokens:a.tokens}}ql(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}jl(){var t;if(this.ql("$current_url")&&this.ql("$pathname")&&null!=l&&l.pathname)return""+(null!==(t=l.origin)&&void 0!==t?t:"")+l.pathname}Nl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.jl(),o=this.ql("$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}},zs=de("[RemoteConfig]"),Ws=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}Bl(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()}Hl(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 zs.info("Using preloaded remote config",this.remoteConfig),void this.zl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zs.warn("Remote config is disabled. Falling back to local config.");this.Bl(t=>{if(!t)return zs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Hl(t=>{this.zl(t.json,t)});this.zl(t)})}catch(t){zs.error("Error loading remote config",t),this.zl()}}zl(t,e){!t&&e&&(0===e.statusCode?e.error||zs.warn("Failed to fetch remote config from PostHog."):zs.error("Failed to fetch remote config from PostHog."));try{this._instance.zl(t?{ok:!0,config:t}:{ok:!1})}catch(t){zs.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){zs.error("Error loading feature flags",t)}}},qs=["fatal","error","warning","log","info","debug"],Gs=Uint8Array,Hs=Uint16Array,Vs=Uint32Array,Js=new Gs([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]),Ys=new Gs([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]),Ks=new Gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xs=function(t,e){for(var i=new Hs(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vs(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]},Qs=Xs(Js,2),Zs=Qs[1];Qs[0][28]=258,Zs[258]=28;for(var tn=Xs(Ys,0)[1],en=new Hs(32768),rn=0;32768>rn;++rn){var sn=(43690&rn)>>>1|(21845&rn)<<1;en[rn]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}var nn=function(t,e,i){for(var r=t.length,s=0,n=new Hs(e);r>s;++s)++n[t[s]-1];var o,a=new Hs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Hs(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[en[d]>>>h]=l}else for(o=new Hs(r),s=0;r>s;++s)o[s]=en[a[t[s]-1]++]>>>15-t[s];return o},on=new Gs(288);for(rn=0;144>rn;++rn)on[rn]=8;for(rn=144;256>rn;++rn)on[rn]=9;for(rn=256;280>rn;++rn)on[rn]=7;for(rn=280;288>rn;++rn)on[rn]=8;var an=new Gs(32);for(rn=0;32>rn;++rn)an[rn]=5;var hn=nn(on,9,0),ln=nn(an,5,0),un=function(t){return(t/8|0)+(7&t&&1)},dn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Hs?Hs:t instanceof Vs?Vs:Gs)(i-e);return r.set(t.subarray(e,i)),r},vn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},cn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},_n=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 Gs(0),0];if(1==s){var o=new Gs(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 Hs(v+1),_=pn(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 w=n[r].s;c[w]==e&&(--c[w],++p)}_=e}return[new Gs(c),_]},pn=function(t,e,i){return-1==t.s?Math.max(pn(t.l,e,i+1),pn(t.r,e,i+1)):e[t.s]=i},fn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Hs(++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]},gn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mn=function(t,e,i){var r=i.length,s=un(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)},bn=function(t,e,i,r,s,n,o,a,h,l,u){vn(e,u++,i),++s[256];for(var d=_n(s,15),v=d[0],c=d[1],_=_n(n,15),p=_[0],f=_[1],g=fn(v),m=g[0],b=g[1],w=fn(p),y=w[0],x=w[1],S=new Hs(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;y.length>E;++E)S[31&y[E]]++;for(var T=_n(S,7),k=T[0],P=T[1],R=19;R>4&&!k[Ks[R-1]];--R);var O,I,C,A,M=l+5<<3,D=gn(s,on)+gn(n,an)+o,N=gn(s,v)+gn(n,p)+o+14+3*R+gn(S,k)+(2*S[16]+3*S[17]+7*S[18]);if(D>=M&&N>=M)return mn(e,u,t.subarray(h,h+l));if(vn(e,u,1+(D>N)),u+=2,D>N){O=nn(v,c,0),I=v,C=nn(p,f,0),A=p;var F=nn(k,P,0);for(vn(e,u,b-257),vn(e,u+5,x-1),vn(e,u+10,R-4),u+=14,E=0;R>E;++E)vn(e,u+3*E,k[Ks[E]]);u+=3*R;for(var U=[m,y],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)vn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(vn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else O=hn,I=on,C=ln,A=an;for(E=0;a>E;++E)if(r[E]>255){var j;cn(e,u,O[257+(j=r[E]>>>18&31)]),u+=I[j+257],j>7&&(vn(e,u,r[E]>>>23&31),u+=Js[j]);var z=31&r[E];cn(e,u,C[z]),u+=A[z],z>3&&(cn(e,u,r[E]>>>5&8191),u+=Ys[z])}else cn(e,u,O[r[E]]),u+=I[r[E]];return cn(e,u,O[256]),u+I[256]},wn=new Vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yn=new Gs(0),$n=function(){for(var t=new Vs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Sn(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=$n[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 Gs(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=mn(h,l,t.subarray(u,d)):(h[u]=n,l=mn(h,l,t.subarray(u,o)))}else{for(var v=wn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Hs(32768),g=new Hs(p+1),m=Math.ceil(i/3),b=2*m,w=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},y=new Vs(25e3),x=new Hs(288),S=new Hs(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var O=w(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){l=bn(t,h,0,y,x,S,T,k,R,u-R,l),k=E=T=0,R=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var D=2,N=0,F=_,U=I-C&32767;if(A>2&&O==w(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&I!=C;){if(t[u+D]==t[u+D-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>D){if(D=z,N=U,z>B)break;var W=Math.min(U,z-2),q=0;for(M=0;W>M;++M){var G=u-U+M+32768&32767,H=G-f[G]+32768&32767;H>q&&(q=H,C=G)}}}U+=(I=C)-(C=f[I])+32768&32767}if(N){y[k++]=268435456|Zs[D]<<18|tn[N];var V=31&Zs[D],J=31&tn[N];T+=Js[V]+Ys[J],++x[257+V],++S[J],P=u+D,++E}else y[k++]=t[u],++x[t[u]]}}l=bn(t,h,n,y,x,S,T,k,R,u-R,l),n||(l=mn(h,l,yn))}return dn(a,0,r+un(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&&xn(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),xn(u,d-8,i.d()),xn(u,d-4,r),u}var En=!!d||!!u,Tn="text/plain",kn=!1,Pn=(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:"")},Rn=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 er(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},On=t=>{if(t.Wl)return t.Wl;var e=t.data,i=t.compression;if(e){if(i===Ss.GZipJS){var r=Sn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gs(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 Gs(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 dn(i,0,r)}(Kr(e)),{mtime:0});return{contentType:Tn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ss.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Kr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Kr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Kr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},In=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Rn(t.url,{compression:Ss.Base64}),encodedBody:On(i({},t,{compression:Ss.Base64,Wl:void 0}))}:{url:Pn(t.url,"compression"),encodedBody:On(i({},t,{compression:void 0,Wl:void 0}))};try{e=On(t)}catch(e){if(se(t.compression,Qr(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,Qr(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(kn=!0,s()):{url:t.url,encodedBody:e}},Cn=t=>{try{return In(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},An=function(){var t=s(function*(t){var e=yield function(t,e,i){return he.apply(this,arguments)}(Kr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Wl:{contentType:Tn,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Mn=/Failed to fetch|NetworkError|Load failed/i,Dn=t=>"TypeError"===(null==t?void 0:t.name)&&Mn.test((null==t?void 0:t.message)||""),Nn=t=>{var e=Cn(t);if(e){var i=new d,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;er(t.headers,function(t,e){i.setRequestHeader(e,t)}),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}},Fn=t=>{var e=Cn(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;er(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)||Dn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;u(r,i({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&!t.Vl&&52428.8>(h||0),body:a,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){ue.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>d?clearTimeout(d.timeout):null)}catch(t){d&&clearTimeout(d.timeout),p(t)}}},Un=t=>{try{var e,r=In(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 Un(i({},t,{data:_(v.slice(0,c))})),void Un(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?Fn(i({},t,{Vl:!0})):Nn(t)}catch(t){ue.warn("Beacon send failed",t)}},Bn=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Rn(r===Ss.GZipJS?Pn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ss.GZipJS?{}:{compression:r}))},Ln=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Fn}),d&&t.push({transport:"XHR",method:Nn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:Un}),t})(),jn=class{constructor(t,e){this.Gl=!0,this.Zl=[],this.Ql=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.Jl=t}enqueue(t){this.Zl.push(t),this.Kl||this.Yl()}unload(){this.Xl();var t=this.Zl.length>0?this.ta():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ea(i({},t,{transport:"sendBeacon"}))})}enable(){this.Gl=!1,this.Yl()}Yl(){var t=this;this.Gl||(this.Kl=setTimeout(()=>{if(this.Xl(),this.Zl.length>0){var e=this.ta(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&P(i.data)&&er(i.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.ea(i)};for(var r in e)i()}},this.Ql))}ea(t){try{this.Jl(t)}catch(t){ue.error(t)}}Xl(){clearTimeout(this.Kl),this.Kl=void 0}ta(){var t={};return er(this.Zl,e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.Zl=[],t}},zn=class{constructor(t){this._instance=t,this.ia=!1,this.na=3e3,this.Zl=[],this.Zl=[],this.sa=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.sa=n.navigator.onLine,this.ra)return;this.ra=()=>{this.sa=!0,this.oa()},this.la=()=>{this.sa=!1},hr(n,"online",this.ra),hr(n,"offline",this.la)}}get length(){return this.Zl.length}retriableRequest(t){var r=t.retriesPerformedSoFar,s=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(r)&&(s.url=Rn(s.url,{retry_count:r})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=r?r:0))return void this.Is(i({retriesPerformedSoFar:r},s));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!=r?r:0)+" retries.")}null==s.callback||s.callback(t)}}))}Is(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(e),r=Date.now()+i;this.Zl.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.ia||(this.ia=!0,this.aa())}aa(){if(this.ua&&clearTimeout(this.ua),0===this.Zl.length)return this.ia=!1,void(this.ua=void 0);this.ua=setTimeout(()=>{this.sa&&this.Zl.length>0&&this.oa(),this.aa()},this.na)}oa(){var t=Date.now(),e=[],i=this.Zl.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Zl=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ua&&(clearTimeout(this.ua),this.ua=void 0),this.ia=!1,C(n)||(this.ra&&(n.removeEventListener("online",this.ra),this.ra=void 0),this.la&&(n.removeEventListener("offline",this.la),this.la=void 0)),this.Zl)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.Zl=[]}},Wn=class{constructor(t){this._instance=t,this.ha=()=>{var t,e,i,r;this.ca||(this.ca={});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.ca.lastScrollY=Math.ceil(n),this.ca.maxScrollY=Math.max(n,null!==(t=this.ca.maxScrollY)&&void 0!==t?t:0),this.ca.maxScrollHeight=Math.max(o,null!==(e=this.ca.maxScrollHeight)&&void 0!==e?e:0),this.ca.lastContentY=a,this.ca.maxContentY=Math.max(a,null!==(i=this.ca.maxContentY)&&void 0!==i?i:0),this.ca.maxContentHeight=Math.max(h,null!==(r=this.ca.maxContentHeight)&&void 0!==r?r:0)}}get da(){return this._instance.config.scroll_root_selector}getContext(){return this.ca}resetContext(){var t=this.ca;return setTimeout(this.ha,0),t}startMeasuringScrollPosition(){hr(n,"scroll",this.ha,{capture:!0}),hr(n,"scrollend",this.ha,{capture:!0}),hr(n,"resize",this.ha)}scrollElement(){var t;if(!this.da)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this.da)?this.da:[this.da]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}va(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this.da){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.va("y")}scrollX(){return this.va("x")}},qn=t=>ls(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),Gn=class{constructor(t,e,i,r){this.je=t=>{var e=this.fa();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.pa(this._instance)};this.ga.register({[Ti]:i})}},this._instance=t,this.ma=e,this.ga=i,this.pa=r||qn,this.ma.onSessionId(this.je)}fa(){return this.ga.props[Ti]}getSetOnceProps(){var t,e=null==(t=this.fa())?void 0:t.props;return e?"r"in e?us(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 er(sr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+S(i)]=e}),t}},Hn=class{on(t,e){return this.ya[t]||(this.ya[t]=[]),this.ya[t].push(e),()=>{this.ya[t]=this.ya[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.ya[t]||[])i(e);for(var r of this.ya["*"]||[])r(t,e)}constructor(){this.ya={}}},Vn=de("[SessionId]"),Jn=864e5,Yn=class{on(t,e){return this.ba.on(t,e)}constructor(t,e,i){var r;if(this._a=null,this.wa=null,this.ka=[],this.Sa=void 0,this.xa=!1,this.ba=new Hn,this.Ca=(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.Sr=t.config,this.ga=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.$a=void 0,this._sessionActivityTimestamp=null,this.Ta=e||pr,this.Ia=i||pr;var s=this.Sr.persistence_name||this.Sr.token;if(this._sessionTimeoutMs=1e3*J(this.Sr.session_idle_timeout_seconds||1800,60,36e3,Vn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ma(),this.Ea="ph_"+s+"_window_id",this.Pa="ph_"+s+"_primary_window_exists",this.Ra()){var n=Nr.Dt(this.Ea),o=Nr.Dt(this.Pa);n&&!o?this.Be=n:Nr.Lt(this.Ea),Nr.At(this.Pa,!0)}null!=(r=this.Sr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Sr.bootstrap.sessionID),this.Aa()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.ka)&&(this.ka=[]),this.ka.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.ka=this.ka.filter(e=>e!==t)}}Ra(){return"memory"!==this.Sr.persistence&&!this.ga.pi&&Nr.Et()}Fa(t){t!==this.Be&&(this.Be=t,this.Ra()&&Nr.At(this.Ea,t))}Oa(){return this.Be?this.Be:this.Ra()?Nr.Dt(this.Ea):null}Da(t){var e=this._a;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}La(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.Da(e)||(this._a=e,this.ga.register({[qe]:[e,t,i]}))}Na(){var t,e=null==(t=this.Sr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}qa(){this.Na()?this.ga.refreshKey(qe):(this.ga.flush(),this.ga.load())}ja(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._a){this.qa();var e=this.Ba();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this._a=this._sessionActivityTimestamp,this.ga.register({[qe]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.ga.flush())}}Ha(){var t=this.Ba()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}za(t){return this.qa(),this.Ca(t,this.Ha())}Ba(){var t=this.ga.props[qe];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._a=null,this.$a=void 0,clearTimeout(this.Ua),this.Ua=void 0,this.La(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 Vn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Vn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.$a={sessionId:t,sessionStartTimestamp:i}:this.La(t,(new Date).getTime(),i),!0)}destroy(){this.xa=!0,this.ja(),clearTimeout(this.Ua),this.Ua=void 0,this.Sa&&n&&(n.removeEventListener(Yi,this.Sa,{capture:!1}),this.Sa=void 0),this.ka=[]}Aa(){this.Sa=()=>{this.ja(),this.Ra()&&Nr.Lt(this.Pa)},hr(n,Yi,this.Sa,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Sr.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.wa=r;else if(D(this.wa)||this.wa>r||r-this.wa>=1e3){var n,o;null==(n=(o=this.ga).syncCookieProperties)||n.call(o),this.wa=r}var a=this.Ba(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.Ha(),v=this.Oa(),c=this.$a,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Jn),p=c?_:U(l)&&Math.abs(r-l)>Jn,f=!1,g=u,m=!h||!!c,b=h,w=!m&&!t&&this.Ca(r,d);if(w){(w=this.za(r))||Vn.info("cross-tab refresh kept the session alive",{sessionId:h});var y=this.Ba();h=y[1],l=y[2]}if(m||w||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Ta(),v=this.Ia(),Vn.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.$a=void 0,f=!0}else v||(v=this.Ia(),f=!0),(g=g||h!==b)&&(Vn.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var S=U(d)&&t&&!p?d:r,E=U(l)?l:(new Date).getTime();this.Fa(v),this.La(h,S,E),t||this.Ma();var T={noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.ka.forEach(t=>t(h,v,T)),{sessionId:h,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}Ma(){this.xa||(clearTimeout(this.Ua),this.Ua=setTimeout(()=>{if(!this.xa)if(this.za((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.ba.emit("forcedIdleReset",{idleSessionId:t})}else this.Ma()},1.1*this.sessionTimeoutMs))}};function Kn(){return(Kn=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 Xn(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 Qn(t,e,i){return Kr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Zn,to="custom",eo="i.posthog.com",io=/^\/static\//,ro=["/s/","/e/","/i/"],so=class{constructor(t){this.Wa={},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("."+eo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Wa[this.apiHost]||(this.Wa[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":to),this.Wa[this.apiHost]}Va(t){if(io.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Ga(t){var e=Xr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Za(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Xr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&ro.some(t=>0===e.indexOf(t))){var a=this.Ga(r);if(a){var h,l=this.apiHost,u=this.Qa;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(this.Qa=u={apiHost:l,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Qa,i=this.Ga(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.Za(t,e,this.uiHost+e);if("flags"===t)return this.Za(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Va(e);if(i)return this.Za(t,e,""+i+e)}if(this.region===to)return this.Za(t,e,this.apiHost+e);var r=eo+e;switch(t){case"assets":return this.Za(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Za(t,e,"https://"+this.region+"."+r)}}},no=de("[Surveys]"),oo={ignoreConditions:!1,ignoreDelay:!1,displayType:Ds.Popover},ao=de("[PostHog ExternalIntegrations]"),ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},lo=class{constructor(t){this._instance=t}Eo(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return ao.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.Eo(ho[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()}}},uo=class{constructor(t,e){this.$=t,this.lo=e,this.Ja=new Map,this.fo=!1}add(t){var e=this;return s(function*(){if(e.fo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ja.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.Ja.set(t.name,t);try{var i=t.setup(e.lo);i&&(yield i)}catch(i){var r=e.Ja.get(t.name)===t;r&&e.Ja.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Ka(t)}})()}getExtension(t){return this.Ja.get(t)}dispose(){if(!this.fo){this.fo=!0;var t=Array.from(this.Ja.values()).reverse();for(var e of(this.Ja.clear(),t))this.Ka(e)}}Ka(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)}}},vo=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)}},co="extensionsRemoteConfig",_o=class{constructor(t){this.instance=t,this.fo=!1,this.$=ue,this.Ya=t.Xa,this.kv=new vo(t),this.onEvent=t=>Ns(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.fo)return Ns(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.tu.on(co,e);return this.Ya&&e(this.Ya),Ns(i)},this.eu=new uo(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(we);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.eu.add(t)}getExtension(t){return this.eu.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 Ns(this.instance.iu(t))}handleRemoteConfig(t){this.fo||(this.Ya=t,this.instance.tu.emit(co,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?Rn(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.fo||(this.fo=!0,this.eu.dispose())}},po={},fo=0,go=()=>{},mo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bo="Surveys module not available",wo="sanitize_properties is deprecated. Use before_send instead",yo="Invalid value for property_denylist config: ",$o=/^[A-Za-z0-9_-]{1,400}$/,xo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,So=["token","distinct_id",Ai],Eo="posthog",To=!En&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),ko=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},Po=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:ar(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:go,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:Vi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:go},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ur,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:ko(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))},Ro=[["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"]],Oo=t=>{var e={};for(var i of Ro){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=ir({},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(yo+t.property_denylist)),n},Io=class{constructor(){this.__forceAllowLocalhost=!1}get nu(){return this.__forceAllowLocalhost}set nu(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Co=(t=class t{su(t){if(t){var e=this.Ja.indexOf(t);-1!==e&&this.Ja.splice(e,1)}}ru(t,e){return this.su(t),this.Ja.push(e),null==e.initialize||e.initialize(),e}ou(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}lu(){if(!(this.au||this.config.reuseAnonymousId||this.config.segment||this.ou())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.uu||(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.au=!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)))}}hu(){if(!this.ou()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.cu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(pr());this.register({distinct_id:i,$device_id:i}),t.set_property(Ei,Gi)}this.du()}}}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.vu=!1,this.fu=!1,this.webPerformance=new Io,this.pu=!1,this.version=ge.LIB_VERSION,this.gu=new Set,this.mu="",this.tu=new Hn,this.Ja=[],this.yu=[],this.uu=!1,this.au=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=qr,this.sentryIntegration=t=>function(t,e){var i=Wr(t,e);return{name:zr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bu=!1,this._u=null,this.wu=null,this.ku=null,this.scrollManager=new Wn(this),this.pageViewManager=new Gr(this),this.rateLimiter=new js(this),this.requestRouter=new so(this),this.consent=new Fr(this),this.externalIntegrations=new lo(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!==Eo){var s,n=null!==(s=po[r])&&void 0!==s?s:new t;return n._init(e,i,r),po[r]=n,po[Eo][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=Po(e.defaults),e.debug=this.Su(e.debug),this.xu=e,this.Cu=[],e.person_profiles?this.wu=e.person_profiles:e.process_person&&(this.wu=e.process_person);var u=Po(e.defaults),d=Oo(e),v=ir({},u,d,{name:r,token:l});O(u.rageclick)&&O(d.rageclick)&&(v.rageclick=ir({},u.rageclick,d.rageclick)),O(u.session_recording)&&O(d.session_recording)&&(v.session_recording=ir({},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:Ss.GZipJS;var c=this.cu();if(this.persistence=new xs(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Nr.Et()){var _=Nr.Dt(this.mu);P(_)&&_.forEach(t=>{A(t)&&this.gu.add(t)})}else Nr.Lt(this.mu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.$u=new jn(t=>this.Tu(t),this.config.request_queue_config),this.Iu=new zn(this),this.__request_queue=[];var g=this.ou();g||(this.sessionManager=new Yn(this),this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Mu()})),this.Eu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Pu(g)},0)):(ue.info("Initializing extensions synchronously"),this.Pu(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.uu=!!m&&!M(m),void 0!==(null==(a=e.bootstrap)?void 0:a.distinctID)){var b=e.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Ei);if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===y)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===y)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 x=this.config.get_device_id(pr()),S=e.bootstrap.isIdentifiedID?x:b;this.persistence.set_property(Ei,e.bootstrap.isIdentifiedID?Hi:Gi),this.register({distinct_id:b,$device_id:S})}}if(g)this.register_once({distinct_id:Ci,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(pr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Ei,Gi)}return hr(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),hr(n,"pageshow",()=>{var t;this.vu=!1,this.fu||null==(t=this.Iu)||t.resume()}),e.segment?jr(this,()=>this.Ru()):this.Ru(),R(this.config._onCapture)&&this.config._onCapture!==go&&(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 Kn.apply(this,arguments)}().then(t=>{t&&this.register({[ye]:t})}).catch(go),this}Au(t){var e=t;return A(e.name)&&R(e.setup)}Fu(t,e){this.Au(t)?e.push(()=>{this.Ou().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.Ja.push(t)}Eu(){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.Du)||o.call(this),this.Du=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Du||(this.Du=this.featureFlags.onReloading(()=>{this.tu.emit("featureFlagsReloading",!0)}),this.Ou().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Pu(e){var r,s,n,o,a,h,l,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Ja.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.Ja.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ja.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ja.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.Ja.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Fu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Fu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Fu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Ja.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ja.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ja.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ja.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ja.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ja.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ja.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.Ja.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new d.toolbar(this)),d.experiments&&this.Ja.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new d.experiments(this)),this.Ja.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Lu){var t=this.Lu;this.Lu=void 0,this.Ja.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.Nu(v,u)}Nu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Nu(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({[Mi]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Di]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}zl(t){var e;if(!h||!h.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.zl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Lu=t),this.Xa=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=x(r.supportedCompression,Ss.GZipJS)?Ss.GZipJS:x(r.supportedCompression,Ss.Base64)?Ss.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.wu?this.wu:Vi}),null==(e=this.qu)||e.handleRemoteConfig(t),this.Ja.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}Ru(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.ju(),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.ou())&&this.Bu()},1),this.Hu=new Ws(this),this.Hu.load()}ju(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.$u)||t.enable())}_dom_loaded(){this.is_capturing()&&tr(this.__request_queue,t=>this.Tu(t)),this.__request_queue=[],this.ju()}_handle_unload(){var t,e,i,r,s;this.vu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.zu()&&this.capture(Xi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.$u)||r.unload(),null==(s=this.Iu)||s.unload()):this.zu()&&this.capture(Xi,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?To?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,h,l,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(n.compression)&&n.data&&(n.compression=Ss.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(l=(P(o=n.data)?o:[o]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(h=u.properties)?void 0:h.token)&&void 0!==a?a:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.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})}(n.data))),n.url=Bn(n.url,n.method,n.compression,n.timestampMode);var v=Ln.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),_=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!_)throw new Error("No available transport method");var p=t=>{try{_(t)}catch(t){Dn(t)?ue.warn(t):ue.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ss.GZipJS&&c&&"undefined"!=typeof Promise&&!kn?An(n).then(t=>{p(t)}).catch(e=>{if(ne(e))return kn=!0,void p(i({},n,{compression:void 0,url:Bn(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)&&(kn=!0),p(n)}):_(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Tu(t){this.Iu?this.Iu.retriableRequest(t):this._send_request(t)}_execute_array(t){fo++;try{var e,i=[],r=[],s=[];tr(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){tr(t,function(t){try{if(P(t[0])){var i=e;er(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{fo--}}push(e){if(fo>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])}Uu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(Ee);return A(e)&&xo.test(e)?{value:e,delivered:!1}:O(e)&&A(e.value)&&xo.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Wu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(Ee);var s=this.Uu();if(!r){if(i)return A(e)&&xo.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[Ee]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ee);if(A(t)&&$o.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ee]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ee)}}Vu(t){if(this.persistence){this.persistence.refreshKey(Ee);var e=this.Uu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[Ee]:{value:t,delivered:!0}})}}capture(t,e,r){var s,n,o,a,h,l,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$u){if(this.is_capturing())if(!C(t)&&A(t)){this.hu();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var p=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var f;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&&(f=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 g=new Date,m=(null==r?void 0:r.timestamp)||g,b=Xt(null==r?void 0:r.uuid,pr),w={uuid:b,event:t,properties:this.calculateEventProperties(t,e||{},m,b)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&_&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),p&&(w.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var y="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!y&&(w.$set=null==r?void 0:r.$set);var x=O(null==e?void 0:e.$set)?e.$set:void 0,S=!(null==r||!r.$set)&&"$fbc"in r.$set,E=S||!!x&&"$fbc"in x,T=S?null==r||null==(s=r.$set)?void 0:s[Se]:null==x?void 0:x[Se],k=P(null==e?void 0:e.$unset)?e.$unset:[],R=(null==r?void 0:r.$unset)||[],M=-1!==k.indexOf("$fbc")||-1!==R.indexOf("$fbc"),D=this.Wu(null==(n=f)?void 0:n.fbclid,T,E,M);D&&!0===w.properties.$process_person_profile&&D.pending&&!E&&!y&&(w.$set=i({[Se]:D.value},w.$set));var F=null==r?void 0:r.$unset;F&&(w.$unset=F);var U=y?void 0:this.Zu(null==r?void 0:r.$set_once,t!==Zi,t===Qi);if(U&&(w.$set_once=U),null!=r&&r._noTruncate||(u=this.config.properties_string_max_length,d=w,v=t=>A(t)?t.slice(0,u):t,c=new Set,w=function t(e,i){if(e!==Object(e))return v?v(e):e;if(!c.has(e)){var r;if(c.add(e),P(e))r=[],tr(e,e=>{r.push(t(e))});else{var s={};er(z(e)?nr(e):e,(e,i)=>{c.has(e)||(s[i]=t(e,i))}),r=s}return r}}(d)),w.timestamp=m,C(null==r?void 0:r.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=g),y&&(w.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}(w.properties,So)),t===As.DISMISSED||t===As.SENT){var B=null==e?void 0:e[Ms.SURVEY_ID],L=null==e?void 0:e[Ms.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){no.error("Failed to persist survey seen state",t)}})({id:B,current_iteration:L}),w.$set=i({},w.$set,{[Xn({id:B,current_iteration:L},t===As.SENT?"responded":"dismissed")]:!0})}else t===As.SHOWN&&(w.$set=i({},w.$set,{[Ms.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Us.SHOWN){var j=null==e?void 0:e[Bs.TOUR_TYPE];j&&(w.$set=i({},w.$set,{[Bs.TOUR_LAST_SEEN_DATE+"/"+j]:(new Date).toISOString()}))}var W=i({},w.properties.$set,w.$set);if(I(W)||this.setPersonPropertiesForFlags(W),!N(this.config.before_send)){var q=this.$s(w);if(!q)return;(w=q).uuid=Xt(w.uuid,pr)}var G=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:O(null==(h=w.properties)?void 0:h.$set)?w.properties.$set.$fbc:void 0,H=null!=D&&D.pending&&G===D.value?D.value:void 0;this.tu.emit("eventCaptured",w);var V,J=null!==(l=null==r?void 0:r._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Y=i({method:"POST",url:J,data:w,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(J)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},H?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Vu(H)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||H?(!Y.transport&&!Y.callback&&I(null!==(V=this.config.request_headers)&&void 0!==V?V:{})&&this.vu&&(Y.transport="sendBeacon"),this.Tu(Y)):this.$u.enqueue(Y),w}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.qu)?void 0:e.getExtension(t)}Ou(){var t;return null!==(t=this.qu)&&void 0!==t?t:this.qu=new _o(this)}iu(t){this.yu.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.yu.indexOf(t);-1!==i&&this.yu.splice(i,1)}}}Qu(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.ku=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.gu.clear(),this.Ju()),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.Qu();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.ou()&&(u[Ai]=!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?[...ts,...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;Yt.length>e;e++){var i,r=Yt[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],w=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},y={};C(i)||(y.detectGoogleSearchApp=i);var x={},S=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(S)||(x.userAgentDataPlatform=S),C(E)||(x.maxTouchPoints=E),C(T)||(x.screenWidth=T),C(k)||(x.screenHeight=k),C(P)||(x.devicePixelRatio=P);var O,I,A,M,D,N,F,U,B=ir(sr({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,w,y),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(I=_,A=x,U=Vt(I),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===wt?"Console":U===tt?"Wearable":U?Y:"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!==(D=null==A?void 0:A.screenWidth)&&void 0!==D?D:0,null!==(N=null==A?void 0:A.screenHeight)&&void 0!==N?N:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?Y:X:"Desktop"),$timezone:ds(),$timezone_offset:vs()}),{$current_url:Zr(r?Zt(null==l?void 0:l.href):null==l?void 0:l.href,d,is),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:Gt(_,navigator.vendor,w,y),$browser_language:os(),$browser_language_prefix:(O=os(),"string"==typeof O?O.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&&ir(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ir(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Iu)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===to&&(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=ir(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 w=this.persistence.properties(),y=this.sessionPersistence.properties(),x=u.$groups,S=w.$groups;O(x)&&!I(x)&&(u.$groups=i({},O(S)?S:{},x)),er(["$referrer","$referring_domain"],t=>{t in w&&delete y[t]});var E={};if(this.yu.length>0)for(var T of this.yu.slice())try{ir(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=ir({},c,w,y,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?er(this.config.property_denylist,function(t){delete u[t]}):ue.error(yo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(wo),u=k(u,t));var D=this.Ku();return u.$process_person_profile=D,D&&!o&&this.Yu("_calculate_event_properties"),u}Zu(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Ku())return t;if(this.pu&&!i)return t;var s=ir({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(wo),s=n(s,"$set_once")),e&&(this.pu=!0),I(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.Qu(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.gu.add(t)),this.Ju()}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.gu.delete(t),this.Ju()}Xu(t,e){this.register({[t]:e})}Mu(){this.gu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.gu.clear(),this.Ju()}Ju(){var t;if(this.mu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Nr.Et())Nr.Lt(this.mu);else{var e=[];this.gu.forEach(t=>e.push(t)),e.length>0?Nr.At(this.mu,e):Nr.Lt(this.mu)}}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.tu.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:bo}),()=>{})}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:bo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:bo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=oo),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:bo}}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:bo})}th(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.th(t)&&this.Yu("posthog.identify")){this.hu();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Qu(!1),o=this.persistence.Sl(),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")===Gi,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(Ei,Hi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.xl(),this.capture(Qi,c,{$set:e||{},$set_once:i||{}}),this.ku=Qn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(Ei,Hi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.xl(),this.capture("$set",{$set:_,$set_once:p}),this.ku=Qn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(yi)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Tl(a)}}}setPersonProperties(t,e){if((t||e)&&this.Yu("posthog.setPersonProperties")){var i=Qn(this.get_distinct_id(),t,e);this.ku!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.ku=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.Yu("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.ku=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.Qu();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.Ku()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(Zi,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.Yu("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.eh(e,!1,i)}eh(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.xu)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var l=this.get_property(we),u=this.get_property(ye),d=this.get_property(Fe);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.Sl?void 0:a.Sl(),_=!1;try{var p,f,g,m,b,w,y,x,S,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.gu.clear(),this.Ju(),C(d)||null==(g=this.persistence)||g.register({[Fe]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Ei,Gi),null==(E=this.sessionManager)||E.resetSessionId(),this.ku=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ci,$device_id:null},"");else{var R=this.config.get_device_id(pr());this.register_once({distinct_id:R,$device_id:t?R:l},""),t||C(u)||this.register({[ye]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.ou()||(null==(P=this.persistence)||P.set_property(Ei,r.isIdentifiedID?Hi:Gi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(C(h)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(h,!0))){var O=i({},r);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var I;c&&(null==(I=this.persistence)||null==I.Tl||I.Tl(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.fu=!0,e.Ou().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.$u)||s.unload(),null==(n=e.Iu)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.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.Yu("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.Xu($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(O(t)){var r,s,n,o,a,h,l,u,d,v,c,_,p;ir(this.config,Oo(t));var f=this.cu();null==(r=this.persistence)||r.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.Su(this.config.debug);B(g)&&(this.config.debug=g),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,$r.Et()&&$r.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,$r.Et()&&$r.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.sessionRecording)||a.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this.du(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&jr(this,go,!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.sh}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:Eo;return e!==Eo&&(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"))}Ku(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}zu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Ku()||this.Yu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yu(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.lu(),this.Xu(Ii,!0),!0)}cu(){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)}du(){var t,e,i,r,s,n=this.cu();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.gu.clear(),this.Ju()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.ou()){var n,o,a,h,l,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.eh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Yn(this),this.pageViewManager=new Gr(this),this.persistence&&(this.sessionPropsManager=new Gn(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.ru(this.sessionRecording,new v(this)),this.Xa&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Xa)))}this.consent.optInOut(!0),this.du(),this.ju(),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.Bu()}else ue.warn(mo)}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.eh(!0,!0),this.consent.optInOut(!1),this.du(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ci,$device_id:null}),this.su(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.Bu(),this.ju())}else ue.warn(mo)}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.du()}_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}Bu(){h&&("visible"===h.visibilityState?this.bu||(this.bu=!0,this.capture(Ki,{title:h.title},{send_instantly:!0}),this._u&&(h.removeEventListener(Ji,this._u),this._u=null)):this._u||(this._u=this.Bu.bind(this),hr(h,Ji,this._u)))}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.xu||{};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&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,ue)}$s(t){var e;if(N(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),N(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&&!I(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&&N(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.Ao)?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)})}Su(t){var e=B(t)&&!t,i=$r.Et()&&"true"===$r.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t.sh={trace:Zn=()=>{},debug:Zn,info:Zn,warn:Zn,error:Zn,fatal:Zn},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=rr(t.prototype[e[i]])}(Co,["identify"]);var Ao=function(){ge.SDK_DIST_CHANNEL="npm";var t=po[Eo]=new Co;return function(){function t(){t.done||(t.done=!0,To=!1,er(po,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():hr(h,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ss as Compression,Fs as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ds as DisplaySurveyType,Co as PostHog,Us as ProductTourEventName,Bs as ProductTourEventProperties,As as SurveyEventName,Ms as SurveyEventProperties,Es as SurveyEventType,ks as SurveyPosition,Is as SurveyQuestionBranchingType,Os as SurveyQuestionType,Cs as SurveySchedule,Ps as SurveyTabPosition,Rs as SurveyType,Ts as SurveyWidgetType,Ao as default,Ao as posthog,qs 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.2",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}({}),w=["$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"],y=["token"];function x(t,e){return-1!==t.indexOf(e)}var S=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,O=t=>t===Object(t)&&!P(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,D=t=>null===t,N=t=>C(t)||D(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=>x(w,t),j=t=>x(y,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"],q=t=>x(W,t),G=[!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 Y="Mobile",K="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",wt="Ouya",yt="Generic "+Y.toLowerCase(),$t="Generic "+X.toLowerCase(),xt="Konqueror",St="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",Ot="Waterfox",It="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Dt="Google Search App",Nt=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?It:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?Dt:x(t," OPR/")&&x(t,"Mini")?"Opera Mini":x(t," OPR/")?ht:jt.test(t)?it:x(t,"IEMobile")||x(t,"WPDesktop")?at:x(t,"OculusBrowser")?St:x(t,"SamsungBrowser")?rt:x(t,"Edge")||x(t,"Edg/")?lt:x(t,"Vivaldi/")?Et:x(t,"YaBrowser/")?Tt:x(t,"Whale/")?kt:x(t,"DuckDuckGo/")||x(t,"Ddg/")?Pt:x(t,"Claude/")?Ct:x(t,"Codex/")?At:x(t,"ChatGPT/")?Mt:x(t,"FBIOS")?"Facebook Mobile":x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?nt:x(t,"CrMo")||x(t,st)?st:x(t,K)&&x(t,et)?pt:x(t,"FxiOS")?dt:x(t.toLowerCase(),xt.toLowerCase())?xt:x(t,"Brave/")?It:((t,e)=>e&&x(e,"Apple")||function(t){return x(t,et)&&!x(t,st)&&!x(t,K)}(t))(t,e)?x(t,Y)?ft:et:x(t,"PaleMoon/")?Rt:x(t,"Waterfox/")?Ot:x(t,ut)?ut:x(t,"MSIE")||x(t,"Trident/")?ot:x(t,"Gecko")?ut:"")},qt={[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]:[Nt],[ft]:[Nt],[ht]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gt=function(t,e,i,r){var s=qt[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(Y).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]?[K,[t[2],t[3],t[4]||"0"].join(".")]:[K,""]],[/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(wt,"i").test(t)?wt: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(Y).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)?K:Q:new RegExp("(pda|Mobile)","i").test(t)?yt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yt=[[/\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"]],Kt=/^[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)&&Kt.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.429.3",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",we="$device_id",ye="$device_model",$e="__alias",xe="__cmpns",Se="$fbc",Ee="$fbc_persistence",Te="__timers",ke="$autocapture_disabled_server_side",Pe="$heatmaps_enabled_server_side",Re="$exception_capture_enabled_server_side",Oe="$error_tracking_suppression_rules",Ie="$error_tracking_capture_extension_exceptions",Ce="$web_vitals_enabled_server_side",Ae="$dead_clicks_enabled_server_side",Me="$product_tours_enabled_server_side",De="$logs_capture_enabled_server_side",Ne="$web_vitals_allowed_metrics",Fe="$session_recording_remote_config",Ue="$session_recording_enabled_server_side",Be="$replay_sample_rate",Le="$replay_override_sampling",je="$replay_override_linked_flag",ze="$replay_override_url_trigger",We="$replay_override_event_trigger",qe="$sesid",Ge="$session_is_sampled",He="$session_past_minimum_duration",Ve="$session_recording_url_trigger_activated_session",Je="$session_recording_event_trigger_activated_session",Ye="$debug_first_full_snapshot_timestamp",Ke="$sess_rec_flush_size",Xe="$enabled_feature_flags",Qe="$active_feature_flags",Ze="$early_access_features",ti="$feature_flag_details",ei="$feature_flag_payloads",ii="$feature_flag_request_id",ri="$minimal_flag_called_events",si="$override_feature_flags",ni="$override_feature_flag_payloads",oi="$stored_person_properties",ai="$stored_group_properties",hi="$groups",li="$surveys",ui="$surveys_loaded_at",di="$surveys_activated",vi="$surveys_activated_session",ci="$surveys_activated_timestamps",_i="ph_product_tours",pi="$product_tours_activated",fi="$product_tours_activated_session",gi="$conversations_widget_session_id",mi="$conversations_ticket_id",bi="$conversations_widget_state",wi="$conversations_user_traits",yi="$flag_call_reported",$i="$flag_call_reported_session_id",xi="$feature_flag_errors",Si="$feature_flag_evaluated_at",Ei="$user_state",Ti="$client_session_props",ki="$capture_rate_limit",Pi="$initial_campaign_params",Ri="$initial_referrer_info",Oi="$initial_person_info",Ii="$epp",Ci="$posthog_cookieless",Ai="$cookieless_mode",Mi="$sdk_debug_extensions_init_method",Di="$sdk_debug_extensions_init_time_ms",Ni="$sdk_debug_recording_script_not_loaded",Fi="$sdk_debug_replay_event_trigger_status",Ui="$sdk_debug_replay_linked_flag_trigger_status",Bi="$sdk_debug_replay_matched_recording_trigger_groups",Li="$sdk_debug_replay_pending_trigger_conditions",ji="$sdk_debug_replay_remote_trigger_matching_config",zi="$sdk_debug_replay_trigger_groups_count",Wi="$sdk_debug_replay_url_trigger_status",qi="$session_recording_start_reason",Gi="anonymous",Hi="identified",Vi="identified_only",Ji="visibilitychange",Yi="beforeunload",Ki="$pageview",Xi="$pageleave",Qi="$identify",Zi="$groupidentify";function tr(t,e){P(t)&&t.forEach(e)}function er(t,e){if(!N(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 ir=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},rr=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)}}},sr=function(t){var e={};return er(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function nr(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 or=["herokuapp.com","vercel.app","netlify.app"];function ar(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 or)if(i===r)return!1;return!0}function hr(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 lr=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 ur=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}},dr=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 ur.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 _r}},vr=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&&(vr=t=>crypto.getRandomValues(t));var cr,_r=class{nextUint32(){return this.Rt.length>this.$t||(vr(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},pr=()=>fr().toString(),fr=()=>(cr||(cr=new dr)).generate(),gr="",mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var br=null,wr={Et(){if(!D(br))return br;if(br=!1,h)try{var t="__ph_cookie_support_"+pr();wr.At(t,"xyz"),br='"xyz"'===lr(t),wr.Lt(t)}catch(t){br=!1}return br},Pt(t){ue.error("cookieStore error: "+t)},Ot:lr,Dt(t){var e;try{e=JSON.parse(wr.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),gr)return gr;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_"+pr();!gr&&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",gr=n)}return gr}(t);if(!i){var r=(t=>{var e=t.match(mr);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{wr.At(t,"",-1,e)}catch(t){return}}},yr=null,$r={Et(){if(!D(yr))return yr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";$r.At(e,"xyz"),'"xyz"'!==$r.Ot(e)&&(t=!1),$r.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),yr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){$r.Pt(t)}return null},Dt(t){try{return JSON.parse($r.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){$r.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){$r.Pt(t)}}},xr=[oi,Qe,Xe,ti,ei,ii,Si,xi,yi],Sr=[we,be,qe,Ge,Ii,Oi,Ee,Ei],Er=t=>t+"_cpm",Tr=["__proto__","constructor","prototype"],kr=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Tr.indexOf(i)&&(e[i]=t[i])}),e},Pr=function(t,e){void 0===e&&(e=[]);var i={};return[...Sr,...e].forEach(e=>{var r=t[e];C(r)||D(r)||""===r||(i[e]=r)}),i},Rr=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)},Or=(t,e)=>({p:e,f:Rr(JSON.stringify(t))}),Ir=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=wr.Dt(Er(t)),r=(null==i?void 0:i.f)===Rr(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Cr=(t,e)=>e+"|"+(wr.Ot(Er(t))||""),Ar={},Mr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Ar?Ar[t]:null,Dt:t=>t in Ar?Ar[t]:null,At:(t,e)=>(Ar[t]=e,!0),Lt(t){delete Ar[t]}},Dr=null,Nr={Et(){if(!D(Dr))return Dr;if(Dr=!0,C(n))Dr=!1;else try{var t="__support__";Nr.At(t,"xyz"),'"xyz"'!==Nr.Ot(t)&&(Dr=!1),Nr.Lt(t)}catch(t){Dr=!1}return Dr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Nr.Pt(t)}return null},Dt(t){try{return JSON.parse(Nr.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Nr.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Nr.Pt(t)}}},Fr=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.$o()?0:this.To}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.Io.At(this.Mo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Io.Lt(this.Mo,this.Mr.cross_subdomain_cookie)}get Mo(){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 To(){var t=this.Io.Ot(this.Mo);return q(t)?1:x(G,t)?0:-1}get Io(){var t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?$r:wr,i=e.Et()?e:Mr;if(!this.Eo||this.Eo!==i){this.Eo=i;var r="localStorage"===t?wr:$r;r.Ot(this.Mo)&&(this.Eo.Ot(this.Mo)||this.optInOut(q(r.Ot(this.Mo))),r.Lt(this.Mo,this.Mr.cross_subdomain_cookie))}return this.Eo}$o(){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=>q(t))}},Ur=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var Br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ae)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Lr=de("[SegmentIntegration]");function jr(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()||pr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ei,Hi)),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||Lr.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()||(Lr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(Lr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!N(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),N(s))return null}catch(t){return Lr.error("Error in Segment filterProperties:",t),null}return s})(s,l);if(N(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,Ki)},identify(t){return n(t,Qi)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:h})).then(()=>{e()},t=>{Lr.error("Failed to register the Segment integration",t),e()})},r)}var zr="posthog-js";function Wr(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 qr=class{constructor(t,e,i,r,s,n){this.name=zr,this.setupOnce=function(o){o(Wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Gr=class{constructor(t){this.Fo=(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.Oo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Do()}Do(){var t;this.Lo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Fo)}destroy(){var t;null==(t=this.Lo)||t.call(this),this.Lo=void 0}doPageView(t,e){var i,r=this.No(t,e);return this.Oo={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.No(t,null==(e=this.Oo)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Oo)?void 0:t.pageViewId}}No(t,e){var i=this.Oo;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=ir(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}},Hr=["flags","surveys"],Vr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"event"},[Pe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Re]:{exposure:"event"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"event"},[Ce]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"hidden"},[Ne]:{exposure:"event"},[Fe]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Be]:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},[He]:{exposure:"event"},[Ve]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[Ze]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden",storageGroup:"flags"},[ii]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[li]:{exposure:"hidden",storageGroup:"surveys"},[ui]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[di]:{exposure:"event"},[vi]:{exposure:"hidden"},[ci]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"event"},[mi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[yi]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[hi]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Le]:{exposure:"event"},[je]:{exposure:"event"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Mi]:{exposure:"event"},[Di]:{exposure:"event"},[Ni]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[qi]:{exposure:"event"}},Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Yr=t=>{var e=Vr[t];if(e)return e;for(var i of Jr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Kr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,nr(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},Xr=t=>{var e=null==h?void 0:h.createElement("a");return C(e)?null:(e.href=t,e)},Qr=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," ")},Zr=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},ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],es=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ts],is="<masked>",rs=["li_fat_id"];function ss(t,e){var i=es.concat(e||[]),r={};return er(i,function(e){var i=Qr(t,e);r[e]=i||null}),r}function ns(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(!D(e)){r.$search_engine=e;var s=h?Qr(h.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function os(){return navigator.language||navigator.userLanguage}var as="$direct";function hs(){return(null==h?void 0:h.referrer)||as}function ls(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...ts,...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:hs().substring(0,1e3),u:n?Zr(n,s,is):void 0}}function us(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==as?as:null==(i=Xr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Xr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ir(o,ss(n))}return r&&ir(o,ns(r)),o}function ds(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cs={flags:Si,surveys:ui},_s=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ps=t=>t+"_cookie_identity_change_pending",fs=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},gs="main",ms=[Xe,Qe,ti,ei,ii,Si,ri,oi],bs=t=>-1!==ms.indexOf(t),ws=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},ys=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},$s=(t,e)=>{er(t,(i,r)=>{var s=Yr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},xs=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.qo={},this.jo=!1,this.Bo=!1,this.Ho=!1,this.zo=!1,this.Uo=!1,this.Wo=new Map,this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=new Set,this.Mr=t,this.Ko=r,this.props={},this.Yo=void 0,this.Xo=(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.Io=this.tl(t),this.Ho=this.el(t),this.load(),this.il(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();hr(n,"beforeunload",s,{capture:!1}),hr(n,"pagehide",s,{capture:!1}),this.nl=t=>{if(this.jo&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.Xo){if(this.Ho){var e=Hr.find(e=>t.key===this.sl(e));e&&this.rl(t.key,e)}}else this.rl(t.key,gs)},hr(n,"storage",this.nl)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.Wo.get(e);if(bs(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.ol(e,s)}else this.ol(e,!0)})}onCrossTabFeatureFlagChange(t){return this.Jo.add(t),()=>this.Jo.delete(t)}destroy(){this.nl&&n&&(n.removeEventListener("storage",this.nl),this.nl=void 0),this.Jo.clear()}rl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=$r.Ot(t),D(s)){var n=this.ll(e);return n.storageValue=null,e!==gs&&(n.persisted=!1),!1}r=ys(s)}catch(t){return!1}var o=e===gs?r:$r.Dt(this.Xo);if(o&&this.al(o))return!1;var a=this.ul(r,e,i);return e===gs&&this.Ho&&!ws(this.hl().main,r)||this.cl(r,e,!0,s),a}al(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}cl(t,e,i,r){var s=this.ll(e);s.storageValue=r,e!==gs&&(s.persisted=i);try{s.fingerprint=this.dl(t,e)}catch(t){s.fingerprint=void 0}}ul(t,e,i){var r=!1;return ms.forEach(i=>{var s,n=null==(s=Yr(i))?void 0:s.storageGroup;if(!(e===gs&&this.Ho&&n||e!==gs&&n!==e)){var o=i in t,a=this.vl(i,o?t[i]:void 0),h=this.Wo.has(i)?i in this.props:o;h===i in this.props&&ws(a,this.props[i])||(h?this.fl(i,a,!1):this.pl(i,!1),r=!0)}}),r&&i&&this.Jo.forEach(t=>t()),r}gl(){if(!this.jo)return!1;try{this.Zo=!1;var t,e=$r.Ot(this.Xo),i=this.ll(gs),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=ys(e),this.Zo=!this.Go&&this.al(t),this.Zo)return!1;s=this.ul(t,gs,!1),!this.Ho||ws(this.hl().main,t)?this.cl(t,gs,!0,e):i.storageValue=e,r=!0}return this.Ho&&Hr.forEach(e=>{var i=$r.Ot(this.sl(e)),n=this.ll(e),o=t||{},a=r&&ms.some(t=>{var i;return(null==(i=Yr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.ul(o,e,!1)||s));var h=ys(i);s=this.ul(h,e,!1)||s,this.cl(h,e,!0,i)}}),s}catch(t){return!1}}ol(t,e){this.Wo.set(t,e);var i=Yr(t);null!=i&&i.volatile||(this.ll((this.Ho?null==i?void 0:i.storageGroup:void 0)||gs).fingerprint=void 0,this.ml(t))}yl(){ms.forEach(t=>this.Wo.set(t,!0))}il(){if(this.jo)try{var t=$r.Ot(this.Xo),e=ys(t);this.ll(gs).storageValue=t,ms.forEach(t=>{var i,r=this.Ho?null==(i=Yr(t))?void 0:i.storageGroup:void 0,s=r?$r.Ot(this.sl(r)):null;if(r){var n=this.ll(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?ys(s):e;t in this.props?this.bl(t,o[t],this.props[t]):t in o&&this.ol(t,!0)})}catch(t){}}vl(t,e){var r=this.Wo.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=O(e)?i({},e):{},a=O(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}bl(t,e,i){if(bs(t)){var r=this.Wo.get(t);if(!0!==r){var s=e;if(this.jo)try{var n,o=this.Ho?null==(n=Yr(t))?void 0:n.storageGroup:void 0,a=o?this.sl(o):this.Xo;s=ys($r.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.ol(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach(t=>{l.has(t)!==d.has(t)&&h.add(t)}),h.forEach(t=>{u.has(t)===d.has(t)&&h.delete(t)})}else{if(!O(i))return void(ws(s,i)?this.Wo.delete(t):this.ol(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.ol(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&ws(v[t],i[t])||h.add(t)}),h.forEach(t=>{t in c==t in i&&ws(c[t],i[t])&&h.delete(t)})}h.size?this.ol(t,h):this.Wo.delete(t)}}}_l(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}wl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{var e=Pr(t,this.Mr.cookie_persisted_properties||[]),i=Or(e,this.Mr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=wr.Ot(this.Xo)||void 0;s&&Cr(this.Xo,s)===r&&(this.kl=r,this.Sl=s)}catch(t){}else try{var n=wr.Ot(this.Xo)||void 0;this.kl=n?Cr(this.Xo,n):void 0,this.Sl=n}catch(t){}}syncCookieProperties(){return this.xl(this.Mr)}xl(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Uo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=wr.Ot(this.Xo)||void 0}catch(t){}if(!i||i===this.Sl)return!1;var r,s=Cr(this.Xo,i);try{r=kr(JSON.parse(i))}catch(t){return!1}if((wr.Ot(this.Xo)||void 0)!==i)return!1;this.kl=s,this.Sl=i;var n=Ir(this.Xo,i),o=[...Sr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),I(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[Ei],v=ir({},l);[...Sr,...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===Sr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=ir(v,r),ms.forEach(t=>{var e=t in this.props;t in l===e&&ws(l[t],this.props[t])||(e?this.bl(t,l[t],this.props[t]):this.ol(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this.fl(Ei,Gi);var c=this.props[be],_=this.props[Ei];return!h||c===u&&_===d||(this.Go=!0,this.zo=!0,Nr.At(ps(this.Xo),!0),this.pl(oi),this.pl(Qe),this.pl(Xe),this.pl(ti),this.pl(ei),this.pl(ii),this.pl(Si),this.pl(xi),this.pl(yi),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||($s(this.props,r),this.pl(ai)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.pl($e)),!0}consumeCookieIdentityChange(){var t=ps(this.Xo),e=this.zo||!!Nr.Ot(t);return this.zo=!1,e&&Nr.Lt(t),e}Cl(t){return void 0===t&&(t=!1),!(this.Uo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Uo=!0,0))}$l(){this.Uo&&(C(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0),delete this.qo[gs],this.Il(!0))}Ml(t){if(void 0===t&&(t=!0),this.Uo)try{t?this.$l():C(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0)}finally{this.Uo=!1}}isDisabled(){return!!this.pi}tl(t){-1===_s.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=[...Sr,...t];return i({},$r,{Dt(t){try{var i,s={};try{i=wr.Ot(t)||void 0,s=i?kr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse($r.Ot(t)||"{}");if(e){var a=Ir(t,i),h=[...Sr,...a.properties],l={};Object.keys(s).forEach(t=>{var e=s[t];D(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===Sr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Ei]=Gi),!u||("distinct_id"in l?l[be]:o[be])===v&&("$user_state"in l?l[Ei]:o[Ei])===c||(xr.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[hi],delete o[ai]),delete o.__alias)}n=ir(o,l)}else n=ir(s,o);return $r.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var h=$r.At(i,r,void 0,void 0,a);try{var l=Pr(r,t);if(Object.keys(l).length){if(e){var u=Er(i),d=Or(l,t);if(wr.At(u,d,s,n,o,a),wr.Ot(u)!==JSON.stringify(d)){wr.Lt(u,n);var v=Pr(r);return wr.At(i,v,s,n,o,a),h}}wr.At(i,l,s,n,o,a)}}catch(t){$r.Pt(t)}return h},Lt(t,e){try{null==n||n.localStorage.removeItem(t),wr.Lt(t,e),wr.Lt(Er(t),e)}catch(t){$r.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&$r.Et()?(e=$r,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Nr.Et()?e=Nr:"memory"===a?e=Mr:"cookie"===a&&wr.Et()?(e=wr,s=!0):r.Et()?(e=r,o=!0,s=!0):wr.Et()?(e=wr,s=!0):e=Mr,this.jo=o,this.Bo=s,e}sl(t){return this.Xo+"__"+t}el(t){return this.jo&&!!t.split_storage}properties(){var t={};return er(this.props,(e,i)=>{var r=Yr(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?$r.Dt(this.Xo):null,r={};if(e)try{er(r=kr(wr.Dt(this.Xo)),(t,e)=>{(C(t)||D(t)||""===t)&&delete r[e]})}catch(t){}var s=this.Io.Dt(this.Xo);if(s&&(this.props=ir({},s)),this.Ho&&this.El(),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.zo=!0,Nr.At(ps(this.Xo),!0);var d=ir({},this.props);xr.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==h&&"anonymous"!==r.$user_state&&(C(a)||l===a)||($s(d,r),delete d[ai]),this.props=d;var v=new Set;xr.forEach(t=>{var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};er(this.props,(i,r)=>{var s;(null==(s=Yr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),I(e)?($r.Lt(this.sl(t)),this.qo[t]={}):$r.At(this.sl(t),e)&&(this.qo[t]={persisted:!0,fingerprint:this.dl(e,t)})})}}Nr.Ot(ps(this.Xo))&&(this.zo=!0)}}El(){for(var t of Hr){var e=$r.Dt(this.sl(t));if(e&&!I(e)){var i=this.ll(t);i.persisted=!0,this.Pl(t)||(i.fingerprint=this.dl(e,t)),this.Rl(t,e)||ir(this.props,e)}}}Pl(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Yr(e))?void 0:i.storageGroup)===t})}Rl(t,e){var i=cs[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||"$fbc_persistence"===t&&this.Qo)){var i=this.Ho?null==(e=Yr(t))?void 0:e.storageGroup:void 0,r=i?$r.Dt(this.sl(i)):this.Io.Dt(this.Xo);if(r&&t in r)this.fl(t,r[t],!1);else{if(i){var s=this.Io.Dt(this.Xo);if(s&&t in s)return void this.fl(t,s[t],!1)}this.pl(t,!1)}}}save(){if(!this.pi){var t=this._l();t>0?C(this.Tl)&&(this.Tl=setTimeout(()=>{this.Tl=void 0,this.Il()},t)):this.Il()}}flush(){C(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0,this.Il())}Il(t){if(void 0===t&&(t=!1),!(this.pi||this.Uo&&!t)){t||(this.syncCookieProperties(),this.Qo||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(Ee));var e=!t&&!this.Vo;e||(this.Zo=!1);var i=!!e&&this.gl();if(this.Zo)this.Mr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Ho)return this.Al(),void(i&&this.Jo.forEach(t=>t()));var r=this.Fl(this.Io,this.Xo,this.props,gs);"written"===r&&this.wl(this.props),"failed"!==r&&(this.Wo.clear(),this.Go=!1,this.Qo=!1),i&&this.Jo.forEach(t=>t())}}}Al(){var t=this,e=this.hl(),i=e.main,r=e.groups,s=this.Fl(this.Io,this.Xo,i,gs);"written"===s&&this.wl(i),"failed"!==s&&(this.Go=!1,this.Qo=!1,ms.forEach(t=>{var e;null!=(e=Yr(t))&&e.storageGroup||this.Wo.delete(t)}));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.qo[e])||!i.persisted))return ms.forEach(i=>{var r;(null==(r=Yr(i))?void 0:r.storageGroup)===e&&t.Wo.delete(i)}),1;var n=t.Fl($r,t.sl(e),s,e);"failed"!==n&&ms.forEach(i=>{var r=Yr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.Wo.delete(i)})};for(var o of Hr)if(n(o))continue}hl(){var t={},e={flags:{},surveys:{}};return er(this.props,(i,r)=>{var s,n=null==(s=Yr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}dl(t,e){if(e===gs)return JSON.stringify(t)+"|"+this.Ol+"|"+this.Dl+"|"+this.Ll;var i={};return er(t,(t,e)=>{var r;i[e]=null!=(r=Yr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}Fl(t,e,i,r){var s,n=this.ll(r);if(r!==gs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.dl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Ol,this.Dl,this.Ll,this.Mr.debug)?(n.dirty=!1,r!==gs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.jo&&(n.storageValue=$r.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.yl(),C(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0),this.Io.Lt(this.Xo,!1),this.Io.Lt(this.Xo,!0),!i&&this.Ko)for(var r of Hr)$r.Lt(this.sl(r));i?delete this.qo[gs]:this.qo={},this.kl=void 0,this.Sl=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Ol=C(i)?this.Nl:i;var r=!1;if(er(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.fl(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Ol=C(e)?this.Nl:e;var i=!1;if(er(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||P(e))&&(this.fl(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.pl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.Yo){var e=function(t,e,i){if(!h)return{};var r,s=e?[...ts,...i||[]]:[],n=ss(Zr(h.URL,s,is),t);return ir((r={},er(rs,function(t){var e=lr(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=!I(sr(e));return i&&this.register(e),this.Yo=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?ns(t):{})}update_referrer_info(){var t;this.register_once({$referrer:hs(),$referring_domain:null!=h&&h.referrer&&(null==(t=Xr(h.referrer))?void 0:t.host)||as},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=ls(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Oi]:this.Bo?{r:fs(t.r),u:t.u?fs(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};er([Ri,Pi],e=>{var i=this.props[e];i&&er(i,function(e,i){t["$initial_"+S(i)]=e})});var e=this.props[Oi];return e&&ir(t,function(t,e){void 0===e&&(e=!1);var i=us(t,e),r={};return er(i,function(t,e){r["$initial_"+S(e)]=t}),r}(e,this.Mr.disable_capture_url_hashes)),t}safe_merge(t){return er(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.xl(e,l),this.Mr=t,!h&&(s||n||a)&&(this.kl=void 0,this.Sl=void 0,this.xl(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=o||a?this.tl(t):this.Io;this.ql();var d=this.el(t),v=o||d!==this.Ho,c=!h&&(v||t.cross_subdomain_cookie!==this.Dl||t.secure_cookie!==this.Ll)&&this.Cl(l);this.Vo=v;try{if(this.Nl=this.Ol=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.Io=u,this.Ho=d,this.props=_,this.save()}else a&&(this.Io=u,h||(delete this.qo[gs],this.Il()))}finally{this.Vo=!1,c&&this.Ml()}}ql(){var t=this.props[Oi];if(this.Bo&&O(t)&&"string"==typeof t.r){var e=fs(t.r),r="string"==typeof t.u?fs(t.u):t.u;e===t.r&&r===t.u||this.fl(Oi,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Dl&&(this.Dl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ll&&(this.Ll=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this.fl(Te,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this.fl(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.fl(t,e),this.save()}fl(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.Go=!0),"$fbc_persistence"!==t||ws(s,e)||(this.Qo=!0),this.bl(t,s,e),null!=(r=Yr(t))&&r.volatile||this.ml(t))}pl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(bs(t)&&this.ol(t,!0),"$fbc_persistence"===t&&(this.Qo=!0),this.ml(t))}ml(t){var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&(this.ll(i).dirty=!0)}ll(t){return this.qo[t]||(this.qo[t]={})}},Ss={GZipJS:"gzip-js",Base64:"base64"},Es={Activation:"events",Cancellation:"cancelEvents"},Ts={Button:"button",Tab:"tab",Selector:"selector"},ks={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"},Ps={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Os={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Is={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Cs={Once:"once",Recurring:"recurring",Always:"always"},As={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ms={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"},Ds={Popover:"popover",Inline:"inline"};function Ns(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var Fs={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},Us={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"},Bs={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"},Ls=de("[RateLimiter]"),js=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=>{Ls.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ls.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.jl(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(ki,a),{isRateLimited:h,remainingTokens:a.tokens}}Bl(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Hl(){var t;if(this.Bl("$current_url")&&this.Bl("$pathname")&&null!=l&&l.pathname)return""+(null!==(t=l.origin)&&void 0!==t?t:"")+l.pathname}jl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Hl(),o=this.Bl("$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}},zs=de("[RemoteConfig]"),Ws=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}zl(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()}Ul(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 zs.info("Using preloaded remote config",this.remoteConfig),void this.Wl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zs.warn("Remote config is disabled. Falling back to local config.");this.zl(t=>{if(!t)return zs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ul(t=>{this.Wl(t.json,t)});this.Wl(t)})}catch(t){zs.error("Error loading remote config",t),this.Wl()}}Wl(t,e){!t&&e&&(0===e.statusCode?e.error||zs.warn("Failed to fetch remote config from PostHog."):zs.error("Failed to fetch remote config from PostHog."));try{this._instance.Wl(t?{ok:!0,config:t}:{ok:!1})}catch(t){zs.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){zs.error("Error loading feature flags",t)}}},qs=["fatal","error","warning","log","info","debug"],Gs=Uint8Array,Hs=Uint16Array,Vs=Uint32Array,Js=new Gs([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]),Ys=new Gs([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]),Ks=new Gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xs=function(t,e){for(var i=new Hs(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vs(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]},Qs=Xs(Js,2),Zs=Qs[1];Qs[0][28]=258,Zs[258]=28;for(var tn=Xs(Ys,0)[1],en=new Hs(32768),rn=0;32768>rn;++rn){var sn=(43690&rn)>>>1|(21845&rn)<<1;en[rn]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}var nn=function(t,e,i){for(var r=t.length,s=0,n=new Hs(e);r>s;++s)++n[t[s]-1];var o,a=new Hs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Hs(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[en[d]>>>h]=l}else for(o=new Hs(r),s=0;r>s;++s)o[s]=en[a[t[s]-1]++]>>>15-t[s];return o},on=new Gs(288);for(rn=0;144>rn;++rn)on[rn]=8;for(rn=144;256>rn;++rn)on[rn]=9;for(rn=256;280>rn;++rn)on[rn]=7;for(rn=280;288>rn;++rn)on[rn]=8;var an=new Gs(32);for(rn=0;32>rn;++rn)an[rn]=5;var hn=nn(on,9,0),ln=nn(an,5,0),un=function(t){return(t/8|0)+(7&t&&1)},dn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Hs?Hs:t instanceof Vs?Vs:Gs)(i-e);return r.set(t.subarray(e,i)),r},vn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},cn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},_n=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 Gs(0),0];if(1==s){var o=new Gs(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 Hs(v+1),_=pn(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 w=n[r].s;c[w]==e&&(--c[w],++p)}_=e}return[new Gs(c),_]},pn=function(t,e,i){return-1==t.s?Math.max(pn(t.l,e,i+1),pn(t.r,e,i+1)):e[t.s]=i},fn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Hs(++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]},gn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mn=function(t,e,i){var r=i.length,s=un(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)},bn=function(t,e,i,r,s,n,o,a,h,l,u){vn(e,u++,i),++s[256];for(var d=_n(s,15),v=d[0],c=d[1],_=_n(n,15),p=_[0],f=_[1],g=fn(v),m=g[0],b=g[1],w=fn(p),y=w[0],x=w[1],S=new Hs(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;y.length>E;++E)S[31&y[E]]++;for(var T=_n(S,7),k=T[0],P=T[1],R=19;R>4&&!k[Ks[R-1]];--R);var O,I,C,A,M=l+5<<3,D=gn(s,on)+gn(n,an)+o,N=gn(s,v)+gn(n,p)+o+14+3*R+gn(S,k)+(2*S[16]+3*S[17]+7*S[18]);if(D>=M&&N>=M)return mn(e,u,t.subarray(h,h+l));if(vn(e,u,1+(D>N)),u+=2,D>N){O=nn(v,c,0),I=v,C=nn(p,f,0),A=p;var F=nn(k,P,0);for(vn(e,u,b-257),vn(e,u+5,x-1),vn(e,u+10,R-4),u+=14,E=0;R>E;++E)vn(e,u+3*E,k[Ks[E]]);u+=3*R;for(var U=[m,y],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)vn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(vn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else O=hn,I=on,C=ln,A=an;for(E=0;a>E;++E)if(r[E]>255){var j;cn(e,u,O[257+(j=r[E]>>>18&31)]),u+=I[j+257],j>7&&(vn(e,u,r[E]>>>23&31),u+=Js[j]);var z=31&r[E];cn(e,u,C[z]),u+=A[z],z>3&&(cn(e,u,r[E]>>>5&8191),u+=Ys[z])}else cn(e,u,O[r[E]]),u+=I[r[E]];return cn(e,u,O[256]),u+I[256]},wn=new Vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yn=new Gs(0),$n=function(){for(var t=new Vs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Sn(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=$n[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 Gs(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=mn(h,l,t.subarray(u,d)):(h[u]=n,l=mn(h,l,t.subarray(u,o)))}else{for(var v=wn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Hs(32768),g=new Hs(p+1),m=Math.ceil(i/3),b=2*m,w=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},y=new Vs(25e3),x=new Hs(288),S=new Hs(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var O=w(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){l=bn(t,h,0,y,x,S,T,k,R,u-R,l),k=E=T=0,R=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var D=2,N=0,F=_,U=I-C&32767;if(A>2&&O==w(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&I!=C;){if(t[u+D]==t[u+D-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>D){if(D=z,N=U,z>B)break;var W=Math.min(U,z-2),q=0;for(M=0;W>M;++M){var G=u-U+M+32768&32767,H=G-f[G]+32768&32767;H>q&&(q=H,C=G)}}}U+=(I=C)-(C=f[I])+32768&32767}if(N){y[k++]=268435456|Zs[D]<<18|tn[N];var V=31&Zs[D],J=31&tn[N];T+=Js[V]+Ys[J],++x[257+V],++S[J],P=u+D,++E}else y[k++]=t[u],++x[t[u]]}}l=bn(t,h,n,y,x,S,T,k,R,u-R,l),n||(l=mn(h,l,yn))}return dn(a,0,r+un(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&&xn(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),xn(u,d-8,i.d()),xn(u,d-4,r),u}var En=!!d||!!u,Tn="text/plain",kn=!1,Pn=(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:"")},Rn=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 er(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},On=t=>{if(t.Gl)return t.Gl;var e=t.data,i=t.compression;if(e){if(i===Ss.GZipJS){var r=Sn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gs(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 Gs(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 dn(i,0,r)}(Kr(e)),{mtime:0});return{contentType:Tn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ss.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Kr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Kr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Kr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},In=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Rn(t.url,{compression:Ss.Base64}),encodedBody:On(i({},t,{compression:Ss.Base64,Gl:void 0}))}:{url:Pn(t.url,"compression"),encodedBody:On(i({},t,{compression:void 0,Gl:void 0}))};try{e=On(t)}catch(e){if(se(t.compression,Qr(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,Qr(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(kn=!0,s()):{url:t.url,encodedBody:e}},Cn=t=>{try{return In(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},An=function(){var t=s(function*(t){var e=yield function(t,e,i){return he.apply(this,arguments)}(Kr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Gl:{contentType:Tn,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Mn=/Failed to fetch|NetworkError|Load failed/i,Dn=t=>"TypeError"===(null==t?void 0:t.name)&&Mn.test((null==t?void 0:t.message)||""),Nn=t=>{var e=Cn(t);if(e){var i=new d,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;er(t.headers,function(t,e){i.setRequestHeader(e,t)}),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}},Fn=t=>{var e=Cn(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;er(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)||Dn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;u(r,i({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&!t.Zl&&52428.8>(h||0),body:a,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){ue.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>d?clearTimeout(d.timeout):null)}catch(t){d&&clearTimeout(d.timeout),p(t)}}},Un=t=>{try{var e,r=In(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 Un(i({},t,{data:_(v.slice(0,c))})),void Un(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?Fn(i({},t,{Zl:!0})):Nn(t)}catch(t){ue.warn("Beacon send failed",t)}},Bn=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Rn(r===Ss.GZipJS?Pn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ss.GZipJS?{}:{compression:r}))},Ln=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Fn}),d&&t.push({transport:"XHR",method:Nn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:Un}),t})(),jn=class{constructor(t,e){this.Ql=!0,this.Jl=[],this.Kl=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.Yl=t}enqueue(t){this.Jl.push(t),this.Xl||this.ta()}unload(){this.ea();var t=this.Jl.length>0?this.ia():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.na(i({},t,{transport:"sendBeacon"}))})}enable(){this.Ql=!1,this.ta()}ta(){var t=this;this.Ql||(this.Xl=setTimeout(()=>{if(this.ea(),this.Jl.length>0){var e=this.ia(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&P(i.data)&&er(i.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.na(i)};for(var r in e)i()}},this.Kl))}na(t){try{this.Yl(t)}catch(t){ue.error(t)}}ea(){clearTimeout(this.Xl),this.Xl=void 0}ia(){var t={};return er(this.Jl,e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.Jl=[],t}},zn=class{constructor(t){this._instance=t,this.sa=!1,this.ra=3e3,this.Jl=[],this.Jl=[],this.oa=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.oa=n.navigator.onLine,this.la)return;this.la=()=>{this.oa=!0,this.aa()},this.ua=()=>{this.oa=!1},hr(n,"online",this.la),hr(n,"offline",this.ua)}}get length(){return this.Jl.length}retriableRequest(t){var r=t.retriesPerformedSoFar,s=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(r)&&(s.url=Rn(s.url,{retry_count:r})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=r?r:0))return void this.Is(i({retriesPerformedSoFar:r},s));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!=r?r:0)+" retries.")}null==s.callback||s.callback(t)}}))}Is(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(e),r=Date.now()+i;this.Jl.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.sa||(this.sa=!0,this.ha())}ha(){if(this.ca&&clearTimeout(this.ca),0===this.Jl.length)return this.sa=!1,void(this.ca=void 0);this.ca=setTimeout(()=>{this.oa&&this.Jl.length>0&&this.aa(),this.ha()},this.ra)}aa(){var t=Date.now(),e=[],i=this.Jl.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Jl=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ca&&(clearTimeout(this.ca),this.ca=void 0),this.sa=!1,C(n)||(this.la&&(n.removeEventListener("online",this.la),this.la=void 0),this.ua&&(n.removeEventListener("offline",this.ua),this.ua=void 0)),this.Jl)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.Jl=[]}},Wn=class{constructor(t){this._instance=t,this.da=()=>{var t,e,i,r;this.va||(this.va={});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.va.lastScrollY=Math.ceil(n),this.va.maxScrollY=Math.max(n,null!==(t=this.va.maxScrollY)&&void 0!==t?t:0),this.va.maxScrollHeight=Math.max(o,null!==(e=this.va.maxScrollHeight)&&void 0!==e?e:0),this.va.lastContentY=a,this.va.maxContentY=Math.max(a,null!==(i=this.va.maxContentY)&&void 0!==i?i:0),this.va.maxContentHeight=Math.max(h,null!==(r=this.va.maxContentHeight)&&void 0!==r?r:0)}}get fa(){return this._instance.config.scroll_root_selector}getContext(){return this.va}resetContext(){var t=this.va;return setTimeout(this.da,0),t}startMeasuringScrollPosition(){hr(n,"scroll",this.da,{capture:!0}),hr(n,"scrollend",this.da,{capture:!0}),hr(n,"resize",this.da)}scrollElement(){var t;if(!this.fa)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this.fa)?this.fa:[this.fa]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}pa(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this.fa){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.pa("y")}scrollX(){return this.pa("x")}},qn=t=>ls(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),Gn=class{constructor(t,e,i,r){this.je=t=>{var e=this.ga();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ma(this._instance)};this.ya.register({[Ti]:i})}},this._instance=t,this.ba=e,this.ya=i,this.ma=r||qn,this.ba.onSessionId(this.je)}ga(){return this.ya.props[Ti]}getSetOnceProps(){var t,e=null==(t=this.ga())?void 0:t.props;return e?"r"in e?us(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 er(sr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+S(i)]=e}),t}},Hn=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={}}},Vn=de("[SessionId]"),Jn=864e5,Yn=class{on(t,e){return this.wa.on(t,e)}constructor(t,e,i){var r;if(this.ka=null,this.Sa=null,this.xa=[],this.Ca=void 0,this.$a=!1,this.wa=new Hn,this.Ta=(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.ya=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Ia=void 0,this._sessionActivityTimestamp=null,this.Ma=e||pr,this.Ea=i||pr;var s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*J(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Vn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pa(),this.Ra="ph_"+s+"_window_id",this.Aa="ph_"+s+"_primary_window_exists",this.Fa()){var n=Nr.Dt(this.Ra),o=Nr.Dt(this.Aa);n&&!o?this.Be=n:Nr.Lt(this.Ra),Nr.At(this.Aa,!0)}null!=(r=this.Mr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Oa()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.xa)&&(this.xa=[]),this.xa.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.xa=this.xa.filter(e=>e!==t)}}Fa(){return"memory"!==this.Mr.persistence&&!this.ya.pi&&Nr.Et()}Da(t){t!==this.Be&&(this.Be=t,this.Fa()&&Nr.At(this.Ra,t))}La(){return this.Be?this.Be:this.Fa()?Nr.Dt(this.Ra):null}Na(t){var e=this.ka;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}qa(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.Na(e)||(this.ka=e,this.ya.register({[qe]:[e,t,i]}))}ja(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}Ba(){this.ja()?this.ya.refreshKey(qe):(this.ya.flush(),this.ya.load())}Ha(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ka){this.Ba();var e=this.za();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.ka=this._sessionActivityTimestamp,this.ya.register({[qe]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.ya.flush())}}Ua(){var t=this.za()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Wa(t){return this.Ba(),this.Ta(t,this.Ua())}za(){var t=this.ya.props[qe];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ka=null,this.Ia=void 0,clearTimeout(this.Va),this.Va=void 0,this.qa(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 Vn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Vn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Ia={sessionId:t,sessionStartTimestamp:i}:this.qa(t,(new Date).getTime(),i),!0)}destroy(){this.$a=!0,this.Ha(),clearTimeout(this.Va),this.Va=void 0,this.Ca&&n&&(n.removeEventListener(Yi,this.Ca,{capture:!1}),this.Ca=void 0),this.xa=[]}Oa(){this.Ca=()=>{this.Ha(),this.Fa()&&Nr.Lt(this.Aa)},hr(n,Yi,this.Ca,{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.Sa=r;else if(D(this.Sa)||this.Sa>r||r-this.Sa>=1e3){var n,o;null==(n=(o=this.ya).syncCookieProperties)||n.call(o),this.Sa=r}var a=this.za(),h=a[1],l=a[2],u=!C(s)&&h!==s,d=this.Ua(),v=this.La(),c=this.Ia,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Jn),p=c?_:U(l)&&Math.abs(r-l)>Jn,f=!1,g=u,m=!h||!!c,b=h,w=!m&&!t&&this.Ta(r,d);if(w){(w=this.Wa(r))||Vn.info("cross-tab refresh kept the session alive",{sessionId:h});var y=this.za();h=y[1],l=y[2]}if(m||w||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Ma(),v=this.Ea(),Vn.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.Ia=void 0,f=!0}else v||(v=this.Ea(),f=!0),(g=g||h!==b)&&(Vn.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var S=U(d)&&t&&!p?d:r,E=U(l)?l:(new Date).getTime();this.Da(v),this.qa(h,S,E),t||this.Pa();var T={noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.xa.forEach(t=>t(h,v,T)),{sessionId:h,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}Pa(){this.$a||(clearTimeout(this.Va),this.Va=setTimeout(()=>{if(!this.$a)if(this.Wa((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.wa.emit("forcedIdleReset",{idleSessionId:t})}else this.Pa()},1.1*this.sessionTimeoutMs))}};function Kn(){return(Kn=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 Xn(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 Qn(t,e,i){return Kr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Zn,to="custom",eo="i.posthog.com",io=/^\/static\//,ro=["/s/","/e/","/i/"],so=class{constructor(t){this.Ga={},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("."+eo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ga[this.apiHost]||(this.Ga[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":to),this.Ga[this.apiHost]}Za(t){if(io.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Qa(t){var e=Xr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Ja(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Xr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&ro.some(t=>0===e.indexOf(t))){var a=this.Qa(r);if(a){var h,l=this.apiHost,u=this.Ka;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(this.Ka=u={apiHost:l,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Ka,i=this.Qa(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.Ja(t,e,this.uiHost+e);if("flags"===t)return this.Ja(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Za(e);if(i)return this.Ja(t,e,""+i+e)}if(this.region===to)return this.Ja(t,e,this.apiHost+e);var r=eo+e;switch(t){case"assets":return this.Ja(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Ja(t,e,"https://"+this.region+"."+r)}}},no=de("[Surveys]"),oo={ignoreConditions:!1,ignoreDelay:!1,displayType:Ds.Popover},ao=de("[PostHog ExternalIntegrations]"),ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},lo=class{constructor(t){this._instance=t}Ro(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return ao.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.Ro(ho[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()}}},uo=class{constructor(t,e){this.$=t,this.uo=e,this.Ya=new Map,this.mo=!1}add(t){var e=this;return s(function*(){if(e.mo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ya.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.Ya.set(t.name,t);try{var i=t.setup(e.uo);i&&(yield i)}catch(i){var r=e.Ya.get(t.name)===t;r&&e.Ya.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Xa(t)}})()}getExtension(t){return this.Ya.get(t)}dispose(){if(!this.mo){this.mo=!0;var t=Array.from(this.Ya.values()).reverse();for(var e of(this.Ya.clear(),t))this.Xa(e)}}Xa(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)}}},vo=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)}},co="extensionsRemoteConfig",_o=class{constructor(t){this.instance=t,this.mo=!1,this.$=ue,this.tu=t.eu,this.kv=new vo(t),this.onEvent=t=>Ns(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.mo)return Ns(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.iu.on(co,e);return this.tu&&e(this.tu),Ns(i)},this.nu=new uo(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(we);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.nu.add(t)}getExtension(t){return this.nu.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 Ns(this.instance.su(t))}handleRemoteConfig(t){this.mo||(this.tu=t,this.instance.iu.emit(co,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?Rn(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.mo||(this.mo=!0,this.nu.dispose())}},po={},fo=0,go=()=>{},mo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bo="Surveys module not available",wo="sanitize_properties is deprecated. Use before_send instead",yo="Invalid value for property_denylist config: ",$o=/^[A-Za-z0-9_-]{1,400}$/,xo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,So=["token","distinct_id",Ai],Eo="posthog",To=!En&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),ko=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},Po=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:ar(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:go,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:Vi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:go},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ur,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:ko(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))},Ro=[["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"]],Oo=t=>{var e={};for(var i of Ro){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=ir({},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(yo+t.property_denylist)),n},Io=class{constructor(){this.__forceAllowLocalhost=!1}get ru(){return this.__forceAllowLocalhost}set ru(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Co=(t=class t{ou(t){if(t){var e=this.Ya.indexOf(t);-1!==e&&this.Ya.splice(e,1)}}lu(t,e){return this.ou(t),this.Ya.push(e),null==e.initialize||e.initialize(),e}au(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}uu(){if(!(this.hu||this.config.reuseAnonymousId||this.config.segment||this.au())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.cu||(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.hu=!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)))}}du(){if(!this.au()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.vu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(pr());this.register({distinct_id:i,$device_id:i}),t.set_property(Ei,Gi)}this.fu()}}}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.pu=!1,this.gu=!1,this.webPerformance=new Io,this.mu=!1,this.version=ge.LIB_VERSION,this.yu=new Set,this.bu="",this.iu=new Hn,this.Ya=[],this._u=[],this.cu=!1,this.hu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=qr,this.sentryIntegration=t=>function(t,e){var i=Wr(t,e);return{name:zr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.wu=!1,this.ku=null,this.Su=null,this.xu=null,this.scrollManager=new Wn(this),this.pageViewManager=new Gr(this),this.rateLimiter=new js(this),this.requestRouter=new so(this),this.consent=new Fr(this),this.externalIntegrations=new lo(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!==Eo){var s,n=null!==(s=po[r])&&void 0!==s?s:new t;return n._init(e,i,r),po[r]=n,po[Eo][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=Po(e.defaults),e.debug=this.Cu(e.debug),this.$u=e,this.Tu=[],e.person_profiles?this.Su=e.person_profiles:e.process_person&&(this.Su=e.process_person);var u=Po(e.defaults),d=Oo(e),v=ir({},u,d,{name:r,token:l});O(u.rageclick)&&O(d.rageclick)&&(v.rageclick=ir({},u.rageclick,d.rageclick)),O(u.session_recording)&&O(d.session_recording)&&(v.session_recording=ir({},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:Ss.GZipJS;var c=this.vu();if(this.persistence=new xs(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.bu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Nr.Et()){var _=Nr.Dt(this.bu);P(_)&&_.forEach(t=>{A(t)&&this.yu.add(t)})}else Nr.Lt(this.bu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Iu=new jn(t=>this.Mu(t),this.config.request_queue_config),this.Eu=new zn(this),this.__request_queue=[];var g=this.au();g||(this.sessionManager=new Yn(this),this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Pu()})),this.Ru(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Au(g)},0)):(ue.info("Initializing extensions synchronously"),this.Au(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.cu=!!m&&!M(m),null!=(a=e.bootstrap)&&a.distinctID){var b=e.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Ei);if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===y)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===y)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 x=this.config.get_device_id(pr()),S=e.bootstrap.isIdentifiedID?x:b;this.persistence.set_property(Ei,e.bootstrap.isIdentifiedID?Hi:Gi),this.register({distinct_id:b,$device_id:S})}}if(g)this.register_once({distinct_id:Ci,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(pr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Ei,Gi)}return hr(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),hr(n,"pageshow",()=>{var t;this.pu=!1,this.gu||null==(t=this.Eu)||t.resume()}),e.segment?jr(this,()=>this.Fu()):this.Fu(),R(this.config._onCapture)&&this.config._onCapture!==go&&(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 Kn.apply(this,arguments)}().then(t=>{t&&this.register({[ye]:t})}).catch(go),this}Ou(t){var e=t;return A(e.name)&&R(e.setup)}Du(t,e){this.Ou(t)?e.push(()=>{this.Lu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.Ya.push(t)}Ru(){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.Nu)||o.call(this),this.Nu=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Nu||(this.Nu=this.featureFlags.onReloading(()=>{this.iu.emit("featureFlagsReloading",!0)}),this.Lu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Au(e){var r,s,n,o,a,h,l,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Ya.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.Ya.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ya.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ya.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.Ya.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Du(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Du(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Du(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Ya.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ya.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ya.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ya.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ya.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ya.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ya.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.Ya.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new d.toolbar(this)),d.experiments&&this.Ya.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new d.experiments(this)),this.Ya.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.qu){var t=this.qu;this.qu=void 0,this.Ya.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.ju(v,u)}ju(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.ju(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({[Mi]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Di]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Wl(t){var e;if(!h||!h.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Wl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.qu=t),this.eu=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=x(r.supportedCompression,Ss.GZipJS)?Ss.GZipJS:x(r.supportedCompression,Ss.Base64)?Ss.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Su?this.Su:Vi}),null==(e=this.Bu)||e.handleRemoteConfig(t),this.Ya.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}Fu(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Hu(),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.au())&&this.zu()},1),this.Uu=new Ws(this),this.Uu.load()}Hu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Iu)||t.enable())}_dom_loaded(){this.is_capturing()&&tr(this.__request_queue,t=>this.Mu(t)),this.__request_queue=[],this.Hu()}_handle_unload(){var t,e,i,r,s;this.pu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Wu()&&this.capture(Xi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Iu)||r.unload(),null==(s=this.Eu)||s.unload()):this.Wu()&&this.capture(Xi,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?To?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,h,l,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(n.compression)&&n.data&&(n.compression=Ss.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(l=(P(o=n.data)?o:[o]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(h=u.properties)?void 0:h.token)&&void 0!==a?a:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.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})}(n.data))),n.url=Bn(n.url,n.method,n.compression,n.timestampMode);var v=Ln.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),_=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!_)throw new Error("No available transport method");var p=t=>{try{_(t)}catch(t){Dn(t)?ue.warn(t):ue.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ss.GZipJS&&c&&"undefined"!=typeof Promise&&!kn?An(n).then(t=>{p(t)}).catch(e=>{if(ne(e))return kn=!0,void p(i({},n,{compression:void 0,url:Bn(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)&&(kn=!0),p(n)}):_(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Mu(t){this.Eu?this.Eu.retriableRequest(t):this._send_request(t)}_execute_array(t){fo++;try{var e,i=[],r=[],s=[];tr(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){tr(t,function(t){try{if(P(t[0])){var i=e;er(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{fo--}}push(e){if(fo>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])}Vu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(Ee);return A(e)&&xo.test(e)?{value:e,delivered:!1}:O(e)&&A(e.value)&&xo.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Gu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(Ee);var s=this.Vu();if(!r){if(i)return A(e)&&xo.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[Ee]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ee);if(A(t)&&$o.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ee]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ee)}}Zu(t){if(this.persistence){this.persistence.refreshKey(Ee);var e=this.Vu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[Ee]:{value:t,delivered:!0}})}}capture(t,e,r){var s,n,o,a,h,l,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Iu){if(this.is_capturing())if(!C(t)&&A(t)){this.du();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var p=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var f;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&&(f=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 g=new Date,m=(null==r?void 0:r.timestamp)||g,b=Xt(null==r?void 0:r.uuid,pr),w={uuid:b,event:t,properties:this.calculateEventProperties(t,e||{},m,b)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&_&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),p&&(w.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var y="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!y&&(w.$set=null==r?void 0:r.$set);var x=O(null==e?void 0:e.$set)?e.$set:void 0,S=!(null==r||!r.$set)&&"$fbc"in r.$set,E=S||!!x&&"$fbc"in x,T=S?null==r||null==(s=r.$set)?void 0:s[Se]:null==x?void 0:x[Se],k=P(null==e?void 0:e.$unset)?e.$unset:[],R=(null==r?void 0:r.$unset)||[],M=-1!==k.indexOf("$fbc")||-1!==R.indexOf("$fbc"),D=this.Gu(null==(n=f)?void 0:n.fbclid,T,E,M);D&&!0===w.properties.$process_person_profile&&D.pending&&!E&&!y&&(w.$set=i({[Se]:D.value},w.$set));var F=null==r?void 0:r.$unset;F&&(w.$unset=F);var U=y?void 0:this.Ju(null==r?void 0:r.$set_once,t!==Zi,t===Qi);if(U&&(w.$set_once=U),null!=r&&r._noTruncate||(u=this.config.properties_string_max_length,d=w,v=t=>A(t)?t.slice(0,u):t,c=new Set,w=function t(e,i){if(e!==Object(e))return v?v(e):e;if(!c.has(e)){var r;if(c.add(e),P(e))r=[],tr(e,e=>{r.push(t(e))});else{var s={};er(z(e)?nr(e):e,(e,i)=>{c.has(e)||(s[i]=t(e,i))}),r=s}return r}}(d)),w.timestamp=m,C(null==r?void 0:r.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=g),y&&(w.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}(w.properties,So)),t===As.DISMISSED||t===As.SENT){var B=null==e?void 0:e[Ms.SURVEY_ID],L=null==e?void 0:e[Ms.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){no.error("Failed to persist survey seen state",t)}})({id:B,current_iteration:L}),w.$set=i({},w.$set,{[Xn({id:B,current_iteration:L},t===As.SENT?"responded":"dismissed")]:!0})}else t===As.SHOWN&&(w.$set=i({},w.$set,{[Ms.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Us.SHOWN){var j=null==e?void 0:e[Bs.TOUR_TYPE];j&&(w.$set=i({},w.$set,{[Bs.TOUR_LAST_SEEN_DATE+"/"+j]:(new Date).toISOString()}))}var W=i({},w.properties.$set,w.$set);if(I(W)||this.setPersonPropertiesForFlags(W),!N(this.config.before_send)){var q=this.$s(w);if(!q)return;(w=q).uuid=Xt(w.uuid,pr)}var G=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:O(null==(h=w.properties)?void 0:h.$set)?w.properties.$set.$fbc:void 0,H=null!=D&&D.pending&&G===D.value?D.value:void 0;this.iu.emit("eventCaptured",w);var V,J=null!==(l=null==r?void 0:r._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Y=i({method:"POST",url:J,data:w,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(J)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},H?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Zu(H)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||H?(!Y.transport&&!Y.callback&&I(null!==(V=this.config.request_headers)&&void 0!==V?V:{})&&this.pu&&(Y.transport="sendBeacon"),this.Mu(Y)):this.Iu.enqueue(Y),w}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.Bu)?void 0:e.getExtension(t)}Lu(){var t;return null!==(t=this.Bu)&&void 0!==t?t:this.Bu=new _o(this)}su(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)}}}Ku(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.xu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.yu.clear(),this.Yu()),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.Ku();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.au()&&(u[Ai]=!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?[...ts,...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;Yt.length>e;e++){var i,r=Yt[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],w=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},y={};C(i)||(y.detectGoogleSearchApp=i);var x={},S=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(S)||(x.userAgentDataPlatform=S),C(E)||(x.maxTouchPoints=E),C(T)||(x.screenWidth=T),C(k)||(x.screenHeight=k),C(P)||(x.devicePixelRatio=P);var O,I,A,M,D,N,F,U,B=ir(sr({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,w,y),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(I=_,A=x,U=Vt(I),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===wt?"Console":U===tt?"Wearable":U?Y:"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!==(D=null==A?void 0:A.screenWidth)&&void 0!==D?D:0,null!==(N=null==A?void 0:A.screenHeight)&&void 0!==N?N:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?Y:X:"Desktop"),$timezone:ds(),$timezone_offset:vs()}),{$current_url:Zr(r?Zt(null==l?void 0:l.href):null==l?void 0:l.href,d,is),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:Gt(_,navigator.vendor,w,y),$browser_language:os(),$browser_language_prefix:(O=os(),"string"==typeof O?O.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&&ir(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ir(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Eu)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===to&&(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=ir(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 w=this.persistence.properties(),y=this.sessionPersistence.properties(),x=u.$groups,S=w.$groups;O(x)&&!I(x)&&(u.$groups=i({},O(S)?S:{},x)),er(["$referrer","$referring_domain"],t=>{t in w&&delete y[t]});var E={};if(this._u.length>0)for(var T of this._u.slice())try{ir(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=ir({},c,w,y,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?er(this.config.property_denylist,function(t){delete u[t]}):ue.error(yo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(wo),u=k(u,t));var D=this.Xu();return u.$process_person_profile=D,D&&!o&&this.th("_calculate_event_properties"),u}Ju(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Xu())return t;if(this.mu&&!i)return t;var s=ir({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(wo),s=n(s,"$set_once")),e&&(this.mu=!0),I(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.Ku(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.yu.add(t)),this.Yu()}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.yu.delete(t),this.Yu()}eh(t,e){this.register({[t]:e})}Pu(){this.yu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.yu.clear(),this.Yu()}Yu(){var t;if(this.bu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Nr.Et())Nr.Lt(this.bu);else{var e=[];this.yu.forEach(t=>e.push(t)),e.length>0?Nr.At(this.bu,e):Nr.Lt(this.bu)}}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.iu.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:bo}),()=>{})}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:bo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:bo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=oo),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:bo}}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:bo})}ih(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.ih(t)&&this.th("posthog.identify")){this.du();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Ku(!1),o=this.persistence.Cl(),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")===Gi,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(Ei,Hi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.$l(),this.capture(Qi,c,{$set:e||{},$set_once:i||{}}),this.xu=Qn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(Ei,Hi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.$l(),this.capture("$set",{$set:_,$set_once:p}),this.xu=Qn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(yi)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ml(a)}}}setPersonProperties(t,e){if((t||e)&&this.th("posthog.setPersonProperties")){var i=Qn(this.get_distinct_id(),t,e);this.xu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.xu=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.th("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.xu=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.Ku();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.Xu()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(Zi,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.th("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.nh(e,!1,i)}nh(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.$u)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var l=this.get_property(we),u=this.get_property(ye),d=this.get_property(Fe);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.Cl?void 0:a.Cl(),_=!1;try{var p,f,g,m,b,w,y,x,S,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.yu.clear(),this.Yu(),C(d)||null==(g=this.persistence)||g.register({[Fe]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Ei,Gi),null==(E=this.sessionManager)||E.resetSessionId(),this.xu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ci,$device_id:null},"");else{var R=this.config.get_device_id(pr());this.register_once({distinct_id:R,$device_id:t?R:l},""),t||C(u)||this.register({[ye]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.au()&&(null==(P=this.persistence)||P.set_property(Ei,r.isIdentifiedID?Hi:Gi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(N(h)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(h,!0))){var O=i({},r);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var I;c&&(null==(I=this.persistence)||null==I.Ml||I.Ml(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.gu=!0,e.Lu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Iu)||s.unload(),null==(n=e.Eu)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.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.th("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.eh($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(O(t)){var r,s,n,o,a,h,l,u,d,v,c,_,p;ir(this.config,Oo(t));var f=this.vu();null==(r=this.persistence)||r.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.Cu(this.config.debug);B(g)&&(this.config.debug=g),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,$r.Et()&&$r.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,$r.Et()&&$r.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.sessionRecording)||a.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this.fu(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&jr(this,go,!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.oh}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:Eo;return e!==Eo&&(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"))}Xu(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Wu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Xu()||this.th("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.th("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}th(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.uu(),this.eh(Ii,!0),!0)}vu(){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)}fu(){var t,e,i,r,s,n=this.vu();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.yu.clear(),this.Yu()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.au()){var n,o,a,h,l,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.nh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Yn(this),this.pageViewManager=new Gr(this),this.persistence&&(this.sessionPropsManager=new Gn(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.lu(this.sessionRecording,new v(this)),this.eu&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.eu)))}this.consent.optInOut(!0),this.fu(),this.Hu(),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.zu()}else ue.warn(mo)}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.nh(!0,!0),this.consent.optInOut(!1),this.fu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ci,$device_id:null}),this.ou(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.zu(),this.Hu())}else ue.warn(mo)}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.fu()}_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}zu(){h&&("visible"===h.visibilityState?this.wu||(this.wu=!0,this.capture(Ki,{title:h.title},{send_instantly:!0}),this.ku&&(h.removeEventListener(Ji,this.ku),this.ku=null)):this.ku||(this.ku=this.zu.bind(this),hr(h,Ji,this.ku)))}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.$u||{};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&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,ue)}$s(t){var e;if(N(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),N(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&&!I(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&&N(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.Oo)?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)})}Cu(t){var e=B(t)&&!t,i=$r.Et()&&"true"===$r.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t.oh={trace:Zn=()=>{},debug:Zn,info:Zn,warn:Zn,error:Zn,fatal:Zn},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=rr(t.prototype[e[i]])}(Co,["identify"]);var Ao=function(){ge.SDK_DIST_CHANNEL="npm";var t=po[Eo]=new Co;return function(){function t(){t.done||(t.done=!0,To=!1,er(po,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():hr(h,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ss as Compression,Fs as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ds as DisplaySurveyType,Co as PostHog,Us as ProductTourEventName,Bs as ProductTourEventProperties,As as SurveyEventName,Ms as SurveyEventProperties,Es as SurveyEventType,ks as SurveyPosition,Is as SurveyQuestionBranchingType,Os as SurveyQuestionType,Cs as SurveySchedule,Ps as SurveyTabPosition,Rs as SurveyType,Ts as SurveyWidgetType,Ao as default,Ao as posthog,qs as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.js.map
|