@skill-map/cli 0.67.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/cli/tutorial/sm-tutorial/SKILL.md +16 -8
  2. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/agents-hub/providers/agent-skills/en/agents-hub.md +2 -0
  3. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/agents-hub/providers/agent-skills/es/agents-hub.md +2 -0
  4. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/content-editor-style/providers/agent-skills/en/content-editor-style.md +1 -0
  5. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/content-editor-style/providers/agent-skills/es/content-editor-style.md +1 -0
  6. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/en/todo-bullet-guideline.md +1 -0
  7. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/en/todo-bullet-guideline2.md +1 -0
  8. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/en/todo-bullet-skill.md +1 -0
  9. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/es/todo-bullet-guideline.md +1 -0
  10. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/es/todo-bullet-guideline2.md +1 -0
  11. package/dist/cli/tutorial/sm-tutorial/fixtures-data/edits/todo-connectors/providers/agent-skills/es/todo-bullet-skill.md +1 -0
  12. package/dist/cli/tutorial/sm-tutorial/fixtures-data/manifest.json +9 -1
  13. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/harness/providers/agent-skills/en/__PROVIDER__/skills/publish/SKILL.md +15 -0
  14. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/harness/providers/agent-skills/es/__PROVIDER__/skills/publish/SKILL.md +16 -0
  15. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/harness/providers/codex/en/__PROVIDER__/skills/publish/SKILL.md +15 -0
  16. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/harness/providers/codex/es/__PROVIDER__/skills/publish/SKILL.md +16 -0
  17. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/master/providers/agent-skills/en/__PROVIDER__/skills/master-agent/SKILL.md +13 -0
  18. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/master/providers/agent-skills/es/__PROVIDER__/skills/master-agent/SKILL.md +14 -0
  19. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/master/providers/codex/en/.codex/agents/master-agent.toml +10 -0
  20. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/master/providers/codex/es/.codex/agents/master-agent.toml +10 -0
  21. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/agent-skills/en/AGENTS.md +7 -0
  22. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/agent-skills/en/__PROVIDER__/skills/content-editor/SKILL.md +20 -0
  23. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/agent-skills/es/AGENTS.md +7 -0
  24. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/agent-skills/es/__PROVIDER__/skills/content-editor/SKILL.md +20 -0
  25. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/agent-skills/shared/CLAUDE.md +1 -0
  26. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/codex/en/.codex/agents/content-editor.toml +19 -0
  27. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/portfolio/providers/codex/es/.codex/agents/content-editor.toml +19 -0
  28. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/prologue/providers/codex/en/.codex/agents/demo-agent.toml +13 -0
  29. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/prologue/providers/codex/en/__PROVIDER__/skills/demo-command/SKILL.md +11 -0
  30. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/prologue/providers/codex/es/.codex/agents/demo-agent.toml +13 -0
  31. package/dist/cli/tutorial/sm-tutorial/fixtures-data/sets/prologue/providers/codex/es/__PROVIDER__/skills/demo-command/SKILL.md +12 -0
  32. package/dist/cli/tutorial/sm-tutorial/references/_core.md +101 -48
  33. package/dist/cli/tutorial/sm-tutorial/references/_manifest.json +174 -0
  34. package/dist/cli/tutorial/sm-tutorial/references/_manifest.yml +90 -0
  35. package/dist/cli/tutorial/sm-tutorial/references/part-basic-connect.md +166 -0
  36. package/dist/cli/tutorial/sm-tutorial/references/part-basic-daily.md +267 -0
  37. package/dist/cli/tutorial/sm-tutorial/references/part-basic-fundamentals.md +350 -0
  38. package/dist/cli/tutorial/sm-tutorial/references/part-basic-kickoff.md +140 -0
  39. package/dist/cli/tutorial/sm-tutorial/references/part-connect-harness.md +6 -4
  40. package/dist/cli/tutorial/sm-tutorial/references/part-daily-loop.md +21 -26
  41. package/dist/cli/tutorial/sm-tutorial/references/part-fundamentals.md +10 -5
  42. package/dist/cli/tutorial/sm-tutorial/references/part-mcp.md +3 -6
  43. package/dist/cli/tutorial/sm-tutorial/references/part-project-kickoff.md +29 -14
  44. package/dist/cli/tutorial/sm-tutorial/references/part-settings.md +17 -13
  45. package/dist/cli/tutorial/sm-tutorial/scripts/fixtures.js +85 -22
  46. package/dist/cli/tutorial/sm-tutorial/scripts/lib/paths.js +74 -4
  47. package/dist/cli/tutorial/sm-tutorial/scripts/state.js +22 -6
  48. package/dist/cli.js +400 -160
  49. package/dist/conformance/index.js +42 -2
  50. package/dist/index.js +43 -30
  51. package/dist/kernel/index.d.ts +28 -5
  52. package/dist/kernel/index.js +43 -30
  53. package/dist/ui/chunk-3ANNEMV4.js +499 -0
  54. package/dist/ui/chunk-3GDWM5VM.js +2 -0
  55. package/dist/ui/{chunk-5BJGO7GH.js → chunk-3U4QZKU2.js} +4 -4
  56. package/dist/ui/chunk-3ZAHOYQ7.js +1 -0
  57. package/dist/ui/chunk-4F53HBGG.js +1845 -0
  58. package/dist/ui/{chunk-56CBK7LB.js → chunk-6FGV5O5J.js} +1 -1
  59. package/dist/ui/chunk-7WMT2LX4.js +1 -0
  60. package/dist/ui/chunk-BJUBDHJR.js +3 -0
  61. package/dist/ui/{chunk-276RLZR4.js → chunk-BSIR3ADF.js} +14 -14
  62. package/dist/ui/{chunk-FC22ZJQZ.js → chunk-CG25RHMO.js} +1 -1
  63. package/dist/ui/chunk-EFSC6SOL.js +3 -0
  64. package/dist/ui/chunk-EJVWTBMV.js +4 -0
  65. package/dist/ui/chunk-EZI3BXQN.js +1 -0
  66. package/dist/ui/{chunk-JZ2YF7EL.js → chunk-GUPPOK7U.js} +8 -8
  67. package/dist/ui/{chunk-CJURGJTN.js → chunk-HLALESGR.js} +1 -1
  68. package/dist/ui/chunk-I3I4KHR5.js +2 -0
  69. package/dist/ui/{chunk-BOVJVOLH.js → chunk-I6ED2OW7.js} +1 -1
  70. package/dist/ui/chunk-JKPG5PO7.js +375 -0
  71. package/dist/ui/chunk-KHDWXSGR.js +1 -0
  72. package/dist/ui/{chunk-HEK4PH5A.js → chunk-KMHXNOFZ.js} +1 -1
  73. package/dist/ui/chunk-KWT7E2RJ.js +16 -0
  74. package/dist/ui/{chunk-WHZVGOS3.js → chunk-MQSU6EFZ.js} +1 -1
  75. package/dist/ui/{chunk-43S72FTV.js → chunk-OGEE252A.js} +1 -1
  76. package/dist/ui/{chunk-J4J42HJ4.js → chunk-PU5OP5RN.js} +1 -1
  77. package/dist/ui/{chunk-UTRZTB6V.js → chunk-QVG7J2MP.js} +1 -1
  78. package/dist/ui/chunk-TQBXK5JN.js +1 -0
  79. package/dist/ui/chunk-Z7SOKILO.js +2 -0
  80. package/dist/ui/{chunk-WCABR6TI.js → chunk-ZRJ5ZCFR.js} +1 -1
  81. package/dist/ui/index.html +2 -2
  82. package/dist/ui/main-ZYRIR6DB.js +4 -0
  83. package/dist/ui/styles-VEGETYWD.css +1 -0
  84. package/package.json +17 -18
  85. package/dist/ui/chunk-34ZZDYNQ.js +0 -1
  86. package/dist/ui/chunk-444BFYGR.js +0 -3
  87. package/dist/ui/chunk-44VNNUSQ.js +0 -2
  88. package/dist/ui/chunk-4SG4352Z.js +0 -7
  89. package/dist/ui/chunk-5ITZXW3A.js +0 -1
  90. package/dist/ui/chunk-7ANZW2OI.js +0 -499
  91. package/dist/ui/chunk-BJ6X6WBO.js +0 -4
  92. package/dist/ui/chunk-CZSLV6YD.js +0 -1
  93. package/dist/ui/chunk-DLYJHLJX.js +0 -2
  94. package/dist/ui/chunk-LGFABCIA.js +0 -16
  95. package/dist/ui/chunk-LPDD2DHE.js +0 -369
  96. package/dist/ui/chunk-P3SNMV4X.js +0 -2
  97. package/dist/ui/chunk-S4S5ZMXJ.js +0 -3
  98. package/dist/ui/chunk-VHEFRMK3.js +0 -1
  99. package/dist/ui/chunk-X6TRIDBI.js +0 -1845
  100. package/dist/ui/main-V77F2KZX.js +0 -4
  101. package/dist/ui/styles-I4ULXD3V.css +0 -1
  102. /package/dist/ui/{chunk-Y2Z26SRI.js → chunk-5RNLC6V4.js} +0 -0
