@useorgx/openclaw-plugin 0.4.8 → 0.7.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 (284) hide show
  1. package/README.md +35 -0
  2. package/dashboard/dist/assets/BJgZIVUQ.js +53 -0
  3. package/dashboard/dist/assets/BJgZIVUQ.js.br +0 -0
  4. package/dashboard/dist/assets/BJgZIVUQ.js.gz +0 -0
  5. package/dashboard/dist/assets/BXWDRGm-.js +1 -0
  6. package/dashboard/dist/assets/BXWDRGm-.js.br +0 -0
  7. package/dashboard/dist/assets/BXWDRGm-.js.gz +0 -0
  8. package/dashboard/dist/assets/BgOYB78t.js +4 -0
  9. package/dashboard/dist/assets/BgOYB78t.js.br +0 -0
  10. package/dashboard/dist/assets/BgOYB78t.js.gz +0 -0
  11. package/dashboard/dist/assets/C-KIc3Wc.js.br +0 -0
  12. package/dashboard/dist/assets/C-KIc3Wc.js.gz +0 -0
  13. package/dashboard/dist/assets/CE38zU4U.js +1 -0
  14. package/dashboard/dist/assets/CE38zU4U.js.br +0 -0
  15. package/dashboard/dist/assets/CE38zU4U.js.gz +0 -0
  16. package/dashboard/dist/assets/CFGKRAzG.js +1 -0
  17. package/dashboard/dist/assets/CFGKRAzG.js.br +0 -0
  18. package/dashboard/dist/assets/CFGKRAzG.js.gz +0 -0
  19. package/dashboard/dist/assets/CGGR2GZh.js +1 -0
  20. package/dashboard/dist/assets/CGGR2GZh.js.br +0 -0
  21. package/dashboard/dist/assets/CGGR2GZh.js.gz +0 -0
  22. package/dashboard/dist/assets/CL_wXqR7.js +1 -0
  23. package/dashboard/dist/assets/CL_wXqR7.js.br +0 -0
  24. package/dashboard/dist/assets/CL_wXqR7.js.gz +0 -0
  25. package/dashboard/dist/assets/CPFiTmlw.js +8 -0
  26. package/dashboard/dist/assets/CPFiTmlw.js.br +0 -0
  27. package/dashboard/dist/assets/CPFiTmlw.js.gz +0 -0
  28. package/dashboard/dist/assets/CZZTvkQZ.js +1 -0
  29. package/dashboard/dist/assets/CZZTvkQZ.js.br +0 -0
  30. package/dashboard/dist/assets/CZZTvkQZ.js.gz +0 -0
  31. package/dashboard/dist/assets/{CpJsfbXo.js → CxQ08qFN.js} +2 -2
  32. package/dashboard/dist/assets/CxQ08qFN.js.br +0 -0
  33. package/dashboard/dist/assets/CxQ08qFN.js.gz +0 -0
  34. package/dashboard/dist/assets/D-bf6hEI.js +213 -0
  35. package/dashboard/dist/assets/D-bf6hEI.js.br +0 -0
  36. package/dashboard/dist/assets/D-bf6hEI.js.gz +0 -0
  37. package/dashboard/dist/assets/DG6y9wJI.js +2 -0
  38. package/dashboard/dist/assets/DG6y9wJI.js.br +0 -0
  39. package/dashboard/dist/assets/DG6y9wJI.js.gz +0 -0
  40. package/dashboard/dist/assets/DNxKz-GV.js +1 -0
  41. package/dashboard/dist/assets/DNxKz-GV.js.br +0 -0
  42. package/dashboard/dist/assets/DNxKz-GV.js.gz +0 -0
  43. package/dashboard/dist/assets/DW_rKUic.js +11 -0
  44. package/dashboard/dist/assets/DW_rKUic.js.br +0 -0
  45. package/dashboard/dist/assets/DW_rKUic.js.gz +0 -0
  46. package/dashboard/dist/assets/DbNoijHm.js +1 -0
  47. package/dashboard/dist/assets/DbNoijHm.js.br +0 -0
  48. package/dashboard/dist/assets/DbNoijHm.js.gz +0 -0
  49. package/dashboard/dist/assets/DjcdE6jC.js +2 -0
  50. package/dashboard/dist/assets/DjcdE6jC.js.br +0 -0
  51. package/dashboard/dist/assets/DjcdE6jC.js.gz +0 -0
  52. package/dashboard/dist/assets/FZYuCDnt.js +1 -0
  53. package/dashboard/dist/assets/FZYuCDnt.js.br +0 -0
  54. package/dashboard/dist/assets/FZYuCDnt.js.gz +0 -0
  55. package/dashboard/dist/assets/PAUiij_z.js +1 -0
  56. package/dashboard/dist/assets/PAUiij_z.js.br +0 -0
  57. package/dashboard/dist/assets/PAUiij_z.js.gz +0 -0
  58. package/dashboard/dist/assets/cNrhgGc1.js +8 -0
  59. package/dashboard/dist/assets/cNrhgGc1.js.br +0 -0
  60. package/dashboard/dist/assets/cNrhgGc1.js.gz +0 -0
  61. package/dashboard/dist/assets/h5biQs2I.css +1 -0
  62. package/dashboard/dist/assets/h5biQs2I.css.br +0 -0
  63. package/dashboard/dist/assets/h5biQs2I.css.gz +0 -0
  64. package/dashboard/dist/assets/ic2FaMnh.js +1 -0
  65. package/dashboard/dist/assets/ic2FaMnh.js.br +0 -0
  66. package/dashboard/dist/assets/ic2FaMnh.js.gz +0 -0
  67. package/dashboard/dist/assets/nByHNHoW.js +1 -0
  68. package/dashboard/dist/assets/nByHNHoW.js.br +0 -0
  69. package/dashboard/dist/assets/nByHNHoW.js.gz +0 -0
  70. package/dashboard/dist/assets/qm8xLgv-.css +1 -0
  71. package/dashboard/dist/assets/qm8xLgv-.css.br +0 -0
  72. package/dashboard/dist/assets/qm8xLgv-.css.gz +0 -0
  73. package/dashboard/dist/assets/tS9mbYZi.js +1 -0
  74. package/dashboard/dist/assets/tS9mbYZi.js.br +0 -0
  75. package/dashboard/dist/assets/tS9mbYZi.js.gz +0 -0
  76. package/dashboard/dist/brand/anthropic-mark.svg.br +0 -0
  77. package/dashboard/dist/brand/anthropic-mark.svg.gz +0 -0
  78. package/dashboard/dist/brand/openai-mark.svg.br +0 -0
  79. package/dashboard/dist/brand/openai-mark.svg.gz +0 -0
  80. package/dashboard/dist/brand/openclaw-mark.svg.br +0 -0
  81. package/dashboard/dist/brand/openclaw-mark.svg.gz +0 -0
  82. package/dashboard/dist/brand/xandy-orchestrator.png +0 -0
  83. package/dashboard/dist/index.html +7 -5
  84. package/dashboard/dist/index.html.br +0 -0
  85. package/dashboard/dist/index.html.gz +0 -0
  86. package/dist/activity-actor-fields.js +26 -4
  87. package/dist/activity-store.js +38 -26
  88. package/dist/agent-context-store.js +84 -42
  89. package/dist/agent-run-store.js +49 -28
  90. package/dist/agent-suite.d.ts +9 -0
  91. package/dist/agent-suite.js +150 -17
  92. package/dist/artifacts/artifact-domain-schemas.d.ts +66 -0
  93. package/dist/artifacts/artifact-domain-schemas.js +357 -0
  94. package/dist/artifacts/register-artifact.d.ts +4 -3
  95. package/dist/artifacts/register-artifact.js +170 -57
  96. package/dist/auth/flows.d.ts +47 -0
  97. package/dist/auth/flows.js +169 -0
  98. package/dist/auth-store.js +6 -26
  99. package/dist/byok-store.js +5 -19
  100. package/dist/chat-store.d.ts +157 -0
  101. package/dist/chat-store.js +586 -0
  102. package/dist/cli/orgx.d.ts +66 -0
  103. package/dist/cli/orgx.js +102 -0
  104. package/dist/config/refresh.d.ts +32 -0
  105. package/dist/config/refresh.js +55 -0
  106. package/dist/config/resolution.d.ts +37 -0
  107. package/dist/config/resolution.js +178 -0
  108. package/dist/contracts/client.d.ts +43 -3
  109. package/dist/contracts/client.js +159 -30
  110. package/dist/contracts/retro-schema.d.ts +81 -0
  111. package/dist/contracts/retro-schema.js +80 -0
  112. package/dist/contracts/shared-types.d.ts +306 -0
  113. package/dist/contracts/shared-types.js +179 -0
  114. package/dist/contracts/skill-pack-schema.d.ts +192 -0
  115. package/dist/contracts/skill-pack-schema.js +180 -0
  116. package/dist/contracts/types.d.ts +224 -132
  117. package/dist/contracts/types.js +5 -0
  118. package/dist/entities/auto-assignment.d.ts +36 -0
  119. package/dist/entities/auto-assignment.js +141 -0
  120. package/dist/entity-comment-store.js +5 -25
  121. package/dist/event-sanitization.d.ts +11 -0
  122. package/dist/event-sanitization.js +113 -0
  123. package/dist/fs-utils.js +13 -1
  124. package/dist/gateway-watchdog.d.ts +5 -0
  125. package/dist/gateway-watchdog.js +50 -0
  126. package/dist/hash-utils.d.ts +2 -0
  127. package/dist/hash-utils.js +12 -0
  128. package/dist/hooks/post-reporting-event.mjs +1 -5
  129. package/dist/http/helpers/activity-headline.d.ts +10 -0
  130. package/dist/http/helpers/activity-headline.js +73 -0
  131. package/dist/http/helpers/artifact-fallback.d.ts +13 -0
  132. package/dist/http/helpers/artifact-fallback.js +148 -0
  133. package/dist/http/helpers/auto-continue-engine.d.ts +486 -0
  134. package/dist/http/helpers/auto-continue-engine.js +3563 -0
  135. package/dist/http/helpers/autopilot-operations.d.ts +176 -0
  136. package/dist/http/helpers/autopilot-operations.js +554 -0
  137. package/dist/http/helpers/autopilot-runtime.d.ts +43 -0
  138. package/dist/http/helpers/autopilot-runtime.js +607 -0
  139. package/dist/http/helpers/autopilot-slice-utils.d.ts +56 -0
  140. package/dist/http/helpers/autopilot-slice-utils.js +899 -0
  141. package/dist/http/helpers/decision-mapper.d.ts +52 -0
  142. package/dist/http/helpers/decision-mapper.js +260 -0
  143. package/dist/http/helpers/dispatch-lifecycle.d.ts +119 -0
  144. package/dist/http/helpers/dispatch-lifecycle.js +809 -0
  145. package/dist/http/helpers/hash-utils.d.ts +1 -0
  146. package/dist/http/helpers/hash-utils.js +1 -0
  147. package/dist/http/helpers/kickoff-context.d.ts +12 -0
  148. package/dist/http/helpers/kickoff-context.js +228 -0
  149. package/dist/http/helpers/llm-client.d.ts +47 -0
  150. package/dist/http/helpers/llm-client.js +256 -0
  151. package/dist/http/helpers/mission-control.d.ts +193 -0
  152. package/dist/http/helpers/mission-control.js +1383 -0
  153. package/dist/http/helpers/openclaw-cli.d.ts +37 -0
  154. package/dist/http/helpers/openclaw-cli.js +283 -0
  155. package/dist/http/helpers/runtime-sse.d.ts +20 -0
  156. package/dist/http/helpers/runtime-sse.js +110 -0
  157. package/dist/http/helpers/sentinel-catalog.d.ts +23 -0
  158. package/dist/http/helpers/sentinel-catalog.js +193 -0
  159. package/dist/http/helpers/session-classification.d.ts +9 -0
  160. package/dist/http/helpers/session-classification.js +564 -0
  161. package/dist/http/helpers/slice-experience-v2.d.ts +137 -0
  162. package/dist/http/helpers/slice-experience-v2.js +677 -0
  163. package/dist/http/helpers/slice-run-projections.d.ts +72 -0
  164. package/dist/http/helpers/slice-run-projections.js +860 -0
  165. package/dist/http/helpers/triage-mapper.d.ts +43 -0
  166. package/dist/http/helpers/triage-mapper.js +549 -0
  167. package/dist/http/helpers/value-utils.d.ts +6 -0
  168. package/dist/http/helpers/value-utils.js +72 -0
  169. package/dist/http/helpers/workspace-scope.d.ts +15 -0
  170. package/dist/http/helpers/workspace-scope.js +170 -0
  171. package/dist/http/index.d.ts +88 -0
  172. package/dist/http/index.js +3610 -0
  173. package/dist/http/router.d.ts +23 -0
  174. package/dist/http/router.js +23 -0
  175. package/dist/http/routes/agent-control.d.ts +79 -0
  176. package/dist/http/routes/agent-control.js +684 -0
  177. package/dist/http/routes/agent-suite.d.ts +38 -0
  178. package/dist/http/routes/agent-suite.js +397 -0
  179. package/dist/http/routes/agents-catalog.d.ts +40 -0
  180. package/dist/http/routes/agents-catalog.js +128 -0
  181. package/dist/http/routes/billing.d.ts +23 -0
  182. package/dist/http/routes/billing.js +55 -0
  183. package/dist/http/routes/chat.d.ts +19 -0
  184. package/dist/http/routes/chat.js +522 -0
  185. package/dist/http/routes/debug.d.ts +14 -0
  186. package/dist/http/routes/debug.js +21 -0
  187. package/dist/http/routes/decision-actions.d.ts +20 -0
  188. package/dist/http/routes/decision-actions.js +103 -0
  189. package/dist/http/routes/delegation.d.ts +19 -0
  190. package/dist/http/routes/delegation.js +32 -0
  191. package/dist/http/routes/dispatch-gateway-envelope.d.ts +25 -0
  192. package/dist/http/routes/dispatch-gateway-envelope.js +26 -0
  193. package/dist/http/routes/entities.d.ts +63 -0
  194. package/dist/http/routes/entities.js +440 -0
  195. package/dist/http/routes/entity-dynamic.d.ts +25 -0
  196. package/dist/http/routes/entity-dynamic.js +191 -0
  197. package/dist/http/routes/health.d.ts +22 -0
  198. package/dist/http/routes/health.js +49 -0
  199. package/dist/http/routes/live-legacy.d.ts +115 -0
  200. package/dist/http/routes/live-legacy.js +112 -0
  201. package/dist/http/routes/live-misc.d.ts +81 -0
  202. package/dist/http/routes/live-misc.js +426 -0
  203. package/dist/http/routes/live-snapshot.d.ts +136 -0
  204. package/dist/http/routes/live-snapshot.js +916 -0
  205. package/dist/http/routes/live-terminal.d.ts +11 -0
  206. package/dist/http/routes/live-terminal.js +261 -0
  207. package/dist/http/routes/live-triage.d.ts +61 -0
  208. package/dist/http/routes/live-triage.js +248 -0
  209. package/dist/http/routes/mission-control-actions.d.ts +131 -0
  210. package/dist/http/routes/mission-control-actions.js +1791 -0
  211. package/dist/http/routes/mission-control-read.d.ts +73 -0
  212. package/dist/http/routes/mission-control-read.js +1640 -0
  213. package/dist/http/routes/onboarding.d.ts +34 -0
  214. package/dist/http/routes/onboarding.js +101 -0
  215. package/dist/http/routes/realtime-orchestrator.d.ts +10 -0
  216. package/dist/http/routes/realtime-orchestrator.js +74 -0
  217. package/dist/http/routes/run-control.d.ts +27 -0
  218. package/dist/http/routes/run-control.js +96 -0
  219. package/dist/http/routes/runtime-hooks.d.ts +69 -0
  220. package/dist/http/routes/runtime-hooks.js +437 -0
  221. package/dist/http/routes/sentinels-catalog.d.ts +7 -0
  222. package/dist/http/routes/sentinels-catalog.js +24 -0
  223. package/dist/http/routes/settings-byok.d.ts +23 -0
  224. package/dist/http/routes/settings-byok.js +163 -0
  225. package/dist/http/routes/summary.d.ts +18 -0
  226. package/dist/http/routes/summary.js +49 -0
  227. package/dist/http/routes/usage.d.ts +24 -0
  228. package/dist/http/routes/usage.js +362 -0
  229. package/dist/http/routes/work-artifacts.d.ts +9 -0
  230. package/dist/http/routes/work-artifacts.js +55 -0
  231. package/dist/http/shared-state.d.ts +16 -0
  232. package/dist/http/shared-state.js +1 -0
  233. package/dist/http-handler.d.ts +1 -88
  234. package/dist/http-handler.js +1 -10605
  235. package/dist/index.js +287 -2284
  236. package/dist/json-utils.d.ts +1 -0
  237. package/dist/json-utils.js +8 -0
  238. package/dist/local-openclaw.js +29 -6
  239. package/dist/mcp-client-setup.js +3 -3
  240. package/dist/mcp-http-handler.js +33 -59
  241. package/dist/next-up-queue-store.d.ts +16 -1
  242. package/dist/next-up-queue-store.js +93 -25
  243. package/dist/outbox.d.ts +5 -0
  244. package/dist/outbox.js +113 -9
  245. package/dist/paths.js +24 -5
  246. package/dist/reporting/rollups.d.ts +53 -0
  247. package/dist/reporting/rollups.js +148 -0
  248. package/dist/retro/domain-templates.d.ts +45 -0
  249. package/dist/retro/domain-templates.js +297 -0
  250. package/dist/retro/quality-rubric.d.ts +33 -0
  251. package/dist/retro/quality-rubric.js +213 -0
  252. package/dist/runtime-cleanup.d.ts +18 -0
  253. package/dist/runtime-cleanup.js +87 -0
  254. package/dist/runtime-instance-store.js +5 -31
  255. package/dist/services/background.d.ts +34 -0
  256. package/dist/services/background.js +45 -0
  257. package/dist/services/experiment-randomization.d.ts +21 -0
  258. package/dist/services/experiment-randomization.js +63 -0
  259. package/dist/services/instrumentation.d.ts +29 -0
  260. package/dist/services/instrumentation.js +136 -0
  261. package/dist/skill-pack-state.d.ts +36 -5
  262. package/dist/skill-pack-state.js +273 -29
  263. package/dist/snapshot-store.js +5 -25
  264. package/dist/stores/json-store.d.ts +11 -0
  265. package/dist/stores/json-store.js +42 -0
  266. package/dist/sync/local-agent-telemetry.d.ts +13 -0
  267. package/dist/sync/local-agent-telemetry.js +128 -0
  268. package/dist/sync/outbox-replay.d.ts +55 -0
  269. package/dist/sync/outbox-replay.js +621 -0
  270. package/dist/team-context-store.d.ts +23 -0
  271. package/dist/team-context-store.js +116 -0
  272. package/dist/telemetry/posthog.js +4 -2
  273. package/dist/tools/core-tools.d.ts +72 -0
  274. package/dist/tools/core-tools.js +2270 -0
  275. package/dist/types.d.ts +2 -0
  276. package/dist/types.js +2 -0
  277. package/dist/worker-supervisor.js +23 -0
  278. package/package.json +14 -4
  279. package/dashboard/dist/assets/B3ziCA02.js +0 -8
  280. package/dashboard/dist/assets/BNeJ0kpF.js +0 -1
  281. package/dashboard/dist/assets/BzkiMPmM.js +0 -215
  282. package/dashboard/dist/assets/CUV9IHHi.js +0 -1
  283. package/dashboard/dist/assets/Ie7d9Iq2.css +0 -1
  284. package/dashboard/dist/assets/sAhvFnpk.js +0 -4