@@ -1 +1 @@
1
- import{$b as s,Ab as o,Bb as a,Ja as i,Za as r,ac as l}from"./chunk-BJ6X6WBO.js";import"./chunk-WCABR6TI.js";var n={triggering:"Triggering an intentional uncaught error to exercise UI Sentry error reporting...",errorMessage:"skill-map UI intentional failure (Sentry self-test)"};var d=(()=>{class e{texts=n;ngOnInit(){console.warn(n.triggering),setTimeout(()=>{throw new Error(n.errorMessage)},0)}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=r({type:e,selectors:[["sm-intentional-fail"]],decls:2,vars:1,consts:[["data-testid","intentional-fail",1,"sm-intentional-fail"]],template:function(t,c){t&1&&(o(0,"p",0),s(1),a()),t&2&&(i(),l(c.texts.triggering))},encapsulation:2,changeDetection:0})}return e})();export{d as IntentionalFail};
1
+ import{$b as s,Ab as o,Bb as a,Ja as i,Za as r,ac as l}from"./chunk-EJVWTBMV.js";import"./chunk-ZRJ5ZCFR.js";var n={triggering:"Triggering an intentional uncaught error to exercise UI Sentry error reporting...",errorMessage:"skill-map UI intentional failure (Sentry self-test)"};var d=(()=>{class e{texts=n;ngOnInit(){console.warn(n.triggering),setTimeout(()=>{throw new Error(n.errorMessage)},0)}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=r({type:e,selectors:[["sm-intentional-fail"]],decls:2,vars:1,consts:[["data-testid","intentional-fail",1,"sm-intentional-fail"]],template:function(t,c){t&1&&(o(0,"p",0),s(1),a()),t&2&&(i(),l(c.texts.triggering))},encapsulation:2,changeDetection:0})}return e})();export{d as IntentionalFail};
@@ -0,0 +1,2 @@
1
+ import"./chunk-ZRJ5ZCFR.js";var v=typeof window<"u"?window:void 0,ie=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(ie.self=ie),typeof File>"u"&&(ie.File=function(){});var _e=ie?.navigator,x=ie?.document,te=ie?.location,mr=ie?.fetch,yr=ie!=null&&ie.XMLHttpRequest&&"withCredentials"in new ie.XMLHttpRequest?ie.XMLHttpRequest:void 0,Ys=ie?.AbortController,ba=ie?.CompressionStream,ve=_e?.userAgent,I=v??{},Zs="1.393.5",ee={DEBUG:!1,LIB_VERSION:Zs,LIB_NAME:"web",JS_SDK_VERSION:Zs};function en(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(c){return void i(c)}a.done?e(l):Promise.resolve(l).then(r,s)}function se(t){return function(){var e=this,i=arguments;return new Promise(function(r,s){var n=t.apply(e,i);function o(l){en(n,r,s,o,a,"next",l)}function a(l){en(n,r,s,o,a,"throw",l)}o(void 0)})}}function m(){return m=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},m.apply(null,arguments)}function Gn(t,e){if(t==null)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;i[r]=t[r]}return i}var wa=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Ea(t){return typeof t=="string"||t}function xa(t){return typeof t=="string"?t:void 0}var kt,Ae=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),tn=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),Sa=["$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"],ka=["token"],Jn="NativeGzipValidationError",br=t=>t.length>=2&&t[0]===31&&t[1]===139,rn=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",ii=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Jn,e},Pa=(function(){var t=se(function*(e,i){18>e.size&&ii("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());br(r)&&r[2]===8||ii("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(kt)return kt;kt=[];for(var u=0;256>u;u++){for(var h=u,p=0;8>p;p++)h=1&h?3988292384^h>>>1:h>>>1;kt[u]=h>>>0}return kt})(),l=4294967295,c=0;o.length>c;c++)l=a[255&(l^o[c])]^l>>>8;return(4294967295^l)>>>0})(i)&&ii("invalid-crc");var n=i.length>>>0;s.getUint32(4,!0)!==n&&ii("invalid-size")});return function(e,i){return t.apply(this,arguments)}})();function wr(){return wr=se(function*(t,e,i){e===void 0&&(e=!0);try{var r=new TextEncoder().encode(t),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then(()=>n.close()).catch((function(){var c=se(function*(u){try{yield n.abort(u)}catch{}throw u});return function(u){return c.apply(this,arguments)}})()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield Pa(l,r),l}catch(c){if(i!=null&&i.rethrow)throw c;return e&&console.error("Failed to gzip compress data",c),null}}),wr.apply(this,arguments)}var Ta=["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","pinterest","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"],sn=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var i=t.toLowerCase();return Ta.concat(e).some(r=>{var s=r.toLowerCase();return i.indexOf(s)!==-1})};function C(t,e){return t.indexOf(e)!==-1}var Bi=function(t){return t.trim()},Er=function(t){return t.replace(/^\$/,"")},Xn=Object.prototype,Kn=Xn.hasOwnProperty,Vi=Xn.toString,N=Array.isArray||function(t){return Vi.call(t)==="[object Array]"},Le=t=>typeof t=="function",X=t=>t===Object(t)&&!N(t),ze=t=>{if(X(t)){for(var e in t)if(Kn.call(t,e))return!1;return!0}return!1},b=t=>t===void 0,G=t=>Vi.call(t)=="[object String]",xr=t=>G(t)&&t.trim().length===0,ce=t=>t===null,L=t=>b(t)||ce(t),he=t=>Vi.call(t)=="[object Number]"&&t==t,Ce=t=>he(t)&&t>0,Fe=t=>Vi.call(t)==="[object Boolean]",Ra=t=>t instanceof FormData,Fa=t=>C(Sa,t),$a=t=>C(ka,t);function Qn(t){return t===null||typeof t!="object"}function fi(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Cs(t){return typeof Event<"u"&&(function(e,i){try{return e instanceof i}catch{return!1}})(t,Event)}var Ia=[!0,"true",1,"1","yes"],Ji=t=>C(Ia,t),Oa=[!1,"false",0,"0","no"];function Re(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),he(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),Re(s||i,e,i,r))}var Sr=class{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=Re(e.bucketSize,0,100,e.Ae),this.$e=Re(e.refillRate,0,this.Fe,e.Ae),this.De=Re(e.refillInterval,0,864e5,e.Ae)}Ne(e,i){var r=Math.floor((i-e.lastAccess)/this.De);r>0&&(e.tokens=Math.min(e.tokens+r*this.$e,this.Fe),e.lastAccess=e.lastAccess+r*this.De)}consumeRateLimit(e){var i,r=Date.now(),s=String(e),n=this.Ee[s];return n?this.Ne(n,r):this.Ee[s]=n={tokens:this.Fe,lastAccess:r},n.tokens===0||(n.tokens--,n.tokens===0&&((i=this.Pe)==null||i.call(this,e)),n.tokens===0)}stop(){this.Ee={}}},me="Mobile",mi="iOS",je="Android",bt="Tablet",Yn=je+" "+bt,Zn="iPad",eo="Apple",to=eo+" Watch",jt="Safari",wt="BlackBerry",io="Samsung",ro=io+"Browser",so=io+" Internet",nt="Chrome",Ca=nt+" OS",no=nt+" "+mi,Ms="Internet Explorer",oo=Ms+" "+me,As="Opera",Ma=As+" Mini",Ls="Edge",ao="Microsoft "+Ls,mt="Firefox",lo=mt+" "+mi,Gt="Nintendo",Jt="PlayStation",yt="Xbox",uo=je+" "+me,co=me+" "+jt,At="Windows",kr=At+" Phone",nn="Nokia",Pr="Ouya",ho="Generic",Aa=ho+" "+me.toLowerCase(),po=ho+" "+bt.toLowerCase(),Tr="Konqueror",vo="Oculus Browser",yi="Vivaldi",go="Yandex",bi="Whale",Rr="DuckDuckGo",_o="Pale Moon",wi="Waterfox",Ht="Brave",fo="Google Search App",K="(\\d+(\\.\\d+)?)",Xi=new RegExp("Version/"+K),La=new RegExp(yt,"i"),Da=new RegExp(Jt+" \\w+","i"),Na=new RegExp(Gt+" \\w+","i"),Ds=new RegExp(wt+"|PlayBook|BB10","i"),Ua={"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"},mo=function(t,e,i,r){e=e||"";var s=(function(n){return n!=null&&n.brave?Ht:null})(i);return s||(r!=null&&r.detectGoogleSearchApp&&C(t,"GSA/")?fo:C(t," OPR/")&&C(t,"Mini")?Ma:C(t," OPR/")?As:Ds.test(t)?wt:C(t,"IE"+me)||C(t,"WPDesktop")?oo:C(t,"OculusBrowser")?vo:C(t,ro)?so:C(t,Ls)||C(t,"Edg/")?ao:C(t,yi+"/")?yi:C(t,"YaBrowser/")?go:C(t,bi+"/")?bi:C(t,Rr+"/")||C(t,"Ddg/")?Rr:C(t,"FBIOS")?"Facebook "+me:C(t,"UCWEB")||C(t,"UCBrowser")?"UC Browser":C(t,"CriOS")?no:C(t,"CrMo")||C(t,nt)?nt:C(t,je)&&C(t,jt)?uo:C(t,"FxiOS")?lo:C(t.toLowerCase(),Tr.toLowerCase())?Tr:C(t,Ht+"/")?Ht:((n,o)=>o&&C(o,eo)||(function(a){return C(a,jt)&&!C(a,nt)&&!C(a,je)})(n))(t,e)?C(t,me)?co:jt:C(t,"PaleMoon/")?_o:C(t,wi+"/")?wi:C(t,mt)?mt:C(t,"MSIE")||C(t,"Trident/")?Ms:C(t,"Gecko")?mt:"")},ja={[oo]:[new RegExp("rv:"+K)],[ao]:[new RegExp(Ls+"?\\/"+K)],[nt]:[new RegExp("("+nt+"|CrMo)\\/"+K)],[no]:[new RegExp("CriOS\\/"+K)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+K)],[jt]:[Xi],[co]:[Xi],[As]:[new RegExp("(Opera|OPR)\\/"+K)],[mt]:[new RegExp(mt+"\\/"+K)],[lo]:[new RegExp("FxiOS\\/"+K)],[Tr]:[new RegExp("Konqueror[:/]?"+K,"i")],[wt]:[new RegExp(wt+" "+K),Xi],[uo]:[new RegExp("android\\s"+K,"i")],[so]:[new RegExp(ro+"\\/"+K)],[vo]:[new RegExp("OculusBrowser\\/"+K)],[yi]:[new RegExp(yi+"\\/"+K)],[go]:[new RegExp("YaBrowser\\/"+K)],[bi]:[new RegExp(bi+"\\/"+K)],[Ht]:[new RegExp(Ht+"\\/"+K)],[Rr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+K)],[_o]:[new RegExp("PaleMoon\\/"+K)],[wi]:[new RegExp(wi+"\\/"+K)],[fo]:[new RegExp("GSA\\/"+K)],[Ms]:[new RegExp("(rv:|MSIE )"+K)],Mozilla:[new RegExp("rv:"+K)]},Ha=function(t,e,i,r){var s=mo(t,e,i,r),n=ja[s];if(b(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},on=[[new RegExp(yt+"; "+yt+" (.*?)[);]","i"),t=>[yt,t&&t[1]||""]],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Jt,"i"),[Jt,""]],[Ds,[wt,""]],[new RegExp(At,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[kr,""];if(new RegExp(me).test(e)&&!/IEMobile\b/.test(e))return[At+" "+me,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ua[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[At,r]}return[At,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[mi,[t[3],t[4],t[5]||"0"].join(".")]:[mi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=b(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+je+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+je+")","i"),t=>t&&t[2]?[je,[t[2],t[3],t[4]||"0"].join(".")]:[je,""]],[/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/,[Ca,""]],[/Linux|debian/i,["Linux",""]]],an=function(t){return Na.test(t)?Gt:Da.test(t)?Jt:La.test(t)?yt:new RegExp(Pr,"i").test(t)?Pr:new RegExp("("+kr+"|WPDesktop)","i").test(t)?kr:/iPad/.test(t)?Zn:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?to:Ds.test(t)?wt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(nn,"i").test(t)?nn:/(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(me).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)?je:Yn:new RegExp("(pda|"+me+")","i").test(t)?Aa:new RegExp(bt,"i").test(t)&&!new RegExp(bt+" pc","i").test(t)?po:""},qa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return typeof(i=t)=="string"&&qa.test(i)?t:e();var i}function We(t){return t&&t.split("#")[0]}function Ki(t,e){var i=setTimeout(t,e);return i?.unref&&i?.unref(),i}var Ba=t=>t instanceof Error,yo={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Va=yo.info;function bo(t){if(Fe(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(N(t))return{arrayValue:{values:t.map(e=>bo(e))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function wo(t){var e=[];for(var i in t){var r=t[i];ce(r)||b(r)||e.push({key:i,value:bo(r)})}return e}function za(t,e){var i=t.level||"info",{text:r,number:s}=yo[i]||Va,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),L(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),L(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=m({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:wo(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),b(t.trace_flags)||(l.flags=t.trace_flags),l}function Eo(t,e,i){return m({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}function xo(t,e,i,r){return{resourceLogs:[{resource:{attributes:wo(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}var Wa=class{constructor(t,e,i,r,s,n,o){var a;n===void 0&&(n=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=i,this.qe=r,this.Be=s,this.je=n,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.Ye=e.flushIntervalMs,this.Ke=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.it(t);if(e!==null)if(e.body){if(this.nt()){var i={record:za(e,this.qe())};this.Be(()=>this.st(i))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var i=N(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;r=n}catch(o){return this.Ae.error("Error in beforeSend function for log:",o),null}return r}nt(){if(this.et===void 0)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return se(function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally(()=>{t.Ue=null})),t.Ue})()}ot(){var t=this;return se(function*(){var e;t.tt();var i=(e=t._instance.getPersistedProperty(Ae.LogsQueue))!==null&&e!==void 0?e:[];if(i.length!==0)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ze=0;var a=Math.min(i.length,t.Ke),l=i.slice(0,a),c=xo(l.map(h=>h.record),t.ut(),(n=t.He)!==null&&n!==void 0?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.ht(c);if(u.kind==="too-large"&&l.length>1)t.Ke=Math.max(1,Math.floor(l.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ke);else if(u.kind==="retry-later"||(u.kind==="too-large"?t.Ae.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&t.Se.maxBatchRecordsPerPost>t.Ke&&(t.Ke=Math.min(t.Se.maxBatchRecordsPerPost,t.Ke+1)),yield t.dt(l.length),i=(o=t._instance.getPersistedProperty(Ae.LogsQueue))!==null&&o!==void 0?o:[],s+=l.length,u.kind==="fatal"))throw u.error}})()}dt(t){var e=this;return se(function*(){var i,r=Math.max(0,t-e.ze),s=(i=e._instance.getPersistedProperty(Ae.LogsQueue))!==null&&i!==void 0?i:[];e._instance.setPersistedProperty(Ae.LogsQueue,s.slice(r)),yield e.je()})()}ut(){return Eo(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var i=(e=this._instance.getPersistedProperty(Ae.LogsQueue))!==null&&e!==void 0?e:[];this.Je>i.length||(i.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ae.LogsQueue,i),this.Qe>i.length?this.ct():this.rt()}}ct(t){t===void 0&&(t=this.Ye),this.vt||(this.vt=Ki(()=>{this.vt=void 0,this.rt()},t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(Ae.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return se(function*(){e.tt();var i=e.flush().catch(()=>{});t!==void 0?yield Promise.race([i,new Promise(r=>Ki(r,t))]):yield i})()}flushWithTimeout(t){var e=this;return se(function*(){var i=!1,r=e.flush(),s=new Promise(n=>Ki(()=>{i=!0,n()},t));try{yield Promise.race([r,s])}finally{i&&r.catch(()=>{})}})()}rt(){this.flush().then(()=>{this.Ve=0},t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())})}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}},ri,un,Qi;function Ga(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Qi&&i.length===un||(un=i.length,Qi=i.reduce((r,s)=>{ri||(ri={});var n=ri[s];if(n)r[n[0]]=n[1];else for(var o=t(s),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[s];if(c&&u){r[c]=u,ri[s]=[c,u];break}}return r},{})),Qi}}var Fr=class{constructor(e,i,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=i,this.modifiers=r}buildFromUnknown(e,i){i===void 0&&(i={});var r=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,i,0).apply(e),n=this.buildParsingContext(i),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var i=this;return se(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&N(r.stacktrace.frames)&&(r.stacktrace.frames=yield i.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var i;return{type:"Error",value:"Unknown error",stack:(i=e.syntheticException)==null?void 0:i.stack,synthetic:!0}}parseStacktrace(e,i){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,i)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?i.skipFirstLines:0),i.chunkIdMap)),m({},e,{cause:r,stack:s})}applyChunkIds(e,i){return e.map(r=>(r.filename&&i&&(r.chunk_id=i[r.filename]),r))}applyCoercers(e,i){for(var r of this.coercers)if(r.match(e))return r.coerce(e,i);return this.coerceFallback(i)}applyModifiers(e){var i=this;return se(function*(){var r=e;for(var s of i.modifiers)r=yield s(r);return r})()}convertToExceptionList(e,i){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:(r=i.type)!==null&&r!==void 0?r:"generic",handled:(s=i.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,m({},i,{handled:!0}))),a}buildParsingContext(e){var i;return{chunkIdMap:Ga(this.stackParser),skipFirstLines:(i=e.skipFirstLines)!==null&&i!==void 0?i:1}}buildCoercingContext(e,i,r){r===void 0&&(r=0);var s=(n,o)=>{if(4>=o){var a=this.buildCoercingContext(e,i,o);return this.applyCoercers(n,a)}};return m({},i,{syntheticException:r==0?i.syntheticException:void 0,mechanism:e,apply:n=>s(n,r),next:n=>s(n,r+1)})}},Et="?";function $r(t,e,i,r,s){var n={platform:t,filename:e,function:i==="<anonymous>"?Et:i,in_app:!0};return b(r)||(n.lineno=r),b(s)||(n.colno=s),n}var So=(t,e)=>{var i=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return i||r?[t.indexOf("@")!==-1?t.split("@")[0]:Et,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Ja=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Xa=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ka=/\((\S*)(?::(\d+))(?::(\d+))\)/,Qa=(t,e)=>{var i=Ja.exec(t);if(i){var[,r,s,n]=i;return $r(e,r,Et,+s,+n)}var o=Xa.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Ka.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=So(o[1]||Et,o[2]);return $r(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ya=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Za=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,el=(t,e)=>{var i=Ya.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Za.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||Et;return[n,s]=So(n,s),$r(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},cn=/\(error: (.*)\)/,Ir=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,i){var r=G(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?i.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var i=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?i+": "+e.message:i}isDOMException(e){return fi(e,"DOMException")}isDOMError(e){return fi(e,"DOMError")}},Or=class{match(e){return(i=>i instanceof Error)(e)}coerce(e,i){return{type:this.getType(e),value:this.getMessage(e,i),stack:this.getStack(e),cause:e.cause?i.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,i){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}},Cr=class{constructor(){}match(e){return fi(e,"ErrorEvent")&&e.error!=null}coerce(e,i){var r;return i.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}},tl=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Mr=class{match(e){return typeof e=="string"}coerce(e,i){var r,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var i="Error",r=e,s=e.match(tl);return s&&(i=s[1],r=s[2]),[i,r]}},il=["fatal","error","warning","log","info","debug"];function ko(t,e){e===void 0&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}var Ar=class{match(e){return typeof e=="object"&&e!==null}coerce(e,i){var r,s=this.getErrorPropertyFromObject(e);return s?i.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=i.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Cs(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var i="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(i+=" with message: '"+e.message+"'"),i}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+ko(e)}isSeverityLevel(e){return G(e)&&!xr(e)&&il.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var i in e)if({}.hasOwnProperty.call(e,i)){var r=e[i];if(Ba(r))return r}}getObjectClassName(e){try{var i=Object.getPrototypeOf(e);return i?i.constructor.name:void 0}catch{return}}},Lr=class{match(e){return Cs(e)}coerce(e,i){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+ko(e),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Dr=class{match(e){return Qn(e)}coerce(e,i){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Nr=class{match(e){return fi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Cs(e))return!1;try{var i=e.detail;return i!=null&&typeof i=="object"&&"reason"in i}catch{return!1}}coerce(e,i){var r,s=this.getUnhandledRejectionReason(e);return Qn(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}:i.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Ei="$message",xi="$timestamp",rl=new Set([Ei,xi]),Yi={enabled:!0,max_bytes:32768};function Si(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Yi.enabled,max_bytes:sl(t.max_bytes,Yi.max_bytes)}:m({},Yi)}var Ur=class{constructor(e){this.bt=[],this._t=0,this.Se=Si(e)}setConfig(e){this.Se=Si(e),this.wt()}add(e){var i=(function(s){var n=(function(u){var h=new WeakSet;try{return JSON.stringify(u,(p,d)=>{if(typeof d=="bigint")return d.toString();if(typeof d!="function"&&typeof d!="symbol"){if(d instanceof Date)return d.toISOString();if(d instanceof Error)return{name:d.name,message:d.message,stack:d.stack};if(d&&typeof d=="object"){if(h.has(d))return"[Circular]";h.add(d)}return d}})}catch{return}})(s);if(n)try{var o=JSON.parse(n);if(!X(o))return;var a=o,l=a[Ei],c=a[xi];return!G(l)||l.trim().length===0||!G(c)&&!he(c)?void 0:{step:a,json:n}}catch{return}})(e);if(i){var r=(function(s){if(typeof TextEncoder<"u")return new TextEncoder().encode(s).length;for(var n=encodeURIComponent(s),o=0,a=0;n.length>a;a++)n[a]==="%"?(o+=1,a+=2):o+=1;return o})(i.json);r>this.Se.max_bytes||(this.bt.push({step:i.step,bytes:r}),this._t+=r,this.wt())}}getAttachable(){return this.bt.map(e=>e.step)}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var e=this.bt.shift();e&&(this._t-=e.bytes)}}};function sl(t,e){if(!he(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Po=function(t,e){var{debugEnabled:i}=e===void 0?{}:e,r={k(s){if(v&&(ee.DEBUG||I.POSTHOG_DEBUG||i)&&!b(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];n(t,...a)}},debug(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.k("debug",...n)},info(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.k("log",...n)},warn(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.k("warn",...n)},error(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.k("error",...n)},critical(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];console.error(t,...n)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Po(t+" "+s,n)};return r},E=Po("[PostHog.js]"),Q=E.createLogger,nl=Q("[ExternalScriptsLoader]"),Zi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return nl.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=x?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:i()}:(l.addEventListener("load",c=>{l.__posthog_loading_callback_fired=!0,i(void 0,c)}),l.onerror=c=>i(c),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v}var a=()=>{if(!x)return i("document not found");var l=x.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,i(void 0,h)},l.onerror=h=>i(h),t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return i("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")x.head.appendChild(l);else{var c,u=x.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):x.body.appendChild(l)}};x!=null&&x.body?a():x?.addEventListener("DOMContentLoaded",a)};I.__PosthogExtensions__=I.__PosthogExtensions__||{},I.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if(e!=="remote-config"){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}Zi(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Zi(t,o,i)}},I.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Zi(t,r,i)};var To="$people_distinct_id",ki="$device_id",Lt="__alias",Dt="__timers",jr="$autocapture_disabled_server_side",Hr="$heatmaps_enabled_server_side",qr="$exception_capture_enabled_server_side",Br="$error_tracking_suppression_rules",Vr="$error_tracking_capture_extension_exceptions",zr="$web_vitals_enabled_server_side",Ns="$dead_clicks_enabled_server_side",Us="$product_tours_enabled_server_side",Wr="$web_vitals_allowed_metrics",st="$session_recording_remote_config",Ro="$replay_sample_rate",Fo="$replay_override_sampling",$o="$replay_override_linked_flag",Io="$replay_override_url_trigger",Oo="$replay_override_event_trigger",_t="$sesid",js="$session_is_sampled",rt="$enabled_feature_flags",di="$active_feature_flags",Nt="$early_access_features",Gr="$feature_flag_details",pi="$feature_flag_payloads",Jr="$feature_flag_request_id",Me="$override_feature_flags",pt="$override_feature_flag_payloads",et="$stored_person_properties",tt="$stored_group_properties",Xr="$surveys",Hs="$surveys_loaded_at",Kr="$surveys_activated",Ut="ph_product_tours",qt="$flag_call_reported",Qr="$flag_call_reported_session_id",Yr="$feature_flag_errors",Xt="$feature_flag_evaluated_at",xe="$user_state",Zr="$client_session_props",es="$capture_rate_limit",ts="$initial_campaign_params",is="$initial_referrer_info",Pi="$initial_person_info",Ti="$epp",Co="__POSTHOG_TOOLBAR__",si="$posthog_cookieless",Mo="$sdk_debug_extensions_init_method",Ao="$sdk_debug_extensions_init_time_ms",Lo="$sdk_debug_recording_script_not_loaded",rs="PostHog loadExternalDependency extension not found.",it="on_reject",Ne="always",lt="anonymous",ut="identified",ss="identified_only",Ri="visibilitychange",Fi="beforeunload",vt="$pageview",er="$pageleave",tr="$identify",hn="$groupidentify";function ni(t,e){N(t)&&t.forEach(e)}function z(t,e){if(!L(t))if(N(t))t.forEach(e);else if(Ra(t))t.forEach((r,s)=>e(r,s));else for(var i in t)Kn.call(t,i)&&e(t[i],i)}var W=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)s[n]!==void 0&&(t[n]=s[n]);return t};function vi(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var dn=function(t){try{return t()}catch{return}},ol=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(s){E.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),E.critical(s)}}},qs=function(t){var e={};return z(t,function(i,r){(G(i)&&i.length>0||he(i))&&(e[r]=i)}),e},al=["herokuapp.com","vercel.app","netlify.app"];function ll(t){var e=t?.hostname;if(!G(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of al)if(i===r)return!1;return!0}function Y(t,e,i,r){var{capture:s=!1,passive:n=!0}=r??{};t?.addEventListener(e,i,{capture:s,passive:n})}function Do(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return he(t)&&isFinite(t)&&Math.floor(t)===t});var ns=class t{constructor(e){if(this.bytes=e,e.length!==16)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/Math.pow(2,8),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 e="",i=0;this.bytes.length>i;i++)e=e+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var i=0;16>i;i++){var r=this.bytes[i]-e.bytes[i];if(r!==0)return Math.sign(r)}return 0}},os=class{constructor(){this.S=0,this.C=0,this.I=new as}generate(){var e=this.generateOrAbort();if(b(e)){this.S=0;var i=this.generateOrAbort();if(b(i))throw new Error("Could not generate UUID after timestamp reset");return i}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return ns.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},pn,No=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&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};v&&!b(v.crypto)&&crypto.getRandomValues&&(No=t=>crypto.getRandomValues(t));var as=class{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(No(this.R),this.O=0),this.R[this.O++]}},De=()=>ul().toString(),ul=()=>(pn||(pn=new os)).generate(),Pt="",cl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Te={N:()=>!!x,D(t){E.error("cookieStore error: "+t)},P(t){if(x){try{for(var e=t+"=",i=x.cookie.split(";").filter(n=>n.length),r=0;i.length>r;r++){for(var s=i[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},F(t){var e;try{e=JSON.parse(Te.P(t))||{}}catch{}return e},q(t,e,i,r,s){if(!x)return!1;try{var n="",o="",a=(function(u,h){if(h){var p=(function(g,_){if(_===void 0&&(_=x),Pt)return Pt;if(!_||["localhost","127.0.0.1"].includes(g))return"";for(var y=g.split("."),f=Math.min(y.length,8),T="dmn_chk_"+De();!Pt&&f--;){var P=y.slice(f).join("."),S=T+"=1;domain=."+P+";path=/";_.cookie=S+";max-age=3",_.cookie.includes(T)&&(_.cookie=S+";max-age=0",Pt=P)}return Pt})(u);if(!p){var d=(g=>{var _=g.match(cl);return _?_[0]:""})(u);d!==p&&E.info("Warning: cookie subdomain discovery mismatch",d,p),p=d}return p?"; domain=."+p:""}return""})(x.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&E.warn("cookieStore warning: large cookie, len="+c.length),x.cookie=c,!0}catch{return!1}},A(t,e){if(x!=null&&x.cookie)try{Te.q(t,"",-1,e)}catch{return}}},ir=null,V={N(){if(!ce(ir))return ir;var t=!0;if(b(v))t=!1;else try{var e="__mplssupport__";V.q(e,"xyz"),V.P(e)!=='"xyz"'&&(t=!1),V.A(e)}catch{t=!1}return t||E.error("localStorage unsupported; falling back to cookie store"),ir=t,t},D(t){E.error("localStorage error: "+t)},P(t){try{return v?.localStorage.getItem(t)}catch(e){V.D(e)}return null},F(t){try{return JSON.parse(V.P(t))||{}}catch{}return null},q(t,e){try{return v?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(i){V.D(i)}return!1},A(t){try{v?.localStorage.removeItem(t)}catch(e){V.D(e)}}},hl=[ki,"distinct_id",_t,js,Ti,Pi,xe],oi={},dl={N:()=>!0,D(t){E.error("memoryStorage error: "+t)},P:t=>oi[t]||null,F:t=>oi[t]||null,q:(t,e)=>(oi[t]=e,!0),A(t){delete oi[t]}},Je=null,oe={N(){if(!ce(Je))return Je;if(Je=!0,b(v))Je=!1;else try{var t="__support__";oe.q(t,"xyz"),oe.P(t)!=='"xyz"'&&(Je=!1),oe.A(t)}catch{Je=!1}return Je},D(t){E.error("sessionStorage error: ",t)},P(t){try{return v?.sessionStorage.getItem(t)}catch(e){oe.D(e)}return null},F(t){try{return JSON.parse(oe.P(t))||null}catch{}return null},q(t,e){try{return v?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(i){oe.D(i)}return!1},A(t){try{v?.sessionStorage.removeItem(t)}catch(e){oe.D(e)}}},ls=class{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===Ne||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===it}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Ct.q(this.It,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.A(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:e,opt_out_capturing_cookie_prefix:i,consent_persistence_name:r}=this._instance.config;return r||(i?i+e:"__ph_opt_in_out_"+e)}get St(){var e=this.Ct.P(this.It);return Ji(e)?1:C(Oa,e)?0:-1}get Ct(){var e=this.Se.opt_out_capturing_persistence_type,i=e==="localStorage"?V:Te;if(!this.Tt||this.Tt!==i){this.Tt=i;var r=e==="localStorage"?Te:V;r.P(this.It)&&(this.Tt.P(this.It)||this.optInOut(Ji(r.P(this.It))),r.A(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[_e?.doNotTrack,_e?.msDoNotTrack,I.doNotTrack].some(e=>Ji(e))}},pl=1,vl=3,gl=11;function vn(t){return t instanceof Element&&(t.id===Co||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Ge(t){return!!t&&t.nodeType===pl}function fe(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Uo(t){return!!t&&t.nodeType===vl}function jo(t){return!!t&&t.nodeType===gl&&Ge(t.host)}function Bs(t){return t?Bi(t).split(/\s+/):[]}function gn(t){var e=v?.location.href;return!!(e&&t&&t.some(i=>e.match(i)))}function $i(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Bs(e)}function Ho(t){return L(t)?null:Bi(t).split(/(\s+)/).filter(e=>Bt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Kt(t){var e="";return cs(t)&&!zo(t)&&t.childNodes&&t.childNodes.length&&z(t.childNodes,function(i){var r;Uo(i)&&i.textContent&&(e+=(r=Ho(i.textContent))!==null&&r!==void 0?r:"")}),Bi(e)}function rr(t){return b(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Vs=["a","button","form","input","select","textarea","label"];function us(t,e){if(b(e))return!0;var i,r=function(n){if(e.some(o=>(function(a,l){var c=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!c&&c.call(a,l)}catch{return!1}})(n,o)))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function qo(t){var e=t.parentNode;return!(!e||!Ge(e))&&e}var _l=[".ph-no-autocapture","[data-ph-no-autocapture]"],Bo=["next","previous","prev",">","<"],fl=[...Bo,"+","-","\u2212","\u2013"],_n=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,fn=[".ph-no-rageclick",".ph-no-capture"],ml=["","text","search","email","password","url","tel","number"];function mn(t,e){if(!v||zs(t))return!1;var i,r,s,n,o;if(Fe(e)?(i=!!e&&fn,r=void 0,s=!1):(i=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:fn,r=e?.content_ignorelist,s=(o=e?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||s&&(function(l){return!(!l||!Ge(l))&&(!!fe(l,"textarea")||(fe(l,"input")?C(ml,(l.getAttribute("type")||"").toLowerCase()):(function(c){if(c.isContentEditable)return!0;var u=c.getAttribute==null?void 0:c.getAttribute("contenteditable");return u==="true"||u===""})(l)))})(t))return!1;var{targetElementList:a}=Vo(t,!1);return!(function(l,c){if(l===!1||b(l))return!1;var u;if(l===!0)u=Bo;else{if(!N(l))return!1;if(l.length>10)return E.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=l.map(h=>h.toLowerCase())}return c.some(h=>{var{safeText:p,ariaLabel:d}=h;return u.some(g=>_n(p,g)||_n(d,g))})})(r,a.map(l=>{var c;return{safeText:Kt(l).toLowerCase(),ariaLabel:((c=l.getAttribute("aria-label"))==null?void 0:c.toLowerCase().trim())||""}}))&&!us(a,i)}var zs=t=>!t||fe(t,"html")||!Ge(t),Vo=(t,e)=>{if(!v||zs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!fe(s,"body");)if(jo(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=qo(s);if(!n)break;if(e||Vs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=v.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function cs(t){for(var e=t;e.parentNode&&!fe(e,"body");e=e.parentNode){var i=$i(e);if(C(i,"ph-sensitive")||C(i,"ph-no-capture"))return!1}if(C($i(t),"ph-include"))return!0;var r=t.type||"";if(G(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!G(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function zo(t){return!!(fe(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||fe(t,"select")||fe(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Wo="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",yl=new RegExp("^(?:"+Wo+")$"),bl=new RegExp(Wo),Go="\\d{3}-?\\d{2}-?\\d{4}",wl=new RegExp("^("+Go+")$"),El=new RegExp("("+Go+")");function Bt(t,e){return e===void 0&&(e=!0),!(L(t)||G(t)&&(t=Bi(t),(e?yl:bl).test((t||"").replace(/[- ]/g,""))||(e?wl:El).test(t)))}function yn(t){var e=Kt(t);return Bt(e=(e+" "+Jo(t)).trim())?e:""}function Jo(t){var e="";return t&&t.childNodes&&t.childNodes.length&&z(t.childNodes,function(i){var r;if(i&&((r=i.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Kt(i);e=(e+" "+s).trim(),i.childNodes&&i.childNodes.length&&(e=(e+" "+Jo(i)).trim())}catch(n){E.error("[AutoCapture]",n)}}),e}function bn(t){return t.replace(/"|\\"/g,'\\"')}function xl(t){var e=t.attr__class;return e?N(e)?e:Bs(e):void 0}var ai=Q("[Dead Clicks]"),Sl=()=>!0,kl=t=>{var e,i=!((e=t.instance.persistence)==null||!e.get_property(Ns)),r=t.instance.config.capture_dead_clicks;return Fe(r)?r:!!X(r)||i},Ii=class{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(e,i,r){this.instance=e,this.isEnabled=i,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Ns]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt(()=>{this.Pt()}):this.stop()}Mt(e){var i,r;(i=I.__PosthogExtensions__)!=null&&i.initDeadClicksAutocapture?e():(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?ai.error("failed to load script",s):e()})}Pt(){var e;if(x){if(!this.Et&&(e=I.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var i=X(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.Et=I.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Et.start(x),ai.info("starting...")}}else ai.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,ai.info("stopping..."))}},sr=Q("[SegmentIntegration]"),Xo="posthog-js";function Ko(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,h,p;if(n!=="*"&&!n.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var d=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var g,_=((l=a.exception)==null?void 0:l.values)||[],y=_.map(T=>m({},T,{stacktrace:T.stacktrace?m({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map(P=>m({},P,{platform:"web:javascript"}))}):void 0})),f={$exception_message:((c=_[0])==null?void 0:c.value)||a.message,$exception_type:(u=_[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:y,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=_[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=_[0])==null?void 0:p.type,$sentry_tags:a.tags};return i&&r&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+a.event_id),o&&((g=t.exceptions)==null||g.sendExceptionEvent(f)),a}}var hs=class{constructor(e,i,r,s,n,o){this.name=Xo,this.setupOnce=function(a){a(Ko(e,{organization:i,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},Oi=class{constructor(e){this.Rt=(i,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(E.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:i,changeReason:s}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Lt()}Lt(){var e;this.Ft=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Rt)}destroy(){var e;(e=this.Ft)==null||e.call(this),this.Ft=void 0}doPageView(e,i){var r,s=this.At(e,i);return this.Ot={pathname:(r=v?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var i;return this.At(e,(i=this.Ot)==null?void 0:i.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ot)==null?void 0:e.pageViewId}}At(e,i){var r=this.Ot;if(!r)return{$pageview_id:i};var s={$pageview_id:i,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(b(o)||b(a)||b(l)||b(c)||b(u)||b(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var p=o>1?Re(a/o,0,1,E):1,d=o>1?Re(l/o,0,1,E):1,g=c>1?Re(u/c,0,1,E):1,_=c>1?Re(h/c,0,1,E):1;s=W(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}},li=["flags","surveys"],Pl={[To]:{exposure:"hidden"},[Lt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Dt]:{exposure:"hidden"},[jr]:{exposure:"event"},[Hr]:{exposure:"hidden"},[qr]:{exposure:"event"},[Br]:{exposure:"hidden"},[Vr]:{exposure:"event"},[zr]:{exposure:"event"},[Ns]:{exposure:"event"},[Us]:{exposure:"hidden"},[Wr]:{exposure:"event"},[st]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[_t]:{exposure:"hidden"},[js]:{exposure:"event"},[Ro]:{exposure:"event",shouldSkipFromEventProperties:t=>ce(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[rt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!X(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[di]:{exposure:"event",storageGroup:"flags"},[Nt]:{exposure:"hidden"},[Gr]:{exposure:"hidden",storageGroup:"flags"},[pi]:{exposure:"event",storageGroup:"flags"},[Jr]:{exposure:"event",storageGroup:"flags",volatile:!0},[Me]:{exposure:"event"},[pt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[Xr]:{exposure:"hidden",storageGroup:"surveys"},[Hs]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Kr]:{exposure:"event"},[Ut]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[qt]:{exposure:"hidden"},[Qr]:{exposure:"hidden"},[Yr]:{exposure:"hidden"},[Xt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden"},[Zr]:{exposure:"hidden"},[es]:{exposure:"hidden"},[ts]:{exposure:"hidden"},[is]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[Fo]:{exposure:"event"},[$o]:{exposure:"event"},[Io]:{exposure:"event"},[Oo]:{exposure:"event"},[Mo]:{exposure:"event"},[Ao]:{exposure:"event"},[Lo]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Tl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Xe=t=>{var e=Pl[t];if(e)return e;for(var[i,r]of Tl)if(t.indexOf(i)===0)return r},Ci=t=>{var e=x?.createElement("a");return b(e)?null:(e.href=t,e)},Qt=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(!N(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{E.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Yt=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],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");N(h)&&(e.includes(h[0])?c.push(h[0]+"="+i):c.push(l[u]))}var p=a;return o!=null&&(p+="?"+c.join("&")),s!=null&&(p+="#"+s),p},Mi=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},ui="https?://(.*)",xt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Rl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...xt],Zt="<masked>",Fl=["li_fat_id"];function Qo(t,e,i){if(!x)return{};var r,s=e?[...xt,...i||[]]:[],n=Yo(Yt(x.URL,s,Zt),t),o=(r={},z(Fl,function(a){var l=Te.P(a);r[a]=l||null}),r);return W(o,n)}function Yo(t,e){var i=Rl.concat(e||[]),r={};return z(i,function(s){var n=Qt(t,s);r[s]=n||null}),r}function Zo(t){var e=(function(n){return n?n.search(ui+"google.([^/?]*)")===0?"google":n.search(ui+"bing.com")===0?"bing":n.search(ui+"yahoo.com")===0?"yahoo":n.search(ui+"duckduckgo.com")===0?"duckduckgo":null:null})(t),i=e!="yahoo"?"q":"p",r={};if(!ce(e)){r.$search_engine=e;var s=x?Qt(x.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function wn(){return navigator.language||navigator.userLanguage}var Ai="$direct";function ea(){return x?.referrer||Ai}function ta(t,e,i){i===void 0&&(i=!1);var r=t?[...xt,...e||[]]:[],s=i?We(te?.href):te?.href,n=s?.substring(0,1e3);return{r:ea().substring(0,1e3),u:n?Yt(n,r,Zt):void 0}}function ia(t,e){var i;e===void 0&&(e=!1);var{r,u:s}=t,n=e?We(s):s,o={$referrer:r,$referring_domain:r==null?void 0:r==Ai?Ai:(i=Ci(r))==null?void 0:i.host};if(n){o.$current_url=n;var a=Ci(n);o.$host=a?.host,o.$pathname=a?.pathname;var l=Yo(n);W(o,l)}if(r){var c=Zo(r);W(o,c)}return o}function ra(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function $l(){try{return new Date().getTimezoneOffset()}catch{return}}var Il={flags:Xt,surveys:Hs},Ol=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ct="main",Vt=class{constructor(e,i,r){if(r===void 0&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=e,this.qt=r,this.props={},this.Bt=!1,this.jt=(n=>{var o="";return n.token&&(o=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+o+"_posthog"})(e),this.Ct=this.Ht(e),this.Nt=this.Ut(e),this.load(),e.debug&&E.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,i),this.save(),v){var s=()=>this.flush();Y(v,"beforeunload",s,{capture:!1}),Y(v,"pagehide",s,{capture:!1})}}zt(){var e,i=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return he(i)&&i>0?i:0}isDisabled(){return!!this.Vt}Ht(e){Ol.indexOf(e.persistence.toLowerCase())===-1&&(E.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=(function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var l=[...hl,...o];return m({},V,{F(c){try{var u={};try{u=Te.F(c)||{}}catch{}var h,p=JSON.parse(V.P(c)||"{}");if(a){var d={};for(var g in u){var _=u[g];ce(_)||_===""||(d[g]=_)}h=W(p,d)}else h=W(u,p);return V.q(c,h),h}catch{}return null},q(c,u,h,p,d,g){var _=V.q(c,u,void 0,void 0,g);try{var y={};l.forEach(f=>{u[f]&&(y[f]=u[f])}),Object.keys(y).length&&Te.q(c,y,h,p,d,g)}catch(f){V.D(f)}return _},A(c,u){try{v?.localStorage.removeItem(c),Te.A(c,u)}catch(h){V.D(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&V.N()?(i=V,s=!0):n==="localstorage+cookie"&&r.N()?(i=r,s=!0):n==="sessionstorage"&&oe.N()?i=oe:n==="memory"?i=dl:n==="cookie"?i=Te:r.N()?(i=r,s=!0):i=Te,this.Dt=s,i}Wt(e){return this.jt+"__"+e}Ut(e){return this.Dt&&!!e.split_storage}Gt(e){var i=e??this.Se.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var r=this.props[Xt];return!r||typeof r!="number"||Date.now()-r>i}properties(){var e={};return z(this.props,(i,r)=>{var s=Xe(r);if(s?.exposure==="derived"){if(s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(i,r===rt?()=>this.Gt():()=>!1))return;s.transformToEventProperties&&W(e,s.transformToEventProperties(i))}else if(!s||s.exposure==="event"){if(s!=null&&s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(i,()=>!1))return;e[r]=i}}),e}load(){if(!this.Vt){var e=this.Ct.F(this.jt);e&&(this.props=W({},e)),this.Nt&&this.Zt()}}Zt(){for(var e of li){var i=V.F(this.Wt(e));if(i&&!ze(i)){var r=this.Qt(e);r.persisted=!0,this.Jt(e)||(r.fingerprint=this.Yt(i,e)),this.Kt(e,i)||W(this.props,i)}}}Jt(e){return Object.keys(this.props).some(i=>{var r;return((r=Xe(i))==null?void 0:r.storageGroup)===e})}Kt(e,i){var r=Il[e];if(!r)return!1;var s=i[r],n=this.props[r];return he(s)&&he(n)&&n>s}refreshKey(e){var i;if(!this.Vt){var r=this.Nt?(i=Xe(e))==null?void 0:i.storageGroup:void 0,s=r?V.F(this.Wt(r)):this.Ct.F(this.jt);if(s&&e in s)this.Xt(e,s[e]);else{if(r){var n=this.Ct.F(this.jt);if(n&&e in n)return void this.Xt(e,n[e])}this.er(e)}}}save(){if(!this.Vt){var e=this.zt();e>0?b(this.tr)&&(this.tr=setTimeout(()=>{this.tr=void 0,this.rr()},e)):this.rr()}}flush(){b(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,ct))}ir(){var{main:e,groups:i}=this.sr();for(var r of(this.nr(this.Ct,this.jt,e,ct),li)){var s,n=i[r];(!ze(n)||(s=this.$t[r])!=null&&s.persisted)&&this.nr(V,this.Wt(r),n,r)}}sr(){var e={},i={};for(var r of li)i[r]={};return z(this.props,(s,n)=>{var o,a=(o=Xe(n))==null?void 0:o.storageGroup;a?i[a][n]=s:e[n]=s}),{main:e,groups:i}}Yt(e,i){if(i===ct)return JSON.stringify(e)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var r={};return z(e,(s,n)=>{var o;r[n]=(o=Xe(n))!=null&&o.volatile?"__volatile__":s}),JSON.stringify(r)}nr(e,i,r,s){var n=this.Qt(s);if(s===ct||n.dirty||b(n.fingerprint)){var o;try{if((o=this.Yt(r,s))===n.fingerprint)return void(n.dirty=!1)}catch{o=void 0}e.q(i,r,this.ar,this.lr,this.ur,this.Se.debug)?(n.dirty=!1,s!==ct&&(n.persisted=!0),b(o)||(n.fingerprint=o)):this.Se.debug&&E.warn('failed to persist storage entry "'+i+'"; will retry on next save')}}remove(e){var{keepGroupEntries:i=!1}=e===void 0?{}:e;if(b(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.A(this.jt,!1),this.Ct.A(this.jt,!0),!i&&this.qt)for(var r of li)V.A(this.Wt(r));i?delete this.$t[ct]:this.$t={}}clear(){this.remove(),this.props={}}register_once(e,i,r){if(X(e)){b(i)&&(i="None"),this.ar=b(r)?this.hr:r;var s=!1;if(z(e,(n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==i||(this.Xt(o,n),s=!0)}),s)return this.save(),!0}return!1}register(e,i){if(X(e)){this.ar=b(i)?this.hr:i;var r=!1;if(z(e,(s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.Xt(n,s),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.er(e),this.save())}update_campaign_params(){if(!this.Bt){var e=Qo(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ze(qs(e))||this.register(e),this.Bt=!0}}update_search_keyword(){var e;this.register((e=x?.referrer)?Zo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ea(),$referring_domain:x!=null&&x.referrer&&((e=Ci(x.referrer))==null?void 0:e.host)||Ai},void 0)}set_initial_person_info(){this.props[ts]||this.props[is]||this.register_once({[Pi]:ta(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};z([is,ts],s=>{var n=this.props[s];n&&z(n,function(o,a){e["$initial_"+Er(a)]=o})});var i=this.props[Pi];if(i){var r=(function(s,n){n===void 0&&(n=!1);var o=ia(s,n),a={};return z(o,function(l,c){a["$initial_"+Er(c)]=l}),a})(i,this.Se.disable_capture_url_hashes);W(e,r)}return e}safe_merge(e){return z(this.props,function(i,r){r in e||(e[r]=i)}),e}update_config(e,i,r){this.hr=this.ar=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==i.persistence||!((l,c)=>{if(l.length!==c.length)return!1;var u=[...l].sort(),h=[...c].sort();return u.every((p,d)=>p===h[d])})(e.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),n=s?this.Ht(e):this.Ct,o=this.Ut(e);if(s||o!==this.Nt){var a=this.props;this.clear(),this.Ct=n,this.Nt=o,this.props=a,this.save()}}set_disabled(e){this.Vt=e,this.Vt?this.remove():this.save()}set_cross_subdomain(e){e!==this.lr&&(this.lr=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.ur&&(this.ur=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,i){var r=this.props[Dt]||{};r[e]=i,this.Xt(Dt,r),this.save()}remove_event_timer(e){var i=this.props[Dt]||{},r=i[e];return b(r)||(delete i[e],this.Xt(Dt,i),this.save()),r}get_property(e){return this.props[e]}set_property(e,i){this.Xt(e,i),this.save()}Xt(e,i){var r;this.props[e]=i,(r=Xe(e))!=null&&r.volatile||this.dr(e)}er(e){delete this.props[e],this.dr(e)}dr(e){var i,r=(i=Xe(e))==null?void 0:i.storageGroup;r&&(this.Qt(r).dirty=!0)}Qt(e){return this.$t[e]||(this.$t[e]={})}},Tt={Activation:"events",Cancellation:"cancelEvents"},vu={Button:"button",Tab:"tab",Selector:"selector"},gu={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"},_u={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},nr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},fu={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},mu={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Cl={Once:"once",Recurring:"recurring",Always:"always"},Ue={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},or={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"},yu={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},Ml={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"},En={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"},xn=Q("[RateLimiter]"),ps=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var r=i.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(s=>{xn.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void xn.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var i,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(i=(r=this.instance.persistence)==null?void 0:r.get_property(es))!==null&&i!==void 0?i:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(s=this.instance.persistence)==null||s.set_property(es,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var i=this.serverLimits[e||"events"]||!1;return i!==!1&&new Date().getTime()<i}},Rt=Q("[RemoteConfig]"),Li=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=I._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}cr(e){var i,r;(i=I.__PosthogExtensions__)!=null&&i.loadExternalDependency?(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}vr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(i){e(i.json)}})}load(){try{if(this.remoteConfig)return Rt.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void Rt.warn("Remote config is disabled. Falling back to local config.");this.cr(e=>{if(!e)return Rt.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr(i=>{this.pr(i),this.gr()});this.pr(e),this.gr()})}catch(e){Rt.error("Error loading remote config",e)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&x&&x.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}gr(){var e;if(!this.yr){var i=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;i!==0&&(this.yr=setInterval(()=>{this.refresh()},i))}}pr(e){var i;e||Rt.error("Failed to fetch remote config from PostHog."),this._instance.pr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded())}},bu=["fatal","error","warning","log","info","debug"],Pe={GZipJS:"gzip-js",Base64:"base64"},Ee=Uint8Array,ue=Uint16Array,St=Uint32Array,Ws=new Ee([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]),Gs=new Ee([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]),Sn=new Ee([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sa=function(t,e){for(var i=new ue(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new St(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]},na=sa(Ws,2),vs=na[1];na[0][28]=258,vs[258]=28;for(gs=sa(Gs,0)[1],Di=new ue(32768),J=0;32768>J;++J)Ke=(43690&J)>>>1|(21845&J)<<1,Di[J]=((65280&(Ke=(61680&(Ke=(52428&Ke)>>>2|(13107&Ke)<<2))>>>4|(3855&Ke)<<4))>>>8|(255&Ke)<<8)>>>1;var Ke,gs,Di,J,zt=function(t,e,i){for(var r=t.length,s=0,n=new ue(e);r>s;++s)++n[t[s]-1];var o,a=new ue(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ue(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var c=s<<4|t[s],u=e-t[s],h=a[t[s]-1]++<<u,p=h|(1<<u)-1;p>=h;++h)o[Di[h]>>>l]=c}else for(o=new ue(r),s=0;r>s;++s)o[s]=Di[a[t[s]-1]++]>>>15-t[s];return o},at=new Ee(288);for(J=0;144>J;++J)at[J]=8;for(J=144;256>J;++J)at[J]=9;for(J=256;280>J;++J)at[J]=7;for(J=280;288>J;++J)at[J]=8;var Ni=new Ee(32);for(J=0;32>J;++J)Ni[J]=5;var Al=zt(at,9,0),Ll=zt(Ni,5,0),oa=function(t){return(t/8>>0)+(7&t&&1)},aa=function(t,e,i){(i==null||i>t.length)&&(i=t.length);var r=new(t instanceof ue?ue:t instanceof St?St:Ee)(i-e);return r.set(t.subarray(e,i)),r},$e=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ft=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ar=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 Ee(0),0];if(s==1){var o=new Ee(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(F,A){return F.f-A.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[h].f>i[c].f?c++:h++],l=i[c!=u&&i[h].f>i[c].f?c++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(r=1;s>r;++r)n[r].s>p&&(p=n[r].s);var d=new ue(p+1),g=_s(i[u-1],d,0);if(g>e){r=0;var _=0,y=g-e,f=1<<y;for(n.sort(function(F,A){return d[A.s]-d[F.s]||F.f-A.f});s>r;++r){var T=n[r].s;if(e>=d[T])break;_+=f-(1<<g-d[T]),d[T]=e}for(_>>>=y;_>0;){var P=n[r].s;e>d[P]?_-=1<<e-d[P]++-1:++r}for(;r>=0&&_;--r){var S=n[r].s;d[S]==e&&(--d[S],++_)}g=e}return[new Ee(d),g]},_s=function(t,e,i){return t.s==-1?Math.max(_s(t.l,e,i+1),_s(t.r,e,i+1)):e[t.s]=i},kn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new ue(++e),r=0,s=t[0],n=1,o=function(l){i[r++]=l},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]},$t=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},fs=function(t,e,i){var r=i.length,s=oa(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)},Pn=function(t,e,i,r,s,n,o,a,l,c,u){$e(e,u++,i),++s[256];for(var h=ar(s,15),p=h[0],d=h[1],g=ar(n,15),_=g[0],y=g[1],f=kn(p),T=f[0],P=f[1],S=kn(_),F=S[0],A=S[1],w=new ue(19),k=0;T.length>k;++k)w[31&T[k]]++;for(k=0;F.length>k;++k)w[31&F[k]]++;for(var R=ar(w,7),$=R[0],O=R[1],M=19;M>4&&!$[Sn[M-1]];--M);var U,D,j,B,H=c+5<<3,ae=$t(s,at)+$t(n,Ni)+o,ye=$t(s,p)+$t(n,_)+o+14+3*M+$t(w,$)+(2*w[16]+3*w[17]+7*w[18]);if(ae>=H&&ye>=H)return fs(e,u,t.subarray(l,l+c));if($e(e,u,1+(ae>ye)),u+=2,ae>ye){U=zt(p,d,0),D=p,j=zt(_,y,0),B=_;var be=zt($,O,0);for($e(e,u,P-257),$e(e,u+5,A-1),$e(e,u+10,M-4),u+=14,k=0;M>k;++k)$e(e,u+3*k,$[Sn[k]]);u+=3*M;for(var Z=[T,F],ge=0;2>ge;++ge){var re=Z[ge];for(k=0;re.length>k;++k)$e(e,u,be[de=31&re[k]]),u+=$[de],de>15&&($e(e,u,re[k]>>>5&127),u+=re[k]>>>12)}}else U=Al,D=at,j=Ll,B=Ni;for(k=0;a>k;++k)if(r[k]>255){var de;Ft(e,u,U[257+(de=r[k]>>>18&31)]),u+=D[de+257],de>7&&($e(e,u,r[k]>>>23&31),u+=Ws[de]);var le=31&r[k];Ft(e,u,j[le]),u+=B[le],le>3&&(Ft(e,u,r[k]>>>5&8191),u+=Gs[le])}else Ft(e,u,U[r[k]]),u+=D[r[k]];return Ft(e,u,U[256]),u+D[256]},Dl=new St([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Nl=(function(){for(var t=new St(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t})(),lr=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ul(t,e){e===void 0&&(e={});var i=(function(){var h=4294967295;return{p(p){for(var d=h,g=0;p.length>g;++g)d=Nl[255&d^p[g]]^d>>>8;h=d},d(){return 4294967295^h}}})(),r=t.length;i.p(t);var s,n,o,a,l,c=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,(function(h,p,d,g,_,y){var f=h.length,T=new Ee(g+f+5*(1+Math.floor(f/7e3))+_),P=T.subarray(g,T.length-_),S=0;if(!p||8>f)for(var F=0;f>=F;F+=65535){var A=F+65535;f>A?S=fs(P,S,h.subarray(F,A)):(P[F]=!0,S=fs(P,S,h.subarray(F,f)))}else{for(var w=Dl[p-1],k=w>>>13,R=8191&w,$=(1<<d)-1,O=new ue(32768),M=new ue($+1),U=Math.ceil(d/3),D=2*U,j=function(Gi){return(h[Gi]^h[Gi+1]<<U^h[Gi+2]<<D)&$},B=new St(25e3),H=new ue(288),ae=new ue(32),ye=0,be=0,Z=(F=0,0),ge=0,re=0;f>F;++F){var de=j(F),le=32767&F,He=M[de];if(O[le]=He,M[de]=le,F>=ge){var qe=f-F;if((ye>7e3||Z>24576)&&qe>423){S=Pn(h,P,0,B,H,ae,be,Z,re,F-re,S),Z=ye=be=0,re=F;for(var pe=0;286>pe;++pe)H[pe]=0;for(pe=0;30>pe;++pe)ae[pe]=0}var Se=2,ti=0,ga=R,Be=le-He&32767;if(qe>2&&de==j(F-Be))for(var _a=Math.min(k,qe)-1,fa=Math.min(32767,F),ma=Math.min(258,qe);fa>=Be&&--ga&&le!=He;){if(h[F+Se]==h[F+Se-Be]){for(var Ve=0;ma>Ve&&h[F+Ve]==h[F+Ve-Be];++Ve);if(Ve>Se){if(Se=Ve,ti=Be,Ve>_a)break;var ya=Math.min(Be,Ve-2),Js=0;for(pe=0;ya>pe;++pe){var Wi=F-Be+pe+32768&32767,Xs=Wi-O[Wi]+32768&32767;Xs>Js&&(Js=Xs,He=Wi)}}}Be+=(le=He)-(He=O[le])+32768&32767}if(ti){B[Z++]=268435456|vs[Se]<<18|gs[ti];var Ks=31&vs[Se],Qs=31&gs[ti];be+=Ws[Ks]+Gs[Qs],++H[257+Ks],++ae[Qs],ge=F+Se,++ye}else B[Z++]=h[F],++H[h[F]]}}S=Pn(h,P,!0,B,H,ae,be,Z,re,F-re,S)}return aa(T,0,g+oa(S)+_)})(n=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=c.length;return(function(h,p){var d=p.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>p.level?4:p.level==9?2:0,h[9]=3,p.mtime!=0&&lr(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),d){h[3]=8;for(var g=0;d.length>=g;++g)h[g+10]=d.charCodeAt(g)}})(c,e),lr(c,u-8,i.d()),lr(c,u-4,r),c}var jl=!!yr||!!mr,la="text/plain",gi=!1,Hl=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter(a=>a.split("=")[0]!==e).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},ua=function(t,e,i){var r;i===void 0&&(i=!0);var[s,n]=t.split("?"),o=m({},e),a=(r=n?.split("&").map(c=>{var u,[h,p]=c.split("="),d=i&&(u=o[h])!==null&&u!==void 0?u:p;return delete o[h],h+"="+d}))!==null&&r!==void 0?r:[],l=(function(c,u){var h,p;u===void 0&&(u="&");var d=[];return z(c,function(g,_){b(g)||b(_)||_==="undefined"||(h=encodeURIComponent((y=>y instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(_),d[d.length]=p+"="+h)}),d.join(u)})(o);return l&&a.push(l),s+"?"+a.join("&")},ft=(t,e)=>JSON.stringify(t,(i,r)=>typeof r=="bigint"?r.toString():r,e),Tn=t=>{if(t.xt)return t.xt;var{data:e,compression:i}=t;if(e){if(i===Pe.GZipJS){var r=Ul((function(a,l){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var u=new Ee(a.length+(a.length>>>1)),h=0,p=function(y){u[h++]=y},d=0;c>d;++d){if(h+5>u.length){var g=new Ee(h+8+(c-d<<1));g.set(u),u=g}var _=a.charCodeAt(d);128>_?p(_):2048>_?(p(192|_>>>6),p(128|63&_)):_>55295&&57344>_?(p(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++d))>>>18),p(128|_>>>12&63),p(128|_>>>6&63),p(128|63&_)):(p(224|_>>>12),p(128|_>>>6&63),p(128|63&_))}return aa(u,0,h)})(ft(e)),{mtime:0});return{contentType:la,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Pe.Base64){var s=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))})(ft(e)),n=(a=>"data="+encodeURIComponent(typeof a=="string"?a:ft(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=ft(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ur=t=>{var e,i,r,s=Tn(t);return!s||(i=t.compression,r=Qt(t.url,"compression"),i!==tn.GZipJS&&r!==tn.GZipJS&&r!=="gzip")||((e=s.body)instanceof ArrayBuffer?br(new Uint8Array(e)):ArrayBuffer.isView(e)&&br(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:s}:(gi=!0,{url:Hl(t.url,"compression"),encodedBody:Tn(m({},t,{compression:void 0,xt:void 0}))})},ql=(function(){var t=se(function*(e){var i=ft(e.data),r=yield(function(n,o,a){return wr.apply(this,arguments)})(i,ee.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return m({},e,{xt:{contentType:la,body:s,estimatedSize:s.byteLength}})});return function(e){return t.apply(this,arguments)}})(),Rn=(t,e)=>ua(t,{_:new Date().getTime().toString(),ver:ee.JS_SDK_VERSION,compression:e}),_i=[];mr&&_i.push({transport:"fetch",method(t){var e,{url:i,encodedBody:r}=ur(t),{contentType:s,body:n,estimatedSize:o}=r??{},a=new Headers;z(t.headers,function(h,p){a.append(p,h)}),s&&a.append("Content-Type",s);var l=null,c=null;if(Ys){var u=new Ys;l={signal:u.signal,timeout:setTimeout(()=>{var h,p;h=t.timeout,(p=new Error("PostHog request timed out"+(h?" after "+h+"ms":""))).name="AbortError",u.abort(c=p)},t.timeout)}}mr(i,m({method:t?.method||"GET",headers:a,keepalive:t.method==="POST"&&52428.8>(o||0),body:n,signal:(e=l)==null?void 0:e.signal},t.fetchOptions)).then(h=>h.text().then(p=>{var d={statusCode:h.status,text:p};if(h.status===200)try{d.json=JSON.parse(p)}catch(g){E.error(g)}t.callback==null||t.callback(d)})).catch(h=>{h===c?E.warn(h):E.error(h),t.callback==null||t.callback({statusCode:0,error:h})}).finally(()=>l?clearTimeout(l.timeout):null)}}),yr&&_i.push({transport:"XHR",method(t){var e=new yr,{url:i,encodedBody:r}=ur(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=r??{};z(t.headers,function(o,a){e.setRequestHeader(a,o)}),s&&e.setRequestHeader("Content-Type",s),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(e.readyState===4){var o={statusCode:e.status,text:e.responseText};if(e.status===200)try{o.json=JSON.parse(e.responseText)}catch{}t.callback==null||t.callback(o)}},e.send(n)}}),_e!=null&&_e.sendBeacon&&_i.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:i}=ur(t),{contentType:r,body:s}=i??{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});_e.sendBeacon(e,n)}catch{}}});var ms=3e3,ys=class{constructor(e,i){this.br=!0,this._r=[],this.wr=Re(i?.flush_interval_ms||ms,250,5e3,E.createLogger("flush interval"),ms),this.kr=e}enqueue(e){this._r.push(e),this.Sr||this.Cr()}unload(){this.Ir();var e=this._r.length>0?this.Tr():{},i=Object.values(e);[...i.filter(r=>r.url.indexOf("/e")===0),...i.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.kr(m({},r,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.Cr()}Cr(){var e=this;this.br||(this.Sr=setTimeout(()=>{if(this.Ir(),this._r.length>0){var i=this.Tr(),r=function(){var n=i[s],o=new Date().getTime();n.data&&N(n.data)&&z(n.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.kr(n)};for(var s in i)r()}},this.wr))}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var e={};return z(this._r,i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;b(e[n])&&(e[n]=m({},s,{data:[]})),(r=e[n].data)==null||r.push(s.data)}),this._r=[],e}},Bl=["retriesPerformedSoFar"],bs=class{constructor(e){this.Er=!1,this.Mr=3e3,this._r=[],this._instance=e,this._r=[],this.Pr=!0,!b(v)&&"onLine"in v.navigator&&(this.Pr=v.navigator.onLine,this.Rr=()=>{this.Pr=!0,this.Or()},this.Lr=()=>{this.Pr=!1},Y(v,"online",this.Rr),Y(v,"offline",this.Lr))}get length(){return this._r.length}retriableRequest(e){var{retriesPerformedSoFar:i}=e,r=Gn(e,Bl);Ce(i)&&(r.url=ua(r.url,{retry_count:i})),this._instance._send_request(m({},r,{callback:s=>{if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(i??0))return void this.st(m({retriesPerformedSoFar:i},r));s.statusCode===0&&E.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(i??0)+" retries.")}r.callback==null||r.callback(s)}}))}st(e){var i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var r=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=Math.random()-.5;return Math.ceil(c+u*(c-l))})(i),s=Date.now()+r;this._r.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),E.warn(n),this.Er||(this.Er=!0,this.Fr())}Fr(){if(this.Ar&&clearTimeout(this.Ar),this._r.length===0)return this.Er=!1,void(this.Ar=void 0);this.Ar=setTimeout(()=>{this.Pr&&this._r.length>0&&this.Or(),this.Fr()},this.Mr)}Or(){var e=Date.now(),i=[],r=this._r.filter(n=>e>n.retryAt||(i.push(n),!1));if(this._r=i,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Er=!1,b(v)||(this.Rr&&(v.removeEventListener("online",this.Rr),this.Rr=void 0),this.Lr&&(v.removeEventListener("offline",this.Lr),this.Lr=void 0)),this._r))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(i){E.error(i)}this._r=[]}},ws=class{constructor(e){this.$r=()=>{var i,r,s,n;this.Dr||(this.Dr={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.Dr.lastScrollY=Math.ceil(a),this.Dr.maxScrollY=Math.max(a,(i=this.Dr.maxScrollY)!==null&&i!==void 0?i:0),this.Dr.maxScrollHeight=Math.max(l,(r=this.Dr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Dr.lastContentY=c,this.Dr.maxContentY=Math.max(c,(s=this.Dr.maxContentY)!==null&&s!==void 0?s:0),this.Dr.maxContentHeight=Math.max(u,(n=this.Dr.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Nr(){return this._instance.config.scroll_root_selector}getContext(){return this.Dr}resetContext(){var e=this.Dr;return setTimeout(this.$r,0),e}startMeasuringScrollPosition(){Y(v,"scroll",this.$r,{capture:!0}),Y(v,"scrollend",this.$r,{capture:!0}),Y(v,"resize",this.$r)}scrollElement(){if(!this.Nr)return v?.document.documentElement;var e=N(this.Nr)?this.Nr:[this.Nr];for(var i of e){var r=v?.document.querySelector(i);if(r)return r}}qr(e){var i=e==="y"?"scrollTop":"scrollLeft";if(this.Nr){var r=this.scrollElement();return r&&r[i]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.qr("y")}scrollX(){return this.qr("x")}},Vl=t=>ta(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes),Ui=class{constructor(e,i,r,s){this.Br=n=>{var o=this.jr();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Hr(this._instance)};this.Ur.register({[Zr]:a})}},this._instance=e,this.zr=i,this.Ur=r,this.Hr=s||Vl,this.zr.onSessionId(this.Br)}jr(){return this.Ur.props[Zr]}getSetOnceProps(){var e,i=(e=this.jr())==null?void 0:e.props;return i?"r"in i?ia(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var e={};return z(qs(this.getSetOnceProps()),(i,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Er(r)]=i}),e}},ei=class{constructor(){this.Vr={}}on(e,i){return this.Vr[e]||(this.Vr[e]=[]),this.Vr[e].push(i),()=>{this.Vr[e]=this.Vr[e].filter(r=>r!==i)}}emit(e,i){for(var r of this.Vr[e]||[])r(i);for(var s of this.Vr["*"]||[])s(e,i)}},It=Q("[SessionId]"),ji=class{on(e,i){return this.Wr.on(e,i)}constructor(e,i,r){var s;if(this.Gr=null,this.Zr=[],this.Qr=void 0,this.Jr=!1,this.Wr=new ei,this.Yr=(c,u)=>!(!Ce(c)||!Ce(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ne)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.Ur=e.persistence,this.Kr=void 0,this.Xr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ei=i||De,this.ti=r||De;var n=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*Re(this.Se.session_idle_timeout_seconds||1800,60,36e3,It.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ri(),this.ii="ph_"+n+"_window_id",this.ni="ph_"+n+"_primary_window_exists",this.si()){var o=oe.F(this.ii),a=oe.F(this.ni);o&&!a?this.Kr=o:oe.A(this.ii),oe.q(this.ni,!0)}if((s=this.Se.bootstrap)!=null&&s.sessionID)try{var l=(c=>{var u=this.Se.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.oi(this.Se.bootstrap.sessionID,new Date().getTime(),l)}catch(c){It.error("Invalid sessionID in bootstrap",c)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.Zr)&&(this.Zr=[]),this.Zr.push(e),this.Xr&&e(this.Xr,this.Kr),()=>{this.Zr=this.Zr.filter(i=>i!==e)}}si(){return this.Se.persistence!=="memory"&&!this.Ur.Vt&&oe.N()}li(e){e!==this.Kr&&(this.Kr=e,this.si()&&oe.q(this.ii,e))}ui(){return this.Kr?this.Kr:this.si()?oe.F(this.ii):null}hi(e){var i=this.Gr;return!ce(i)&&!ce(e)&&5e3>Math.abs(e-i)}oi(e,i,r){var s=i!==this._sessionActivityTimestamp,n=!(e!==this.Xr||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=i,this.Xr=e,n&&!s||n&&this.hi(i)||(this.Gr=i,this.Ur.register({[_t]:[i,e,r]}))}di(){var e,i=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Ce(i)&&i>0}ci(){this.di()?this.Ur.refreshKey(_t):(this.Ur.flush(),this.Ur.load())}vi(){var e;if(!ce(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Gr){this.ci();var[,i,r]=this.fi();i===this.Xr&&r===this._sessionStartTimestamp&&(this.Gr=this._sessionActivityTimestamp,this.Ur.register({[_t]:[this._sessionActivityTimestamp,(e=this.Xr)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ur.flush())}}pi(){var[e]=this.fi(),i=Ce(e)?e:0,r=Ce(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,r)}gi(e){return this.ci(),this.Yr(e,this.pi())}fi(){var e=this.Ur.props[_t];return N(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Gr=null,clearTimeout(this.mi),this.mi=void 0,this.oi(null,null,null)}destroy(){this.Jr=!0,this.vi(),clearTimeout(this.mi),this.mi=void 0,this.Qr&&v&&(v.removeEventListener(Fi,this.Qr,{capture:!1}),this.Qr=void 0),this.Zr=[]}ai(){this.Qr=()=>{this.vi(),this.si()&&oe.A(this.ni)},Y(v,Fi,this.Qr,{capture:!1})}checkAndGetSessionAndWindowId(e,i){if(e===void 0&&(e=!1),i===void 0&&(i=null),this.Se.cookieless_mode===Ne)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||new Date().getTime(),[,s,n]=this.fi(),o=this.pi(),a=this.ui(),l=Ce(n)&&Math.abs(r-n)>864e5,c=!1,u=!1,h=!s,p=s,d=!h&&!e&&this.Yr(r,o);d&&((d=this.gi(r))||It.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,n]=this.fi()),h||d||l?(s=this.ei(),a=this.ti(),It.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:h,activityTimeout:d,sessionPastMaximumLength:l}}),n=r,c=!0):(a||(a=this.ti(),c=!0),(u=s!==p)&&(It.info("adopted cross-tab session id",{sessionId:s,windowId:a}),c=!0));var g=Ce(o)&&e&&!l?o:r,_=Ce(n)?n:new Date().getTime();this.li(a),this.oi(s,g,_),e||this.ri();var y={noSessionId:h,activityTimeout:d,sessionPastMaximumLength:l,crossTabAdoption:u};return c&&this.Zr.forEach(f=>f(s,a,y)),{sessionId:s,windowId:a,sessionStartTimestamp:_,changeReason:c?y:void 0,lastActivityTimestamp:o}}ri(){this.Jr||(clearTimeout(this.mi),this.mi=setTimeout(()=>{if(!this.Jr)if(this.gi(new Date().getTime())){var e=this.Xr;this.resetSessionId(),this.Wr.emit("forcedIdleReset",{idleSessionId:e})}else this.ri()},1.1*this.sessionTimeoutMs))}},ca=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&sn(i,e))return!0;try{var r=t?.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>sn(s?.brand,e)))return!0}catch{}return!!t.webdriver},Hi=function(t,e){if(!(function(i){try{new RegExp(i)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Fn(t,e,i){return ft({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var ha={exact:(t,e)=>e.some(i=>t.some(r=>i===r)),is_not:(t,e)=>e.every(i=>t.every(r=>i!==r)),regex:(t,e)=>e.some(i=>t.some(r=>Hi(i,r))),not_regex:(t,e)=>e.every(i=>t.every(r=>!Hi(i,r))),icontains:(t,e)=>e.map(ci).some(i=>t.map(ci).some(r=>i.includes(r))),not_icontains:(t,e)=>e.map(ci).every(i=>t.map(ci).every(r=>!i.includes(r))),gt:(t,e)=>e.some(i=>{var r=parseFloat(i);return!isNaN(r)&&t.some(s=>r>parseFloat(s))}),lt:(t,e)=>e.some(i=>{var r=parseFloat(i);return!isNaN(r)&&t.some(s=>r<parseFloat(s))})},ci=t=>t.toLowerCase();function da(t,e){return!t||Object.entries(t).every(i=>{var[r,s]=i,n=e?.[r];if(b(n)||ce(n))return!1;var o=[String(n)],a=ha[s.operator];return!!a&&a(s.values,o)})}var Es="custom",$n="i.posthog.com",zl=/^\/static\//,xs=class{constructor(e){this.yi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,i=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+$n,".posthog.com")),i==="https://app.posthog.com"?"https://us.posthog.com":i}get region(){return this.yi[this.apiHost]||(this.yi[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":Es),this.yi[this.apiHost]}bi(e){if(zl.test(e)){var i=this.instance.config.asset_host;if(typeof i=="string")return i.trim().replace(/\/$/,"")||void 0}}endpointFor(e,i){if(i===void 0&&(i=""),i&&(i=i[0]==="/"?i:"/"+i),e==="ui")return this.uiHost+i;if(e==="flags")return this.flagsApiHost+i;if(e==="assets"){var r=this.bi(i);if(r)return""+r+i}if(this.region===Es)return this.apiHost+i;var s=$n+i;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}},q=Q("[Surveys]"),Ss="seenSurvey_",Wl=[nr.Popover,nr.Widget,nr.API],Gl={ignoreConditions:!1,ignoreDelay:!1,displayType:ds.Popover},Jl=Q("[PostHog ExternalIntegrations]"),Xl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},ks=class{constructor(e){this._instance=e}Mt(e,i){var r;(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,s=>{if(s)return Jl.error("failed to load script",s);i()})}startIfEnabledOrStop(){var e=this,i=function(o){var a,l,c;!s||(a=I.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.Mt(Xl[o],()=>{var u;(u=I.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)}),!s&&(l=I.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=I.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;i(r)}}},ht,Wt={},cr=0,Ps=()=>{},In='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ot="Surveys module not available",On="sanitize_properties is deprecated. Use before_send instead",pa="Invalid value for property_denylist config: ",gt="posthog",va=!jl&&ve?.indexOf("MSIE")===-1&&ve?.indexOf("Mozilla")===-1,Cn=t=>{var e;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ll(x?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ps,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:te&&G(te?.search)&&te.search.indexOf("__posthog_debug=true")!==-1||!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,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",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(i){E.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ss,before_send:void 0,request_queue_config:{flush_interval_ms:ms},error_tracking:{},_onCapture:Ps},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:fl,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:i&&i>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:i&&i>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:i&&i>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i)}))(t))},Kl=[["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"]],Mn=t=>{var e={};for(var[i,r]of Kl)b(t[i])||(e[r]=t[i]);var s=W({},e,t),n=t.__preview_external_dependency_versioned_paths;return b(n)||(b(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),G(n)&&b(t.asset_host)&&(s.asset_host=n)),N(t.property_blacklist)&&(b(t.property_denylist)?s.property_denylist=t.property_blacklist:N(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:E.error(pa+t.property_denylist)),s},Ts=class{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(e){E.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ot=class t{xi(e,i){if(e){var r=this.ki.indexOf(e);r!==-1&&this.ki.splice(r,1)}return this.ki.push(i),i.initialize==null||i.initialize(),i}Si(){return this.config.cookieless_mode===Ne||this.config.cookieless_mode===it&&this.consent.isRejected()}get decideEndpointWasHit(){var e,i;return(e=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,i;return(e=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Ts,this.Ci=!1,this.version=ee.LIB_VERSION,this.Ii=new ei,this.ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Cn(),this.SentryIntegration=hs,this.sentryIntegration=r=>(function(s,n){var o=Ko(s,n);return{name:Xo,processEvent:a=>o(a)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ti=!1,this.Ei=null,this.Mi=null,this.Pi=null,this.scrollManager=new ws(this),this.pageViewManager=new Oi(this),this.rateLimiter=new ps(this),this.requestRouter=new xs(this),this.consent=new ls(this),this.externalIntegrations=new ks(this);var i=(e=t.__defaultExtensionClasses)!==null&&e!==void 0?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.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(r,s,n)=>{var o=G(r)?{[r]:s}:r;this.setPersonProperties(o),n?.({})},set_once:(r,s,n)=>{var o=G(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",r=>E.info('send "'+r?.event+'"',r))}init(e,i,r){if(r&&r!==gt){var s,n=(s=Wt[r])!==null&&s!==void 0?s:new t;return n._init(e,i,r),Wt[r]=n,Wt[gt][r]=n,n}return this._init(e,i,r)}_init(e,i,r){var s,n;i===void 0&&(i={});var o=G(e)?e.trim():"";if(!o)return E.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},i.debug=this.Ri(i.debug),this.Oi=i,this.Li=[],i.person_profiles?this.Mi=i.person_profiles:i.process_person&&(this.Mi=i.process_person);var a=Cn(i.defaults),l=Mn(i),c=W({},a,l,{name:r,token:o});X(a.rageclick)&&X(l.rageclick)&&(c.rageclick=W({},a.rageclick,l.rageclick)),X(a.session_recording)&&X(l.session_recording)&&(c.session_recording=W({},a.session_recording,l.session_recording)),this.set_config(c),this.config.on_xhr_error&&E.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Pe.GZipJS;var u=this.Fi();this.persistence=new Vt(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vt(m({},this.config,{persistence:"sessionStorage"}),u,!1);var h=m({},this.persistence.props),p=m({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ai=new ys(S=>this.$i(S),this.config.request_queue_config),this.Di=new bs(this),this.__request_queue=[];var d=this.Si();if(d||(this.sessionManager=new ji(this),this.sessionPropsManager=new Ui(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(E.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Ni(d)},0)):(E.info("Initializing extensions synchronously"),this.Ni(d)),ee.DEBUG=ee.DEBUG||this.config.debug,ee.DEBUG&&E.info("Starting in debug mode",{this:this,config:i,thisC:m({},this.config),p:h,s:p}),!this.config.identity_distinct_id||(s=i.bootstrap)!=null&&s.distinctID||(i.bootstrap=m({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=i.bootstrap)==null?void 0:n.distinctID)!==void 0){var g=i.bootstrap.distinctID,_=this.get_distinct_id(),y=this.persistence.get_property(xe);if(i.bootstrap.isIdentifiedID&&_!=null&&_!==g&&y===lt)this.identify(g);else if(i.bootstrap.isIdentifiedID&&_!=null&&_!==g&&y===ut)E.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var f=this.config.get_device_id(De()),T=i.bootstrap.isIdentifiedID?f:g;this.persistence.set_property(xe,i.bootstrap.isIdentifiedID?ut:lt),this.register({distinct_id:g,$device_id:T})}}if(d)this.register_once({distinct_id:si,$device_id:null},"");else if(!this.get_distinct_id()){var P=this.config.get_device_id(De());this.register_once({distinct_id:P,$device_id:P},""),this.persistence.set_property(xe,lt)}return Y(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?(function(S,F){var A=S.config.segment;if(!A)return F();(function(w,k){var R=w.config.segment;if(!R)return k();var $=M=>{var U=()=>M.anonymousId()||De();w.config.get_device_id=U,M.id()&&(w.register({distinct_id:M.id(),$device_id:U()}),w.persistence.set_property(xe,ut)),k()},O=R.user();"then"in O&&Le(O.then)?O.then($):$(O)})(S,()=>{A.register((w=>{Promise&&Promise.resolve||sr.warn("This browser does not have Promise support, and can not use the segment integration");var k=(R,$)=>{if(!$)return R;R.event.userId||R.event.anonymousId===w.get_distinct_id()||(sr.info("No userId set, resetting PostHog"),w.reset()),R.event.userId&&R.event.userId!==w.get_distinct_id()&&(sr.info("UserId set, identifying with PostHog"),w.identify(R.event.userId));var O=w.calculateEventProperties($,R.event.properties);return R.event.properties=Object.assign({},O,R.event.properties),R};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:R=>k(R,R.event.event),page:R=>k(R,vt),identify:R=>k(R,tr),screen:R=>k(R,"$screen")}})(S)).then(()=>{F()})})})(this,()=>this.qi()):this.qi(),Le(this.config._onCapture)&&this.config._onCapture!==Ps&&(E.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&E.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ni(e){var i,r,s,n,o,a,l,c=performance.now(),u=m({},t.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.ki.push(this.featureFlags=(i=this.featureFlags)!==null&&i!==void 0?i:new u.featureFlags(this)),u.exceptions&&this.ki.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new u.exceptions(this)),u.historyAutocapture&&this.ki.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ki.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ki.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.ki.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.ki.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.ki.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.ki.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.ki.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new u.conversations(this)),u.productTours&&this.ki.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ki.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ki.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ki.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ki.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,kl)),u.toolbar&&this.ki.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new u.toolbar(this)),u.experiments&&this.ki.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.ki.forEach(p=>{p.initialize&&h.push(()=>{p.initialize==null||p.initialize()})}),h.push(()=>{if(this.Bi){var p=this.Bi;this.Bi=void 0,this.pr(p)}}),this.ji(h,c)}ji(e,i){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&e.length>0)return void setTimeout(()=>{this.ji(e,i)},0);var r=e.shift();if(r)try{r()}catch(n){E.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-i);this.register_for_session({[Mo]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ao]:s}),this.config.__preview_deferred_init_extensions&&E.info("PostHog extensions initialized ("+s+"ms)")}pr(e){var i;if(!x||!x.body)return E.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.pr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Bi=e),this.Hi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=C(e.supportedCompression,Pe.GZipJS)?Pe.GZipJS:C(e.supportedCompression,Pe.Base64)?Pe.Base64:void 0),(i=e.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Mi?this.Mi:ss}),this.ki.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}qi(){try{this.config.loaded(this)}catch(r){E.critical("`loaded` function failed",r)}if(this.Ui(),this.config.internal_or_test_user_hostname&&te!=null&&te.hostname){var e=te.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?e===i:i.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Si())&&this.zi()},1),this.Vi=new Li(this),this.Vi.load()}Ui(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ai)==null||e.enable())}_dom_loaded(){this.is_capturing()&&ni(this.__request_queue,e=>this.$i(e)),this.__request_queue=[],this.Ui()}_handle_unload(){var e,i,r,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),this.config.request_batching?(this.Wi()&&this.capture(er),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.Ai)==null||r.unload(),(s=this.Di)==null||s.unload()):this.Wi()&&this.capture(er,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?va?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=m({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(b(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(i=>{var r,s,n,o=m({},i);o.timeout=o.timeout||6e4,o.url=Rn(o.url,o.compression);var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=_i.filter(u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport)),c=(s=(n=(function(u,h){for(var p=0;u.length>p;p++)if(u[p].transport===a)return u[p]})(l))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===Pe.GZipJS&&ba&&!gi?ql(o).then(u=>{c(u)}).catch(u=>{if(rn(u))return gi=!0,void c(m({},o,{compression:void 0,url:Rn(i.url,void 0)}));(h=>{if(!h||typeof h!="object")return!1;var p="name"in h?String(h.name):"";return rn(h)||p===Jn})(u)&&(gi=!0),c(o)}):c(o)})(m({},e,{callback:i=>{var r,s;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,i),e.callback==null||e.callback(i)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}$i(e){this.Di?this.Di.retriableRequest(e):this._send_request(e)}_execute_array(e){cr++;try{var i,r=[],s=[],n=[];ni(e,a=>{if(a)if(N(i=a[0]))n.push(a);else if(Le(a))try{a.call(this)}catch(l){E.error("Error executing queued PostHog call",a,l)}else N(a)&&i==="alias"?r.push(a):N(a)&&i.indexOf("capture")!==-1&&Le(this[i])?n.push(a):s.push(a)});var o=function(a,l){ni(a,function(c){try{if(N(c[0])){var u=l;z(c,function(h){u=u[h[0]].apply(u,h.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(h){E.error("Error executing queued PostHog call",c,h)}})};o(r,this),o(s,this),o(n,this)}finally{cr--}}push(e){if(cr>0&&N(e)&&G(e[0])){var i=t.prototype[e[0]];Le(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,i,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ai){if(this.is_capturing())if(!b(e)&&G(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){i!=null&&i.$current_url&&!G(i?.$current_url)&&(E.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),e!=="$exception"||r!=null&&r.Gi||E.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,p=r?.timestamp||h,d=ln(r?.uuid,De),g={uuid:d,event:e,properties:this.calculateEventProperties(e,i||{},p,d)};e===vt&&this.config.__preview_capture_bot_pageviews&&c&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),u&&(g.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),r?.$set&&(g.$set=r?.$set);var _=r?.$unset;_&&(g.$unset=_);var y,f,T,P=this.Zi(r?.$set_once,e!==hn,e===tr);if(P&&(g.$set_once=P),r!=null&&r._noTruncate||(n=this.config.properties_string_max_length,o=g,a=$=>G($)?$.slice(0,n):$,l=new Set,g=(function $(O,M){return O!==Object(O)?a?a(O):O:l.has(O)?void 0:(l.add(O),N(O)?(U=[],ni(O,D=>{U.push($(D))})):(U={},z(O,(D,j)=>{l.has(D)||(U[j]=$(D,j))})),U);var U})(o)),g.timestamp=p,b(r?.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=h),e===Ue.DISMISSED||e===Ue.SENT){var S=i?.[or.SURVEY_ID],F=i?.[or.SURVEY_ITERATION];($=>{try{var O=(M=>((U,D)=>{var j=""+Ss+D.id;return D.current_iteration&&D.current_iteration>0&&(j=""+Ss+D.id+"_"+D.current_iteration),j})(0,M))($);if(localStorage.getItem(O))return;localStorage.setItem(O,"true")}catch(M){q.error("Failed to persist survey seen state",M)}})({id:S,current_iteration:F}),g.$set=m({},g.$set,{[(y={id:S,current_iteration:F},f=e===Ue.SENT?"responded":"dismissed",T="$survey_"+f+"/"+y.id,y.current_iteration&&y.current_iteration>0&&(T="$survey_"+f+"/"+y.id+"/"+y.current_iteration),T)]:!0})}else e===Ue.SHOWN&&(g.$set=m({},g.$set,{[or.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Ml.SHOWN){var A=i?.[En.TOUR_TYPE];A&&(g.$set=m({},g.$set,{[En.TOUR_LAST_SEEN_DATE+"/"+A]:new Date().toISOString()}))}var w=m({},g.properties.$set,g.$set);if(ze(w)||this.setPersonPropertiesForFlags(w),!L(this.config.before_send)){var k=this.it(g);if(!k)return;(g=k).uuid=ln(g.uuid,De)}this.Ii.emit("eventCaptured",g);var R={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:g,compression:"best-available",batchKey:r?._batchKey,transport:r?.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.$i(R):this.Ai.enqueue(R),g}E.critical("This capture call is ignored due to client rate limiting.")}}else E.error("No event name provided to posthog.capture")}else E.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",i=>e(i.event,i))}calculateEventProperties(e,i,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var o=n?void 0:this.persistence.remove_event_timer(e),a=m({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Si()&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=m({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!G(a.distinct_id)&&!he(a.distinct_id)||xr(a.distinct_id))&&E.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=(function(f,T,P,S){var F,A,w,k;if(S===void 0&&(S=!1),!ve)return{};var R,$,O,M,U,D,j,B,H,ae=f?[...xt,...T||[]]:[],[ye,be]=(function(de){for(var le=0;on.length>le;le++){var[He,qe]=on[le],pe=He.exec(de),Se=pe&&(Le(qe)?qe(pe,de):qe);if(Se)return Se}return["",""]})(ve),Z=(R=typeof navigator<"u"?navigator:void 0)!=null&&R.brave?{brave:!0}:{},ge={detectGoogleSearchApp:P},re=W(qs({$os:ye,$os_version:be,$browser:mo(ve,navigator.vendor,Z,ge),$device:an(ve),$device_type:(O=ve,M={userAgentDataPlatform:(F=navigator)==null||(F=F.userAgentData)==null?void 0:F.platform,maxTouchPoints:(A=navigator)==null?void 0:A.maxTouchPoints,screenWidth:v==null||(w=v.screen)==null?void 0:w.width,screenHeight:v==null||(k=v.screen)==null?void 0:k.height,devicePixelRatio:v?.devicePixelRatio},H=an(O),H===Zn||H===Yn||H==="Kobo"||H==="Kindle Fire"||H===po?bt:H===Gt||H===yt||H===Jt||H===Pr?"Console":H===to?"Wearable":H?me:M?.userAgentDataPlatform==="Android"&&((U=M?.maxTouchPoints)!==null&&U!==void 0?U:0)>0?600>Math.min((D=M?.screenWidth)!==null&&D!==void 0?D:0,(j=M?.screenHeight)!==null&&j!==void 0?j:0)/((B=M?.devicePixelRatio)!==null&&B!==void 0?B:1)?me:bt:"Desktop"),$timezone:ra(),$timezone_offset:$l()}),{$current_url:Yt(S?We(te?.href):te?.href,ae,Zt),$host:te?.host,$pathname:te?.pathname,$raw_user_agent:ve.length>1e3?ve.substring(0,997)+"...":ve,$browser_version:Ha(ve,navigator.vendor,Z,ge),$browser_language:wn(),$browser_language_prefix:($=wn(),typeof $=="string"?$.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:ee.LIB_NAME,$lib_version:ee.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ee.SDK_DIST_CHANNEL&&(re.$sdk_dist_channel=ee.SDK_DIST_CHANNEL),re})(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{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=h,a.$window_id=p}this.sessionPropsManager&&W(a,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&W(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(d=this.Di)==null?void 0:d.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}if(this.requestRouter.region===Es&&(a.$lib_custom_api_host=this.config.api_host),c=e!==vt||n?e!==er||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=W(a,c),e===vt&&x&&(a.title=x.title),!b(o)){var g=r.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}ve&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=W({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),N(this.config.property_denylist)?z(this.config.property_denylist,function(f){delete a[f]}):E.error(pa+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(E.error(On),a=_(a,e));var y=this.Qi();return a.$process_person_profile=y,y&&!n&&this.Ji("_calculate_event_properties"),a}Zi(e,i,r){var s;if(i===void 0&&(i=!0),r===void 0&&(r=!1),!this.persistence||!this.Qi()||this.Ci&&!r)return e;var n=this.persistence.get_initial_props(),o=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),a=W({},n,o||{},e||{}),l=this.config.sanitize_properties;return l&&(E.error(On),a=l(a,"$set_once")),i&&(this.Ci=!0),ze(a)?void 0:a}register(e,i){var r;(r=this.persistence)==null||r.register(e,i)}register_once(e,i,r){var s;(s=this.persistence)==null||s.register_once(e,i,r)}register_for_session(e){var i;(i=this.sessionPersistence)==null||i.register(e)}unregister(e){var i;(i=this.persistence)==null||i.unregister(e)}unregister_for_session(e){var i;(i=this.sessionPersistence)==null||i.unregister(e)}Yi(e,i){this.register({[e]:i})}getFeatureFlag(e,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,i)}getFeatureFlagPayload(e){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagPayload(e)}getFeatureFlagResult(e,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,i)}isFeatureEnabled(e,i){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,i)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,i,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,i,r)}updateEarlyAccessFeatureEnrollment(e,i,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,i,r)}getEarlyAccessFeatures(e,i,r){var s;return i===void 0&&(i=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,i,r)}on(e,i){return this.Ii.on(e,i)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Ot}),()=>{})}onSessionId(e){var i,r;return(i=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&i!==void 0?i:()=>{}}getSurveys(e,i){i===void 0&&(i=!1),this.surveys?this.surveys.getSurveys(e,i):e([],{isLoaded:!1,error:Ot})}getActiveMatchingSurveys(e,i){i===void 0&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,i):e([],{isLoaded:!1,error:Ot})}renderSurvey(e,i){var r;(r=this.surveys)==null||r.renderSurvey(e,i)}displaySurvey(e,i){var r;i===void 0&&(i=Gl),(r=this.surveys)==null||r.displaySurvey(e,i)}cancelPendingSurvey(e){var i;(i=this.surveys)==null||i.cancelPendingSurvey(e)}canRenderSurvey(e){var i,r;return(i=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&i!==void 0?i:{visible:!1,disabledReason:Ot}}canRenderSurveyAsync(e,i){var r,s;return i===void 0&&(i=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,i))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Ot})}Ki(e){return!e||xr(e)?(E.critical("Unique user id has not been set in posthog.identify"),!1):e===si?(E.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(E.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,i,r){if(!this.__loaded||!this.persistence)return E.uninitializedWarning("posthog.identify");if(he(e)&&(e=e.toString(),E.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ki(e)&&this.Ji("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ki)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(Lt)&&(this.unregister(Lt),this.register({distinct_id:e}));var n,o=(this.persistence.get_property(xe)||lt)===lt;e!==s&&o?(this.persistence.set_property(xe,ut),this.setPersonPropertiesForFlags({$set:i||{},$set_once:r||{}},!1),this.capture(tr,{distinct_id:e,$anon_distinct_id:s},{$set:i||{},$set_once:r||{}}),this.Pi=Fn(e,i,r),(n=this.featureFlags)==null||n.setAnonymousDistinctId(s)):(i||r)&&this.setPersonProperties(i,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(qt))}}setPersonProperties(e,i){if((e||i)&&this.Ji("posthog.setPersonProperties")){var r=Fn(this.get_distinct_id(),e,i);this.Pi!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!0),this.capture("$set",{$set:e||{},$set_once:i||{}}),this.Pi=r):E.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var i,r=(N(e)?e:[e]).filter(s=>G(s)&&s.length>0);r.length!==0&&this.Ji("posthog.unsetPersonProperties")&&((i=this.featureFlags)==null||i.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Pi=null)}group(e,i,r){if(e&&i){var s=this.getGroups(),n=s[e]!==i;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:m({},s,{[e]:i})}),n||r){var o={$group_type:e,$group_key:i};r&&(o.$group_set=r),this.capture(hn,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else E.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,i){var r;i===void 0&&(i=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,i)}resetPersonPropertiesForFlags(e){var i;e===void 0&&(e=!0),(i=this.featureFlags)==null||i.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,i){var r;i===void 0&&(i=!0),this.Ji("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,i))}resetGroupPropertiesForFlags(e){var i;(i=this.featureFlags)==null||i.resetGroupPropertiesForFlags(e)}reset(e){var i,r,s,n,o,a,l,c,u;if(E.info("reset"),!this.__loaded)return E.uninitializedWarning("posthog.reset");var h,p=this.get_property(ki),d=this.get_property(st);if(this.consent.reset(),(i=this.persistence)==null||i.clear(),(r=this.sessionPersistence)==null||r.clear(),b(d)||(h=this.persistence)==null||h.register({[st]:d}),(s=this.surveys)==null||s.reset(),(n=this.Vi)==null||n.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(l=this.logs)==null||l.reset(),(c=this.persistence)==null||c.set_property(xe,lt),(u=this.sessionManager)==null||u.resetSessionId(),this.Pi=null,this.config.cookieless_mode===Ne)this.register_once({distinct_id:si,$device_id:null},"");else{var g=this.config.get_device_id(De());this.register_once({distinct_id:g,$device_id:e?g:p},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,i){var r;this.config.identity_distinct_id=e,this.config.identity_hash=i,this.alias(e),(r=this.conversations)==null||r.Xi()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.en()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,i;return(e=(i=this.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(e!=null&&e.withTimestamp&&r){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,i){return e===this.get_property(To)?(E.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ji("posthog.alias")?(b(i)&&(i=this.get_distinct_id()),e!==i?(this.Yi(Lt,e),this.capture("$create_alias",{alias:e,distinct_id:i})):(E.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var i=m({},this.config);if(X(e)){var r,s,n,o,a,l,c,u,h,p,d;W(this.config,Mn(e));var g=this.Fi();(r=this.persistence)==null||r.update_config(this.config,i,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vt(m({},this.config,{persistence:"sessionStorage"}),g,!1);var _=this.Ri(this.config.debug);Fe(_)&&(this.config.debug=_),Fe(this.config.debug)&&(this.config.debug?(ee.DEBUG=!0,V.N()&&V.q("ph_debug",!0),E.info("set_config",{config:e,oldConfig:i,newConfig:m({},this.config)})):(ee.DEBUG=!1,V.N()&&V.A("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.tracingHeaders)==null||a.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(u=this.exceptionObserver)==null||u.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(p=this.surveys)==null||p.loadIfEnabled(),this.tn(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,i){ee.LIB_NAME=e,ee.LIB_VERSION=i}startSessionRecording(e){var i,r,s,n,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(m({},s,i))}}addExceptionStep(e,i){var r;(r=this.exceptions)==null||r.addExceptionStep(e,i)}captureLog(e){var i;(i=this.logs)==null||i.captureLog(e)}get logger(){var e,i;return(e=(i=this.logs)==null?void 0:i.logger)!==null&&e!==void 0?e:t.rn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var i,r;return(i=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&i!==void 0&&i}get_property(e){var i;return(i=this.persistence)==null?void 0:i.props[e]}getSessionProperty(e){var i;return(i=this.sessionPersistence)==null?void 0:i.props[e]}toString(){var e,i=(e=this.config.name)!==null&&e!==void 0?e:gt;return i!==gt&&(i=gt+"."+i),i}_isIdentified(){var e,i;return((e=this.persistence)==null?void 0:e.get_property(xe))===ut||((i=this.sessionPersistence)==null?void 0:i.get_property(xe))===ut}Qi(){var e,i;return!(this.config.person_profiles==="never"||this.config.person_profiles===ss&&!this._isIdentified()&&ze(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Lt])&&((i=this.persistence)==null||(i=i.props)==null||!i[Ti]))}Wi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Qi()||this.Ji("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ji("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ji(e){return this.config.person_profiles==="never"?(E.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Yi(Ti,!0),!0)}Fi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==it)}tn(){var e,i,r,s,n=this.Fi();return((e=this.persistence)==null?void 0:e.Vt)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((i=this.sessionPersistence)==null?void 0:i.Vt)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var i;if(this.config.cookieless_mode!==Ne){if(this.Si()){var r,s,n,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new ji(this),this.pageViewManager=new Oi(this),this.persistence&&(this.sessionPropsManager=new Ui(this,this.sessionManager,this.persistence));var l,c=(n=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&n!==void 0?n:(a=t.__defaultExtensionClasses)==null?void 0:a.sessionRecording;c&&(this.sessionRecording=this.xi(this.sessionRecording,new c(this)),this.Hi&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Hi)))}var u,h;this.consent.optInOut(!0),this.tn(),this.Ui(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),this.config.cookieless_mode==it&&((u=this.surveys)==null||u.loadIfEnabled()),(b(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.zi()}else E.warn(In)}opt_out_capturing(){var e,i,r;this.config.cookieless_mode!==Ne?(this.config.cookieless_mode===it&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===it&&(this.register({distinct_id:si,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.zi(),this.Ui())):E.warn(In)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ne||(this.config.cookieless_mode===it?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return _e?ca(_e,this.config.custom_blocked_useragents):void 0}zi(){x&&(x.visibilityState==="visible"?this.Ti||(this.Ti=!0,this.capture(vt,{title:x.title},{send_instantly:!0}),this.Ei&&(x.removeEventListener(Ri,this.Ei),this.Ei=null)):this.Ei||(this.Ei=this.zi.bind(this),Y(x,Ri,this.Ei)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.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}))}mr(){var e,i,r,s,n,o,a=this.Oi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(E.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",s=E,n=(i="advanced_disable_flags")in(e=a)&&!L(e[i]),o=r in e&&!L(e[r]),n?e[i]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),e[r]))}it(e){var i;if(L(this.config.before_send))return e;var r=Object.keys((i=e.properties)!==null&&i!==void 0?i:{}).filter($a),s=N(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var o of s){if(n=o(n),L(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return Fa(e.event)?E.warn(a+". This can cause unexpected behavior."):E.info(a),null}n.properties&&!ze(n.properties)||E.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of r)if(n.properties&&L(n.properties[l]))return E.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return(e=this.pageViewManager.Ot)==null?void 0:e.pageViewId}captureTraceFeedback(e,i){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:i})}captureTraceMetric(e,i,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:i,$ai_metric_value:String(r)})}Ri(e){var i=Fe(e)&&!e,r=V.N()&&V.P("ph_debug")==="true";return!i&&(!!r||e)}};ot.__defaultExtensionClasses={},ot.rn={trace:ht=()=>{},debug:ht,info:ht,warn:ht,error:ht,fatal:ht},(function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=ol(t.prototype[e[i]])})(ot,["identify"]);var qi=class{constructor(e){this.disabled=e===!1;var i=X(e)?e:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(e,i,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:i,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:i,timestamp:r}];return!1}},hr="$copy_autocapture",dr=Q("[AutoCapture]");function pr(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ql(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Ge(e));return e}function Yl(t,e){var i,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l,disableCaptureUrlHashes:c}=e;if(!Ge(t))return{props:{}};for(var u=[t],h=t;h.parentNode&&!fe(h,"body");)if(jo(h.parentNode))u.push(h.parentNode.host),h=h.parentNode.host;else{if(!Ge(h.parentNode))break;u.push(h.parentNode),h=h.parentNode}var p,d,g=[],_={},y=!1,f=!1;if(z(u,A=>{var w=cs(A);if(fe(A,"a")){var k=A.getAttribute("href");y=!!(w&&k&&Bt(k))&&(c?We(k):k)}C($i(A),"ph-no-capture")&&(f=!0),g.push((function($,O,M,U,D){D===void 0&&(D=!1);var j=$.tagName.toLowerCase(),B={tag_name:j};Vs.indexOf(j)>-1&&!M&&(B.$el_text=j.toLowerCase()==="a"||j.toLowerCase()==="button"?pr(1024,yn($)):pr(1024,Kt($)));var H=$i($);H.length>0&&(B.classes=H.filter(function(Z){return Z!==""})),z($.attributes,function(Z){var ge;if((!zo($)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&(U==null||!U.includes(Z.name))&&!O&&Bt(Z.value)&&(!G(ge=Z.name)||ge.substring(0,10)!=="_ngcontent"&&ge.substring(0,7)!=="_nghost")){var re=Z.value;Z.name==="class"&&(re=Bs(re).join(" ")),B["attr__"+Z.name]=pr(1024,Z.name==="href"&&D?We(re):re)}});for(var ae=1,ye=1,be=$;be=Ql(be);)ae++,be.tagName===$.tagName&&ye++;return B.nth_child=ae,B.nth_of_type=ye,B})(A,n,o,a,c));var R=(function($){if(!cs($))return{};var O={};return z($.attributes,function(M){if(M.name&&M.name.indexOf("data-ph-capture-attribute")===0){var U=M.name.replace("data-ph-capture-attribute-",""),D=M.value;U&&D&&Bt(D)&&(O[U]=D)}}),O})(A);W(_,R)}),f)return{props:{},explicitNoCapture:f};if(o||(g[0].$el_text=fe(t,"a")||fe(t,"button")?yn(t):Kt(t)),y){var T,P;g[0].attr__href=y;var S=(T=Ci(y))==null?void 0:T.host,F=v==null||(P=v.location)==null?void 0:P.host;S&&F&&S!==F&&(p=y)}return{props:W({$event_type:s.type,$ce_version:1},l?{}:{$elements:g},{$elements_chain:(d=g,(function(A){return A.map(w=>{var k,R,$="";if(w.tag_name&&($+=w.tag_name),w.attr_class)for(var O of(w.attr_class.sort(),w.attr_class))$+="."+O.replace(/"/g,"");var M=m({},w.text?{text:w.text}:{},{"nth-child":(k=w.nth_child)!==null&&k!==void 0?k:0,"nth-of-type":(R=w.nth_of_type)!==null&&R!==void 0?R:0},w.href?{href:w.href}:{},w.attr_id?{attr_id:w.attr_id}:{},w.attributes),U={};return vi(M).sort((D,j)=>{var[B]=D,[H]=j;return B.localeCompare(H)}).forEach(D=>{var[j,B]=D;return U[bn(j.toString())]=bn(B.toString())}),($+=":")+vi(U).map(D=>{var[j,B]=D;return j+'="'+B+'"'}).join("")}).join(";")})((function(A){return A.map(w=>{var k,R,$={text:(k=w.$el_text)==null?void 0:k.slice(0,400),tag_name:w.tag_name,href:(R=w.attr__href)==null?void 0:R.slice(0,2048),attr_class:xl(w),attr_id:w.attr__id,nth_child:w.nth_child,nth_of_type:w.nth_of_type,attributes:{}};return vi(w).filter(O=>{var[M]=O;return M.indexOf("attr__")===0}).forEach(O=>{var[M,U]=O;return $.attributes[M]=U}),$})})(d)))},(i=g[0])!=null&&i.$el_text?{$el_text:(r=g[0])==null?void 0:r.$el_text}:{},p&&s.type==="click"?{$external_click_url:p}:{},_)}}var Ct=Q("[ExceptionAutocapture]"),Zl=Q("[TracingHeaders]"),Qe=Q("[Web Vitals]"),An=9e5,Ln="disabled",Dn="lazy_loading",Mt="awaiting_config",hi="missing_config";Q("[SessionRecording]"),Q("[SessionRecording]");var Rs="[SessionRecording]",Ie=Q(Rs),eu=Q("[Heatmaps]");function Nn(t){return X(t)&&"clientX"in t&&"clientY"in t&&he(t.clientX)&&he(t.clientY)}var vr=Q("[Product Tours]"),gr=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Us))},tu=["$set_once","$set"],ke=Q("[SiteApps]"),Un="Error while initializing PostHog app with config id ";function dt(t,e,i){if(L(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var Fs=class{constructor(e){this.nn=new ei,this.sn=(i,r)=>this.an(i,r)&&this.ln(i,r)&&this.un(i,r)&&this.hn(i,r),this.an=(i,r)=>r==null||!r.event||i?.event===r?.event,this._instance=e,this.dn=new Set,this.cn=new Set}init(){var e,i;b((e=this._instance)==null?void 0:e._addCaptureHook)||(i=this._instance)==null||i._addCaptureHook((r,s)=>{this.on(r,s)})}register(e){var i,r;if(!b((i=this._instance)==null?void 0:i._addCaptureHook)&&(e.forEach(o=>{var a,l;(a=this.cn)==null||a.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.dn)==null||u.add(c?.event||"")})}),(r=this._instance)!=null&&r.autocapture)){var s,n=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&n.add(l?.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,i){var r;i!=null&&e.length!=0&&(this.dn.has(e)||this.dn.has(i?.event))&&this.cn&&((r=this.cn)==null?void 0:r.size)>0&&this.cn.forEach(s=>{this.vn(i,s)&&this.nn.emit("actionCaptured",s.name)})}fn(e){this.onAction("actionCaptured",i=>e(i))}vn(e,i){if(i?.steps==null)return!1;for(var r of i.steps)if(this.sn(e,r))return!0;return!1}onAction(e,i){return this.nn.on(e,i)}ln(e,i){if(i!=null&&i.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!dt(s,i.url,i.url_matching||"contains"))return!1}return!0}un(e,i){return!!this.pn(e,i)&&!!this.gn(e,i)&&!!this.mn(e,i)}pn(e,i){var r;if(i==null||!i.href)return!0;var s=this.yn(e);if(s.length>0)return s.some(a=>dt(a.href,i.href,i.href_matching||"exact"));var n,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&dt((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",i.href,i.href_matching||"exact")}gn(e,i){var r;if(i==null||!i.text)return!0;var s=this.yn(e);if(s.length>0)return s.some(c=>dt(c.text,i.text,i.text_matching||"exact")||dt(c.$el_text,i.text,i.text_matching||"exact"));var n,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],p=/(?::|")text="(.*?)"/g;!L(u=p.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),o=i.text,a=i.text_matching||"exact",n.some(c=>dt(c,o,a)))}mn(e,i){var r,s;if(i==null||!i.selector)return!0;var n=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(n!=null&&n.includes(i.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(i.selector_regex&&o)try{return new RegExp(i.selector_regex).test(o)}catch{return!1}return!1}yn(e){var i;return(e==null||(i=e.properties)==null?void 0:i.$elements)==null?[]:e?.properties.$elements}hn(e,i){return i==null||!i.properties||i.properties.length===0||da(i.properties.reduce((r,s)=>{var n=N(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r},{}),e?.properties)}},$s=class{constructor(e){this.bn=[],this._instance=e,this._n=new Map,this.wn=new Map,this.xn=new Map}kn(e,i){return!!e&&da(e.propertyFilters,i?.properties)}Sn(e,i){var r=new Map;return e.forEach(s=>{var n;(n=s.conditions)==null||(n=n[i])==null||(n=n.values)==null||n.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}})}),r}Cn(e,i,r){var s=(r===Tt.Activation?this._n:this.wn).get(e),n=[];return this.In(o=>{n=o.filter(a=>s?.includes(a.id))}),n.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(c=>c.name===e);return this.kn(l,i)})}register(e){var i;b((i=this._instance)==null?void 0:i._addCaptureHook)||(this.Tn(e),this.En(e))}En(e){var i=e.filter(r=>{var s,n;return((s=r.conditions)==null?void 0:s.actions)&&((n=r.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0});i.length!==0&&(this.Mn==null&&(this.Mn=new Fs(this._instance),this.Mn.init(),this.Mn.fn(r=>{this.onAction(r)})),i.forEach(r=>{var s,n,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(n=r.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Mn)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.xn.get(c.name);u&&u.push(r.id),this.xn.set(c.name,u||[r.id])}}))}))}Tn(e){var i,r=e.filter(n=>{var o,a;return((o=n.conditions)==null?void 0:o.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),s=e.filter(n=>{var o,a;return((o=n.conditions)==null?void 0:o.cancelEvents)&&((a=n.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&s.length===0||((i=this._instance)==null||i._addCaptureHook((n,o)=>{this.onEvent(n,o)}),this._n=this.Sn(e,Tt.Activation),this.wn=this.Sn(e,Tt.Cancellation))}onEvent(e,i){var r,s,n=this.Pn(),o=(i==null||(r=i.properties)==null?void 0:r.$survey_id)||(i==null||(s=i.properties)==null?void 0:s.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.Rn(e,o);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.On([o]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:o}),void this.Ln(o)}if(this.wn.has(e)){var l=this.Cn(e,i,Tt.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map(u=>u.id)}),this.On(l.map(u=>u.id)),l.forEach(u=>this.Fn(u.id)))}if(this._n.has(e)){n.info("event name matched",{event:e,eventPayload:i,items:this._n.get(e)});var c=this.Cn(e,i,Tt.Activation);this.An(c.map(u=>u.id))}}onAction(e){this.xn.has(e)&&this.An(this.xn.get(e)||[])}An(e){e.length!==0&&(this.bn=[...new Set([...this.bn,...e])],this.Pn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Ln(e){this.bn=this.bn.filter(r=>r!==e);var i=this.$n();i.includes(e)||this.Dn([...i,e])}On(e){var i=new Set(e);this.bn=this.bn.filter(n=>!i.has(n));var r=this.$n(),s=r.filter(n=>!i.has(n));s.length!==r.length&&this.Dn(s)}$n(){var e,i=this.Nn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[i])||[]}getActivatedIds(){return[...new Set([...this.$n(),...this.bn])].filter(e=>!this.qn(e))}reset(){this.bn=[],this.$n().length>0&&this.Dn([])}getEventToItemsMap(){return this._n}Bn(){return this.Mn}},Is=class extends $s{constructor(e){super(e)}Nn(){return Kr}jn(){return Ue.SHOWN}In(e){var i;(i=this._instance)==null||i.getSurveys(e)}Fn(e){var i;(i=this._instance)==null||i.cancelPendingSurvey(e)}Pn(){return q}Dn(e){var i;(i=this._instance)==null||(i=i.persistence)==null||i.register({[Kr]:e})}qn(){return!1}Rn(e,i){var r;this.In(n=>{r=n.find(o=>o.id===i)});var s=!r||(function(n){var o,a,l,c=((o=(a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)!==null&&o!==void 0?o:0)>0;return n.schedule===Cl.Always||!((l=n.conditions)==null||(l=l.events)==null||!l.repeatedActivation||!c)})(r);return s?e===Ue.SHOWN?"consume":"ignore":e===Ue.SHOWN?"persist":e===Ue.DISMISSED||e===Ue.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},_r="SDK is not enabled or survey functionality is not yet loaded",jn="Disabled. Not loading surveys.",iu=v!=null&&v.location?Mi(v.location.hash,"__posthog")||Mi(location.hash,"state"):null,Hn="_postHogToolbarParams",qn=Q("[Toolbar]"),ne=Q("[FeatureFlags]"),Ye=Q("[FeatureFlags]",{debugEnabled:!0}),fr=`" failed. Feature flags didn't load in time.`,Bn=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Vn=t=>{var e={};for(var[i,r]of vi(t||{}))r&&(e[i]=r);return e},Oe=Q("[Error tracking]"),zn="Refusing to render web experiment since the viewer is a likely bot",ru={icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!v&&Hi(e.href,t),not_regex:(t,e)=>!!v&&!Hi(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t},Os=class t{get Se(){return this._instance.config}constructor(e){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),i.getWebExperiments(s=>{t.Hn("retrieved web experiments from the server"),i.Un=new Map,s.forEach(n=>{if(n.feature_flag_key){var o;i.Un&&(t.Hn("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=i.Un)==null||o.set(n.feature_flag_key,n));var a=i._instance.getFeatureFlag(n.feature_flag_key);G(a)&&n.variants[a]&&i.zn(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];t.Vn(c)&&i.zn(n.name,l,c.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t.Hn(zn);else if(!this.Se.disable_web_experiments){if(L(this.Un))return this.Un=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Hn("applying feature flags",e),e.forEach(i=>{var r;if(this.Un&&(r=this.Un)!=null&&r.has(i)){var s,n=this._instance.getFeatureFlag(i),o=(s=this.Un)==null?void 0:s.get(i);n&&o!=null&&o.variants[n]&&this.zn(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var i=Qt(e?.search,"__experiment_id"),r=Qt(e?.search,"__experiment_variant");i&&r&&(t.Hn("previewing web experiments "+i+" && "+r),this.getWebExperiments(s=>{this.Wn(parseInt(i),r,s)},!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,i,r){if(this.Se.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!i)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Wn(e,i,r){var s=r.filter(n=>n.id===e);s&&s.length>0&&(t.Hn("Previewing web experiment ["+s[0].name+"] with variant ["+i+"]"),this.zn(s[0].name,i,s[0].variants[i].transforms))}static Vn(e){return!L(e.conditions)&&t.Gn(e)&&t.Zn(e)}static Gn(e){var i;if(L(e.conditions)||L((i=e.conditions)==null?void 0:i.url))return!0;var r,s,n,o=t.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||ru[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return v?.location}static Zn(e){var i;if(L(e.conditions)||L((i=e.conditions)==null?void 0:i.utm))return!0;var r=Qo();if(r.utm_source){var s,n,o,a,l,c,u,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,d=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return p&&g&&_&&d}return!1}static Hn(e){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];E.info("[WebExperiments] "+e,r)}zn(e,i,r){this._is_bot()?t.Hn(zn):i!=="control"?r.forEach(s=>{if(s.selector){var n;t.Hn("applying transform of variant "+i+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o?.forEach(a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):t.Hn("Control variants leave the page unmodified.")}_is_bot(){return _e&&this._instance?ca(_e,this.Se.custom_blocked_useragents):void 0}},we=Q("[Conversations]"),Ze="Conversations not available yet.",Wn="console",zi={featureFlags:class{constructor(t){this.Qn=!1,this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get Ur(){return this._instance.persistence}ns(t){return this._instance.get_property(t)}ss(){var t,e;return(t=(e=this.Ur)==null?void 0:e.Gt(this.Se.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}os(){return!!this.ss()&&(this.rs||this.Yn||(this.rs=!0,ne.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ls(){var t,e=(t=this.Se.evaluation_contexts)!==null&&t!==void 0?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ts||(ne.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ts=!0),e!=null&&e.length?e.filter(i=>{var r=i&&typeof i=="string"&&i.trim().length>0;return r||ne.error("Invalid evaluation context found:",i,"Expected non-empty string"),r}):[]}us(){return this.ls().length>0}hs(){var t=this.Se.flag_keys;if(!b(t)){if(N(t))return t.filter(e=>{var i=e&&typeof e=="string"&&e.trim().length>0;return i||ne.error("Invalid flag key found:",e,"Expected non-empty string"),i});ne.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:i}=this._instance,r=(t=(e=i.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var s,n,o=(s=(n=i.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},a=Object.keys(r).filter(c=>!!r[c]).reduce((c,u)=>(c[u]=r[u]||!1,c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(o[u]&&(c[u]=o[u]),c),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,i){var r,s,n=i!=null&&i.merge&&(r=this.ns(rt))!==null&&r!==void 0?r:{},o=i!=null&&i.merge&&(s=this.ns(pi))!==null&&s!==void 0?s:{},a=m({},n,t),l=m({},o,e),c={};for(var[u,h]of Object.entries(a))c[u]={key:u,enabled:Ea(h),variant:xa(h),reason:void 0,metadata:b(l?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}};this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ns(Gr),e=this.ns(Me),i=this.ns(pt);if(!i&&!e)return t||{};var r=W({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],c=e?.[n],u=b(c)?(o=l?.enabled)!==null&&o!==void 0&&o:!!c,h=b(c)?l.variant:typeof c=="string"?c:void 0,p=i?.[n],d=m({},l,{enabled:u,variant:u?h??l?.variant:void 0});u!==l?.enabled&&(d.original_enabled=l?.enabled),h!==l?.variant&&(d.original_variant=l?.variant),p&&(d.metadata=m({},l?.metadata,{payload:p,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[n]=d}return this.Qn||(ne.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Qn=!0),r}getFlagVariants(){var t=this.ns(rt),e=this.ns(Me);if(!e)return t||{};for(var i=W({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(ne.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Qn=!0),i}getFlagPayloads(){var t=this.ns(pi),e=this.ns(pt);if(!e)return t||{};for(var i=W({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(ne.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Qn=!0),i}reloadFeatureFlags(){this.Kn||this.Se.advanced_disable_feature_flags||this.ds||(this._instance.Ii.emit("featureFlagsReloading",!0),this.ds=setTimeout(()=>{this.cs()},5))}vs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Jn||this.Yn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Kn=t}cs(t){var e;if(this.vs(),!this._instance.mr())if(this.Yn)this.Xn=!0;else{var i=this.Se.token,r=this.ns(ki),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},((e=this.Ur)==null?void 0:e.get_initial_props())||{},this.ns(et)||{}),group_properties:this.ns(tt),timezone:ra()};ce(r)||b(r)||(s.$device_id=r),(t!=null&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.us()&&(s.evaluation_contexts=this.ls());var n=this.hs();b(n)||(s.flag_keys=n);var o=!!this.Se.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Yn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.Se.disable_compression?void 0:Pe.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:l=>{var c,u,h,p=!0;if(l.statusCode===200&&(this.Xn||(this.$anon_distinct_id=void 0),p=!1),this.Yn=!1,!s.disable_flags||this.Xn){this.es=!p;var d=[];l.error?l.error instanceof Error?d.push(l.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):l.statusCode!==200&&d.push("api_error_"+l.statusCode),(c=l.json)!=null&&c.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var g,_=!((u=l.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));_&&d.push("quota_limited"),(h=this.Ur)==null||h.register({[Yr]:d}),_?ne.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags((g=l.json)!==null&&g!==void 0?g:{},p,{partialResponse:o}),this.Xn&&(this.Xn=!1,this.cs()))}}})}}getFeatureFlag(t,e){var i;if(e===void 0&&(e={}),!e.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var r=this.getFeatureFlagResult(t,e);return(i=r?.variant)!==null&&i!==void 0?i:r?.enabled}}else ne.warn('getFeatureFlag for key "'+t+fr)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.ns(Jr)||void 0,l=this.ns(Xt)||void 0,c=this.ns(qt)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),p=this.ns(Qr);h&&h!==p&&(c={},(u=this.Ur)==null||u.register({[qt]:c,[Qr]:h}))}if((e.send_event||!("send_event"in e))&&(!(t in c)||!c[t].includes(o))){var d,g,_,y,f,T,P,S,F,A;N(c[t])?c[t].push(o):c[t]=[o],(d=this.Ur)==null||d.register({[qt]:c});var w=this.getFeatureFlagDetails(t),k=[...(g=this.ns(Yr))!==null&&g!==void 0?g:[]];b(s)&&k.push("flag_missing");var R={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((_=this.Se.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((y=this.Se.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[t])||null,$used_bootstrap_value:!this.es};b(w==null||(f=w.metadata)==null?void 0:f.version)||(R.$feature_flag_version=w.metadata.version);var $,O=(T=w==null||(P=w.reason)==null?void 0:P.description)!==null&&T!==void 0?T:w==null||(S=w.reason)==null?void 0:S.code;O&&(R.$feature_flag_reason=O),w!=null&&(F=w.metadata)!=null&&F.id&&(R.$feature_flag_id=w.metadata.id),b(w?.original_variant)&&b(w?.original_enabled)||(R.$feature_flag_original_response=b(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(A=w.metadata)!=null&&A.original_payload&&(R.$feature_flag_original_payload=w==null||($=w.metadata)==null?void 0:$.original_payload),k.length&&(R.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",R)}if(r)return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:wa(n)}}}else ne.warn('getFeatureFlagResult for key "'+t+fr)}getRemoteConfigPayload(t,e){var i=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.us()&&(r.evaluation_contexts=this.ls());var s=this.hs();b(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:Pe.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(n){var o,a=(o=n.json)==null?void 0:o.featureFlagPayloads;e(a?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.es){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return b(i)?void 0:!!i}ne.warn('isFeatureEnabled for key "'+t+fr)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){if(this.Ur){this.Jn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var p=(k=>{var R=k.flags;return R?(k.featureFlags=Object.fromEntries(Object.keys(R).map($=>{var O;return[$,(O=R[$].variant)!==null&&O!==void 0?O:R[$].enabled]})),k.featureFlagPayloads=Object.fromEntries(Object.keys(R).filter($=>R[$].enabled).filter($=>{var O;return(O=R[$].metadata)==null?void 0:O.payload}).map($=>{var O;return[$,(O=R[$].metadata)==null?void 0:O.payload]}))):k.featureFlags&&ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(o),d=p.flags,g=p.featureFlags,_=p.featureFlagPayloads;if(g){var y=o.requestId,f=o.evaluatedAt;if(N(g)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var T={};if(g)for(var P=0;g.length>P;P++)T[g[P]]=!0;a&&a.register({[di]:g,[rt]:T})}else{var S=g,F=_,A=d;if(h!=null&&h.partialResponse)S=m({},l,S),F=m({},c,F),A=m({},u,A);else if(o.errorsWhileComputingFlags)if(d){var w=new Set(Object.keys(d).filter(k=>{var R;return!((R=d[k])!=null&&R.failed)}));S=m({},l,Object.fromEntries(Object.entries(S).filter(k=>{var[R]=k;return w.has(R)}))),F=m({},c,Object.fromEntries(Object.entries(F||{}).filter(k=>{var[R]=k;return w.has(R)}))),A=m({},u,Object.fromEntries(Object.entries(A||{}).filter(k=>{var[R]=k;return w.has(R)})))}else S=m({},l,S),F=m({},c,F),A=m({},u,A);a&&a.register(m({[di]:Object.keys(Vn(S)),[rt]:S||{},[pi]:F||{},[Gr]:A||{}},y?{[Jr]:y}:{},f?{[Xt]:f}:{}))}}})(t,this.Ur,r,s,n,i),e||(this.rs=!1),this.fs(e)}}override(t,e){e===void 0&&(e=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Ur)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.Ur.unregister(Me),this.Ur.unregister(pt),this.fs(),Ye.info("All overrides cleared");if(N(t)){var e=Bn(t);return this.Ur.register({[Me]:e}),this.fs(),Ye.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Qn=!!((i=r.suppressWarning)!==null&&i!==void 0&&i),"flags"in r){if(r.flags===!1)this.Ur.unregister(Me),Ye.info("Flag overrides cleared");else if(r.flags){if(N(r.flags)){var s=Bn(r.flags);this.Ur.register({[Me]:s})}else this.Ur.register({[Me]:r.flags});Ye.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.Ur.unregister(pt),Ye.info("Payload overrides cleared")):r.payloads&&(this.Ur.register({[pt]:r.payloads}),Ye.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&typeof t=="object")return this.Ur.register({[Me]:t}),this.fs(),Ye.info("Flag overrides set",{flags:t});ne.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.ns(Nt)||[]).find(l=>l.flagKey===t),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=m({},this.getFlagVariants(),{[t]:e});(r=this.Ur)==null||r.register({[di]:Object.keys(Vn(a)),[rt]:a}),this.fs()}getEarlyAccessFeatures(t,e,i){e===void 0&&(e=!1);var r=this.ns(Nt),s=i?"&"+i.map(n=>"stage="+n).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+s),method:"GET",callback:n=>{var o,a;if(n.json){var l=n.json.earlyAccessFeatures;return(o=this.Ur)==null||o.unregister(Nt),(a=this.Ur)==null||a.register({[Nt]:l}),t(l)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(i=>e[i]),flagVariants:Object.keys(e).filter(i=>e[i]).reduce((i,r)=>(i[r]=e[r],i),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach(r=>r(e,i,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var i=this.ns(et)||{},r=t?.$set||(t!=null&&t.$set_once?{}:t),s=t?.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[et]:m({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var i=m({},this.ns(et)||{});t.forEach(r=>{delete i[r]}),this._instance.register({[et]:i}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(et),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var i=this.ns(tt)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(r=>{i[r]=m({},i[r],t[r]),delete t[r]}),this._instance.register({[tt]:m({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ns(tt)||{};this._instance.register({[tt]:m({},e,{[t]:{}})})}else this._instance.unregister(tt)}reset(){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.$anon_distinct_id=void 0,this.vs(),this.Qn=!1}}},su={sessionRecording:class{get Se(){return this._instance.config}get Ur(){return this._instance.persistence}get started(){var t;return!((t=this.gs)==null||!t.isStarted)}get status(){var t,e;return this.ys===Mt||this.ys===hi?this.ys:(t=(e=this.gs)==null?void 0:e.status)!==null&&t!==void 0?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=Ln,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw Ie.error("started without valid sessionManager"),new Error(Rs+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===Ne)throw new Error(Rs+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!((t=this._instance.get_property(st))==null||!t.enabled),i=!this.Se.disable_session_recording,r=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||(e=this.gs)==null||!e.isStarted){var i=!b(Object.assign)&&!b(Array.from);this._s&&i?(this.ws(t),Ie.info("starting")):(this.ys=Ln,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==Mt&&this.ys!==hi&&(this.ys=Dn),I!=null&&(e=I.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(i=I.__PosthogExtensions__)!=null&&i.initSessionRecording?this.xs(t):(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.ks,s=>{if(s)return Ie.error("could not load recorder",s);this.xs(t)}))}stopRecording(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.stop()}Ss(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.discard()}Cs(){var t,e;(t=this.Ur)==null||t.unregister(js),(e=this.Ur)==null||e.unregister(Ro)}Is(t,e){if(L(t))return null;var i,r=he(t)?t:parseFloat(t);return typeof(i=r)!="number"||!Number.isFinite(i)||0>i||i>1?(Ie.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.Ur){var e,i,r=this.Ur,s=()=>{var n,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.Is((n=this.Se.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Is(o?.sampleRate,"remote config sampleRate"),c=a??l;L(c)&&this.Cs();var u=o?.minimumDurationMilliseconds;r.register({[st]:m({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:m({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:b(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};s(),(e=this.bs)==null||e.call(this),this.bs=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===Mt&&(this.ys=hi,Ie.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;e===void 0&&(e="log"),(i=this.gs)!=null&&i.log?this.gs.log(t,e):Ie.warn("log called before recorder was ready")}get ks(){var t,e,i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(st);return(i==null||(e=i.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Es(){var t,e,i=this._instance.get_property(st);if(!i)return!1;try{e=typeof i=="object"?i:JSON.parse(i)}catch(s){return Ie.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}var r=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-r}xs(t){var e,i;if((e=I.__PosthogExtensions__)==null||!e.initSessionRecording)return Ie.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lo]:!0});if(this.gs||(this.gs=(i=I.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es())return this.ys===hi||this.ys===Mt?void 0:(this.ys=Mt,Ie.info("persisted remote config is stale, requesting fresh config before starting"),void new Li(this._instance).load());this.ys=Dn,this.gs.start(t)}onRRwebEmit(t){var e;(e=this.gs)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||(e=this.Ur)==null||e.register({[$o]:!0}),(t=this.gs)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||(e=this.Ur)==null||e.register({[Fo]:!0}),(t=this.gs)==null||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||(i=this.Ur)==null||i.register({[t==="url"?Io:Oo]:!0}),(e=this.gs)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.gs)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!((i=this.gs)==null||!i.tryAddCustomEvent(t,e))}}},nu={autocapture:class{constructor(t){this.Ms=!1,this.Ps=null,this.Rs=!1,this.instance=t,this.rageclicks=new qi(t.config.rageclick),this.Os=null}initialize(){this.startIfEnabled()}get Se(){var t,e,i=X(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(t=i.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),i.url_ignorelist=(e=i.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),i}Ls(){if(this.isBrowserSupported()){if(v&&x){var t=i=>{i=i||v?.event;try{this.Fs(i)}catch(r){dr.error("Failed to capture event",r)}};if(Y(x,"submit",t,{capture:!0}),Y(x,"change",t,{capture:!0}),Y(x,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=i=>{i=i||v?.event;try{this.Fs(i,hr)}catch(r){dr.error("Failed to capture copy/cut event",r)}};Y(x,"copy",e,{capture:!0}),Y(x,"cut",e,{capture:!0})}}}else dr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ms&&(this.Ls(),this.Ms=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Rs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[jr]:!!t.autocapture_opt_out}),this.Ps=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Os=t}getElementSelectors(t){var e,i=[];return(e=this.Os)==null||e.forEach(r=>{var s=x?.querySelectorAll(r);s?.forEach(n=>{t===n&&i.push(r)})}),i}get isEnabled(){var t,e,i=(t=this.instance.persistence)==null?void 0:t.props[jr];if(ce(this.Ps)&&!Fe(i)&&!this.instance.mr())return!1;var r=(e=this.Ps)!==null&&e!==void 0?e:!!i;return!!this.instance.config.autocapture&&!r}Fs(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var i,r=rr(t);Uo(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&mn(r,this.instance.config.rageclick)&&this.Fs(t,"$rageclick");var s=e===hr;if(r&&(function(h,p,d,g,_){var y,f,T,P,S,F;if(d===void 0&&(d=void 0),!v||zs(h)||(y=d)!=null&&y.url_allowlist&&!gn(d.url_allowlist)||(f=d)!=null&&f.url_ignorelist&&gn(d.url_ignorelist))return!1;if((T=d)!=null&&T.dom_event_allowlist){var A=d.dom_event_allowlist;if(A&&!A.some(O=>p.type===O))return!1}var{parentIsUsefulElement:w,targetElementList:k}=Vo(h,g);if(!(function(O,M){var U=M?.element_allowlist;if(b(U))return!0;var D,j=function(H){if(U.some(ae=>H.tagName.toLowerCase()===ae))return{v:!0}};for(var B of O)if(D=j(B))return D.v;return!1})(k,d)||!us(k,(P=d)==null?void 0:P.css_selector_allowlist)||us(k,(S=(F=d)==null?void 0:F.css_selector_ignorelist)!==null&&S!==void 0?S:_l))return!1;var R=v.getComputedStyle(h);if(R&&R.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0;var $=h.tagName.toLowerCase();switch($){case"html":return!1;case"form":return(_||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(p.type)>=0;default:return w?(_||["click"]).indexOf(p.type)>=0:(_||["click"]).indexOf(p.type)>=0&&(Vs.indexOf($)>-1||h.getAttribute("contenteditable")==="true")}})(r,t,this.Se,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Yl(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Rs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===hr){var l,c=Ho(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=t.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Le(x?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.As=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(E.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,E.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Ds("pushState"),this.Ds("replaceState"),this.Ns())}Ds(t){var e;if(v&&((e=v.history[t])==null||!e.__posthog_wrapped__)){var i=this;(function(r,s,n){try{if(!(s in r))return()=>{};var o=r[s],a=n(o);return Le(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[s]=a,()=>{r[s]===a&&(r[s]=o)}}catch{return()=>{}}})(v.history,t,r=>function(s,n,o){r.call(this,s,n,o),i.qs(t)})}}qs(t){try{var e,i=v==null||(e=v.location)==null?void 0:e.pathname;if(!i)return;i!==this.As&&this.isEnabled&&this._instance.capture(vt,{navigation_type:t}),this.As=i}catch(r){E.error("Error capturing "+t+" pageview",r)}}Ns(){if(!this.$s){var t=()=>{this.qs("popstate")};Y(v,"popstate",t),this.$s=()=>{v&&v.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.Bs=!1,this.Ms=!1,this.js=null,this.instance=t,this.Bs=!((e=this.instance.persistence)==null||!e.props[Hr]),this.rageclicks=new qi(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return X(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return L(this.Se.capture_heatmaps)?L(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ms)return;eu.info("starting..."),this.Hs(),this.ke()}else{var t;clearInterval((t=this.js)!==null&&t!==void 0?t:void 0),this.Us(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Hr]:e}),this.Bs=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}zs(t){this.fe(t.originalEvent,"deadclick")}ke(){this.js&&clearInterval(this.js),this.js=x?.visibilityState==="visible"?setInterval(this.Or.bind(this),this.flushIntervalMilliseconds):null}Hs(){v&&x&&(this.Vs=this.Or.bind(this),Y(v,Fi,this.Vs),this.Ws=t=>this.fe(t||v?.event),Y(x,"click",this.Ws,{capture:!0}),this.Gs=t=>this.Zs(t||v?.event),Y(x,"mousemove",this.Gs,{capture:!0}),this.Qs=new Ii(this.instance,Sl,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.ke.bind(this),Y(x,Ri,this.Js),this.Ms=!0)}Us(){var t;v&&x&&(this.Vs&&v.removeEventListener(Fi,this.Vs),this.Ws&&x.removeEventListener("click",this.Ws,{capture:!0}),this.Gs&&x.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Js&&x.removeEventListener(Ri,this.Js),clearTimeout(this.Ys),(t=this.Qs)==null||t.stop(),this.Ms=!1)}Ks(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){for(var c=o;c&&Ge(c)&&!fe(c,"body");){if(c===l)return!1;if(C(a,v?.getComputedStyle(c).position))return!0;c=qo(c)}return!1})(rr(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}fe(t,e){var i;if(e===void 0&&(e="click"),!vn(t.target)&&Nn(t)){var r=this.Ks(t,e);(i=this.rageclicks)!=null&&i.isRageClick(t.clientX,t.clientY,new Date().getTime())&&mn(rr(t),this.instance.config.rageclick)&&this.Xs(m({},r,{type:"rageclick"})),this.Xs(r)}}Zs(t){!vn(t.target)&&Nn(t)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.Xs(this.Ks(t,"mousemove"))},500))}Xs(t){if(v){var e=this.Se.disable_capture_url_hashes?We(v.location.href):v.location.href,i=this.Se.custom_personal_data_properties,r=this.Se.mask_personal_data_properties?[...xt,...i||[]]:[],s=Yt(e,r,Zt);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}Or(){this.R&&!ze(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ii,webVitalsAutocapture:class{constructor(t){var e;this.Bs=!1,this.Ms=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((i,r)=>m({},i,{["$web_vitals_"+r.name+"_event"]:m({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.io=i=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.no();if(!b(s))if(L(i?.name)||L(i?.value))Qe.error("Invalid metric received",i);else if(!this.so||this.so>i.value){this.R.url!==s&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),b(this.R.url)&&(this.R.url=s),this.R.firstMetricTimestamp=b(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0);var n=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),o=m({},i,{$current_url:s,timestamp:Date.now()});b(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.R.metrics.push(o),this.R.metrics.length===this.allowedMetrics.length&&this.eo()}else Qe.error("Ignoring metric with value >= "+this.so,i)},this.oo=()=>{if(!this.Ms){var i,r,s,n,o=I.__PosthogExtensions__;b(o)||b(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:r,onFCP:s,onINP:n}=o.postHogWebVitalsCallbacks),i&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.io.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.io.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.io.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.io.bind(this)),this.Ms=!0):Qe.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Bs=!((e=this._instance.persistence)==null||!e.props[zr]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=X(this.ao)?(t=this.ao)==null?void 0:t.web_vitals_allowed_metrics:void 0;return L(i)?((e=this._instance.persistence)==null?void 0:e.props[Wr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(X(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=X(this.ao)?this.ao.web_vitals_attribution:void 0;return t!=null&&t}get so(){var t=X(this.ao)&&he(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:An;return t>0&&6e4>=t?An:t}get isEnabled(){var t=te?.protocol;if(t!=="http:"&&t!=="https:")return Qe.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=X(this.ao)?this.ao.web_vitals:Fe(this.ao)?this.ao:void 0;return Fe(e)?e:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ms&&(Qe.info("enabled, starting..."),this.Mt(this.oo))}onRemoteConfig(t){if("capturePerformance"in t){var e=X(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=X(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[zr]:e}),this._instance.persistence.register({[Wr]:i})),this.Bs=e,this.startIfEnabled()}}Mt(t){var e,i;(e=I.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(i=I.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?Qe.error("failed to load script",r):t()})}no(){var t=v?this._instance.config.disable_capture_url_hashes?We(v.location.href):v.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...xt,...e||[]]:[];return Yt(t,i,Zt)}Qe.error("Could not determine current URL")}}},ou={exceptionObserver:class{constructor(t){var e,i,r;this.oo=()=>{var s;if(v&&this.isEnabled&&(s=I.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=I.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=I.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=I.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lo&&this.Se.capture_unhandled_errors&&(this.lo=n(this.captureException.bind(this))),!this.uo&&this.Se.capture_unhandled_rejections&&(this.uo=o(this.captureException.bind(this))),!this.ho&&this.Se.capture_console_errors&&(this.ho=a(this.captureException.bind(this)))}catch(l){Ct.error("failed to start",l),this.do()}}},this._instance=t,this.co=!((e=this._instance.persistence)==null||!e.props[qr]),this.vo=new Sr({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Ae:Ct}),this.Se=this.fo(),this.startIfEnabledOrStop()}fo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return X(t)?e=m({},e,t):(b(t)?this.co:t)&&(e=m({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ct.info("enabled"),this.do(),this.Mt(this.oo)):this.do()}Mt(t){var e,i;(e=I.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(i=I.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return Ct.error("failed to load script",r);t()})}do(){var t,e,i;(t=this.lo)==null||t.call(this),this.lo=void 0,(e=this.uo)==null||e.call(this),this.uo=void 0,(i=this.ho)==null||i.call(this),this.ho=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[qr]:this.co}),this.Se=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.fo()}captureException(t){var e,i,r,s=(e=t==null||(i=t.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&e!==void 0?e:"Exception";this.vo.consumeRateLimit(s)?Ct.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.po=[],this.mo=new Fr([new Ir,new Nr,new Cr,new Or,new Lr,new Ar,new Mr,new Dr],(function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),o=1;s>o;o++)n[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var c=[],u=a.split(`
2
+ `),h=l;u.length>h;h++){var p=u[h];if(1024>=p.length){var d=cn.test(p)?p.replace(cn,"$1"):p;if(!d.match(/\S*Error: /)){for(var g of n){var _=g(d,r);if(_){c.push(_);break}}if(c.length>=50)break}}}return(function(y){if(!y.length)return[];var f=Array.from(y);return f.reverse(),f.slice(0,50).map(T=>{return m({},T,{filename:T.filename||(P=f,P[P.length-1]||{}).filename,function:T.function||Et});var P})})(c)}})("web:javascript",Qa,el)),this._instance=t,this.po=(e=(i=this._instance.persistence)==null?void 0:i.get_property(Br))!==null&&e!==void 0?e:[],this.yo=Si(this.bo()),this._o=new Ur(this.yo)}onConfigChange(){this.yo=Si(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=(e=(i=t.errorTracking)==null?void 0:i.suppressionRules)!==null&&e!==void 0?e:[],n=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.po=s,this._instance.persistence&&this._instance.persistence.register({[Br]:this.po,[Vr]:n})}}get wo(){var t,e=!!this._instance.get_property(Vr),i=this._instance.config.error_tracking.captureExtensionExceptions;return(t=i??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.mo.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.yo.enabled)try{if(!G(t)||t.trim().length===0)return void Oe.warn("Ignoring exception step because message must be a non-empty string");var i=this.xo(e),{sanitizedProperties:r,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(n).reduce((a,l)=>rl.has(l)?(o.push(l),a):(a[l]=n[l],a),{}),droppedKeys:o}})(i);s.length>0&&Oe.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(m({[Ei]:t,[xi]:new Date().toISOString()},r))}catch(n){Oe.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.ko(e)){if(this.So(e))return this.Co("Exception dropped: matched a suppression rule"),void Oe.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(e))return this.Co("Exception dropped: thrown by a browser extension"),void Oe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Oe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.yo.enabled&&L(t.$exception_steps)?this.Eo(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Gi:!0});return r&&this._o.clear(),r}catch(s){return Oe.error("Failed to capture exception event. Dropping this exception.",s),void this._o.clear()}}catch(s){return void Oe.error("Failed to process exception event. Ignoring this exception.",s)}}Eo(t){try{var e=this._o.getAttachable();return e.length===0?t:m({},t,{$exception_steps:e})}catch(i){return Oe.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Co(t){this.yo.enabled&&this._o.add({[Ei]:t,[xi]:new Date().toISOString()})}xo(t){return X(t)?m({},t):{}}bo(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}So(t){if(t.length===0)return!1;var e=t.reduce((i,r)=>{var{type:s,value:n}=r;return G(s)&&s.length>0&&i.$exception_types.push(s),G(n)&&n.length>0&&i.$exception_values.push(n),i},{$exception_types:[],$exception_values:[]});return this.po.some(i=>{var r=i.values.map(s=>{var n,o=ha[s.operator],a=N(s.value)?s.value:[s.value],l=(n=e[s.key])!==null&&n!==void 0?n:[];return a.length>0&&o(a,l)});return i.type==="OR"?r.some(Boolean):r.every(Boolean)})}Io(t){return t.flatMap(e=>{var i,r;return(i=(r=e.stacktrace)==null?void 0:r.frames)!==null&&i!==void 0?i:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}To(t){if(t.length>0){var e,i,r,s,n=(e=(i=t[0].stacktrace)==null?void 0:i.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ko(t){return!L(t)&&N(t)}}},au=m({productTours:class{get Ur(){return this._instance.persistence}constructor(t){this.Mo=null,this.Po=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.Ur&&this.Ur.register({[Us]:!!t.productTours}),!gr(this._instance))return!this.Mo&&L((e=this.Ur)==null?void 0:e.props[Ut])||vr.info("product tours disabled; stopping and clearing cached tours"),(i=this.Mo)==null||i.stop(),this.Mo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mo&&gr(this._instance)&&this.Mt(()=>this.Ro())}Mt(t){var e,i;(e=I.__PosthogExtensions__)!=null&&e.generateProductTours?t():(i=I.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",r=>{r?vr.error("Could not load product tours script",r):t()})}Ro(){var t;!this.Mo&&(t=I.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.Mo=I.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!N(this.Po)||e){var i=this.Ur;if(i){var r=i.props[Ut];if(N(r)&&!e)return this.Po=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{if(gr(this._instance)){var n=s.statusCode;if(n!==200||!s.json){var o="Product Tours API could not be loaded, status: "+n;return vr.error(o),void t([],{isLoaded:!1,error:o})}var a=N(s.json.product_tours)?s.json.product_tours:[];this.Po=a,i&&i.register({[Ut]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Po,{isLoaded:!0})}getActiveProductTours(t){L(this.Mo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Mo)==null||e.showTourById(t)}previewTour(t){this.Mo?this.Mo.previewTour(t):this.Mt(()=>{var e;this.Ro(),(e=this.Mo)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.Mo)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Mo)==null||t.nextStep()}previousStep(){var t;(t=this.Mo)==null||t.previousStep()}clearCache(){var t;this.Po=null,(t=this.Ur)==null||t.unregister(Ut)}resetTour(t){var e;(e=this.Mo)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.Mo)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Mo)==null||e.cancelPendingTour(t)}}},zi),lu={siteApps:class{constructor(t){this.Oo=0,this._instance=t,this.Lo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fo(t,e){if(e){var i=this.globalsForEvent(e);this.Lo.push(i),this.Lo.length>1e3&&(this.Lo=this.Lo.slice(10))}}get siteAppLoaders(){var t;return(t=I._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Fo.bind(this));this.Ao=()=>{t(),this.Lo=[],this.Ao=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(u))l[h]={id:c[h],type:h,properties:p};var{$set_once:d,$set:g}=t;return{event:m({},Gn(t,tu),{properties:m({},t.properties,g?{$set:m({},(e=(i=t.properties)==null?void 0:i.$set)!==null&&e!==void 0?e:{},g)}:{},d?{$set_once:m({},(r=(s=t.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},d)}:{}),elements_chain:(n=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}$o(t){var e,i=(e=t.tagName)==null?void 0:e.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(ke.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(ke.error("prepare_external_dependency_script returned null"),null):t}Do(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=x?.defaultView,c=l==null||(t=l.Node)==null?void 0:t.prototype;if(!l||!c)return()=>{};if(this.Oo++,this.No)return this.qo();var u=[],h=this,p=new WeakSet,d=(y,f,T)=>{if(y!=null&&y[f]){var P=y[f];y[f]=T(P),u.push(()=>{y[f]=P})}},g=y=>{if(p.has(y))return y;var f=h.$o(y);return f&&p.add(f),f},_=y=>y.map(f=>typeof f=="string"?f:g(f)).filter(f=>!ce(f));return d(c,"appendChild",y=>function(f){var T=g(f);return T?y.call(this,T):f}),d(c,"insertBefore",y=>function(f,T){var P=g(f);return P?y.call(this,P,T):f}),d(c,"replaceChild",y=>function(f,T){var P=g(f);return P?y.call(this,P,T):T}),[(e=l.Element)==null?void 0:e.prototype,(i=l.Document)==null?void 0:i.prototype,(r=l.DocumentFragment)==null?void 0:r.prototype].forEach(y=>{d(y,"append",f=>function(){for(var T=arguments.length,P=new Array(T),S=0;T>S;S++)P[S]=arguments[S];return f.apply(this,_(P))}),d(y,"prepend",f=>function(){for(var T=arguments.length,P=new Array(T),S=0;T>S;S++)P[S]=arguments[S];return f.apply(this,_(P))})}),[(s=l.Element)==null?void 0:s.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(o=l.DocumentType)==null?void 0:o.prototype].forEach(y=>{d(y,"before",f=>function(){for(var T=arguments.length,P=new Array(T),S=0;T>S;S++)P[S]=arguments[S];return f.apply(this,_(P))}),d(y,"after",f=>function(){for(var T=arguments.length,P=new Array(T),S=0;T>S;S++)P[S]=arguments[S];return f.apply(this,_(P))}),d(y,"replaceWith",f=>function(){for(var T=arguments.length,P=new Array(T),S=0;T>S;S++)P[S]=arguments[S];var F=_(P);return P.length&&!F.length?void 0:f.apply(this,F)})}),d((a=l.Element)==null?void 0:a.prototype,"insertAdjacentElement",y=>function(f,T){var P=g(T);return P?y.call(this,f,P):null}),this.No=()=>{u.forEach(y=>y()),this.No=void 0},this.qo()}qo(){var t=!1;return()=>{var e;t||(t=!0,this.Oo--,this.Oo===0&&((e=this.No)==null||e.call(this)))}}Bo(t,e){e===void 0&&(e=!0);var i=this.Do();try{var r=t(i);return e&&i(),r}catch(s){throw i(),s}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var o;!e.errored&&this.Lo.length&&(ke.info("Processing "+this.Lo.length+" events for site app with id "+t.id),this.Lo.forEach(a=>this.Bo(()=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.Ao)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,ke.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Bo(o=>t.init({posthog:this._instance,callback(a){o(),s(a)}}),!1);n&&(e.processEvent=n),r=!0}catch(o){ke.error(Un+t.id,o),s(!1)}if(r&&e.loaded)try{i()}catch(o){ke.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}jo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Ho(t){var e=this;if(Object.keys(this.apps).length!==0){var i=this.globalsForEvent(t),r=function(n){try{e.Bo(()=>n.processEvent==null?void 0:n.processEvent(i))}catch(o){ke.error("Error while processing event "+t.event+" for site app "+n.id,o)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.jo(),void this._instance.on("eventCaptured",l=>this.Ho(l))):void ke.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Ao)==null||i.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var c;I["__$$ph_site_app_"+l]=s._instance,(c=I.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,a,u=>{if(u)return ke.error(Un+l,u)})};for(var{id:o,url:a}of t.siteApps)n(o)}else ke.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},uu={tracingHeaders:class{constructor(t){this.Uo=void 0,this.zo=void 0,this.Vo=void 0,this.oo=()=>{var e,i,r=this.Wo();r?(b(this.Uo)&&(this.Uo=(e=I.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),b(this.zo)&&(this.zo=(i=I.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null?void 0:i._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.do()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Mt(t){var e,i;(e=I.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(i=I.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return Zl.error("failed to load script",r);t()})}Go(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Wo(){var t=this.Go();return N(t)?(N(this.Vo)?this.Vo.splice(0,this.Vo.length,...t):this.Vo=[...t],t.length>0?this.Vo:void 0):(N(this.Vo)&&this.Vo.splice(0),this.Vo=t||void 0,this.Vo)}do(){var t,e;(t=this.Uo)==null||t.call(this),(e=this.zo)==null||e.call(this),this.Uo=void 0,this.zo=void 0}startIfEnabledOrStop(){this.Wo()?this.Mt(this.oo):this.do()}}},cu=m({surveys:class{get Se(){return this._instance.config}constructor(t){this.Zo=void 0,this._surveyManager=null,this.Qo=!1,this.Jo=[],this.Yo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(L(e))return q.warn("Flags not loaded yet. Not loading surveys.");var i=N(e);this.Zo=i?e.length>0:e,q.info("flags response received, isSurveysEnabled: "+this.Zo),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(r!=null&&r.startsWith(Ss)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(s=>localStorage.removeItem(s))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Qo)q.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)q.info(jn);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())q.info("Not loading surveys in cookieless mode without consent.");else{var t=I?.__PosthogExtensions__;if(t){if(!b(this.Zo)||this.Se.advanced_enable_surveys){var e=this.Zo||this.Se.advanced_enable_surveys;this.Qo=!0;try{var i=t.generateSurveys;if(i)return void this.Ko(i,e);var r=t.loadExternalDependency;if(!r)return void this.Xo(rs);r(this._instance,"surveys",s=>{s||!t.generateSurveys?this.Xo("Could not load surveys script",s):this.Ko(t.generateSurveys,e)})}catch(s){throw this.Xo("Error initializing surveys",s),s}finally{this.Qo=!1}}}else q.error("PostHog Extensions not found.")}}Ko(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Is(this._instance),q.info("Surveys loaded successfully"),this.ea({isLoaded:!0})}Xo(t,e){q.error(t,e),this.ea({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Jo.push(t),this._surveyManager&&this.ea({isLoaded:!0}),()=>{this.Jo=this.Jo.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Se.disable_surveys)return q.info(jn),t([]);var i,r=this._instance.get_property(Xr);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.Yo?this.Yo.then(s=>{var{surveys:n,context:o}=s;return t(n,o)}):(typeof Promise<"u"&&(this.Yo=new Promise(s=>{i=s})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:s=>{var n;this.Yo=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;q.error(a);var l={isLoaded:!1,error:a};return t([],l),void(i==null||i({surveys:[],context:l}))}var c,u=s.json.surveys||[],h=u.filter(d=>(function(g){return!(!g.start_date||g.end_date)})(d)&&((function(g){var _;return!((_=g.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)})(d)||(function(g){var _;return!((_=g.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(d)));h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(n=this._instance.persistence)==null||n.register({[Xr]:u,[Hs]:Date.now()});var p={isLoaded:!0};t(u,p),i?.({surveys:u,context:p})}}))}ea(t){for(var e of this.Jo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(i){q.error("Error in survey callback",i)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);q.warn("init was not called")}ta(t){var e=null;return this.getSurveys(i=>{var r;e=(r=i.find(s=>s.id===t))!==null&&r!==void 0?r:null}),e}ra(t){if(L(this._surveyManager))return{eligible:!1,reason:_r};var e=typeof t=="string"?this.ta(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(L(this._surveyManager))return q.warn("init was not called"),{visible:!1,disabledReason:_r};var e=this.ra(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return L(this._surveyManager)?(q.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:_r})):new Promise(i=>{this.getSurveys(r=>{var s,n=(s=r.find(a=>a.id===t))!==null&&s!==void 0?s:null;if(n){var o=this.ra(n);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var r;if(L(this._surveyManager))q.warn("init was not called");else{var s=typeof t=="string"?this.ta(t):t;if(s!=null&&s.id)if(Wl.includes(s.type)){var n=x?.querySelector(e);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(q.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;q.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,n,i),q.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);q.warn("Survey element not found")}else q.warn("Surveys of type "+s.type+" cannot be rendered in the app");else q.warn("Survey not found")}}displaySurvey(t,e){var i;if(L(this._surveyManager))q.warn("init was not called");else{var r=this.ta(t);if(r){var s=r;if((i=r.appearance)!=null&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=m({},r,{appearance:m({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ds.Popover&&e.initialResponses&&q.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(r);if(!n.visible)return void q.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==ds.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else q.warn("Survey not found")}}cancelPendingSurvey(t){L(this._surveyManager)?q.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},zi),hu={toolbar:class{constructor(t){this.instance=t}ia(t){I.ph_toolbar_state=t}na(){var t;return(t=I.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),i===void 0&&(i=void 0),Do(this.instance.config)||!v||!x)return!1;t=t??v.location,i=i??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var r,s=iu||Mi(t.hash,"__posthog")||Mi(t.hash,"state"),n=s?dn(()=>JSON.parse(atob(decodeURIComponent(s))))||dn(()=>JSON.parse(decodeURIComponent(s))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Hn)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}sa(t){var e=I.ph_load_toolbar||I.ph_load_editor;!L(e)&&Le(e)?e(t,this.instance):qn.warn("No toolbar load function found")}loadToolbar(t){var e=!(x==null||!x.getElementById(Co));if(!v||e)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=m({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(v.localStorage.setItem(Hn,JSON.stringify(m({},r,{source:void 0}))),this.na()===2)this.sa(r);else if(this.na()===0){var s;this.ia(1),(s=I.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",n=>{if(n)return qn.error("[Toolbar] Failed to load",n),void this.ia(0);this.ia(2),this.sa(r)}),Y(v,"turbolinks:load",()=>{this.ia(0),this.loadToolbar(r)})}return!0}oa(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},du=m({experiments:Os},zi),pu=m({},zi,su,nu,ou,au,lu,cu,uu,hu,du,{conversations:class{constructor(t){this.aa=void 0,this._conversationsManager=null,this.la=!1,this.ua=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;L(e)||(Fe(e)?this.aa=e:(this.aa=e.enabled,this.ua=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.aa=void 0,this.ua=null}loadIfEnabled(){if(!(this._conversationsManager||this.la||this._instance.config.disable_conversations||Do(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=I?.__PosthogExtensions__;if(t&&!b(this.aa)&&this.aa)if(this.ua&&this.ua.token){this.la=!0;try{var e=t.initConversations;if(e)return this.ha(e),void(this.la=!1);var i=t.loadExternalDependency;if(!i)return void this.da(rs);i(this._instance,"conversations",r=>{r||!t.initConversations?this.da("Could not load conversations script",r):this.ha(t.initConversations),this.la=!1})}catch(r){this.da("Error initializing conversations",r),this.la=!1}}else we.error("Conversations enabled but missing token in remote config.")}}ha(t){if(this.ua)try{this._conversationsManager=t(this.ua,this._instance),we.info("Conversations loaded successfully")}catch(e){this.da("Error completing conversations initialization",e)}else we.error("Cannot complete initialization: remote config is null")}da(t,e){we.error(t,e),this._conversationsManager=null,this.la=!1}show(){this._conversationsManager?this._conversationsManager.show():we.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.aa===!0&&!ce(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,i){var r=this;return se(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(we.warn(Ze),null)})()}getMessages(t,e){var i=this;return se(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(we.warn(Ze),null)})()}markAsRead(t){var e=this;return se(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(we.warn(Ze),null)})()}getTickets(t){var e=this;return se(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(we.warn(Ze),null)})()}requestRestoreLink(t){var e=this;return se(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(we.warn(Ze),null)})()}restoreFromToken(t){var e=this;return se(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(we.warn(Ze),null)})()}restoreFromUrlToken(){var t=this;return se(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(we.warn(Ze),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Xi(){var t;(t=this._conversationsManager)==null||t.setIdentity()}en(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},{logs:class{constructor(t){var e;this.ca=!1,this.va=!1,this.Ae=Q("[logs]"),this._r=[],this.fa=[],this.pa=()=>{var i,r;(i=this.ga)==null||i.onReconnect(),(r=this.ma)==null||r.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.ca=!0),v&&Y(v,"online",this.pa)}ya(t,e,i,r){var s,n=(function(o,a){var l,c,u,h,p,d,g,_=(l=o?.flushIntervalMs)!==null&&l!==void 0?l:3e3,y=(c=o?.maxBufferSize)!==null&&c!==void 0?c:100,f=a!=null&&a.consoleCapture?void 0:(u=o?.maxLogsPerInterval)!==null&&u!==void 0?u:1e3,T=b(f)?Math.max(y,2048):Math.max(y,f),P=o?.resourceAttributes;return{serviceName:(h=(p=P?.["service.name"])!==null&&p!==void 0?p:o?.serviceName)!==null&&h!==void 0?h:a?.serviceNameDefault,serviceVersion:(d=P?.["service.version"])!==null&&d!==void 0?d:o?.serviceVersion,environment:(g=P?.["deployment.environment"])!==null&&g!==void 0?g:o?.environment,resourceAttributes:P,beforeSend:o?.beforeSend,flushIntervalMs:_,maxBufferSize:y,maxQueueSize:T,maxBatchRecordsPerPost:100,rateCapWindowMs:_,maxLogsPerInterval:f,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((s=this._instance)==null||(s=s.config)==null?void 0:s.logs,i);return[new Wa(this.ba(t,e),n,this.Ae,()=>this._a(),o=>o(),void 0,r),n]}wa(){var t,e,i=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;return this.ga&&this.xa===i||((e=this.ga)==null||e.reset(),this.xa=i,[this.ga,this.ka]=this.ya(()=>this._r,r=>{this._r=r})),this.ga}Sa(){var t,e,i=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;return this.ma&&this.Ca===i||((e=this.ma)==null||e.reset(),this.Ca=i,[this.ma,this.Ia]=this.ya(()=>this.fa,r=>{this.fa=r},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Wn)),this.ma}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=(e=t.logs)==null?void 0:e.captureConsoleLogs;!L(i)&&i&&(this.ca=!0,this.loadIfEnabled())}reset(){var t,e;this._r=[],(t=this.ga)==null||t.reset(),this.fa=[],(e=this.ma)==null||e.reset()}captureLog(t){this.wa().captureLog(t)}le(t){this.Sa().captureLog(t)}get logger(){return this.Ta||(this.Ta={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Ta}flushLogs(t){t?this.Ea(t):(this.ga&&this.ga.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)),this.ma&&this.ma.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)))}loadIfEnabled(){if(this.ca&&!this.va){var t=I?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",i=>{var r;i||(r=t.logs)==null||!r.initializeLogs?this.Ae.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.va=!0)}):this.Ae.error(rs)}else this.Ae.error("PostHog Extensions not found.")}}ba(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:r=>r===Ae.LogsQueue?t():void 0,setPersistedProperty(r,s){var n;r===Ae.LogsQueue&&e((n=s)!==null&&n!==void 0?n:[])},ht:r=>this.ht(r),getLibraryId:()=>ee.LIB_NAME,getLibraryVersion:()=>ee.LIB_VERSION}}ht(t){return new Promise(e=>{var i=!1,r=n=>{i||(i=!0,clearTimeout(s),e(n))},s=setTimeout(()=>r({kind:"retry-later",error:new Error("logs request timed out")}),9e4);this._instance._send_request({method:"POST",url:this.Ma(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(n){var o=n.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==429&&500>o)r({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;r({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})})}Ea(t){this._r.length>0&&this.Pa(t,this._r,this.ka,ee.LIB_NAME,e=>{this._r=e}),this.fa.length>0&&this.Pa(t,this.fa,this.Ia,Wn,e=>{this.fa=e})}Pa(t,e,i,r,s){if(e.length!==0){var n=e.map(a=>a.record);s([]);var o=xo(n,Eo(i,ee.LIB_NAME,ee.LIB_VERSION),r,ee.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ma(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Ma(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_a(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=r,L(s)||(e.sessionStartTimestamp=s),L(n)||(e.lastActivityTimestamp=n)}if(I!=null&&(t=I.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?We(I.location.href):I.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}});ot.__defaultExtensionClasses=m({},pu);var wu=(function(){ee.SDK_DIST_CHANNEL="npm";var t=Wt[gt]=new ot;return(function(){function e(){e.done||(e.done=!0,va=!1,z(Wt,function(i){i._dom_loaded()}))}x!=null&&x.addEventListener?x.readyState==="complete"?e():Y(x,"DOMContentLoaded",e,{capture:!1}):v&&E.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();export{Pe as Compression,yu as DEFAULT_PRODUCT_TOUR_APPEARANCE,ds as DisplaySurveyType,ot as PostHog,Ml as ProductTourEventName,En as ProductTourEventProperties,Ue as SurveyEventName,or as SurveyEventProperties,Tt as SurveyEventType,gu as SurveyPosition,mu as SurveyQuestionBranchingType,fu as SurveyQuestionType,Cl as SurveySchedule,_u as SurveyTabPosition,nr as SurveyType,vu as SurveyWidgetType,wu as default,wu as posthog,bu as severityLevels};
@@ -1 +1 @@
1
- import{a as A,b as P}from"./chunk-UTRZTB6V.js";import{b as T,c as M}from"./chunk-FC22ZJQZ.js";import{c as O}from"./chunk-JZ2YF7EL.js";import"./chunk-276RLZR4.js";import"./chunk-LPDD2DHE.js";import"./chunk-34ZZDYNQ.js";import"./chunk-4SG4352Z.js";import{Ja as s,Kb as c,Za as f,Zb as _,ec as y,fc as h,ga as u,gc as v,ja as g,lc as C,nb as b,wb as n,wc as D,xb as a,xc as m,yb as d,yc as r}from"./chunk-BJ6X6WBO.js";import"./chunk-WCABR6TI.js";var k={fallbackHeader:"Provide a value",ariaLabel:"Action input",confirm:"Confirm",cancel:"Cancel"};var N=()=>({width:"28rem"}),G=(()=>{class l{texts=k;open=r(!1);descriptor=r.required();headerText=r(void 0);busy=r(!1);confirmed=m();closed=m();collected=u("");header=D(()=>this.headerText()??this.texts.fallbackHeader);seedOnOpen=g(()=>{this.open()&&this.collected.set(this.seedValue())});seedValue(){let t=this.descriptor(),i=t.inputType==="string-list",e=t.defaultValue;return i?Array.isArray(e)?e.slice():[]:typeof e=="string"?e:""}confirm(){this.confirmed.emit(this.collected())}cancel(){this.closed.emit()}onVisibleChange(t){t||this.closed.emit()}static \u0275fac=function(i){return new(i||l)};static \u0275cmp=f({type:l,selectors:[["sm-action-prompt-dialog"]],inputs:{open:[1,"open"],descriptor:[1,"descriptor"],headerText:[1,"headerText"],busy:[1,"busy"]},outputs:{confirmed:"confirmed",closed:"closed"},decls:5,vars:17,consts:[["appendTo","body","data-testid","action-prompt-dialog",3,"visibleChange","visible","modal","closable","draggable","resizable","dismissableMask","header"],["data-testid","action-prompt-control",3,"valueChange","descriptor","value"],[1,"apd__actions"],["severity","secondary","data-testid","action-prompt-cancel",3,"onClick","label","text"],["severity","primary","data-testid","action-prompt-confirm",3,"onClick","label","disabled"]],template:function(i,e){i&1&&(a(0,"p-dialog",0),c("visibleChange",function(o){return e.onVisibleChange(o)}),a(1,"sm-input-type-control",1),v("valueChange",function(o){return h(e.collected,o)||(e.collected=o),o}),d(),a(2,"div",2)(3,"p-button",3),c("onClick",function(){return e.cancel()}),d(),a(4,"p-button",4),c("onClick",function(){return e.confirm()}),d()()()),i&2&&(_(C(16,N)),n("visible",e.open())("modal",!0)("closable",!0)("draggable",!1)("resizable",!1)("dismissableMask",!0)("header",e.header()),b("aria-label",e.texts.ariaLabel),s(),n("descriptor",e.descriptor()),y("value",e.collected),s(2),n("label",e.texts.cancel)("text",!0),s(),n("label",e.texts.confirm)("disabled",e.busy()))},dependencies:[M,T,P,A,O],styles:[".apd__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1.25rem}"],changeDetection:0})}return l})();export{G as ActionPromptDialog};
1
+ import{a as A,b as P}from"./chunk-QVG7J2MP.js";import{b as T,c as M}from"./chunk-CG25RHMO.js";import{c as O}from"./chunk-GUPPOK7U.js";import"./chunk-BSIR3ADF.js";import"./chunk-JKPG5PO7.js";import"./chunk-7WMT2LX4.js";import"./chunk-TQBXK5JN.js";import{Ja as s,Kb as c,Za as f,Zb as _,ec as y,fc as h,ga as u,gc as v,ja as g,lc as C,nb as b,wb as n,wc as D,xb as a,xc as m,yb as d,yc as r}from"./chunk-EJVWTBMV.js";import"./chunk-ZRJ5ZCFR.js";var k={fallbackHeader:"Provide a value",ariaLabel:"Action input",confirm:"Confirm",cancel:"Cancel"};var N=()=>({width:"28rem"}),G=(()=>{class l{texts=k;open=r(!1);descriptor=r.required();headerText=r(void 0);busy=r(!1);confirmed=m();closed=m();collected=u("");header=D(()=>this.headerText()??this.texts.fallbackHeader);seedOnOpen=g(()=>{this.open()&&this.collected.set(this.seedValue())});seedValue(){let t=this.descriptor(),i=t.inputType==="string-list",e=t.defaultValue;return i?Array.isArray(e)?e.slice():[]:typeof e=="string"?e:""}confirm(){this.confirmed.emit(this.collected())}cancel(){this.closed.emit()}onVisibleChange(t){t||this.closed.emit()}static \u0275fac=function(i){return new(i||l)};static \u0275cmp=f({type:l,selectors:[["sm-action-prompt-dialog"]],inputs:{open:[1,"open"],descriptor:[1,"descriptor"],headerText:[1,"headerText"],busy:[1,"busy"]},outputs:{confirmed:"confirmed",closed:"closed"},decls:5,vars:17,consts:[["appendTo","body","data-testid","action-prompt-dialog",3,"visibleChange","visible","modal","closable","draggable","resizable","dismissableMask","header"],["data-testid","action-prompt-control",3,"valueChange","descriptor","value"],[1,"apd__actions"],["severity","secondary","data-testid","action-prompt-cancel",3,"onClick","label","text"],["severity","primary","data-testid","action-prompt-confirm",3,"onClick","label","disabled"]],template:function(i,e){i&1&&(a(0,"p-dialog",0),c("visibleChange",function(o){return e.onVisibleChange(o)}),a(1,"sm-input-type-control",1),v("valueChange",function(o){return h(e.collected,o)||(e.collected=o),o}),d(),a(2,"div",2)(3,"p-button",3),c("onClick",function(){return e.cancel()}),d(),a(4,"p-button",4),c("onClick",function(){return e.confirm()}),d()()()),i&2&&(_(C(16,N)),n("visible",e.open())("modal",!0)("closable",!0)("draggable",!1)("resizable",!1)("dismissableMask",!0)("header",e.header()),b("aria-label",e.texts.ariaLabel),s(),n("descriptor",e.descriptor()),y("value",e.collected),s(2),n("label",e.texts.cancel)("text",!0),s(),n("label",e.texts.confirm)("disabled",e.busy()))},dependencies:[M,T,P,A,O],styles:[".apd__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1.25rem}"],changeDetection:0})}return l})();export{G as ActionPromptDialog};