@@ -1,4 +0,0 @@
1
- var ui={exports:{}},ci={};var yr;function Bn(){return yr||(yr=1,(function(r){function e(w,P){var T=w.length;w.push(P);e:for(;0<T;){var L=T-1>>>1,A=w[L];if(0<s(A,P))w[L]=P,w[T]=A,T=L;else break e}}function t(w){return w.length===0?null:w[0]}function i(w){if(w.length===0)return null;var P=w[0],T=w.pop();if(T!==P){w[0]=T;e:for(var L=0,A=w.length,K=A>>>1;L<K;){var G=2*(L+1)-1,ye=w[G],ie=G+1,Ve=w[ie];if(0>s(ye,T))ie<A&&0>s(Ve,ye)?(w[L]=Ve,w[ie]=T,L=ie):(w[L]=ye,w[G]=T,L=G);else if(ie<A&&0>s(Ve,T))w[L]=Ve,w[ie]=T,L=ie;else break e}}return P}function s(w,P){var T=w.sortIndex-P.sortIndex;return T!==0?T:w.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;r.unstable_now=function(){return n.now()}}else{var a=Date,o=a.now();r.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,p=3,f=!1,g=!1,v=!1,_=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function $(w){for(var P=t(c);P!==null;){if(P.callback===null)i(c);else if(P.startTime<=w)i(c),P.sortIndex=P.expirationTime,e(l,P);else break;P=t(c)}}function R(w){if(v=!1,$(w),!g)if(t(l)!==null)g=!0,me(k);else{var P=t(c);P!==null&&pe(R,P.startTime-w)}}function k(w,P){g=!1,v&&(v=!1,I(F),F=-1),f=!0;var T=p;try{for($(P),h=t(l);h!==null&&(!(h.expirationTime>P)||w&&!se());){var L=h.callback;if(typeof L=="function"){h.callback=null,p=h.priorityLevel;var A=L(h.expirationTime<=P);P=r.unstable_now(),typeof A=="function"?h.callback=A:h===t(l)&&i(l),$(P)}else i(l);h=t(l)}if(h!==null)var K=!0;else{var G=t(c);G!==null&&pe(R,G.startTime-P),K=!1}return K}finally{h=null,p=T,f=!1}}var H=!1,M=null,F=-1,ee=5,z=-1;function se(){return!(r.unstable_now()-z<ee)}function te(){if(M!==null){var w=r.unstable_now();z=w;var P=!0;try{P=M(!0,w)}finally{P?ne():(H=!1,M=null)}}else H=!1}var ne;if(typeof S=="function")ne=function(){S(te)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,de=ue.port2;ue.port1.onmessage=te,ne=function(){de.postMessage(null)}}else ne=function(){_(te,0)};function me(w){M=w,H||(H=!0,ne())}function pe(w,P){F=_(function(){w(r.unstable_now())},P)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(w){w.callback=null},r.unstable_continueExecution=function(){g||f||(g=!0,me(k))},r.unstable_forceFrameRate=function(w){0>w||125<w||(ee=0<w?Math.floor(1e3/w):5)},r.unstable_getCurrentPriorityLevel=function(){return p},r.unstable_getFirstCallbackNode=function(){return t(l)},r.unstable_next=function(w){switch(p){case 1:case 2:case 3:var P=3;break;default:P=p}var T=p;p=P;try{return w()}finally{p=T}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(w,P){switch(w){case 1:case 2:case 3:case 4:case 5:break;default:w=3}var T=p;p=w;try{return P()}finally{p=T}},r.unstable_scheduleCallback=function(w,P,T){var L=r.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?L+T:L):T=L,w){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=T+A,w={id:u++,callback:P,priorityLevel:w,startTime:T,expirationTime:A,sortIndex:-1},T>L?(w.sortIndex=T,e(c,w),t(l)===null&&w===t(c)&&(v?(I(F),F=-1):v=!0,pe(R,T-L))):(w.sortIndex=A,e(l,w),g||f||(g=!0,me(k))),w},r.unstable_shouldYield=se,r.unstable_wrapCallback=function(w){var P=p;return function(){var T=p;p=P;try{return w.apply(this,arguments)}finally{p=T}}}})(ci)),ci}var br;function Fl(){return br||(br=1,ui.exports=Bn()),ui.exports}var d=typeof window<"u"?window:void 0,Q=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(Q.self=Q),typeof File>"u"&&(Q.File=function(){});var Ps=Array.prototype,wr=Ps.forEach,Er=Ps.indexOf,he=Q==null?void 0:Q.navigator,y=Q==null?void 0:Q.document,Z=Q==null?void 0:Q.location,Ri=Q==null?void 0:Q.fetch,$i=Q!=null&&Q.XMLHttpRequest&&"withCredentials"in new Q.XMLHttpRequest?Q.XMLHttpRequest:void 0,xr=Q==null?void 0:Q.AbortController,oe=he==null?void 0:he.userAgent,x=d??{},ke={DEBUG:!1,LIB_VERSION:"1.345.5"};function kr(r,e,t,i,s,n,a){try{var o=r[n](a),l=o.value}catch(c){return void t(c)}o.done?e(l):Promise.resolve(l).then(i,s)}function Ke(r){return function(){var e=this,t=arguments;return new Promise((function(i,s){var n=r.apply(e,t);function a(l){kr(n,i,s,a,o,"next",l)}function o(l){kr(n,i,s,a,o,"throw",l)}a(void 0)}))}}function E(){return E=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},E.apply(null,arguments)}function Ss(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var Gn=["$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"],Vn=["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"],Pr=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return Vn.concat(e).some((i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1}))};function C(r,e){return r.indexOf(e)!==-1}var ri=function(r){return r.trim()},Ci=function(r){return r.replace(/^\$/,"")},Wn=Array.isArray,Fs=Object.prototype,Is=Fs.hasOwnProperty,si=Fs.toString,D=Wn||function(r){return si.call(r)==="[object Array]"},De=r=>typeof r=="function",Y=r=>r===Object(r)&&!D(r),Xe=r=>{if(Y(r)){for(var e in r)if(Is.call(r,e))return!1;return!0}return!1},m=r=>r===void 0,J=r=>si.call(r)=="[object String]",Oi=r=>J(r)&&r.trim().length===0,_e=r=>r===null,O=r=>m(r)||_e(r),Re=r=>si.call(r)=="[object Number]"&&r==r,Ye=r=>Re(r)&&r>0,Te=r=>si.call(r)==="[object Boolean]",zn=r=>r instanceof FormData,Yn=r=>C(Gn,r);function Mi(r){return r===null||typeof r!="object"}function Ut(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function Ts(r){return!m(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var Jn=[!0,"true",1,"1","yes"],hi=r=>C(Jn,r),Kn=[!1,"false",0,"0","no"];function we(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),Re(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),we(s||t,e,t,i))}class Xn{constructor(e){this.t={},this.i=e.i,this.o=we(e.bucketSize,0,100,e.h),this.m=we(e.refillRate,0,this.o,e.h),this.$=we(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}}var fe="Mobile",Bt="iOS",Ie="Android",Ft="Tablet",Rs=Ie+" "+Ft,$s="iPad",Cs="Apple",Os=Cs+" Watch",It="Safari",tt="BlackBerry",Ms="Samsung",As=Ms+"Browser",Ds=Ms+" Internet",Be="Chrome",Zn=Be+" OS",Ls=Be+" "+Bt,sr="Internet Explorer",Ns=sr+" "+fe,nr="Opera",Qn=nr+" Mini",ar="Edge",js="Microsoft "+ar,Qe="Firefox",qs=Qe+" "+Bt,Tt="Nintendo",Rt="PlayStation",et="Xbox",Hs=Ie+" "+fe,Us=fe+" "+It,gt="Windows",Ai=gt+" Phone",Sr="Nokia",Di="Ouya",Bs="Generic",ea=Bs+" "+fe.toLowerCase(),Gs=Bs+" "+Ft.toLowerCase(),Li="Konqueror",ae="(\\d+(\\.\\d+)?)",di=new RegExp("Version/"+ae),ta=new RegExp(et,"i"),ia=new RegExp(Rt+" \\w+","i"),ra=new RegExp(Tt+" \\w+","i"),or=new RegExp(tt+"|PlayBook|BB10","i"),sa={"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"},At,Fr,pi,na=(r,e)=>e&&C(e,Cs)||(function(t){return C(t,It)&&!C(t,Be)&&!C(t,Ie)})(r),Vs=function(r,e){return e=e||"",C(r," OPR/")&&C(r,"Mini")?Qn:C(r," OPR/")?nr:or.test(r)?tt:C(r,"IE"+fe)||C(r,"WPDesktop")?Ns:C(r,As)?Ds:C(r,ar)||C(r,"Edg/")?js:C(r,"FBIOS")?"Facebook "+fe:C(r,"UCWEB")||C(r,"UCBrowser")?"UC Browser":C(r,"CriOS")?Ls:C(r,"CrMo")||C(r,Be)?Be:C(r,Ie)&&C(r,It)?Hs:C(r,"FxiOS")?qs:C(r.toLowerCase(),Li.toLowerCase())?Li:na(r,e)?C(r,fe)?Us:It:C(r,Qe)?Qe:C(r,"MSIE")||C(r,"Trident/")?sr:C(r,"Gecko")?Qe:""},aa={[Ns]:[new RegExp("rv:"+ae)],[js]:[new RegExp(ar+"?\\/"+ae)],[Be]:[new RegExp("("+Be+"|CrMo)\\/"+ae)],[Ls]:[new RegExp("CriOS\\/"+ae)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ae)],[It]:[di],[Us]:[di],[nr]:[new RegExp("(Opera|OPR)\\/"+ae)],[Qe]:[new RegExp(Qe+"\\/"+ae)],[qs]:[new RegExp("FxiOS\\/"+ae)],[Li]:[new RegExp("Konqueror[:/]?"+ae,"i")],[tt]:[new RegExp(tt+" "+ae),di],[Hs]:[new RegExp("android\\s"+ae,"i")],[Ds]:[new RegExp(As+"\\/"+ae)],[sr]:[new RegExp("(rv:|MSIE )"+ae)],Mozilla:[new RegExp("rv:"+ae)]},oa=function(r,e){var t=Vs(r,e),i=aa[t];if(m(i))return null;for(var s=0;s<i.length;s++){var n=i[s],a=r.match(n);if(a)return parseFloat(a[a.length-2])}return null},Ir=[[new RegExp(et+"; "+et+" (.*?)[);]","i"),r=>[et,r&&r[1]||""]],[new RegExp(Tt,"i"),[Tt,""]],[new RegExp(Rt,"i"),[Rt,""]],[or,[tt,""]],[new RegExp(gt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ai,""];if(new RegExp(fe).test(e)&&!/IEMobile\b/.test(e))return[gt+" "+fe,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=sa[i]||"";return/arm/i.test(e)&&(s="RT"),[gt,s]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Bt,e.join(".")]}return[Bt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=m(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Ie+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ie+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Ie,e.join(".")]}return[Ie,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Zn,""]],[/Linux|debian/i,["Linux",""]]],Tr=function(r){return ra.test(r)?Tt:ia.test(r)?Rt:ta.test(r)?et:new RegExp(Di,"i").test(r)?Di:new RegExp("("+Ai+"|WPDesktop)","i").test(r)?Ai:/iPad/.test(r)?$s:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Os:or.test(r)?tt:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Sr,"i").test(r)?Sr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(fe).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?Ie:Rs:new RegExp("(pda|"+fe+")","i").test(r)?ea:new RegExp(Ft,"i").test(r)&&!new RegExp(Ft+" pc","i").test(r)?Gs:""},la=r=>r instanceof Error;function ua(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return pi&&t.length===Fr||(Fr=t.length,pi=t.reduce(((i,s)=>{At||(At={});var n=At[s];if(n)i[n[0]]=n[1];else for(var a=r(s),o=a.length-1;o>=0;o--){var l=a[o],c=l==null?void 0:l.filename,u=e[s];if(c&&u){i[c]=u,At[s]=[c,u];break}}return i}),{})),pi}}class ca{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Ke((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&D(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),E({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Ke((function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i}))()}convertToExceptionList(e,t){var i,s,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:ua(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,a)=>{if(a<=4){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return E({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}}var it="?";function Ni(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?it:t,in_app:!0};return m(i)||(n.lineno=i),m(s)||(n.colno=s),n}var Ws=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:it,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},ha=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,da=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pa=/\((\S*)(?::(\d+))(?::(\d+))\)/,fa=(r,e)=>{var t=ha.exec(r);if(t){var[,i,s,n]=t;return Ni(e,i,it,+s,+n)}var a=da.exec(r);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=pa.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=Ws(a[1]||it,a[2]);return Ni(e,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},ga=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,va=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_a=(r,e)=>{var t=ga.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=va.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var s=t[3],n=t[1]||it;return[n,s]=Ws(n,s),Ni(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Rr=/\(error: (.*)\)/,$r=50;function ma(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return function(s,n){n===void 0&&(n=0);for(var a=[],o=s.split(`
2
- `),l=n;l<o.length;l++){var c=o[l];if(!(c.length>1024)){var u=Rr.test(c)?c.replace(Rr,"$1"):c;if(!u.match(/\S*Error: /)){for(var h of t){var p=h(u,r);if(p){a.push(p);break}}if(a.length>=$r)break}}}return(function(f){if(!f.length)return[];var g=Array.from(f);return g.reverse(),g.slice(0,$r).map((v=>{return E({},v,{filename:v.filename||(_=g,_[_.length-1]||{}).filename,function:v.function||it});var _}))})(a)}})("web:javascript",fa,_a)}class ya{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=J(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ut(e,"DOMException")}isDOMError(e){return Ut(e,"DOMError")}}class ba{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class wa{constructor(){}match(e){return Ut(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var Ea=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class xa{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Ea);return s&&(t=s[1],i=s[2]),[t,i]}}var ka=["fatal","error","warning","log","info","debug"];function zs(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class Pa{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ts(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+zs(e)}isSeverityLevel(e){return J(e)&&!Oi(e)&&ka.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(la(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class Sa{match(e){return Ts(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+zs(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Fa{match(e){return Mi(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Ia{match(e){return Ut(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return Mi(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(Mi(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Ys=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(ke.DEBUG||x.POSTHOG_DEBUG||t)&&!m(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],a=arguments.length,o=new Array(a>1?a-1:0),l=1;l<a;l++)o[l-1]=arguments[l];n(r,...o)}},info:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a]},uninitializedWarning:s=>{i.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Ys(r+" "+s,n)};return i},b=Ys("[PostHog.js]"),B=b.createLogger,Ta=B("[ExternalScriptsLoader]"),Cr=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Ta.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=y==null?void 0:y.querySelectorAll("script");if(i){for(var s,n=function(){if(i[a].src===e){var l=i[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},a=0;a<i.length;a++)if(s=n())return s.v}var o=()=>{if(!y)return t("document not found");var l=y.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")y.head.appendChild(l);else{var c,u=y.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):y.body.appendChild(l)}};y!=null&&y.body?o():y==null||y.addEventListener("DOMContentLoaded",o)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);Cr(r,n,t)},x.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);Cr(r,i,t)};var Gt={};function Le(r,e,t){if(D(r)){if(wr&&r.forEach===wr)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Gt)return}}}function j(r,e,t){if(!O(r)){if(D(r))return Le(r,e,t);if(zn(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Gt)return}else for(var s in r)if(Is.call(r,s)&&e.call(t,r[s],s)===Gt)return}}var V=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Le(t,(function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])})),r},st=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Le(t,(function(s){Le(s,(function(n){r.push(n)}))})),r};function qt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var Or=function(r){try{return r()}catch{return}},Ra=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(s)}}},lr=function(r){var e={};return j(r,(function(t,i){(J(t)&&t.length>0||Re(t))&&(e[i]=t)})),e};function $a(r,e){return t=r,i=n=>J(n)&&!_e(e)?n.slice(0,e):n,s=new Set,(function n(a,o){return a!==Object(a)?i?i(a,o):a:s.has(a)?void 0:(s.add(a),D(a)?(l=[],Le(a,(c=>{l.push(n(c))}))):(l={},j(a,((c,u)=>{s.has(c)||(l[u]=n(c,u))}))),l);var l})(t);var t,i,s}var Ca=["herokuapp.com","vercel.app","netlify.app"];function Oa(r){var e=r==null?void 0:r.hostname;if(!J(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Ca)if(t===i)return!1;return!0}function Js(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function W(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r==null||r.addEventListener(e,t,{capture:s,passive:n})}var Ks="$people_distinct_id",vt="__alias",_t="__timers",Mr="$autocapture_disabled_server_side",ji="$heatmaps_enabled_server_side",Ar="$exception_capture_enabled_server_side",qi="$error_tracking_suppression_rules",Dr="$error_tracking_capture_extension_exceptions",Lr="$web_vitals_enabled_server_side",Xs="$dead_clicks_enabled_server_side",Nr="$product_tours_enabled_server_side",jr="$web_vitals_allowed_metrics",fi="$session_recording_remote_config",Vt="$sesid",Zs="$session_is_sampled",Ze="$enabled_feature_flags",mt="$early_access_features",Hi="$feature_flag_details",yt="$stored_person_properties",Ue="$stored_group_properties",Ui="$surveys",Wt="$flag_call_reported",Bi="$feature_flag_errors",Pe="$user_state",Gi="$client_session_props",Vi="$capture_rate_limit",Wi="$initial_campaign_params",zi="$initial_referrer_info",zt="$initial_person_info",Yt="$epp",Qs="__POSTHOG_TOOLBAR__",at="$posthog_cookieless",Ma=[Ks,vt,"__cmpns",_t,"$session_recording_enabled_server_side",ji,Vt,Ze,qi,Pe,mt,Hi,Ue,yt,Ui,Wt,Bi,Gi,Vi,Wi,zi,Yt,zt,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function qr(r){return r instanceof Element&&(r.id===Qs||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function ni(r){return!!r&&r.nodeType===1}function Ne(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function en(r){return!!r&&r.nodeType===3}function tn(r){return!!r&&r.nodeType===11}function ur(r){return r?ri(r).split(/\s+/):[]}function Hr(r){var e=d==null?void 0:d.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Jt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return ur(e)}function rn(r){return O(r)?null:ri(r).split(/(\s+)/).filter((e=>$t(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ct(r){var e="";return Yi(r)&&!ln(r)&&r.childNodes&&r.childNodes.length&&j(r.childNodes,(function(t){var i;en(t)&&t.textContent&&(e+=(i=rn(t.textContent))!==null&&i!==void 0?i:"")})),ri(e)}function sn(r){return m(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var cr=["a","button","form","input","select","textarea","label"];function nn(r,e){if(m(e))return!0;var t,i=function(n){if(e.some((a=>n.matches(a))))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function an(r){var e=r.parentNode;return!(!e||!ni(e))&&e}var Aa=["next","previous","prev",">","<"],Ur=10,Br=[".ph-no-rageclick",".ph-no-capture"];function Da(r,e){if(!d||hr(r))return!1;var t,i,s;if(Te(e)?(t=!!e&&Br,i=void 0):(t=(s=e==null?void 0:e.css_selector_ignorelist)!==null&&s!==void 0?s:Br,i=e==null?void 0:e.content_ignorelist),t===!1)return!1;var{targetElementList:n}=on(r,!1);return!(function(a,o){if(a===!1||m(a))return!1;var l;if(a===!0)l=Aa;else{if(!D(a))return!1;if(a.length>Ur)return b.error("[PostHog] content_ignorelist array cannot exceed "+Ur+" items. Use css_selector_ignorelist for more complex matching."),!1;l=a.map((c=>c.toLowerCase()))}return o.some((c=>{var{safeText:u,ariaLabel:h}=c;return l.some((p=>u.includes(p)||h.includes(p)))}))})(i,n.map((a=>{var o;return{safeText:Ct(a).toLowerCase(),ariaLabel:((o=a.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}})))&&!nn(n,t)}var hr=r=>!r||Ne(r,"html")||!ni(r),on=(r,e)=>{if(!d||hr(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Ne(s,"body");)if(tn(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=an(s);if(!n)break;if(e||cr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=d.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function La(r,e,t,i,s){var n,a,o,l;if(t===void 0&&(t=void 0),!d||hr(r)||(n=t)!=null&&n.url_allowlist&&!Hr(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&Hr(t.url_ignorelist))return!1;if((o=t)!=null&&o.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((g=>e.type===g)))return!1}var{parentIsUsefulElement:u,targetElementList:h}=on(r,i);if(!(function(g,v){var _=v==null?void 0:v.element_allowlist;if(m(_))return!0;var I,S=function(R){if(_.some((k=>R.tagName.toLowerCase()===k)))return{v:!0}};for(var $ of g)if(I=S($))return I.v;return!1})(h,t)||!nn(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(r);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(cr.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Yi(r){for(var e=r;e.parentNode&&!Ne(e,"body");e=e.parentNode){var t=Jt(e);if(C(t,"ph-sensitive")||C(t,"ph-no-capture"))return!1}if(C(Jt(r),"ph-include"))return!0;var i=r.type||"";if(J(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(J(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 ln(r){return!!(Ne(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Ne(r,"select")||Ne(r,"textarea")||r.getAttribute("contenteditable")==="true")}var un="(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})",Na=new RegExp("^(?:"+un+")$"),ja=new RegExp(un),cn="\\d{3}-?\\d{2}-?\\d{4}",qa=new RegExp("^("+cn+")$"),Ha=new RegExp("("+cn+")");function $t(r,e){return e===void 0&&(e=!0),!(O(r)||J(r)&&(r=ri(r),(e?Na:ja).test((r||"").replace(/[- ]/g,""))||(e?qa:Ha).test(r)))}function hn(r){var e=Ct(r);return $t(e=(e+" "+dn(r)).trim())?e:""}function dn(r){var e="";return r&&r.childNodes&&r.childNodes.length&&j(r.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=Ct(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+dn(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function Ua(r){return(function(e){var t=e.map((i=>{var s,n,a="";if(i.tag_name&&(a+=i.tag_name),i.attr_class)for(var o of(i.attr_class.sort(),i.attr_class))a+="."+o.replace(/"/g,"");var l=E({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),c={};return qt(l).sort(((u,h)=>{var[p]=u,[f]=h;return p.localeCompare(f)})).forEach((u=>{var[h,p]=u;return c[Gr(h.toString())]=Gr(p.toString())})),a+=":",a+=qt(c).map((u=>{var[h,p]=u;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:Ba(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return qt(t).filter((a=>{var[o]=a;return o.indexOf("attr__")===0})).forEach((a=>{var[o,l]=a;return n.attributes[o]=l})),n}))})(r))}function Gr(r){return r.replace(/"|\\"/g,'\\"')}function Ba(r){var e=r.attr__class;return e?D(e)?e:ur(e):void 0}class pn{constructor(e){this.disabled=e===!1;var t=Y(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Kt=r=>{var e=y==null?void 0:y.createElement("a");return m(e)?null:(e.href=r,e)},Ga=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return j(r,(function(n,a){m(n)||m(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t)})),s.join(e)},Xt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!D(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{b.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ot=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],a=s.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),u=[],h=0;h<c.length;h++){var p=c[h].split("=");D(p)&&(e.includes(p[0])?u.push(p[0]+"="+t):u.push(c[h]))}var f=l;return o!=null&&(f+="?"+u.join("&")),n!=null&&(f+="#"+n),f},Zt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},gi="$copy_autocapture",Vr=B("[AutoCapture]");function vi(r,e){return e.length>r?e.slice(0,r)+"...":e}function Va(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!ni(e));return e}function Wa(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};cr.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=vi(1024,hn(r)):n.$el_text=vi(1024,Ct(r)));var a=Jt(r);a.length>0&&(n.classes=a.filter((function(u){return u!==""}))),j(r.attributes,(function(u){var h;if((!ln(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(i==null||!i.includes(u.name))&&!e&&$t(u.value)&&(h=u.name,!J(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=u.value;u.name==="class"&&(p=ur(p).join(" ")),n["attr__"+u.name]=vi(1024,p)}}));for(var o=1,l=1,c=r;c=Va(c);)o++,c.tagName===r.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}function za(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Ne(u,"body");)tn(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var h,p=[],f={},g=!1,v=!1;if(j(c,(R=>{var k=Yi(R);R.tagName.toLowerCase()==="a"&&(g=R.getAttribute("href"),g=k&&g&&$t(g)&&g),C(Jt(R),"ph-no-capture")&&(v=!0),p.push(Wa(R,n,a,o));var H=(function(M){if(!Yi(M))return{};var F={};return j(M.attributes,(function(ee){if(ee.name&&ee.name.indexOf("data-ph-capture-attribute")===0){var z=ee.name.replace("data-ph-capture-attribute-",""),se=ee.value;z&&se&&$t(se)&&(F[z]=se)}})),F})(R);V(f,H)})),v)return{props:{},explicitNoCapture:v};if(a||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=hn(r):p[0].$el_text=Ct(r)),g){var _,I;p[0].attr__href=g;var S=(_=Kt(g))==null?void 0:_.host,$=d==null||(I=d.location)==null?void 0:I.host;S&&$&&S!==$&&(h=g)}return{props:V({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:Ua(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(i=p[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},f)}}class Ya{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new pn(e.config.rageclick),this.C=null}get R(){var e,t,i=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),i}F(){if(this.isBrowserSupported()){if(d&&y){var e=i=>{i=i||(d==null?void 0:d.event);try{this.O(i)}catch(s){Vr.error("Failed to capture event",s)}};if(W(y,"submit",e,{capture:!0}),W(y,"change",e,{capture:!0}),W(y,"click",e,{capture:!0}),this.R.capture_copied_text){var t=i=>{i=i||(d==null?void 0:d.event),this.O(i,gi)};W(y,"copy",t,{capture:!0}),W(y,"cut",t,{capture:!0})}}}else Vr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Mr]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return(t=this.C)==null||t.forEach((s=>{var n=y==null?void 0:y.querySelectorAll(s);n==null||n.forEach((a=>{e===a&&i.push(s)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[Mr],s=this.T;if(_e(s)&&!Te(i)&&!this.instance.M())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=sn(e);en(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Da(s,this.instance.config.rageclick)&&this.O(e,"$rageclick");var n=t===gi;if(s&&La(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=za(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===gi){var c,u=rn(d==null||(c=d.getSelection())==null?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return De(y==null?void 0:y.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Re(r)&&isFinite(r)&&Math.floor(r)===r});var Wr="0123456789abcdef";class Qt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>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|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Qt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Wr.charAt(this.bytes[t]>>>4)+Wr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Qt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class Ja{constructor(){this.A=0,this.j=0,this.D=new Ka}generate(){var e=this.generateOrAbort();if(m(e)){this.A=0;var t=this.generateOrAbort();if(m(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return Qt.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}}var zr,fn=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!m(d.crypto)&&crypto.getRandomValues&&(fn=r=>crypto.getRandomValues(r));class Ka{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(fn(this.N),this.U=0),this.N[this.U++]}}var Ae=()=>Xa().toString(),Xa=()=>(zr||(zr=new Ja)).generate(),ot="",Za=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Qa(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=y),ot)return ot;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Ae();!ot&&o--;){var c=a.slice(o).join("."),u=l+"=1;domain=."+c+";path=/";n.cookie=u+";max-age=3",n.cookie.includes(l)&&(n.cookie=u+";max-age=0",ot=c)}return ot})(r);if(!t){var i=(s=>{var n=s.match(Za);return n?n[0]:""})(r);i!==t&&b.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var be={H:()=>!!y,B:function(r){b.error("cookieStore error: "+r)},q:function(r){if(y){try{for(var e=r+"=",t=y.cookie.split(";").filter((n=>n.length)),i=0;i<t.length;i++){for(var s=t[i];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}},W:function(r){var e;try{e=JSON.parse(be.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(y)try{var n="",a="",o=Qa(y.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+c.length),y.cookie=c,c}catch{return}},V:function(r,e){if(y!=null&&y.cookie)try{be.G(r,"",-1,e)}catch{return}}},_i=null,U={H:function(){if(!_e(_i))return _i;var r=!0;if(m(d))r=!1;else try{var e="__mplssupport__";U.G(e,"xyz"),U.q(e)!=='"xyz"'&&(r=!1),U.V(e)}catch{r=!1}return r||b.error("localStorage unsupported; falling back to cookie store"),_i=r,r},B:function(r){b.error("localStorage error: "+r)},q:function(r){try{return d==null?void 0:d.localStorage.getItem(r)}catch(e){U.B(e)}return null},W:function(r){try{return JSON.parse(U.q(r))||{}}catch{}return null},G:function(r,e){try{d==null||d.localStorage.setItem(r,JSON.stringify(e))}catch(t){U.B(t)}},V:function(r){try{d==null||d.localStorage.removeItem(r)}catch(e){U.B(e)}}},eo=["$device_id","distinct_id",Vt,Zs,Yt,zt],Dt={},to={H:function(){return!0},B:function(r){b.error("memoryStorage error: "+r)},q:function(r){return Dt[r]||null},W:function(r){return Dt[r]||null},G:function(r,e){Dt[r]=e},V:function(r){delete Dt[r]}},je=null,X={H:function(){if(!_e(je))return je;if(je=!0,m(d))je=!1;else try{var r="__support__";X.G(r,"xyz"),X.q(r)!=='"xyz"'&&(je=!1),X.V(r)}catch{je=!1}return je},B:function(r){b.error("sessionStorage error: ",r)},q:function(r){try{return d==null?void 0:d.sessionStorage.getItem(r)}catch(e){X.B(e)}return null},W:function(r){try{return JSON.parse(X.q(r))||null}catch{}return null},G:function(r,e){try{d==null||d.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){X.B(t)}},V:function(r){try{d==null||d.sessionStorage.removeItem(r)}catch(e){X.B(e)}}},Se=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({});class io{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Se.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Se.DENIED||this.consent===Se.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Se.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return hi(e)?Se.GRANTED:C(Kn,e)?Se.DENIED:Se.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?U:be;var t=e==="localStorage"?be:U;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(hi(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Js([he==null?void 0:he.doNotTrack,he==null?void 0:he.msDoNotTrack,x.doNotTrack],(e=>hi(e)))}}var Lt=B("[Dead Clicks]"),ro=()=>!0,so=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(Xs)),i=r.instance.config.capture_dead_clicks;return Te(i)?i:!!Y(i)||t};class gn{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Xs]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabledOrStop()}startIfEnabledOrStop(){this.isEnabled(this)?this.it((()=>{this.et()})):this.stop()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Lt.error("failed to load script",s):e()}))}et(){var e;if(y){if(!this.tt&&(e=x.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Y(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),Lt.info("starting...")}}else Lt.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Lt.info("stopping..."))}}var lt=B("[ExceptionAutocapture]");class no{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=x.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=x.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=a(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=o(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){lt.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Ar]),this.dt=new Xn({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:lt}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(e)?t=E({},t,e):(m(e)?this.ht:e)&&(t=E({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(lt.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return lt.error("failed to load script",s);e()}))}ut(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Ar]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(s)?lt.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function Yr(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return De(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class ao{constructor(e){var t;this._instance=e,this.ct=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||Yr(d.history,"pushState",(s=>function(n,a,o){s.call(this,n,a,o),i._t("pushState")})),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||Yr(d.history,"replaceState",(s=>function(n,a,o){s.call(this,n,a,o),i._t("replaceState")})),this.bt()}}_t(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(s){b.error("Error capturing "+e+" pageview",s)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};W(d,"popstate",e),this.ft=()=>{d&&d.removeEventListener("popstate",e)}}}}var mi=B("[SegmentIntegration]");function oo(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var a=l=>{var c=()=>l.anonymousId()||Ae();i.config.get_device_id=c,l.id()&&(i.register({distinct_id:l.id(),$device_id:c()}),i.persistence.set_property(Pe,"identified")),s()},o=n.user();"then"in o&&De(o.then)?o.then(a):a(o)})(r,(()=>{t.register((i=>{Promise&&Promise.resolve||mi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,a)=>{if(!a)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(mi.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(mi.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var o=i.calculateEventProperties(a,n.event.properties);return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then((()=>{e()}))}))}var vn="posthog-js";function _n(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,c,u,h,p;if(!(n==="*"||n.includes(o.level))||!r.__loaded)return o;o.tags||(o.tags={});var f=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());o.tags["PostHog Person URL"]=f,r.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var g=((l=o.exception)==null?void 0:l.values)||[],v=g.map((I=>E({},I,{stacktrace:I.stacktrace?E({},I.stacktrace,{type:"raw",frames:(I.stacktrace.frames||[]).map((S=>E({},S,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:((c=g[0])==null?void 0:c.value)||o.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:o.tags};return t&&i&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),a&&r.exceptions.sendExceptionEvent(_),o}}class lo{constructor(e,t,i,s,n,a){this.name=vn,this.setupOnce=function(o){o(_n(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}var uo=d!=null&&d.location?Zt(d.location.hash,"__posthog")||Zt(location.hash,"state"):null,Jr="_postHogToolbarParams",Kr=B("[Toolbar]"),Me=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Me||{});class co{constructor(e){this.instance=e}yt(e){x.ph_toolbar_state=e}wt(){var e;return(e=x.ph_toolbar_state)!==null&&e!==void 0?e:Me.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.instance.config.name&&this.instance.config.name==="ph_toolbar_internal"||!d||!y)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d==null?void 0:d.localStorage}var s,n=uo||Zt(e.hash,"__posthog")||Zt(e.hash,"state"),a=n?Or((()=>JSON.parse(atob(decodeURIComponent(n)))))||Or((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Jr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}xt(e){var t=x.ph_load_toolbar||x.ph_load_editor;!O(t)&&De(t)?t(e,this.instance):Kr.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(Qs));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=E({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Jr,JSON.stringify(E({},s,{source:void 0}))),this.wt()===Me.LOADED)this.xt(s);else if(this.wt()===Me.UNINITIALIZED){var n;this.yt(Me.LOADING),(n=x.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(a=>{if(a)return Kr.error("[Toolbar] Failed to load",a),void this.yt(Me.UNINITIALIZED);this.yt(Me.LOADED),this.xt(s)})),W(d,"turbolinks:load",(()=>{this.yt(Me.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var ho=B("[TracingHeaders]");class po{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;m(this.$t)&&((t=x.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),m(this.St)&&((i=x.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return ho.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}}var Nt="https?://(.*)",nt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fo=st(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],nt),Mt="<masked>",go=["li_fat_id"];function mn(r,e,t){if(!y)return{};var i,s=e?st([],nt,t||[]):[],n=yn(Ot(y.URL,s,Mt),r),a=(i={},j(go,(function(o){var l=be.q(o);i[o]=l||null})),i);return V(a,n)}function yn(r,e){var t=fo.concat(e||[]),i={};return j(t,(function(s){var n=Xt(r,s);i[s]=n||null})),i}function bn(r){var e=(function(n){return n?n.search(Nt+"google.([^/?]*)")===0?"google":n.search(Nt+"bing.com")===0?"bing":n.search(Nt+"yahoo.com")===0?"yahoo":n.search(Nt+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!_e(e)){i.$search_engine=e;var s=y?Xt(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Xr(){return navigator.language||navigator.userLanguage}function wn(){return(y==null?void 0:y.referrer)||"$direct"}function En(r,e){var t=r?st([],nt,e||[]):[],i=Z==null?void 0:Z.href.substring(0,1e3);return{r:wn().substring(0,1e3),u:i?Ot(i,t,Mt):void 0}}function xn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Kt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Kt(i);s.$host=n==null?void 0:n.host,s.$pathname=n==null?void 0:n.pathname;var a=yn(i);V(s,a)}if(t){var o=bn(t);V(s,o)}return s}function kn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function vo(){try{return new Date().getTimezoneOffset()}catch{return}}function _o(r,e){if(!oe)return{};var t,i,s,n=r?st([],nt,e||[]):[],[a,o]=(function(l){for(var c=0;c<Ir.length;c++){var[u,h]=Ir[c],p=u.exec(l),f=p&&(De(h)?h(p,l):h);if(f)return f}return["",""]})(oe);return V(lr({$os:a,$os_version:o,$browser:Vs(oe,navigator.vendor),$device:Tr(oe),$device_type:(i=oe,s=Tr(i),s===$s||s===Rs||s==="Kobo"||s==="Kindle Fire"||s===Gs?Ft:s===Tt||s===et||s===Rt||s===Di?"Console":s===Os?"Wearable":s?fe:"Desktop"),$timezone:kn(),$timezone_offset:vo()}),{$current_url:Ot(Z==null?void 0:Z.href,n,Mt),$host:Z==null?void 0:Z.host,$pathname:Z==null?void 0:Z.pathname,$raw_user_agent:oe.length>1e3?oe.substring(0,997)+"...":oe,$browser_version:oa(oe,navigator.vendor),$browser_language:Xr(),$browser_language_prefix:(t=Xr(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d==null?void 0:d.screen.height,$screen_width:d==null?void 0:d.screen.width,$viewport_height:d==null?void 0:d.innerHeight,$viewport_width:d==null?void 0:d.innerWidth,$lib:"web",$lib_version:ke.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ce=B("[Web Vitals]"),Zr=9e5;class mo{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((i,s)=>E({},i,{["$web_vitals_"+s.name+"_event"]:E({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(m(n))Ce.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Ct();m(a)||(O(i==null?void 0:i.name)||O(i==null?void 0:i.value)?Ce.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Ce.error("Ignoring metric with value >= "+this.Rt,i):(this.N.url!==a&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),m(this.N.url)&&(this.N.url=a),this.N.firstMetricTimestamp=m(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(E({},i,{$current_url:a,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var i,s,n,a,o=x.__PosthogExtensions__;m(o)||m(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:a}=o.postHogWebVitalsCallbacks),i&&s&&n&&a?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.It.bind(this)),this.P=!0):Ce.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[Lr]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=Y(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return O(i)?((t=this._instance.persistence)==null?void 0:t.props[jr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Y(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Y(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=Y(this._instance.config.capture_performance)&&Re(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Zr;return 0<e&&e<=6e4?Zr:e}get isEnabled(){var e=Z==null?void 0:Z.protocol;if(e!=="http:"&&e!=="https:")return Ce.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Y(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Te(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Te(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Ce.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Lr]:t}),this._instance.persistence.register({[jr]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;if((t=x.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,s,(n=>{n?Ce.error("failed to load script",n):e()}))}}Ct(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?st([],nt,i||[]):[];return Ot(e,s,Mt)}Ce.error("Could not determine current URL")}}var yo=B("[Heatmaps]");function Qr(r){return Y(r)&&"clientX"in r&&"clientY"in r&&Re(r.clientX)&&Re(r.clientY)}class bo{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[ji]),this.rageclicks=new pn(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Y(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return O(this.instance.config.capture_heatmaps)?O(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;yo.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ji]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return(e==null?void 0:e.visibilityState)==="visible"})(y)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){d&&y&&(this.Nt=this.Lt.bind(this),W(d,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||(d==null?void 0:d.event)),W(y,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(d==null?void 0:d.event)),W(y,"mousemove",this.zt,{capture:!0}),this.Bt=new gn(this.instance,ro,this.jt.bind(this)),this.Bt.startIfEnabledOrStop(),this.qt=this.Mt.bind(this),W(y,"visibilitychange",this.qt),this.P=!0)}At(){var e;d&&y&&(this.Nt&&d.removeEventListener("beforeunload",this.Nt),this.Ut&&y.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&y.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&y.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=(function(o,l,c){for(var u=o;u&&ni(u)&&!Ne(u,"body");){if(u===c)return!1;if(C(l,d==null?void 0:d.getComputedStyle(u).position))return!0;u=an(u)}return!1})(sn(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}Dt(e,t){var i;if(t===void 0&&(t="click"),!qr(e.target)&&Qr(e)){var s=this.Gt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(E({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!qr(e.target)&&Qr(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?st([],nt,s||[]):[],a=Ot(t,n,Mt);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(e)}}Lt(){this.N&&!Xe(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class es{constructor(e){this.Jt=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var i,s=this.Qt(e,t);return this.Kt={pathname:(i=d==null?void 0:d.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(m(a)||m(o)||m(l)||m(c)||m(u)||m(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var p=a<=1?1:we(o/a,0,1,b),f=a<=1?1:we(l/a,0,1,b),g=c<=1?1:we(u/c,0,1,b),v=c<=1?1:we(h/c,0,1,b);s=V(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var Fe=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),ge=Uint8Array,le=Uint16Array,rt=Uint32Array,dr=new ge([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]),pr=new ge([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]),ts=new ge([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pn=function(r,e){for(var t=new le(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new rt(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},Sn=Pn(dr,2),wo=Sn[0],Ji=Sn[1];wo[28]=258,Ji[258]=28;for(var is=Pn(pr,0)[1],Fn=new le(32768),q=0;q<32768;++q){var qe=(43690&q)>>>1|(21845&q)<<1;qe=(61680&(qe=(52428&qe)>>>2|(13107&qe)<<2))>>>4|(3855&qe)<<4,Fn[q]=((65280&qe)>>>8|(255&qe)<<8)>>>1}var Pt=function(r,e,t){for(var i=r.length,s=0,n=new le(e);s<i;++s)++n[r[s]-1];var a,o=new le(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;for(a=new le(i),s=0;s<i;++s)a[s]=Fn[o[r[s]-1]++]>>>15-r[s];return a},Ge=new ge(288);for(q=0;q<144;++q)Ge[q]=8;for(q=144;q<256;++q)Ge[q]=9;for(q=256;q<280;++q)Ge[q]=7;for(q=280;q<288;++q)Ge[q]=8;var ei=new ge(32);for(q=0;q<32;++q)ei[q]=5;var Eo=Pt(Ge,9),xo=Pt(ei,5),In=function(r){return(r/8>>0)+(7&r&&1)},Tn=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof le?le:r instanceof rt?rt:ge)(t-e);return i.set(r.subarray(e,t)),i},Ee=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},ut=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},yi=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new ge(0),0];if(s==1){var a=new ge(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(k,H){return k.f-H.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=s-1;)o=t[t[c].f<t[h].f?c++:h++],l=t[c!=u&&t[c].f<t[h].f?c++:h++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var p=n[0].s;for(i=1;i<s;++i)n[i].s>p&&(p=n[i].s);var f=new le(p+1),g=Ki(t[u-1],f,0);if(g>e){i=0;var v=0,_=g-e,I=1<<_;for(n.sort((function(k,H){return f[H.s]-f[k.s]||k.f-H.f}));i<s;++i){var S=n[i].s;if(!(f[S]>e))break;v+=I-(1<<g-f[S]),f[S]=e}for(v>>>=_;v>0;){var $=n[i].s;f[$]<e?v-=1<<e-f[$]++-1:++i}for(;i>=0&&v;--i){var R=n[i].s;f[R]==e&&(--f[R],++v)}g=e}return[new ge(f),g]},Ki=function(r,e,t){return r.s==-1?Math.max(Ki(r.l,e,t+1),Ki(r.r,e,t+1)):e[r.s]=t},rs=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new le(++e),i=0,s=r[0],n=1,a=function(l){t[i++]=l},o=1;o<=e;++o)if(r[o]==s&&o!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=r[o]}return[t.subarray(0,i),e]},ct=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Xi=function(r,e,t){var i=t.length,s=In(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},ss=function(r,e,t,i,s,n,a,o,l,c,u){Ee(e,u++,t),++s[256];for(var h=yi(s,15),p=h[0],f=h[1],g=yi(n,15),v=g[0],_=g[1],I=rs(p),S=I[0],$=I[1],R=rs(v),k=R[0],H=R[1],M=new le(19),F=0;F<S.length;++F)M[31&S[F]]++;for(F=0;F<k.length;++F)M[31&k[F]]++;for(var ee=yi(M,7),z=ee[0],se=ee[1],te=19;te>4&&!z[ts[te-1]];--te);var ne,ue,de,me,pe=c+5<<3,w=ct(s,Ge)+ct(n,ei)+a,P=ct(s,p)+ct(n,v)+a+14+3*te+ct(M,z)+(2*M[16]+3*M[17]+7*M[18]);if(pe<=w&&pe<=P)return Xi(e,u,r.subarray(l,l+c));if(Ee(e,u,1+(P<w)),u+=2,P<w){ne=Pt(p,f),ue=p,de=Pt(v,_),me=v;var T=Pt(z,se);for(Ee(e,u,$-257),Ee(e,u+5,H-1),Ee(e,u+10,te-4),u+=14,F=0;F<te;++F)Ee(e,u+3*F,z[ts[F]]);u+=3*te;for(var L=[S,k],A=0;A<2;++A){var K=L[A];for(F=0;F<K.length;++F){var G=31&K[F];Ee(e,u,T[G]),u+=z[G],G>15&&(Ee(e,u,K[F]>>>5&127),u+=K[F]>>>12)}}}else ne=Eo,ue=Ge,de=xo,me=ei;for(F=0;F<o;++F)if(i[F]>255){G=i[F]>>>18&31,ut(e,u,ne[G+257]),u+=ue[G+257],G>7&&(Ee(e,u,i[F]>>>23&31),u+=dr[G]);var ye=31&i[F];ut(e,u,de[ye]),u+=me[ye],ye>3&&(ut(e,u,i[F]>>>5&8191),u+=pr[ye])}else ut(e,u,ne[i[F]]),u+=ue[i[F]];return ut(e,u,ne[256]),u+ue[256]},ko=new rt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Po=(function(){for(var r=new rt(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),So=function(r,e,t,i,s){return(function(n,a,o,l,c,u){var h=n.length,p=new ge(l+h+5*(1+Math.floor(h/7e3))+c),f=p.subarray(l,p.length-c),g=0;if(!a||h<8)for(var v=0;v<=h;v+=65535){var _=v+65535;_<h?g=Xi(f,g,n.subarray(v,_)):(f[v]=u,g=Xi(f,g,n.subarray(v,h)))}else{for(var I=ko[a-1],S=I>>>13,$=8191&I,R=(1<<o)-1,k=new le(32768),H=new le(R+1),M=Math.ceil(o/3),F=2*M,ee=function(li){return(n[li]^n[li+1]<<M^n[li+2]<<F)&R},z=new rt(25e3),se=new le(288),te=new le(32),ne=0,ue=0,de=(v=0,0),me=0,pe=0;v<h;++v){var w=ee(v),P=32767&v,T=H[w];if(k[P]=T,H[w]=P,me<=v){var L=h-v;if((ne>7e3||de>24576)&&L>423){g=ss(n,f,0,z,se,te,ue,de,pe,v-pe,g),de=ne=ue=0,pe=v;for(var A=0;A<286;++A)se[A]=0;for(A=0;A<30;++A)te[A]=0}var K=2,G=0,ye=$,ie=P-T&32767;if(L>2&&w==ee(v-ie))for(var Ve=Math.min(S,L)-1,qn=Math.min(32767,v),Hn=Math.min(258,L);ie<=qn&&--ye&&P!=T;){if(n[v+K]==n[v+K-ie]){for(var $e=0;$e<Hn&&n[v+$e]==n[v+$e-ie];++$e);if($e>K){if(K=$e,G=ie,$e>Ve)break;var Un=Math.min(ie,$e-2),gr=0;for(A=0;A<Un;++A){var oi=v-ie+A+32768&32767,vr=oi-k[oi]+32768&32767;vr>gr&&(gr=vr,T=oi)}}}ie+=(P=T)-(T=k[P])+32768&32767}if(G){z[de++]=268435456|Ji[K]<<18|is[G];var _r=31&Ji[K],mr=31&is[G];ue+=dr[_r]+pr[mr],++se[257+_r],++te[mr],me=v+K,++ne}else z[de++]=n[v],++se[n[v]]}}g=ss(n,f,u,z,se,te,ue,de,pe,v-pe,g)}return Tn(p,0,l+In(g)+c)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},bi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Fo(r,e){e===void 0&&(e={});var t=(function(){var o=4294967295;return{p:function(l){for(var c=o,u=0;u<l.length;++u)c=Po[255&c^l[u]]^c>>>8;o=c},d:function(){return 4294967295^o}}})(),i=r.length;t.p(r);var s,n=So(r,e,10+((s=e).filename&&s.filename.length+1||0),8),a=n.length;return(function(o,l){var c=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&bi(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){o[3]=8;for(var u=0;u<=c.length;++u)o[u+10]=c.charCodeAt(u)}})(n,e),bi(n,a-8,t.d()),bi(n,a-4,i),n}var Io=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
3
- `).replace(/\r/g,`
4
- `)).length,s=0;s<i;s++){var a=r.charCodeAt(s),o=null;a<128?t++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),_e(o)||(t>e&&(n+=r.substring(e,t)),n+=o,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},To=!!$i||!!Ri,ns="text/plain",ti=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),a=E({},e),o=(i=n==null?void 0:n.split("&").map((c=>{var u,[h,p]=c.split("="),f=t&&(u=a[h])!==null&&u!==void 0?u:p;return delete a[h],h+"="+f})))!==null&&i!==void 0?i:[],l=Ga(a);return l&&o.push(l),s+"?"+o.join("&")},bt=(r,e)=>JSON.stringify(r,((t,i)=>typeof i=="bigint"?i.toString():i),e),wi=r=>{var{data:e,compression:t}=r;if(e){if(t===Fe.GZipJS){var i=Fo((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new ge(l.length+(l.length>>>1)),p=0,f=function(I){h[p++]=I},g=0;g<u;++g){if(p+5>h.length){var v=new ge(p+8+(u-g<<1));v.set(h),h=v}var _=l.charCodeAt(g);_<128||c?f(_):_<2048?(f(192|_>>>6),f(128|63&_)):_>55295&&_<57344?(f(240|(_=65536+(1047552&_)|1023&l.charCodeAt(++g))>>>18),f(128|_>>>12&63),f(128|_>>>6&63),f(128|63&_)):(f(224|_>>>12),f(128|_>>>6&63),f(128|63&_))}return Tn(h,0,p)})(bt(e)),{mtime:0}),s=new Blob([i],{type:ns});return{contentType:ns,body:s,estimatedSize:s.size}}if(t===Fe.Base64){var n=(function(l){var c,u,h,p,f,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,_=0,I="",S=[];if(!l)return l;l=Io(l);do c=(f=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,u=f>>12&63,h=f>>6&63,p=63&f,S[_++]=g.charAt(c)+g.charAt(u)+g.charAt(h)+g.charAt(p);while(v<l.length);switch(I=S.join(""),l.length%3){case 1:I=I.slice(0,-2)+"==";break;case 2:I=I.slice(0,-1)+"="}return I})(bt(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:bt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=bt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ht=[];Ri&&Ht.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=wi(r))!==null&&e!==void 0?e:{},a=new Headers;j(r.headers,(function(u,h){a.append(h,u)})),i&&a.append("Content-Type",i);var o=r.url,l=null;if(xr){var c=new xr;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Ri(o,E({method:(r==null?void 0:r.method)||"GET",headers:a,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((u=>u.text().then((h=>{var p={statusCode:u.status,text:h};if(u.status===200)try{p.json=JSON.parse(h)}catch(f){b.error(f)}r.callback==null||r.callback(p)})))).catch((u=>{b.error(u),r.callback==null||r.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),$i&&Ht.push({transport:"XHR",method:r=>{var e,t=new $i;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=wi(r))!==null&&e!==void 0?e:{};j(r.headers,(function(n,a){t.setRequestHeader(a,n)})),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),he!=null&&he.sendBeacon&&Ht.push({transport:"sendBeacon",method:r=>{var e=ti(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=wi(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;he.sendBeacon(e,n)}catch{}}});var ii=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function as(r,e,t){return bt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Rn={exact:(r,e)=>e.some((t=>r.some((i=>t===i)))),is_not:(r,e)=>e.every((t=>r.every((i=>t!==i)))),regex:(r,e)=>e.some((t=>r.some((i=>ii(t,i))))),not_regex:(r,e)=>e.every((t=>r.every((i=>!ii(t,i))))),icontains:(r,e)=>e.map(jt).some((t=>r.map(jt).some((i=>t.includes(i))))),not_icontains:(r,e)=>e.map(jt).every((t=>r.map(jt).every((i=>!t.includes(i))))),gt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i>parseFloat(s)))})),lt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i<parseFloat(s)))}))},jt=r=>r.toLowerCase();function $n(r,e){return!r||Object.entries(r).every((t=>{var[i,s]=t,n=e==null?void 0:e[i];if(m(n)||_e(n))return!1;var a=[String(n)],o=Rn[s.operator];return!!o&&o(s.values,a)}))}var Ei=B("[Error tracking]");class Ro{constructor(e){var t,i;this.Zt=[],this.ti=new ca([new ya,new Ia,new wa,new ba,new Sa,new Pa,new xa,new Fa],ma()),this._instance=e,this.Zt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(qi))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Zt=n,this._instance.persistence&&this._instance.persistence.register({[qi]:this.Zt,[Dr]:a})}get ii(){var e,t=!!this._instance.get_property(Dr),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Ei.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Ei.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Ei.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((i,s)=>{var{type:n,value:a}=s;return J(n)&&n.length>0&&i.$exception_types.push(n),J(a)&&a.length>0&&i.$exception_values.push(a),i}),{$exception_types:[],$exception_values:[]});return this.Zt.some((i=>{var s=i.values.map((n=>{var a,o=Rn[n.operator],l=D(n.value)?n.value:[n.value],c=(a=t[n.key])!==null&&a!==void 0?a:[];return l.length>0&&o(l,c)}));return i.type==="OR"?s.some(Boolean):s.every(Boolean)}))}si(e){return e.flatMap((t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,i,s,n,a=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],o=a[a.length-1];return(s=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ei(e){return!O(e)&&D(e)}}var ce=B("[FeatureFlags]"),ht=B("[FeatureFlags]",{debugEnabled:!0}),$o="errors_while_computing_flags",Co="flag_missing",Oo="quota_limited",Mo="timeout",Ao="connection_error",Do="unknown_error",Lo=r=>"api_error_"+r,xi="$active_feature_flags",We="$override_feature_flags",os="$feature_flag_payloads",dt="$override_feature_flag_payloads",ls="$feature_flag_request_id",us="$feature_flag_evaluated_at",cs=r=>{var e={};for(var[t,i]of qt(r||{}))i&&(e[t]=i);return e},No=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):ce.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},jo=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({});class qo{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(ce.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((i=>{var s=i&&typeof i=="string"&&i.trim().length>0;return s||ce.error("Invalid evaluation context found:",i,"Expected non-empty string"),s})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Hi),t=this._instance.get_property(We),i=this._instance.get_property(dt);if(!i&&!t)return e||{};var s=V({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var a of n){var o,l,c=s[a],u=t==null?void 0:t[a],h=m(u)?(o=c==null?void 0:c.enabled)!==null&&o!==void 0&&o:!!u,p=m(u)?c.variant:typeof u=="string"?u:void 0,f=i==null?void 0:i[a],g=E({},c,{enabled:h,variant:h?p??(c==null?void 0:c.variant):void 0});h!==(c==null?void 0:c.enabled)&&(g.original_enabled=c==null?void 0:c.enabled),p!==(c==null?void 0:c.variant)&&(g.original_variant=c==null?void 0:c.variant),f&&(g.metadata=E({},c==null?void 0:c.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),s[a]=g}return this.oi||(ce.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.oi=!0),s}getFlagVariants(){var e=this._instance.get_property(Ze),t=this._instance.get_property(We);if(!t)return e||{};for(var i=V({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(ce.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(os),t=this._instance.get_property(dt);if(!t)return e||{};for(var i=V({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(ce.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.bi.emit("featureFlagsReloading",!0),this.gi=setTimeout((()=>{this.mi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.yi(),!this._instance.M())if(this.li)this.hi=!0;else{var i=this._instance.config.token,s=this._instance.get_property("$device_id"),n={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(yt)||{}),group_properties:this._instance.get_property(Ue)};_e(s)||m(s)||(n.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.pi()&&(n.evaluation_contexts=this.fi());var a=this._instance.config.__preview_remote_config,o=a?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",o+l);a&&(n.timezone=kn()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:n,compression:this._instance.config.disable_compression?void 0:Fe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var h,p,f,g,v=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),v=!1),this.li=!1,this.di||(this.di=!0,this._instance.wi((g=u.json)!==null&&g!==void 0?g:{})),!n.disable_flags||this.hi){this.vi=!v;var _=[];u.error?u.error instanceof Error?_.push(u.error.name==="AbortError"?Mo:Ao):_.push(Do):u.statusCode!==200&&_.push(Lo(u.statusCode)),(h=u.json)!=null&&h.errorsWhileComputingFlags&&_.push($o);var I=!((p=u.json)==null||(p=p.quotaLimited)==null||!p.includes(jo.FeatureFlags));if(I&&_.push(Oo),(f=this._instance.persistence)==null||f.register({[Bi]:_}),I)ce.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.");else{var S;n.disable_flags||this.receivedFeatureFlags((S=u.json)!==null&&S!==void 0?S:{},v),this.hi&&(this.hi=!1,this.mi())}}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlagResult(e,t);return(i=s==null?void 0:s.variant)!==null&&i!==void 0?i:s==null?void 0:s.enabled}ce.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants(),s=e in i,n=i[e],a=this.getFlagPayloads()[e],o=String(n),l=this._instance.get_property(ls)||void 0,c=this._instance.get_property(us)||void 0,u=this._instance.get_property(Wt)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var h,p,f,g,v,_,I,S,$,R;D(u[e])?u[e].push(o):u[e]=[o],(h=this._instance.persistence)==null||h.register({[Wt]:u});var k=this.getFeatureFlagDetails(e),H=[...(p=this._instance.get_property(Bi))!==null&&p!==void 0?p:[]];m(n)&&H.push(Co);var M={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:a||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((f=this._instance.config.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[e])||null,$feature_flag_bootstrapped_payload:((g=this._instance.config.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[e])||null,$used_bootstrap_value:!this.vi};m(k==null||(v=k.metadata)==null?void 0:v.version)||(M.$feature_flag_version=k.metadata.version);var F,ee=(_=k==null||(I=k.reason)==null?void 0:I.description)!==null&&_!==void 0?_:k==null||(S=k.reason)==null?void 0:S.code;ee&&(M.$feature_flag_reason=ee),k!=null&&($=k.metadata)!=null&&$.id&&(M.$feature_flag_id=k.metadata.id),m(k==null?void 0:k.original_variant)&&m(k==null?void 0:k.original_enabled)||(M.$feature_flag_original_response=m(k.original_variant)?k.original_enabled:k.original_variant),k!=null&&(R=k.metadata)!=null&&R.original_payload&&(M.$feature_flag_original_payload=k==null||(F=k.metadata)==null?void 0:F.original_payload),H.length&&(M.$feature_flag_error=H.join(",")),this._instance.capture("$feature_flag_called",M)}if(s){var z=a;if(!m(a))try{z=JSON.parse(a)}catch{}return{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:z}}}else ce.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.pi()&&(s.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:Fe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return m(i)?void 0:!!i}ce.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var h=No(a),p=h.flags,f=h.featureFlags,g=h.featureFlagPayloads;if(f){var v=a.requestId,_=a.evaluatedAt;if(D(f)){ce.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var I={};if(f)for(var S=0;S<f.length;S++)I[f[S]]=!0;o&&o.register({[xi]:f,[Ze]:I})}else{var $=f,R=g,k=p;if(a.errorsWhileComputingFlags)if(p){var H=new Set(Object.keys(p).filter((M=>{var F;return!((F=p[M])!=null&&F.failed)})));$=E({},l,Object.fromEntries(Object.entries($).filter((M=>{var[F]=M;return H.has(F)})))),R=E({},c,Object.fromEntries(Object.entries(R||{}).filter((M=>{var[F]=M;return H.has(F)})))),k=E({},u,Object.fromEntries(Object.entries(k||{}).filter((M=>{var[F]=M;return H.has(F)}))))}else $=E({},l,$),R=E({},c,R),k=E({},u,k);o&&o.register(E({[xi]:Object.keys(cs($)),[Ze]:$||{},[os]:R||{},[Hi]:k||{}},v?{[ls]:v}:{},_?{[us]:_}:{}))}}})(e,this._instance.persistence,i,s,n),this.xi(t)}}override(e,t){t===void 0&&(t=!1),ce.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ce.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(We),this._instance.persistence.unregister(dt),this.xi(),ht.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(We),ht.info("Flag overrides cleared");else if(i.flags){if(D(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[We]:s})}else this._instance.persistence.register({[We]:i.flags});ht.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(dt),ht.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[dt]:i.payloads}),ht.info("Payload overrides set",{payloads:i.payloads}))),void this.xi()}this.xi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.Ei();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(mt)||[]).find((c=>c.flagKey===e)),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=E({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[xi]:Object.keys(cs(l)),[Ze]:l}),this.xi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(mt),n=i?"&"+i.map((a=>"stage="+a)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:a=>{var o,l;if(a.json){var c=a.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(mt),(l=this._instance.persistence)==null||l.register({[mt]:c}),e(c)}}})}Ei(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,s)=>(i[s]=t[s],i)),{})}}xi(e){var{flags:t,flagVariants:i}=this.Ei();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(yt)||{};this._instance.register({[yt]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(yt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Ue)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((s=>{i[s]=E({},i[s],e[s]),delete e[s]})),this._instance.register({[Ue]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ue)||{};this._instance.register({[Ue]:E({},t,{[e]:{}})})}else this._instance.unregister(Ue)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.oi=!1}}var Ho=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ki{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Si=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.ki(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Pi}ki(e){Ho.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...eo,...s];return E({},U,{W:function(a){try{var o={};try{o=be.W(a)||{}}catch{}var l=V(o,JSON.parse(U.q(a)||"{}"));return U.G(a,l),l}catch{}return null},G:function(a,o,l,c,u,h){try{U.G(a,o,void 0,void 0,h);var p={};n.forEach((f=>{o[f]&&(p[f]=o[f])})),Object.keys(p).length&&be.G(a,p,l,c,u,h)}catch(f){U.B(f)}},V:function(a,o){try{d==null||d.localStorage.removeItem(a),be.V(a,o)}catch(l){U.B(l)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&U.H()?U:i==="localstorage+cookie"&&t.H()?t:i==="sessionstorage"&&X.H()?X:i==="memory"?to:i==="cookie"?be:t.H()?t:be}properties(){var e={};return j(this.props,(function(t,i){if(i===Ze&&Y(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else o=i,l=!1,(_e(a=Ma)?l:Er&&a.indexOf===Er?a.indexOf(o)!=-1:(j(a,(function(c){if(l||(l=c===o))return Gt})),l))||(e[i]=t);var a,o,l})),e}load(){if(!this.Pi){var e=this.Y.W(this.Si);e&&(this.props=V({},e))}}save(){this.Pi||this.Y.G(this.Si,this.props,this.Ti,this.Ii,this.Ci,this.R.debug)}remove(){this.Y.V(this.Si,!1),this.Y.V(this.Si,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Y(e)){m(t)&&(t="None"),this.Ti=m(i)?this.Ri:i;var s=!1;if(j(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Ti=m(t)?this.Ri:t;var i=!1;if(j(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=mn(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Xe(lr(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=y==null?void 0:y.referrer)?bn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:wn(),$referring_domain:y!=null&&y.referrer&&((e=Kt(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Wi]||this.props[zi]||this.register_once({[zt]:En(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};j([zi,Wi],(a=>{var o=this.props[a];o&&j(o,(function(l,c){e["$initial_"+Ci(c)]=l}))}));var t,i,s=this.props[zt];if(s){var n=(t=xn(s),i={},j(t,(function(a,o){i["$initial_"+Ci(o)]=a})),i);V(e,n)}return e}safe_merge(e){return j(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ri=this.Ti=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((a,o)=>{if(a.length!==o.length)return!1;var l=[...a].sort(),c=[...o].sort();return l.every(((u,h)=>u===c[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.ki(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.Pi=e,this.Pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_secure(e){e!==this.Ci&&(this.Ci=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[_t]||{};i[e]=t,this.props[_t]=i,this.save()}remove_event_timer(e){var t=(this.props[_t]||{})[e];return m(t)||(delete this.props[_t][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var hs=B("[Product Tours]"),Pi="ph_product_tours";class Uo{constructor(e){this.Fi=null,this.Oi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Nr]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Fi||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Nr)||this.it((()=>this.Mi()))}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",(s=>{s?hs.error("Could not load product tours script",s):e()}))}Mi(){var e;!this.Fi&&(e=x.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Fi=x.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!D(this.Oi)||t){var i=this._instance.persistence;if(i){var s=i.props[Pi];if(D(s)&&!t)return this.Oi=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:n=>{var a=n.statusCode;if(a!==200||!n.json){var o="Product Tours API could not be loaded, status: "+a;return hs.error(o),void e([],{isLoaded:!1,error:o})}var l=D(n.json.product_tours)?n.json.product_tours:[];this.Oi=l,i&&i.register({[Pi]:l}),e(l,{isLoaded:!0})}})}else e(this.Oi,{isLoaded:!0})}getActiveProductTours(e){O(this.Fi)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fi.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Fi)==null||t.showTourById(e)}previewTour(e){this.Fi?this.Fi.previewTour(e):this.it((()=>{var t;this.Mi(),(t=this.Fi)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Fi)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Fi)==null||e.nextStep()}previousStep(){var e;(e=this.Fi)==null||e.previousStep()}clearCache(){var e;this.Oi=null,(e=this._instance.persistence)==null||e.unregister(Pi)}resetTour(e){var t;(t=this.Fi)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Fi)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Fi)==null||t.cancelPendingTour(e)}}var pt=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({});(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({});(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({});(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({});var Si=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({});(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({});(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({});(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({});var wt=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Fi=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),Zi=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),N=B("[Surveys]"),Cn="seenSurvey_",Bo=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},ds=r=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(Cn,r),Go=[Si.Popover,Si.Widget,Si.API],Vo={ignoreConditions:!1,ignoreDelay:!1,displayType:Zi.Popover};class fr{constructor(){this.Ai={},this.Ai={}}on(e,t){return this.Ai[e]||(this.Ai[e]=[]),this.Ai[e].push(t),()=>{this.Ai[e]=this.Ai[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.Ai[e]||[])i(t);for(var s of this.Ai["*"]||[])s(e,t)}}function ze(r,e,t){if(O(r))return!1;switch(t){case"exact":return r===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}class Wo{constructor(e){this.ji=new fr,this.Di=(t,i)=>this.Li(t,i)&&this.Ni(t,i)&&this.Ui(t,i)&&this.zi(t,i),this.Li=(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event),this._instance=e,this.Hi=new Set,this.Bi=new Set}init(){var e;if(!m((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((i,s)=>{this.on(i,s)}))}}register(e){var t,i;if(!m((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.Bi)==null||o.add(a),(l=a.steps)==null||l.forEach((c=>{var u;(u=this.Hi)==null||u.add((c==null?void 0:c.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Hi.has(e)||this.Hi.has(t==null?void 0:t.event))&&this.Bi&&((i=this.Bi)==null?void 0:i.size)>0&&this.Bi.forEach((s=>{this.qi(t,s)&&this.ji.emit("actionCaptured",s.name)}))}Wi(e){this.onAction("actionCaptured",(t=>e(t)))}qi(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this.Di(e,i))return!0;return!1}onAction(e,t){return this.ji.on(e,t)}Ni(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!ze(s,t.url,t.url_matching||"contains"))return!1}return!0}Ui(e,t){return!!this.Gi(e,t)&&!!this.Vi(e,t)&&!!this.Ji(e,t)}Gi(e,t){var i;if(t==null||!t.href)return!0;var s=this.Ki(e);if(s.length>0)return s.some((o=>ze(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!a&&ze((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Vi(e,t){var i;if(t==null||!t.text)return!0;var s=this.Ki(e);if(s.length>0)return s.some((c=>ze(c.text,t.text,t.text_matching||"exact")||ze(c.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],p=/(?::|")text="(.*?)"/g;!O(u=p.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some((c=>ze(c,a,o))))}Ji(e,t){var i,s;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Ki(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}zi(e,t){return t==null||!t.properties||t.properties.length===0||$n(t.properties.reduce(((i,s)=>{var n=D(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i}),{}),e==null?void 0:e.properties)}}class zo{constructor(e){this._instance=e,this.Yi=new Map,this.Xi=new Map,this.Qi=new Map}Zi(e,t){return!!e&&$n(e.propertyFilters,t==null?void 0:t.properties)}te(e,t){var i=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=i.get(a.name)||[];o.push(s.id),i.set(a.name,o)}}))})),i}ie(e,t,i){var s=(i===pt.Activation?this.Yi:this.Xi).get(e),n=[];return this.ee((a=>{n=a.filter((o=>s==null?void 0:s.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[i])==null||(o=o.values)==null?void 0:o.find((c=>c.name===e));return this.Zi(l,t)}))}register(e){var t;m((t=this._instance)==null?void 0:t._addCaptureHook)||(this.re(e),this.se(e))}se(e){var t=e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ne==null&&(this.ne=new Wo(this._instance),this.ne.init(),this.ne.Wi((i=>{this.onAction(i)}))),t.forEach((i=>{var s,n,a,o,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.ne)==null||o.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.Qi.get(c.name);u&&u.push(i.id),this.Qi.set(c.name,u||[i.id])}})))})))}re(e){var t,i=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));(i.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this.Yi=this.te(e,pt.Activation),this.Xi=this.te(e,pt.Cancellation))}onEvent(e,t){var i,s=this.oe(),n=this.ae(),a=this.le(),o=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[n])||[];if(a===e&&t&&o.length>0){var l,c;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var h=o.indexOf(u);h>=0&&(o.splice(h,1),this.ue(o))}}else{if(this.Xi.has(e)){var p=this.ie(e,t,pt.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map((g=>g.id))}),p.forEach((g=>{var v=o.indexOf(g.id);v>=0&&o.splice(v,1),this.he(g.id)})),this.ue(o))}if(this.Yi.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Yi.get(e)});var f=this.ie(e,t,pt.Activation);this.ue(o.concat(f.map((g=>g.id))||[]))}}}onAction(e){var t,i=this.ae(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Qi.has(e)&&this.ue(s.concat(this.Qi.get(e)||[]))}ue(e){var t,i=this.oe(),s=this.ae(),n=[...new Set(e)].filter((a=>!this.de(a)));i.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.ae(),i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i||[]}getEventToItemsMap(){return this.Yi}ve(){return this.ne}}class Yo extends zo{constructor(e){super(e)}ae(){return"$surveys_activated"}le(){return wt.SHOWN}ee(e){var t;(t=this._instance)==null||t.getSurveys(e)}he(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}oe(){return N}de(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Jo{constructor(e){this.ce=void 0,this._surveyManager=null,this.fe=!1,this.pe=[],this.ge=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(O(t))return N.warn("Flags not loaded yet. Not loading surveys.");var i=D(t);this.ce=i?t.length>0:t,N.info("flags response received, isSurveysEnabled: "+this.ce),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(Cn)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.fe)N.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)N.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())N.info("Not loading surveys in cookieless mode without consent.");else{var e=x==null?void 0:x.__PosthogExtensions__;if(e){if(!m(this.ce)||this._instance.config.advanced_enable_surveys){var t=this.ce||this._instance.config.advanced_enable_surveys;this.fe=!0;try{var i=e.generateSurveys;if(i)return void this._e(i,t);var s=e.loadExternalDependency;if(!s)return void this.me("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.me("Could not load surveys script",n):this._e(e.generateSurveys,t)}))}catch(n){throw this.me("Error initializing surveys",n),n}finally{this.fe=!1}}}else N.error("PostHog Extensions not found.")}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Yo(this._instance),N.info("Surveys loaded successfully"),this.be({isLoaded:!0})}me(e,t){N.error(e,t),this.be({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.pe.push(e),this._surveyManager&&this.be({isLoaded:!0}),()=>{this.pe=this.pe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return N.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(Ui);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.ge?this.ge.then((n=>{var{surveys:a,context:o}=n;return e(a,o)})):(typeof Promise<"u"&&(this.ge=new Promise((n=>{i=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var a;this.ge=null;var o=n.statusCode;if(o!==200||!n.json){var l="Surveys API could not be loaded, status: "+o;N.error(l);var c={isLoaded:!1,error:l};return e([],c),void(i==null||i({surveys:[],context:c}))}var u,h=n.json.surveys||[],p=h.filter((g=>(function(v){return!(!v.start_date||v.end_date)})(g)&&((function(v){var _;return!((_=v.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)})(g)||(function(v){var _;return!((_=v.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(g))));p.length>0&&((u=this._surveyEventReceiver)==null||u.register(p)),(a=this._instance.persistence)==null||a.register({[Ui]:h});var f={isLoaded:!0};e(h,f),i==null||i({surveys:h,context:f})}}))}be(e){for(var t of this.pe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){N.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);N.warn("init was not called")}ye(e){var t=null;return this.getSurveys((i=>{var s;t=(s=i.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}we(e){if(O(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(O(this._surveyManager))return N.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.we(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return O(this._surveyManager)?(N.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((s=>{var n,a=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(a){var o=this.we(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(O(this._surveyManager))N.warn("init was not called");else{var n=typeof e=="string"?this.ye(e):e;if(n!=null&&n.id)if(Go.includes(n.type)){var a=y==null?void 0:y.querySelector(t);if(a)return(s=n.appearance)!=null&&s.surveyPopupDelaySeconds?(N.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,l;N.info("Rendering survey "+n.id+" with delay of "+((o=n.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(n,a,i),N.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,a,i);N.warn("Survey element not found")}else N.warn("Surveys of type "+n.type+" cannot be rendered in the app");else N.warn("Survey not found")}}displaySurvey(e,t){var i;if(O(this._surveyManager))N.warn("init was not called");else{var s=this.ye(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=E({},s,{appearance:E({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Zi.Popover&&t.initialResponses&&N.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void N.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==Zi.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else N.warn("Survey not found")}}cancelPendingSurvey(e){O(this._surveyManager)?N.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}var xe=B("[Conversations]");class Ko{constructor(e){this.xe=void 0,this._conversationsManager=null,this.Ee=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;O(t)||(Te(t)?this.xe=t:(this.xe=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.xe=void 0,this.$e=null}loadIfEnabled(){if(!this._conversationsManager&&!this.Ee&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=x==null?void 0:x.__PosthogExtensions__;if(e&&!m(this.xe)&&this.xe)if(this.$e&&this.$e.token){this.Ee=!0;try{var t=e.initConversations;if(t)return this.Se(t),void(this.Ee=!1);var i=e.loadExternalDependency;if(!i)return void this.ke("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",(s=>{s||!e.initConversations?this.ke("Could not load conversations script",s):this.Se(e.initConversations),this.Ee=!1}))}catch(s){this.ke("Error initializing conversations",s),this.Ee=!1}}else xe.error("Conversations enabled but missing token in remote config.")}}Se(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),xe.info("Conversations loaded successfully")}catch(t){this.ke("Error completing conversations initialization",t)}else xe.error("Cannot complete initialization: remote config is null")}ke(e,t){xe.error(e,t),this._conversationsManager=null,this.Ee=!1}show(){this._conversationsManager?this._conversationsManager.show():xe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.xe===!0&&!_e(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Ke((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(xe.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var i=this;return Ke((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(xe.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Ke((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(xe.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Ke((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(xe.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}}class Xo{constructor(e){var t;this.Pe=!1,this.Te=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Pe=!0)}onRemoteConfig(e){var t,i=(t=e.logs)==null?void 0:t.captureConsoleLogs;!O(i)&&i&&(this.Pe=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Pe&&!this.Te){var e=B("[logs]"),t=x==null?void 0:x.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(s=>{var n;s||(n=t.logs)==null||!n.initializeLogs?e.error("Could not load logs script",s):(t.logs.initializeLogs(this._instance),this.Te=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}var ps=B("[RateLimiter]");class Zo{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((s=>{ps.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void ps.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:i})}},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 t,i,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:a}=this,o=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Vi))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var c=l.tokens<1;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 "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(s=this.instance.persistence)==null||s.set_property(Vi,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var He=B("[RemoteConfig]");class Qo{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ie(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(He.error("PostHog Extensions not found. Cannot load remote config."),e())}Ce(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return He.info("Using preloaded remote config",this.remoteConfig),void this.wi(this.remoteConfig);if(this._instance.M())return void He.warn("Remote config is disabled. Falling back to local config.");this.Ie((e=>{if(!e)return He.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ce((t=>{this.wi(t)}));this.wi(e)}))}catch(e){He.error("Error loading remote config",e)}}wi(e){e?this._instance.config.__preview_remote_config?(this._instance.wi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):He.info("__preview_remote_config is disabled. Logging config instead",e):He.error("Failed to fetch remote config from PostHog.")}}var Qi=3e3;class el{constructor(e,t){this.Re=!0,this.Fe=[],this.Oe=we((t==null?void 0:t.flush_interval_ms)||Qi,250,5e3,b.createLogger("flush interval"),Qi),this.Me=e}enqueue(e){this.Fe.push(e),this.Ae||this.je()}unload(){this.De();var e=this.Fe.length>0?this.Le():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Me(E({},i,{transport:"sendBeacon"}))}))}enable(){this.Re=!1,this.je()}je(){var e=this;this.Re||(this.Ae=setTimeout((()=>{if(this.De(),this.Fe.length>0){var t=this.Le(),i=function(){var n=t[s],a=new Date().getTime();n.data&&D(n.data)&&j(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.Me(n)};for(var s in t)i()}}),this.Oe))}De(){clearTimeout(this.Ae),this.Ae=void 0}Le(){var e={};return j(this.Fe,(t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;m(e[n])&&(e[n]=E({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)})),this.Fe=[],e}}var tl=["retriesPerformedSoFar"];class il{constructor(e){this.Ne=!1,this.Ue=3e3,this.Fe=[],this._instance=e,this.Fe=[],this.ze=!0,!m(d)&&"onLine"in d.navigator&&(this.ze=d.navigator.onLine,this.He=()=>{this.ze=!0,this.Lt()},this.Be=()=>{this.ze=!1},W(d,"online",this.He),W(d,"offline",this.Be))}get length(){return this.Fe.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=Ss(e,tl);Ye(t)&&(i.url=ti(i.url,{retry_count:t})),this._instance._send_request(E({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.qe(E({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}qe(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(t),s=Date.now()+i;this.Fe.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.Ne||(this.Ne=!0,this.We())}We(){if(this.Ge&&clearTimeout(this.Ge),this.Fe.length===0)return this.Ne=!1,void(this.Ge=void 0);this.Ge=setTimeout((()=>{this.ze&&this.Fe.length>0&&this.Lt(),this.We()}),this.Ue)}Lt(){var e=Date.now(),t=[],i=this.Fe.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Fe=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ge&&(clearTimeout(this.Ge),this.Ge=void 0),this.Ne=!1,m(d)||(this.He&&(d.removeEventListener("online",this.He),this.He=void 0),this.Be&&(d.removeEventListener("offline",this.Be),this.Be=void 0)),this.Fe))try{this._instance._send_request(E({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.Fe=[]}}class rl{constructor(e){this.Ve=()=>{var t,i,s,n;this.Je||(this.Je={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=o+((a==null?void 0:a.clientHeight)||0),u=(a==null?void 0:a.scrollHeight)||0;this.Je.lastScrollY=Math.ceil(o),this.Je.maxScrollY=Math.max(o,(t=this.Je.maxScrollY)!==null&&t!==void 0?t:0),this.Je.maxScrollHeight=Math.max(l,(i=this.Je.maxScrollHeight)!==null&&i!==void 0?i:0),this.Je.lastContentY=c,this.Je.maxContentY=Math.max(c,(s=this.Je.maxContentY)!==null&&s!==void 0?s:0),this.Je.maxContentHeight=Math.max(u,(n=this.Je.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Je}resetContext(){var e=this.Je;return setTimeout(this.Ve,0),e}startMeasuringScrollPosition(){W(d,"scroll",this.Ve,{capture:!0}),W(d,"scrollend",this.Ve,{capture:!0}),W(d,"resize",this.Ve)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d==null?void 0:d.document.documentElement;var e=D(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d==null?void 0:d.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}}var sl=r=>En(r==null?void 0:r.config.mask_personal_data_properties,r==null?void 0:r.config.custom_personal_data_properties);class fs{constructor(e,t,i,s){this.Ke=n=>{var a=this.Ye();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Xe(this._instance)};this.Qe.register({[Gi]:o})}},this._instance=e,this.Ze=t,this.Qe=i,this.Xe=s||sl,this.Ze.onSessionId(this.Ke)}Ye(){return this.Qe.props[Gi]}getSetOnceProps(){var e,t=(e=this.Ye())==null?void 0:e.props;return t?"r"in t?xn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return j(lr(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Ci(i)]=t})),e}}var Ii=B("[SessionId]");class gs{on(e,t){return this.tr.on(e,t)}constructor(e,t,i){var s;if(this.ir=[],this.er=void 0,this.tr=new fr,this.rr=(u,h)=>!(!Ye(u)||!Ye(h))&&Math.abs(u-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Qe=e.persistence,this.sr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ar=t||Ae,this.lr=i||Ae;var n=this.R.persistence_name||this.R.token,a=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*we(a,60,36e3,Ii.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ur(),this.hr="ph_"+n+"_window_id",this.dr="ph_"+n+"_primary_window_exists",this.vr()){var o=X.W(this.hr),l=X.W(this.dr);o&&!l?this.sr=o:X.V(this.hr),X.G(this.dr,!0)}if((s=this.R.bootstrap)!=null&&s.sessionID)try{var c=(u=>{var h=u.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.R.bootstrap.sessionID);this.cr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Ii.error("Invalid sessionID in bootstrap",u)}this.pr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return m(this.ir)&&(this.ir=[]),this.ir.push(e),this.nr&&e(this.nr,this.sr),()=>{this.ir=this.ir.filter((t=>t!==e))}}vr(){return this.R.persistence!=="memory"&&!this.Qe.Pi&&X.H()}gr(e){e!==this.sr&&(this.sr=e,this.vr()&&X.G(this.hr,e))}_r(){return this.sr?this.sr:this.vr()?X.W(this.hr):null}cr(e,t,i){e===this.nr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.nr=e,this.Qe.register({[Vt]:[t,e,i]}))}mr(){var e=this.Qe.props[Vt];return D(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.cr(null,null,null)}destroy(){clearTimeout(this.br),this.br=void 0,this.er&&d&&(d.removeEventListener("beforeunload",this.er,{capture:!1}),this.er=void 0),this.ir=[]}pr(){this.er=()=>{this.vr()&&X.V(this.dr)},W(d,"beforeunload",this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,a]=this.mr(),o=this._r(),l=Ye(a)&&Math.abs(i-a)>864e5,c=!1,u=!n,h=!u&&!e&&this.rr(i,s);u||h||l?(n=this.ar(),o=this.lr(),Ii.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),a=i,c=!0):o||(o=this.lr(),c=!0);var p=Ye(s)&&e&&!l?s:i,f=Ye(a)?a:new Date().getTime();return this.gr(o),this.cr(n,p,f),e||this.ur(),c&&this.ir.forEach((g=>g(n,o,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ur(){clearTimeout(this.br),this.br=setTimeout((()=>{var[e]=this.mr();if(this.rr(new Date().getTime(),e)){var t=this.nr;this.resetSessionId(),this.tr.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var nl=["$set_once","$set"],Oe=B("[SiteApps]");class al{constructor(e){this._instance=e,this.yr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wr(e,t){if(t){var i=this.globalsForEvent(t);this.yr.push(i),this.yr.length>1e3&&(this.yr=this.yr.slice(10))}}get siteAppLoaders(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.wr.bind(this));this.Er=()=>{e(),this.yr=[],this.Er=void 0}}}globalsForEvent(e){var t,i,s,n,a,o,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[p,f]of Object.entries(h))c[p]={id:u[p],type:p,properties:f};var{$set_once:g,$set:v}=e;return{event:E({},Ss(e,nl),{properties:E({},e.properties,v?{$set:E({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},v)}:{},g?{$set_once:E({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var o;!t.errored&&this.yr.length&&(Oe.info("Processing "+this.yr.length+" events for site app with id "+e.id),this.yr.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((o=this.Er)==null||o.call(this))},s=!1,n=o=>{t.errored=!o,t.loaded=!0,Oe.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),s&&i()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:o=>{n(o)}});a&&(t.processEvent=a),s=!0}catch(o){Oe.error("Error while initializing PostHog app with config id "+e.id,o),n(!1)}if(s&&t.loaded)try{i()}catch(o){Oe.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}$r(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Sr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Oe.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$r(),void this._instance.on("eventCaptured",(c=>this.Sr(c)))):void Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Er)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(c){var u;x["__$$ph_site_app_"+c]=n._instance,(u=x.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(n._instance,l,(h=>{if(h)return Oe.error("Error while initializing PostHog app with config id "+c,h)}))};for(var{id:o,url:l}of e.siteApps)a(o)}else Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var On=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Pr(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some((s=>Pr(s==null?void 0:s.brand,e))))return!0}catch{}return!!r.webdriver},Et=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),vs="i.posthog.com";class ol{constructor(e){this.kr={},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,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+vs,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.kr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=Et.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=Et.EU:this.kr[this.apiHost]=Et.CUSTOM),this.kr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Et.CUSTOM)return this.apiHost+t;var i=vs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var ll={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&ii(e.href,r),not_regex:(r,e)=>!!d&&!ii(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class re{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((s=>{re.Pr("retrieved web experiments from the server"),t.Tr=new Map,s.forEach((n=>{if(n.feature_flag_key){var a;t.Tr&&(re.Pr("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Tr)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);J(o)&&n.variants[o]&&t.Ir(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];re.Cr(c)&&t.Ir(n.name,l,c.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())re.Pr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(O(this.Tr))return this.Tr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();re.Pr("applying feature flags",e),e.forEach((t=>{var i;if(this.Tr&&(i=this.Tr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.Tr)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.Ir(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=re.getWindowLocation();if(e!=null&&e.search){var t=Xt(e==null?void 0:e.search,"__experiment_id"),i=Xt(e==null?void 0:e.search,"__experiment_variant");t&&i&&(re.Pr("previewing web experiments "+t+" && "+i),this.getWebExperiments((s=>{this.Rr(parseInt(t),i,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var a=n.json.experiments||[];return e(a)}})}Rr(e,t,i){var s=i.filter((n=>n.id===e));s&&s.length>0&&(re.Pr("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ir(s[0].name,t,s[0].variants[t].transforms))}static Cr(e){return!O(e.conditions)&&re.Fr(e)&&re.Or(e)}static Fr(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,a=re.getWindowLocation();return!!a&&((i=e.conditions)==null||!i.url||ll[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return d==null?void 0:d.location}static Or(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.utm))return!0;var i=mn();if(i.utm_source){var s,n,a,o,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)==i.utm_campaign,f=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.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)==i.utm_medium,v=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return p&&g&&v&&f}return!1}static Pr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];b.info("[WebExperiments] "+e,i)}Ir(e,t,i){this._is_bot()?re.Pr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((s=>{if(s.selector){var n;re.Pr("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a==null||a.forEach((o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):re.Pr("Control variants leave the page unmodified.")}_is_bot(){return he&&this._instance?On(he,this._instance.config.custom_blocked_useragents):void 0}}var ul=B("[PostHog ExternalIntegrations]"),cl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class hl{constructor(e){this._instance=e}it(e,t){var i;(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(s=>{if(s)return ul.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,c;!s||(o=x.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.it(cl[a],(()=>{var u;(u=x.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)})),!s&&(l=x.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=x.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}}var er="[SessionRecording]",ft=B(er);class _s{get started(){var e;return!((e=this.Mr)==null||!e.isStarted)}get status(){return this.Mr?this.Mr.status:this.Ar&&!this.jr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ar=!1,this.Dr=void 0,this._instance=e,!this._instance.sessionManager)throw ft.error("started without valid sessionManager"),new Error(er+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(er+' cannot be used with cookieless_mode="always"')}get jr(){var e,t=!((e=this._instance.get_property(fi))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.jr||(t=this.Mr)==null||!t.isStarted){var i=!m(Object.assign)&&!m(Array.from);this.jr&&i?(this.Lr(e),ft.info("starting")):this.stopRecording()}}Lr(e){var t,i,s;this.jr&&(x!=null&&(t=x.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=x.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Nr(e):(s=x.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ur,(n=>{if(n)return ft.error("could not load recorder",n);this.Nr(e)})))}stopRecording(){var e,t;(e=this.Dr)==null||e.call(this),this.Dr=void 0,(t=this.Mr)==null||t.stop()}zr(){var e;(e=this._instance.persistence)==null||e.unregister(Zs)}Hr(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,o=a==null?void 0:a.sampleRate,l=O(o)?null:parseFloat(o);O(l)&&this.zr();var c=a==null?void 0:a.minimumDurationMilliseconds;s.register({[fi]:E({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:E({capturePerformance:e.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:l,minimumDurationMilliseconds:m(c)?null:c,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers})})};n(),(t=this.Dr)==null||t.call(this),this.Dr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.Hr(e),this.Ar=!0,this.startIfEnabledOrStop()):this.Ar=!0:ft.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Mr)!=null&&i.log?this.Mr.log(e,t):ft.warn("log called before recorder was ready")}get Ur(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fi);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Nr(e){var t,i;if((t=x.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Mr||(this.Mr=(i=x.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Mr.start(e)}onRRwebEmit(e){var t;(t=this.Mr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Mr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Mr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.Mr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Mr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Mr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Mr)==null||!i.tryAddCustomEvent(e,t))}}var St={},tr=()=>{},Je="posthog",Mn=!To&&(oe==null?void 0:oe.indexOf("MSIE"))===-1&&(oe==null?void 0:oe.indexOf("Mozilla"))===-1,ms=r=>{var e;return E({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Oa(y==null?void 0:y.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:tr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:Z&&J(Z==null?void 0:Z.search)&&Z.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:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Qi},error_tracking:{},_onCapture:tr,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(r))},ys=r=>{var e={};m(r.process_person)||(e.person_profiles=r.process_person),m(r.xhr_headers)||(e.request_headers=r.xhr_headers),m(r.cookie_name)||(e.persistence_name=r.cookie_name),m(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),m(r.store_google)||(e.save_campaign_params=r.store_google),m(r.verbose)||(e.debug=r.verbose);var t=V({},e,r);return D(r.property_blacklist)&&(m(r.property_denylist)?t.property_denylist=r.property_blacklist:D(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:b.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class dl{constructor(){this.__forceAllowLocalhost=!1}get Br(){return this.__forceAllowLocalhost}set Br(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ai{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new dl,this.qr=!1,this.version=ke.LIB_VERSION,this.bi=new fr,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ms(),this.SentryIntegration=lo,this.sentryIntegration=e=>(function(t,i){var s=_n(t,i);return{name:vn,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new qo(this),this.toolbar=new co(this),this.scrollManager=new rl(this),this.pageViewManager=new es(this),this.surveys=new Jo(this),this.conversations=new Ko(this),this.logs=new Xo(this),this.experiments=new re(this),this.exceptions=new Ro(this),this.rateLimiter=new Zo(this),this.requestRouter=new ol(this),this.consent=new io(this),this.externalIntegrations=new hl(this),this.people={set:(e,t,i)=>{var s=J(e)?{[e]:t}:e;this.setPersonProperties(s),i==null||i({})},set_once:(e,t,i)=>{var s=J(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i==null||i({})}},this.on("eventCaptured",(e=>b.info('send "'+(e==null?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Je){var s,n=(s=St[i])!==null&&s!==void 0?s:new ai;return n._init(e,t,i),St[i]=n,St[Je][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),m(e)||Oi(e))return b.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 this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(V({},ms(t.defaults),ys(t),{name:i,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Fe.GZipJS;var n=this.Qr();this.persistence=new ki(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ki(E({},this.config,{persistence:"sessionStorage"}),n);var a=E({},this.persistence.props),o=E({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new el((S=>this.ts(S)),this.config.request_queue_config),this.es=new il(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new gs(this),this.sessionPropsManager=new fs(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(b.info("Initializing extensions synchronously"),this.rs(l)),ke.DEBUG=ke.DEBUG||this.config.debug,ke.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p:a,s:o}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,u,h=this.config.get_device_id(Ae()),p=(c=t.bootstrap)!=null&&c.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(Pe,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.ss()){var f,g,v=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((S=>{var $;return!(($=t.bootstrap)==null||($=$.featureFlags)==null||!$[S])})).reduce(((S,$)=>{var R;return S[$]=((R=t.bootstrap)==null||(R=R.featureFlags)==null?void 0:R[$])||!1,S}),{}),_=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter((S=>v[S])).reduce(((S,$)=>{var R,k;return(R=t.bootstrap)!=null&&(R=R.featureFlagPayloads)!=null&&R[$]&&(S[$]=(k=t.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[$]),S}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:_})}if(l)this.register_once({distinct_id:at,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(Ae());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(Pe,"anonymous")}return W(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?oo(this,(()=>this.ns())):this.ns(),De(this.config._onCapture)&&this.config._onCapture!==tr&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(S=>this.config._onCapture(S.event,S)))),this.config.ip&&b.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}rs(e){var t=performance.now();this.historyAutocapture=new ao(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new po(this).startIfEnabledOrStop()})),i.push((()=>{var s;this.siteApps=new al(this),(s=this.siteApps)==null||s.init()})),e||i.push((()=>{this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new Ya(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.logs.loadIfEnabled()})),i.push((()=>{this.conversations.loadIfEnabled()})),i.push((()=>{this.productTours=new Uo(this),this.productTours.loadIfEnabled()})),i.push((()=>{this.heatmaps=new bo(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new mo(this)})),i.push((()=>{this.exceptionObserver=new no(this),this.exceptionObserver.startIfEnabledOrStop()})),i.push((()=>{this.deadClicksAutocapture=new gn(this,so),this.deadClicksAutocapture.startIfEnabledOrStop()})),i.push((()=>{if(this.os){var s=this.os;this.os=void 0,this.wi(s)}})),this.ls(i,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){b.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}wi(e){var t,i,s,n,a,o,l,c,u;if(!y||!y.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.wi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=C(e.supportedCompression,Fe.GZipJS)?Fe.GZipJS:C(e.supportedCompression,Fe.Base64)?Fe.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(o=this.productTours)==null||o.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(i){b.critical("`loaded` function failed",i)}if(this.us(),this.config.internal_or_test_user_hostname&&Z!=null&&Z.hostname){var e=Z.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Qo(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Le(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Mn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ti(e.url,{ip:this.config.ip?1:0}),e.headers=E({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,a=E({},t);a.timeout=a.timeout||6e4,a.url=ti(a.url,{_:new Date().getTime().toString(),ver:ke.LIB_VERSION,compression:a.compression});var o=(i=a.transport)!==null&&i!==void 0?i:"fetch",l=Ht.filter((u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport))),c=(s=(n=Js(l,(u=>u.transport===o)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");c(a)})(E({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];Le(e,(o=>{o&&(t=o[0],D(t)?n.push(o):De(o)?o.call(this):D(o)&&t==="alias"?i.push(o):D(o)&&t.indexOf("capture")!==-1&&De(this[t])?n.push(o):s.push(o))}));var a=function(o,l){Le(o,(function(c){if(D(c[0])){var u=l;j(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};a(i,this),a(s,this),a(n,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!m(e)&&J(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var a=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!J(t==null?void 0:t.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,l=(i==null?void 0:i.timestamp)||o,c=Ae(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),i!=null&&i.$set&&(u.$set=i==null?void 0:i.$set);var h,p=e!=="$groupidentify",f=this.vs(i==null?void 0:i.$set_once,p);if(f&&(u.$set_once=f),(u=$a(u,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,m(i==null?void 0:i.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===wt.DISMISSED||e===wt.SENT){var g=t==null?void 0:t[Fi.SURVEY_ID],v=t==null?void 0:t[Fi.SURVEY_ITERATION];h={id:g,current_iteration:v},localStorage.getItem(ds(h))||localStorage.setItem(ds(h),"true"),u.$set=E({},u.$set,{[Bo({id:g,current_iteration:v},e===wt.SENT?"responded":"dismissed")]:!0})}else e===wt.SHOWN&&(u.$set=E({},u.$set,{[Fi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var _=E({},u.properties.$set,u.$set);if(Xe(_)||this.setPersonPropertiesForFlags(_),!O(this.config.before_send)){var I=this.cs(u);if(!I)return;u=I}this.bi.emit("eventCaptured",u);var S={method:"POST",url:(s=i==null?void 0:i._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.ts(S):this.Zr.enqueue(S),u}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=E({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!J(o.distinct_id)&&!Re(o.distinct_id)||Oi(o.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=_o(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=h,o.$window_id=p}this.sessionPropsManager&&V(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&V(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(I){o.$sdk_debug_error_capturing_properties=String(I)}if(this.requestRouter.region===Et.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=V(o,c),e==="$pageview"&&y&&(o.title=y.title),!m(a)){var g=i.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}oe&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=V({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?j(this.config.property_denylist,(function(I){delete o[I]})):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=v(o,e));var _=this.fs();return o.$process_person_profile=_,_&&!n&&this.ps("_calculate_event_properties"),o}vs(e,t){var i;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.qr)return e;var s=this.persistence.get_initial_props(),n=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=V({},s,n||{},e||{}),o=this.config.sanitize_properties;return o&&(b.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),t&&(this.qr=!0),Xe(a)?void 0:a}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=i!=null&&i.merge?this.featureFlags.getFlagVariants():{},n=i!=null&&i.merge?this.featureFlags.getFlagPayloads():{},a=E({},s,e),o=E({},n,t),l={};for(var[c,u]of Object.entries(a)){var h=typeof u=="string";l[c]={key:c,enabled:!!h||!!u,variant:h?u:void 0,reason:void 0,metadata:m(o==null?void 0:o[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.bi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=Vo),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(Re(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))b.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.');else if(e!==at){if(this.ps("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(vt)&&(this.unregister(vt),this.register({distinct_id:e}));var a=(this.persistence.get_property(Pe)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(Pe,"identified"),this.setPersonPropertiesForFlags(E({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Jr=as(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Wt))}}else b.critical('The string "'+at+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else b.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var i=as(this.get_distinct_id(),e,t);this.Jr!==i?(this.setPersonPropertiesForFlags(E({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=i):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(Pe,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:at,$device_id:null},"");else{var o=this.config.get_device_id(Ae());this.register_once({distinct_id:o,$device_id:e?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property(Ks)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(m(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(vt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(Y(e)){var i,s,n,a,o,l,c,u;V(this.config,ys(e));var h=this.Qr();(i=this.persistence)==null||i.update_config(this.config,t,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ki(E({},this.config,{persistence:"sessionStorage"}),h);var p=this.Kr(this.config.debug);Te(p)&&(this.config.debug=p),Te(this.config.debug)&&(this.config.debug?(ke.DEBUG=!0,U.H()&&U.G("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(ke.DEBUG=!1,U.H()&&U.V("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,a,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),i.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.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,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(E({},s,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Je;return t!==Je&&(t=Je+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Pe))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Pe))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[vt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Yt]))}ds(){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.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(Yt,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,i,s,n=this.Qr();return((e=this.persistence)==null?void 0:e.Pi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Pi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var i,s,n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new gs(this),this.pageViewManager=new es(this),this.persistence&&(this.sessionPropsManager=new fs(this,this.sessionManager,this.persistence)),this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(m(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:at,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.hs())):b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}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===Se.GRANTED?"granted":e===Se.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return he?On(he,this.config.custom_blocked_useragents):void 0}hs(){y&&(y.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.Gr&&(y.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),W(y,"visibilitychange",this.Gr)))}debug(e){e===!1?(d==null||d.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d==null||d.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}))}M(){var e,t,i,s,n,a,o,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.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):(i="advanced_disable_decide",s=!1,n=b,a=(t="advanced_disable_flags")in(e=l)&&!O(e[t]),o=i in e&&!O(e[i]),a?e[t]:o?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}cs(e){if(O(this.config.before_send))return e;var t=D(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),O(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return Yn(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}i.properties&&!Xe(i.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Kr(e){var t=Te(e)&&!e,i=U.H()&&U.q("ph_debug")==="true";return!t&&(!!i||e)}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Ra(r.prototype[e[t]])})(ai,["identify"]);var bs,Il=(bs=St[Je]=new ai,(function(){function r(){r.done||(r.done=!0,Mn=!1,j(St,(function(e){e._dom_loaded()})))}y!=null&&y.addEventListener?y.readyState==="complete"?r():W(y,"DOMContentLoaded",r,{capture:!1}):d&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),bs);const pl=r=>r;let Tl=pl;function An(r){let e;return()=>(e===void 0&&(e=r()),e)}const fl=(r,e,t)=>{const i=e-r;return i===0?1:(t-r)/i},Rl=r=>r*1e3,$l=r=>r/1e3,gl=An(()=>window.ScrollTimeline!==void 0);class vl{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=t}attachTimeline(e,t){const i=this.animations.map(s=>{if(gl()&&s.attachTimeline)return s.attachTimeline(e);if(typeof t=="function")return t(s)});return()=>{i.forEach((s,n)=>{s&&s(),this.animations[n].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Cl extends vl{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}function Ol(r,e){return r?r[e]||r.default||r:void 0}const ws=2e4;function Ml(r){let e=0;const t=50;let i=r.next(e);for(;!i.done&&e<ws;)e+=t,i=r.next(e);return e>=ws?1/0:e}function Al(r){return typeof r=="function"}function Dl(r,e){r.timeline=e,r.onfinish=null}const Dn=r=>Array.isArray(r)&&typeof r[0]=="number",_l={linearEasing:void 0};function ml(r,e){const t=An(r);return()=>{var i;return(i=_l[e])!==null&&i!==void 0?i:t()}}const ir=ml(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),yl=(r,e,t=10)=>{let i="";const s=Math.max(Math.round(e/t),2);for(let n=0;n<s;n++)i+=r(fl(0,s-1,n))+", ";return`linear(${i.substring(0,i.length-2)})`};function bl(r){return!!(typeof r=="function"&&ir()||!r||typeof r=="string"&&(r in rr||ir())||Dn(r)||Array.isArray(r)&&r.every(bl))}const xt=([r,e,t,i])=>`cubic-bezier(${r}, ${e}, ${t}, ${i})`,rr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xt([0,.65,.55,1]),circOut:xt([.55,0,1,.45]),backIn:xt([.31,.01,.66,-.59]),backOut:xt([.33,1.53,.69,.99])};function wl(r,e){if(r)return typeof r=="function"&&ir()?yl(r,e):Dn(r)?xt(r):Array.isArray(r)?r.map(t=>wl(t,e)||rr.easeOut):rr[r]}const ve={x:!1,y:!1};function Ln(){return ve.x||ve.y}function El(r,e,t){var i;if(r instanceof Element)return[r];if(typeof r=="string"){let s=document;const n=(i=void 0)!==null&&i!==void 0?i:s.querySelectorAll(r);return n?Array.from(n):[]}return Array.from(r)}function Nn(r,e){const t=El(r),i=new AbortController,s={passive:!0,...e,signal:i.signal};return[t,s,()=>i.abort()]}function Es(r){return e=>{e.pointerType==="touch"||Ln()||r(e)}}function Ll(r,e,t={}){const[i,s,n]=Nn(r,t),a=Es(o=>{const{target:l}=o,c=e(o);if(typeof c!="function"||!l)return;const u=Es(h=>{c(h),l.removeEventListener("pointerleave",u)});l.addEventListener("pointerleave",u,s)});return i.forEach(o=>{o.addEventListener("pointerenter",a,s)}),n}const jn=(r,e)=>e?r===e?!0:jn(r,e.parentElement):!1,xl=r=>r.pointerType==="mouse"?typeof r.button!="number"||r.button<=0:r.isPrimary!==!1,kl=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Pl(r){return kl.has(r.tagName)||r.tabIndex!==-1}const kt=new WeakSet;function xs(r){return e=>{e.key==="Enter"&&r(e)}}function Ti(r,e){r.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Sl=(r,e)=>{const t=r.currentTarget;if(!t)return;const i=xs(()=>{if(kt.has(t))return;Ti(t,"down");const s=xs(()=>{Ti(t,"up")}),n=()=>Ti(t,"cancel");t.addEventListener("keyup",s,e),t.addEventListener("blur",n,e)});t.addEventListener("keydown",i,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",i),e)};function ks(r){return xl(r)&&!Ln()}function Nl(r,e,t={}){const[i,s,n]=Nn(r,t),a=o=>{const l=o.currentTarget;if(!ks(o)||kt.has(l))return;kt.add(l);const c=e(o),u=(f,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",p),!(!ks(f)||!kt.has(l))&&(kt.delete(l),typeof c=="function"&&c(f,{success:g}))},h=f=>{u(f,t.useGlobalTarget||jn(l,f.target))},p=f=>{u(f,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",p,s)};return i.forEach(o=>{!Pl(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(t.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",c=>Sl(c,s),s)}),n}function jl(r){return r==="x"||r==="y"?ve[r]?null:(ve[r]=!0,()=>{ve[r]=!1}):ve.x||ve.y?null:(ve.x=ve.y=!0,()=>{ve.x=ve.y=!1})}export{Cl as G,ws as a,Dn as b,Ml as c,Tl as d,wl as e,An as f,yl as g,ir as h,Al as i,Dl as j,bl as k,Ol as l,$l as m,pl as n,xl as o,fl as p,jl as q,Fl as r,Rl as s,Ll as t,Nl as u,Il as v};