@twick/timeline 0.15.7 → 0.15.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -322,15 +322,9 @@ const createAudioTimeline = async (segments, duration) => {
322
322
  const totalFrames = Math.ceil(duration * sampleRate);
323
323
  const offline = new OfflineAudioContextCtor(2, totalFrames, sampleRate);
324
324
  for (const segment of segments) {
325
- if (segment.s >= segment.e) {
326
- console.warn(`Invalid segment: start (${segment.s}) >= end (${segment.e})`);
327
- continue;
328
- }
325
+ if (segment.s >= segment.e) continue;
329
326
  const volume = segment.volume ?? 1;
330
- if (volume <= 0) {
331
- console.warn(`Skipping muted segment: ${segment.src}`);
332
- continue;
333
- }
327
+ if (volume <= 0) continue;
334
328
  try {
335
329
  const audioBuffer = await fetchAndDecodeAudio(segment.src);
336
330
  const segmentDuration = segment.e - segment.s;
@@ -346,8 +340,7 @@ const createAudioTimeline = async (segments, duration) => {
346
340
  source.connect(offline.destination);
347
341
  }
348
342
  source.start(segment.s, 0, sourceDuration);
349
- } catch (error) {
350
- console.warn(`Failed to process segment: ${segment.src}`, error);
343
+ } catch {
351
344
  }
352
345
  }
353
346
  return await offline.startRendering();
@@ -3031,10 +3024,10 @@ class TimelineEditor {
3031
3024
  }
3032
3025
  }
3033
3026
  /**
3034
- * Add an element to a specific track using the visitor pattern
3035
- * @param track The track to add the element to
3036
- * @param element The element to add
3037
- * @returns Promise<boolean> true if element was added successfully
3027
+ * Add an element to a specific track using the visitor pattern.
3028
+ * @param track The track to add the element to.
3029
+ * @param element The element to add.
3030
+ * @returns A promise that resolves to `true` if the element was added successfully, otherwise `false`.
3038
3031
  */
3039
3032
  async addElementToTrack(track, element) {
3040
3033
  var _a;
@@ -3062,9 +3055,9 @@ class TimelineEditor {
3062
3055
  }
3063
3056
  }
3064
3057
  /**
3065
- * Remove an element from a specific track using the visitor pattern
3066
- * @param element The element to remove
3067
- * @returns boolean true if element was removed successfully
3058
+ * Remove an element from a specific track using the visitor pattern.
3059
+ * @param element The element to remove.
3060
+ * @returns `true` if the element was removed successfully, otherwise `false`.
3068
3061
  */
3069
3062
  removeElement(element) {
3070
3063
  const track = this.getTrackById(element.getTrackId());
@@ -3086,9 +3079,9 @@ class TimelineEditor {
3086
3079
  }
3087
3080
  }
3088
3081
  /**
3089
- * Update an element in a specific track using the visitor pattern
3090
- * @param element The updated element
3091
- * @returns TrackElement the updated element
3082
+ * Update an element in a specific track using the visitor pattern.
3083
+ * @param element The updated element.
3084
+ * @returns The updated `TrackElement`.
3092
3085
  */
3093
3086
  updateElement(element) {
3094
3087
  const track = this.getTrackById(element.getTrackId());
@@ -3412,7 +3405,7 @@ if (typeof window !== "undefined") {
3412
3405
  var t = "undefined" != typeof window ? window : void 0, i = "undefined" != typeof globalThis ? globalThis : t;
3413
3406
  "undefined" == typeof self && (i.self = i), "undefined" == typeof File && (i.File = function() {
3414
3407
  });
3415
- var e = Array.prototype, r = e.forEach, s = e.indexOf, n = null == i ? void 0 : i.navigator, o = null == i ? void 0 : i.document, a = null == i ? void 0 : i.location, l = null == i ? void 0 : i.fetch, u = null != i && i.XMLHttpRequest && "withCredentials" in new i.XMLHttpRequest() ? i.XMLHttpRequest : void 0, h = null == i ? void 0 : i.AbortController, d = null == n ? void 0 : n.userAgent, v = null != t ? t : {}, c = { DEBUG: false, LIB_VERSION: "1.321.2" };
3408
+ var e = Array.prototype, r = e.forEach, s = e.indexOf, n = null == i ? void 0 : i.navigator, o = null == i ? void 0 : i.document, a = null == i ? void 0 : i.location, l = null == i ? void 0 : i.fetch, u = null != i && i.XMLHttpRequest && "withCredentials" in new i.XMLHttpRequest() ? i.XMLHttpRequest : void 0, h = null == i ? void 0 : i.AbortController, d = null == n ? void 0 : n.userAgent, v = null != t ? t : {}, c = { DEBUG: false, LIB_VERSION: "1.335.5" };
3416
3409
  function f(t2, i2, e2, r2, s2, n2, o2) {
3417
3410
  try {
3418
3411
  var a2 = t2[n2](o2), l2 = a2.value;
@@ -3899,8 +3892,12 @@ var Ei = function(i2, e2) {
3899
3892
  if (r3.type = "text/javascript", r3.crossOrigin = "anonymous", r3.src = i2, r3.onload = (t3) => {
3900
3893
  r3.__posthog_loading_callback_fired = true, e2(void 0, t3);
3901
3894
  }, r3.onerror = (t3) => e2(t3), t2.config.prepare_external_dependency_script && (r3 = t2.config.prepare_external_dependency_script(r3)), !r3) return e2("prepare_external_dependency_script returned null");
3902
- var s3, n3 = o.querySelectorAll("body > script");
3903
- n3.length > 0 ? null == (s3 = n3[0].parentNode) || s3.insertBefore(r3, n3[0]) : o.body.appendChild(r3);
3895
+ if ("head" === t2.config.external_scripts_inject_target) o.head.appendChild(r3);
3896
+ else {
3897
+ var s3, n3 = o.querySelectorAll("body > script");
3898
+ if (n3.length > 0) null == (s3 = n3[0].parentNode) || s3.insertBefore(r3, n3[0]);
3899
+ else o.body.appendChild(r3);
3900
+ }
3904
3901
  };
3905
3902
  null != o && o.body ? l2() : null == o || o.addEventListener("DOMContentLoaded", l2);
3906
3903
  };
@@ -5043,8 +5040,10 @@ class ms {
5043
5040
  else this.N.url !== r2 && (this.Pt(), this.Tt = setTimeout(this.Pt, this.flushToCaptureTimeoutMs)), M(this.N.url) && (this.N.url = r2), this.N.firstMetricTimestamp = M(this.N.firstMetricTimestamp) ? Date.now() : this.N.firstMetricTimestamp, t3.attribution && t3.attribution.interactionTargetElement && (t3.attribution.interactionTargetElement = void 0), this.N.metrics.push(g({}, t3, { $current_url: r2, $session_id: e2.sessionId, $window_id: e2.windowId, timestamp: Date.now() })), this.N.metrics.length === this.allowedMetrics.length && this.Pt();
5044
5041
  }
5045
5042
  }, this.rt = () => {
5046
- var t3, i3, e2, r2, s2 = v.__PosthogExtensions__;
5047
- M(s2) || M(s2.postHogWebVitalsCallbacks) || ({ onLCP: t3, onCLS: i3, onFCP: e2, onINP: r2 } = s2.postHogWebVitalsCallbacks), t3 && i3 && e2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && t3(this.It.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && i3(this.It.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && e2(this.It.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this.It.bind(this)), this.P = true) : gs.error("web vitals callbacks not loaded - not starting");
5043
+ if (!this.P) {
5044
+ var t3, i3, e2, r2, s2 = v.__PosthogExtensions__;
5045
+ M(s2) || M(s2.postHogWebVitalsCallbacks) || ({ onLCP: t3, onCLS: i3, onFCP: e2, onINP: r2 } = s2.postHogWebVitalsCallbacks), t3 && i3 && e2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && t3(this.It.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && i3(this.It.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && e2(this.It.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this.It.bind(this)), this.P = true) : gs.error("web vitals callbacks not loaded - not starting");
5046
+ }
5048
5047
  }, this._instance = t2, this.kt = !(null == (i2 = this._instance.persistence) || !i2.props[Yi]), this.startIfEnabled();
5049
5048
  }
5050
5049
  get allowedMetrics() {
@@ -5054,6 +5053,10 @@ class ms {
5054
5053
  get flushToCaptureTimeoutMs() {
5055
5054
  return (R(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals_delayed_flush_ms : void 0) || 5e3;
5056
5055
  }
5056
+ get useAttribution() {
5057
+ var t2 = R(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals_attribution : void 0;
5058
+ return null == t2 || t2;
5059
+ }
5057
5060
  get Rt() {
5058
5061
  var t2 = R(this._instance.config.capture_performance) && L(this._instance.config.capture_performance.__web_vitals_max_value) ? this._instance.config.capture_performance.__web_vitals_max_value : _s;
5059
5062
  return 0 < t2 && t2 <= 6e4 ? _s : t2;
@@ -5073,8 +5076,13 @@ class ms {
5073
5076
  }
5074
5077
  it(t2) {
5075
5078
  var i2, e2;
5076
- null != (i2 = v.__PosthogExtensions__) && i2.postHogWebVitalsCallbacks && t2(), null == (e2 = v.__PosthogExtensions__) || null == e2.loadExternalDependency || e2.loadExternalDependency(this._instance, "web-vitals", (i3) => {
5077
- i3 ? gs.error("failed to load script", i3) : t2();
5079
+ null != (i2 = v.__PosthogExtensions__) && i2.postHogWebVitalsCallbacks ? t2() : null == (e2 = v.__PosthogExtensions__) || null == e2.loadExternalDependency || e2.loadExternalDependency(this._instance, "web-vitals", (i3) => {
5080
+ var e3;
5081
+ if (i3) gs.error("failed to load script", i3);
5082
+ else {
5083
+ var r2 = null == (e3 = v.__PosthogExtensions__) ? void 0 : e3.loadWebVitalsCallbacks;
5084
+ r2 ? (r2(this.useAttribution), t2()) : t2();
5085
+ }
5078
5086
  });
5079
5087
  }
5080
5088
  Ct() {
@@ -5630,23 +5638,23 @@ var bn = Si("[FeatureFlags]"), wn = Si("[FeatureFlags]", { debugEnabled: true })
5630
5638
  }({});
5631
5639
  class Rn {
5632
5640
  constructor(t2) {
5633
- this.oi = false, this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this._instance = t2, this.featureFlagEventHandlers = [];
5641
+ this.oi = false, this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.ci = false, this._instance = t2, this.featureFlagEventHandlers = [];
5634
5642
  }
5635
- ci() {
5636
- var t2 = this._instance.config.evaluation_environments;
5637
- return null != t2 && t2.length ? t2.filter((t3) => {
5638
- var i2 = t3 && "string" == typeof t3 && t3.trim().length > 0;
5639
- return i2 || bn.error("Invalid evaluation environment found:", t3, "Expected non-empty string"), i2;
5643
+ fi() {
5644
+ var t2, i2 = null !== (t2 = this._instance.config.evaluation_contexts) && void 0 !== t2 ? t2 : this._instance.config.evaluation_environments;
5645
+ return !this._instance.config.evaluation_environments || this._instance.config.evaluation_contexts || this.ci || (bn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."), this.ci = true), null != i2 && i2.length ? i2.filter((t3) => {
5646
+ var i3 = t3 && "string" == typeof t3 && t3.trim().length > 0;
5647
+ return i3 || bn.error("Invalid evaluation context found:", t3, "Expected non-empty string"), i3;
5640
5648
  }) : [];
5641
5649
  }
5642
- fi() {
5643
- return this.ci().length > 0;
5650
+ pi() {
5651
+ return this.fi().length > 0;
5644
5652
  }
5645
5653
  flags() {
5646
5654
  if (this._instance.config.__preview_remote_config) this.di = true;
5647
5655
  else {
5648
- var t2 = !this.pi && (this._instance.config.advanced_disable_feature_flags || this._instance.config.advanced_disable_feature_flags_on_first_load);
5649
- this.gi({ disableFlags: t2 });
5656
+ var t2 = !this.gi && (this._instance.config.advanced_disable_feature_flags || this._instance.config.advanced_disable_feature_flags_on_first_load);
5657
+ this.mi({ disableFlags: t2 });
5650
5658
  }
5651
5659
  }
5652
5660
  get hasLoadedFlags() {
@@ -5679,15 +5687,15 @@ class Rn {
5679
5687
  return this.oi || (bn.warn(" Overriding feature flag payloads!", { flagPayloads: t2, overriddenPayloads: i2, finalPayloads: e2 }), this.oi = true), e2;
5680
5688
  }
5681
5689
  reloadFeatureFlags() {
5682
- this.ui || this._instance.config.advanced_disable_feature_flags || this.pi || (this.pi = setTimeout(() => {
5683
- this.gi();
5690
+ this.ui || this._instance.config.advanced_disable_feature_flags || this.gi || (this.gi = setTimeout(() => {
5691
+ this.mi();
5684
5692
  }, 5));
5685
5693
  }
5686
- mi() {
5687
- clearTimeout(this.pi), this.pi = void 0;
5694
+ yi() {
5695
+ clearTimeout(this.gi), this.gi = void 0;
5688
5696
  }
5689
5697
  ensureFlagsLoaded() {
5690
- this.ai || this.li || this.pi || this.reloadFeatureFlags();
5698
+ this.ai || this.li || this.gi || this.reloadFeatureFlags();
5691
5699
  }
5692
5700
  setAnonymousDistinctId(t2) {
5693
5701
  this.$anon_distinct_id = t2;
@@ -5695,21 +5703,21 @@ class Rn {
5695
5703
  setReloadingPaused(t2) {
5696
5704
  this.ui = t2;
5697
5705
  }
5698
- gi(t2) {
5706
+ mi(t2) {
5699
5707
  var i2;
5700
- if (this.mi(), !this._instance.O()) if (this.li) this.hi = true;
5708
+ if (this.yi(), !this._instance.O()) if (this.li) this.hi = true;
5701
5709
  else {
5702
5710
  var e2 = this._instance.config.token, r2 = this._instance.get_property("$device_id"), s2 = { token: e2, distinct_id: this._instance.get_distinct_id(), groups: this._instance.getGroups(), $anon_distinct_id: this.$anon_distinct_id, person_properties: g({}, (null == (i2 = this._instance.persistence) ? void 0 : i2.get_initial_props()) || {}, this._instance.get_property(oe) || {}), group_properties: this._instance.get_property(ae) };
5703
- D(r2) || M(r2) || (s2.$device_id = r2), (null != t2 && t2.disableFlags || this._instance.config.advanced_disable_feature_flags) && (s2.disable_flags = true), this.fi() && (s2.evaluation_environments = this.ci());
5711
+ D(r2) || M(r2) || (s2.$device_id = r2), (null != t2 && t2.disableFlags || this._instance.config.advanced_disable_feature_flags) && (s2.disable_flags = true), this.pi() && (s2.evaluation_contexts = this.fi());
5704
5712
  var n2 = this._instance.config.__preview_remote_config, o2 = n2 ? "/flags/?v=2" : "/flags/?v=2&config=true", a2 = this._instance.config.advanced_only_evaluate_survey_feature_flags ? "&only_evaluate_survey_feature_flags=true" : "", l2 = this._instance.requestRouter.endpointFor("flags", o2 + a2);
5705
5713
  n2 && (s2.timezone = cs()), this.li = true, this._instance._send_request({ method: "POST", url: l2, data: s2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (t3) => {
5706
5714
  var i3, e3, r3 = true;
5707
- (200 === t3.statusCode && (this.hi || (this.$anon_distinct_id = void 0), r3 = false), this.li = false, this.di) || (this.di = true, this._instance.yi(null !== (e3 = t3.json) && void 0 !== e3 ? e3 : {}));
5715
+ (200 === t3.statusCode && (this.hi || (this.$anon_distinct_id = void 0), r3 = false), this.li = false, this.di) || (this.di = true, this._instance.bi(null !== (e3 = t3.json) && void 0 !== e3 ? e3 : {}));
5708
5716
  if (!s2.disable_flags || this.hi) if (this.vi = !r3, t3.json && null != (i3 = t3.json.quotaLimited) && i3.includes(Cn.FeatureFlags)) bn.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.");
5709
5717
  else {
5710
5718
  var n3;
5711
5719
  if (!s2.disable_flags) this.receivedFeatureFlags(null !== (n3 = t3.json) && void 0 !== n3 ? n3 : {}, r3);
5712
- this.hi && (this.hi = false, this.gi());
5720
+ this.hi && (this.hi = false, this.mi());
5713
5721
  }
5714
5722
  } });
5715
5723
  }
@@ -5738,7 +5746,7 @@ class Rn {
5738
5746
  }
5739
5747
  getRemoteConfigPayload(t2, i2) {
5740
5748
  var e2 = this._instance.config.token, r2 = { distinct_id: this._instance.get_distinct_id(), token: e2 };
5741
- this.fi() && (r2.evaluation_environments = this.ci()), this._instance._send_request({ method: "POST", url: this._instance.requestRouter.endpointFor("flags", "/flags/?v=2&config=true"), data: r2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (e3) => {
5749
+ this.pi() && (r2.evaluation_contexts = this.fi()), this._instance._send_request({ method: "POST", url: this._instance.requestRouter.endpointFor("flags", "/flags/?v=2&config=true"), data: r2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (e3) => {
5742
5750
  var r3, s2 = null == (r3 = e3.json) ? void 0 : r3.featureFlagPayloads;
5743
5751
  i2((null == s2 ? void 0 : s2[t2]) || void 0);
5744
5752
  } });
@@ -5775,7 +5783,7 @@ class Rn {
5775
5783
  t3.errorsWhileComputingFlags && (c2 = g({}, e3, c2), f2 = g({}, r3, f2), p2 = g({}, s3, p2)), i3 && i3.register(g({ [xn]: Object.keys(Tn(c2)), [re]: c2 || {}, [$n]: f2 || {}, [ne]: p2 || {} }, u2 ? { [kn]: u2 } : {}, h2 ? { [Pn]: h2 } : {}));
5776
5784
  }
5777
5785
  }
5778
- }(t2, this._instance.persistence, e2, r2, s2), this.bi(i2);
5786
+ }(t2, this._instance.persistence, e2, r2, s2), this.wi(i2);
5779
5787
  }
5780
5788
  }
5781
5789
  override(t2, i2) {
@@ -5783,7 +5791,7 @@ class Rn {
5783
5791
  }
5784
5792
  overrideFeatureFlags(t2) {
5785
5793
  if (!this._instance.__loaded || !this._instance.persistence) return bn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");
5786
- if (false === t2) return this._instance.persistence.unregister(En), this._instance.persistence.unregister(Sn), this.bi(), wn.info("All overrides cleared");
5794
+ if (false === t2) return this._instance.persistence.unregister(En), this._instance.persistence.unregister(Sn), this.wi(), wn.info("All overrides cleared");
5787
5795
  if (t2 && "object" == typeof t2 && ("flags" in t2 || "payloads" in t2)) {
5788
5796
  var i2, e2 = t2;
5789
5797
  if (this.oi = Boolean(null !== (i2 = e2.suppressWarning) && void 0 !== i2 && i2), "flags" in e2) {
@@ -5796,13 +5804,13 @@ class Rn {
5796
5804
  wn.info("Flag overrides set", { flags: e2.flags });
5797
5805
  }
5798
5806
  }
5799
- return "payloads" in e2 && (false === e2.payloads ? (this._instance.persistence.unregister(Sn), wn.info("Payload overrides cleared")) : e2.payloads && (this._instance.persistence.register({ [Sn]: e2.payloads }), wn.info("Payload overrides set", { payloads: e2.payloads }))), void this.bi();
5807
+ return "payloads" in e2 && (false === e2.payloads ? (this._instance.persistence.unregister(Sn), wn.info("Payload overrides cleared")) : e2.payloads && (this._instance.persistence.register({ [Sn]: e2.payloads }), wn.info("Payload overrides set", { payloads: e2.payloads }))), void this.wi();
5800
5808
  }
5801
- this.bi();
5809
+ this.wi();
5802
5810
  }
5803
5811
  onFeatureFlags(t2) {
5804
5812
  if (this.addFeatureFlagsHandler(t2), this.ai) {
5805
- var { flags: i2, flagVariants: e2 } = this.wi();
5813
+ var { flags: i2, flagVariants: e2 } = this.xi();
5806
5814
  t2(i2, e2);
5807
5815
  }
5808
5816
  return () => this.removeFeatureFlagsHandler(t2);
@@ -5811,7 +5819,7 @@ class Rn {
5811
5819
  var r2, s2 = (this._instance.get_property(se) || []).find((i3) => i3.flagKey === t2), n2 = { ["$feature_enrollment/" + t2]: i2 }, o2 = { $feature_flag: t2, $feature_enrollment: i2, $set: n2 };
5812
5820
  s2 && (o2.$early_access_feature_name = s2.name), e2 && (o2.$feature_enrollment_stage = e2), this._instance.capture("$feature_enrollment_update", o2), this.setPersonPropertiesForFlags(n2, false);
5813
5821
  var a2 = g({}, this.getFlagVariants(), { [t2]: i2 });
5814
- null == (r2 = this._instance.persistence) || r2.register({ [xn]: Object.keys(Tn(a2)), [re]: a2 }), this.bi();
5822
+ null == (r2 = this._instance.persistence) || r2.register({ [xn]: Object.keys(Tn(a2)), [re]: a2 }), this.wi();
5815
5823
  }
5816
5824
  getEarlyAccessFeatures(t2, i2, e2) {
5817
5825
  void 0 === i2 && (i2 = false);
@@ -5825,12 +5833,12 @@ class Rn {
5825
5833
  }
5826
5834
  } });
5827
5835
  }
5828
- wi() {
5836
+ xi() {
5829
5837
  var t2 = this.getFlags(), i2 = this.getFlagVariants();
5830
5838
  return { flags: t2.filter((t3) => i2[t3]), flagVariants: Object.keys(i2).filter((t3) => i2[t3]).reduce((t3, e2) => (t3[e2] = i2[e2], t3), {}) };
5831
5839
  }
5832
- bi(t2) {
5833
- var { flags: i2, flagVariants: e2 } = this.wi();
5840
+ wi(t2) {
5841
+ var { flags: i2, flagVariants: e2 } = this.xi();
5834
5842
  this.featureFlagEventHandlers.forEach((r2) => r2(i2, e2, { errorsLoading: t2 }));
5835
5843
  }
5836
5844
  setPersonPropertiesForFlags(t2, i2) {
@@ -5855,21 +5863,21 @@ class Rn {
5855
5863
  } else this._instance.unregister(ae);
5856
5864
  }
5857
5865
  reset() {
5858
- this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.$anon_distinct_id = void 0, this.mi(), this.oi = false;
5866
+ this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.$anon_distinct_id = void 0, this.yi(), this.oi = false;
5859
5867
  }
5860
5868
  }
5861
5869
  var Fn = ["cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory"];
5862
5870
  class Mn {
5863
5871
  constructor(t2, i2) {
5864
- this.R = t2, this.props = {}, this.xi = false, this.Ei = ((t3) => {
5872
+ this.R = t2, this.props = {}, this.Ei = false, this.$i = ((t3) => {
5865
5873
  var i3 = "";
5866
5874
  return t3.token && (i3 = t3.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")), t3.persistence_name ? "ph_" + t3.persistence_name : "ph_" + i3 + "_posthog";
5867
- })(t2), this.Y = this.$i(t2), this.load(), t2.debug && $i.info("Persistence loaded", t2.persistence, g({}, this.props)), this.update_config(t2, t2, i2), this.save();
5875
+ })(t2), this.Y = this.Si(t2), this.load(), t2.debug && $i.info("Persistence loaded", t2.persistence, g({}, this.props)), this.update_config(t2, t2, i2), this.save();
5868
5876
  }
5869
5877
  isDisabled() {
5870
- return !!this.Si;
5878
+ return !!this.ki;
5871
5879
  }
5872
- $i(i2) {
5880
+ Si(i2) {
5873
5881
  -1 === Fn.indexOf(i2.persistence.toLowerCase()) && ($i.critical("Unknown persistence type " + i2.persistence + "; falling back to localStorage+cookie"), i2.persistence = "localStorage+cookie");
5874
5882
  var e2 = function(i3) {
5875
5883
  void 0 === i3 && (i3 = []);
@@ -5917,23 +5925,23 @@ class Mn {
5917
5925
  }), t2;
5918
5926
  }
5919
5927
  load() {
5920
- if (!this.Si) {
5921
- var t2 = this.Y.W(this.Ei);
5928
+ if (!this.ki) {
5929
+ var t2 = this.Y.W(this.$i);
5922
5930
  t2 && (this.props = Ri({}, t2));
5923
5931
  }
5924
5932
  }
5925
5933
  save() {
5926
- this.Si || this.Y.G(this.Ei, this.props, this.ki, this.Pi, this.Ti, this.R.debug);
5934
+ this.ki || this.Y.G(this.$i, this.props, this.Pi, this.Ti, this.Ii, this.R.debug);
5927
5935
  }
5928
5936
  remove() {
5929
- this.Y.V(this.Ei, false), this.Y.V(this.Ei, true);
5937
+ this.Y.V(this.$i, false), this.Y.V(this.$i, true);
5930
5938
  }
5931
5939
  clear() {
5932
5940
  this.remove(), this.props = {};
5933
5941
  }
5934
5942
  register_once(t2, i2, e2) {
5935
5943
  if (R(t2)) {
5936
- M(i2) && (i2 = "None"), this.ki = M(e2) ? this.Ii : e2;
5944
+ M(i2) && (i2 = "None"), this.Pi = M(e2) ? this.Ci : e2;
5937
5945
  var r2 = false;
5938
5946
  if (Ci(t2, (t3, e3) => {
5939
5947
  this.props.hasOwnProperty(e3) && this.props[e3] !== i2 || (this.props[e3] = t3, r2 = true);
@@ -5943,7 +5951,7 @@ class Mn {
5943
5951
  }
5944
5952
  register(t2, i2) {
5945
5953
  if (R(t2)) {
5946
- this.ki = M(i2) ? this.Ii : i2;
5954
+ this.Pi = M(i2) ? this.Ci : i2;
5947
5955
  var e2 = false;
5948
5956
  if (Ci(t2, (i3, r2) => {
5949
5957
  t2.hasOwnProperty(r2) && this.props[r2] !== i3 && (this.props[r2] = i3, e2 = true);
@@ -5955,9 +5963,9 @@ class Mn {
5955
5963
  t2 in this.props && (delete this.props[t2], this.save());
5956
5964
  }
5957
5965
  update_campaign_params() {
5958
- if (!this.xi) {
5966
+ if (!this.Ei) {
5959
5967
  var t2 = os(this.R.custom_campaign_params, this.R.mask_personal_data_properties, this.R.custom_personal_data_properties);
5960
- F(Di(t2)) || this.register(t2), this.xi = true;
5968
+ F(Di(t2)) || this.register(t2), this.Ei = true;
5961
5969
  }
5962
5970
  }
5963
5971
  update_search_keyword() {
@@ -5994,23 +6002,23 @@ class Mn {
5994
6002
  }), t2;
5995
6003
  }
5996
6004
  update_config(t2, i2, e2) {
5997
- if (this.Ii = this.ki = t2.cookie_expiration, this.set_disabled(t2.disable_persistence || !!e2), this.set_cross_subdomain(t2.cross_subdomain_cookie), this.set_secure(t2.secure_cookie), t2.persistence !== i2.persistence || !((t3, i3) => {
6005
+ if (this.Ci = this.Pi = t2.cookie_expiration, this.set_disabled(t2.disable_persistence || !!e2), this.set_cross_subdomain(t2.cross_subdomain_cookie), this.set_secure(t2.secure_cookie), t2.persistence !== i2.persistence || !((t3, i3) => {
5998
6006
  if (t3.length !== i3.length) return false;
5999
6007
  var e3 = [...t3].sort(), r3 = [...i3].sort();
6000
6008
  return e3.every((t4, i4) => t4 === r3[i4]);
6001
6009
  })(t2.cookie_persisted_properties || [], i2.cookie_persisted_properties || [])) {
6002
- var r2 = this.$i(t2), s2 = this.props;
6010
+ var r2 = this.Si(t2), s2 = this.props;
6003
6011
  this.clear(), this.Y = r2, this.props = s2, this.save();
6004
6012
  }
6005
6013
  }
6006
6014
  set_disabled(t2) {
6007
- this.Si = t2, this.Si ? this.remove() : this.save();
6015
+ this.ki = t2, this.ki ? this.remove() : this.save();
6008
6016
  }
6009
6017
  set_cross_subdomain(t2) {
6010
- t2 !== this.Pi && (this.Pi = t2, this.remove(), this.save());
6018
+ t2 !== this.Ti && (this.Ti = t2, this.remove(), this.save());
6011
6019
  }
6012
6020
  set_secure(t2) {
6013
- t2 !== this.Ti && (this.Ti = t2, this.remove(), this.save());
6021
+ t2 !== this.Ii && (this.Ii = t2, this.remove(), this.save());
6014
6022
  }
6015
6023
  set_event_timer(t2, i2) {
6016
6024
  var e2 = this.props[qi] || {};
@@ -6030,14 +6038,14 @@ class Mn {
6030
6038
  var On = Si("[Product Tours]"), An = "ph_product_tours";
6031
6039
  class Dn {
6032
6040
  constructor(t2) {
6033
- this.Ci = null, this.Ri = null, this._instance = t2;
6041
+ this.Ri = null, this.Fi = null, this._instance = t2;
6034
6042
  }
6035
6043
  onRemoteConfig(t2) {
6036
6044
  this._instance.persistence && this._instance.persistence.register({ [Qi]: !(null == t2 || !t2.productTours) }), this.loadIfEnabled();
6037
6045
  }
6038
6046
  loadIfEnabled() {
6039
6047
  var t2, i2;
6040
- this.Ci || ((t2 = this._instance).config.disable_product_tours || null == (i2 = t2.persistence) || !i2.get_property(Qi)) || this.it(() => this.Fi());
6048
+ this.Ri || ((t2 = this._instance).config.disable_product_tours || null == (i2 = t2.persistence) || !i2.get_property(Qi)) || this.it(() => this.Mi());
6041
6049
  }
6042
6050
  it(t2) {
6043
6051
  var i2, e2;
@@ -6045,16 +6053,16 @@ class Dn {
6045
6053
  i3 ? On.error("Could not load product tours script", i3) : t2();
6046
6054
  });
6047
6055
  }
6048
- Fi() {
6056
+ Mi() {
6049
6057
  var t2;
6050
- !this.Ci && null != (t2 = v.__PosthogExtensions__) && t2.generateProductTours && (this.Ci = v.__PosthogExtensions__.generateProductTours(this._instance, true));
6058
+ !this.Ri && null != (t2 = v.__PosthogExtensions__) && t2.generateProductTours && (this.Ri = v.__PosthogExtensions__.generateProductTours(this._instance, true));
6051
6059
  }
6052
6060
  getProductTours(t2, i2) {
6053
- if (void 0 === i2 && (i2 = false), !I(this.Ri) || i2) {
6061
+ if (void 0 === i2 && (i2 = false), !I(this.Fi) || i2) {
6054
6062
  var e2 = this._instance.persistence;
6055
6063
  if (e2) {
6056
6064
  var r2 = e2.props[An];
6057
- if (I(r2) && !i2) return this.Ri = r2, void t2(r2, { isLoaded: true });
6065
+ if (I(r2) && !i2) return this.Fi = r2, void t2(r2, { isLoaded: true });
6058
6066
  }
6059
6067
  this._instance._send_request({ url: this._instance.requestRouter.endpointFor("api", "/api/product_tours/?token=" + this._instance.config.token), method: "GET", callback: (i3) => {
6060
6068
  var r3 = i3.statusCode;
@@ -6063,50 +6071,50 @@ class Dn {
6063
6071
  return On.error(s2), void t2([], { isLoaded: false, error: s2 });
6064
6072
  }
6065
6073
  var n2 = I(i3.json.product_tours) ? i3.json.product_tours : [];
6066
- this.Ri = n2, e2 && e2.register({ [An]: n2 }), t2(n2, { isLoaded: true });
6074
+ this.Fi = n2, e2 && e2.register({ [An]: n2 }), t2(n2, { isLoaded: true });
6067
6075
  } });
6068
- } else t2(this.Ri, { isLoaded: true });
6076
+ } else t2(this.Fi, { isLoaded: true });
6069
6077
  }
6070
6078
  getActiveProductTours(t2) {
6071
- j(this.Ci) ? t2([], { isLoaded: false, error: "Product tours not loaded" }) : this.Ci.getActiveProductTours(t2);
6079
+ j(this.Ri) ? t2([], { isLoaded: false, error: "Product tours not loaded" }) : this.Ri.getActiveProductTours(t2);
6072
6080
  }
6073
6081
  showProductTour(t2) {
6074
6082
  var i2;
6075
- null == (i2 = this.Ci) || i2.showTourById(t2);
6083
+ null == (i2 = this.Ri) || i2.showTourById(t2);
6076
6084
  }
6077
6085
  previewTour(t2) {
6078
- this.Ci ? this.Ci.previewTour(t2) : this.it(() => {
6086
+ this.Ri ? this.Ri.previewTour(t2) : this.it(() => {
6079
6087
  var i2;
6080
- this.Fi(), null == (i2 = this.Ci) || i2.previewTour(t2);
6088
+ this.Mi(), null == (i2 = this.Ri) || i2.previewTour(t2);
6081
6089
  });
6082
6090
  }
6083
6091
  dismissProductTour() {
6084
6092
  var t2;
6085
- null == (t2 = this.Ci) || t2.dismissTour("user_clicked_skip");
6093
+ null == (t2 = this.Ri) || t2.dismissTour("user_clicked_skip");
6086
6094
  }
6087
6095
  nextStep() {
6088
6096
  var t2;
6089
- null == (t2 = this.Ci) || t2.nextStep();
6097
+ null == (t2 = this.Ri) || t2.nextStep();
6090
6098
  }
6091
6099
  previousStep() {
6092
6100
  var t2;
6093
- null == (t2 = this.Ci) || t2.previousStep();
6101
+ null == (t2 = this.Ri) || t2.previousStep();
6094
6102
  }
6095
6103
  clearCache() {
6096
6104
  var t2;
6097
- this.Ri = null, null == (t2 = this._instance.persistence) || t2.unregister(An);
6105
+ this.Fi = null, null == (t2 = this._instance.persistence) || t2.unregister(An);
6098
6106
  }
6099
6107
  resetTour(t2) {
6100
6108
  var i2;
6101
- null == (i2 = this.Ci) || i2.resetTour(t2);
6109
+ null == (i2 = this.Ri) || i2.resetTour(t2);
6102
6110
  }
6103
6111
  resetAllTours() {
6104
6112
  var t2;
6105
- null == (t2 = this.Ci) || t2.resetAllTours();
6113
+ null == (t2 = this.Ri) || t2.resetAllTours();
6106
6114
  }
6107
6115
  cancelPendingTour(t2) {
6108
6116
  var i2;
6109
- null == (i2 = this.Ci) || i2.cancelPendingTour(t2);
6117
+ null == (i2 = this.Ri) || i2.cancelPendingTour(t2);
6110
6118
  }
6111
6119
  }
6112
6120
  var jn = function(t2) {
@@ -6149,16 +6157,16 @@ var Kn = "seenSurvey_", Yn = (t2, i2) => {
6149
6157
  })(Kn, t2), Qn = [zn.Popover, zn.Widget, zn.API], Zn = { ignoreConditions: false, ignoreDelay: false, displayType: Vn.Popover };
6150
6158
  class to {
6151
6159
  constructor() {
6152
- this.Mi = {}, this.Mi = {};
6160
+ this.Oi = {}, this.Oi = {};
6153
6161
  }
6154
6162
  on(t2, i2) {
6155
- return this.Mi[t2] || (this.Mi[t2] = []), this.Mi[t2].push(i2), () => {
6156
- this.Mi[t2] = this.Mi[t2].filter((t3) => t3 !== i2);
6163
+ return this.Oi[t2] || (this.Oi[t2] = []), this.Oi[t2].push(i2), () => {
6164
+ this.Oi[t2] = this.Oi[t2].filter((t3) => t3 !== i2);
6157
6165
  };
6158
6166
  }
6159
6167
  emit(t2, i2) {
6160
- for (var e2 of this.Mi[t2] || []) e2(i2);
6161
- for (var r2 of this.Mi["*"] || []) r2(t2, i2);
6168
+ for (var e2 of this.Oi[t2] || []) e2(i2);
6169
+ for (var r2 of this.Oi["*"] || []) r2(t2, i2);
6162
6170
  }
6163
6171
  }
6164
6172
  function io(t2, i2, e2) {
@@ -6181,24 +6189,24 @@ function io(t2, i2, e2) {
6181
6189
  }
6182
6190
  class eo {
6183
6191
  constructor(t2) {
6184
- this.Oi = new to(), this.Ai = (t3, i2) => this.Di(t3, i2) && this.ji(t3, i2) && this.Li(t3, i2) && this.Ni(t3, i2), this.Di = (t3, i2) => null == i2 || !i2.event || (null == t3 ? void 0 : t3.event) === (null == i2 ? void 0 : i2.event), this._instance = t2, this.Ui = /* @__PURE__ */ new Set(), this.zi = /* @__PURE__ */ new Set();
6192
+ this.Ai = new to(), this.Di = (t3, i2) => this.ji(t3, i2) && this.Li(t3, i2) && this.Ni(t3, i2) && this.Ui(t3, i2), this.ji = (t3, i2) => null == i2 || !i2.event || (null == t3 ? void 0 : t3.event) === (null == i2 ? void 0 : i2.event), this._instance = t2, this.zi = /* @__PURE__ */ new Set(), this.Hi = /* @__PURE__ */ new Set();
6185
6193
  }
6186
6194
  init() {
6187
6195
  var t2;
6188
- if (!M(null == (t2 = this._instance) ? void 0 : t2.Hi)) {
6196
+ if (!M(null == (t2 = this._instance) ? void 0 : t2._addCaptureHook)) {
6189
6197
  var i2;
6190
- null == (i2 = this._instance) || i2.Hi((t3, i3) => {
6198
+ null == (i2 = this._instance) || i2._addCaptureHook((t3, i3) => {
6191
6199
  this.on(t3, i3);
6192
6200
  });
6193
6201
  }
6194
6202
  }
6195
6203
  register(t2) {
6196
6204
  var i2, e2;
6197
- if (!M(null == (i2 = this._instance) ? void 0 : i2.Hi) && (t2.forEach((t3) => {
6205
+ if (!M(null == (i2 = this._instance) ? void 0 : i2._addCaptureHook) && (t2.forEach((t3) => {
6198
6206
  var i3, e3;
6199
- null == (i3 = this.zi) || i3.add(t3), null == (e3 = t3.steps) || e3.forEach((t4) => {
6207
+ null == (i3 = this.Hi) || i3.add(t3), null == (e3 = t3.steps) || e3.forEach((t4) => {
6200
6208
  var i4;
6201
- null == (i4 = this.Ui) || i4.add((null == t4 ? void 0 : t4.event) || "");
6209
+ null == (i4 = this.zi) || i4.add((null == t4 ? void 0 : t4.event) || "");
6202
6210
  });
6203
6211
  }), null != (e2 = this._instance) && e2.autocapture)) {
6204
6212
  var r2, s2 = /* @__PURE__ */ new Set();
@@ -6212,8 +6220,8 @@ class eo {
6212
6220
  }
6213
6221
  on(t2, i2) {
6214
6222
  var e2;
6215
- null != i2 && 0 != t2.length && (this.Ui.has(t2) || this.Ui.has(null == i2 ? void 0 : i2.event)) && this.zi && (null == (e2 = this.zi) ? void 0 : e2.size) > 0 && this.zi.forEach((t3) => {
6216
- this.Bi(i2, t3) && this.Oi.emit("actionCaptured", t3.name);
6223
+ null != i2 && 0 != t2.length && (this.zi.has(t2) || this.zi.has(null == i2 ? void 0 : i2.event)) && this.Hi && (null == (e2 = this.Hi) ? void 0 : e2.size) > 0 && this.Hi.forEach((t3) => {
6224
+ this.Bi(i2, t3) && this.Ai.emit("actionCaptured", t3.name);
6217
6225
  });
6218
6226
  }
6219
6227
  qi(t2) {
@@ -6221,13 +6229,13 @@ class eo {
6221
6229
  }
6222
6230
  Bi(t2, i2) {
6223
6231
  if (null == (null == i2 ? void 0 : i2.steps)) return false;
6224
- for (var e2 of i2.steps) if (this.Ai(t2, e2)) return true;
6232
+ for (var e2 of i2.steps) if (this.Di(t2, e2)) return true;
6225
6233
  return false;
6226
6234
  }
6227
6235
  onAction(t2, i2) {
6228
- return this.Oi.on(t2, i2);
6236
+ return this.Ai.on(t2, i2);
6229
6237
  }
6230
- ji(t2, i2) {
6238
+ Li(t2, i2) {
6231
6239
  if (null != i2 && i2.url) {
6232
6240
  var e2, r2 = null == t2 || null == (e2 = t2.properties) ? void 0 : e2.$current_url;
6233
6241
  if (!r2 || "string" != typeof r2) return false;
@@ -6235,7 +6243,7 @@ class eo {
6235
6243
  }
6236
6244
  return true;
6237
6245
  }
6238
- Li(t2, i2) {
6246
+ Ni(t2, i2) {
6239
6247
  return !!this.Wi(t2, i2) && (!!this.Gi(t2, i2) && !!this.Vi(t2, i2));
6240
6248
  }
6241
6249
  Wi(t2, i2) {
@@ -6274,7 +6282,7 @@ class eo {
6274
6282
  var i2;
6275
6283
  return null == (null == t2 || null == (i2 = t2.properties) ? void 0 : i2.$elements) ? [] : null == t2 ? void 0 : t2.properties.$elements;
6276
6284
  }
6277
- Ni(t2, i2) {
6285
+ Ui(t2, i2) {
6278
6286
  return null == i2 || !i2.properties || 0 === i2.properties.length || _n(i2.properties.reduce((t3, i3) => {
6279
6287
  var e2 = I(i3.value) ? i3.value.map(String) : null != i3.value ? [String(i3.value)] : [];
6280
6288
  return t3[i3.key] = { values: e2, operator: i3.operator || "exact" }, t3;
@@ -6311,7 +6319,7 @@ class ro {
6311
6319
  }
6312
6320
  register(t2) {
6313
6321
  var i2;
6314
- M(null == (i2 = this._instance) ? void 0 : i2.Hi) || (this.ee(t2), this.re(t2));
6322
+ M(null == (i2 = this._instance) ? void 0 : i2._addCaptureHook) || (this.ee(t2), this.re(t2));
6315
6323
  }
6316
6324
  re(t2) {
6317
6325
  var i2 = t2.filter((t3) => {
@@ -6345,7 +6353,7 @@ class ro {
6345
6353
  return (null == (i3 = t3.conditions) ? void 0 : i3.cancelEvents) && (null == (e3 = t3.conditions) || null == (e3 = e3.cancelEvents) || null == (e3 = e3.values) ? void 0 : e3.length) > 0;
6346
6354
  });
6347
6355
  if (0 !== e2.length || 0 !== r2.length) {
6348
- null == (i2 = this._instance) || i2.Hi((t3, i3) => {
6356
+ null == (i2 = this._instance) || i2._addCaptureHook((t3, i3) => {
6349
6357
  this.onEvent(t3, i3);
6350
6358
  }), this.Ki = this.Zi(t2, jn.Activation), this.Yi = this.Zi(t2, jn.Cancellation);
6351
6359
  }
@@ -6580,11 +6588,11 @@ class no {
6580
6588
  var r2 = this.ye(t2);
6581
6589
  if (r2) {
6582
6590
  var s2 = r2;
6583
- if (null != (e2 = r2.appearance) && e2.surveyPopupDelaySeconds && i2.ignoreDelay && (s2 = g({}, r2, { appearance: g({}, r2.appearance, { surveyPopupDelaySeconds: 0 }) })), false === i2.ignoreConditions) {
6591
+ if (null != (e2 = r2.appearance) && e2.surveyPopupDelaySeconds && i2.ignoreDelay && (s2 = g({}, r2, { appearance: g({}, r2.appearance, { surveyPopupDelaySeconds: 0 }) })), i2.displayType !== Vn.Popover && i2.initialResponses && Jn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."), false === i2.ignoreConditions) {
6584
6592
  var n2 = this.canRenderSurvey(r2);
6585
6593
  if (!n2.visible) return void Jn.warn("Survey is not eligible to be displayed: ", n2.disabledReason);
6586
6594
  }
6587
- i2.displayType !== Vn.Inline ? this._surveyManager.handlePopoverSurvey(s2, i2.properties) : this.renderSurvey(s2, i2.selector, i2.properties);
6595
+ i2.displayType !== Vn.Inline ? this._surveyManager.handlePopoverSurvey(s2, i2) : this.renderSurvey(s2, i2.selector, i2.properties);
6588
6596
  } else Jn.warn("Survey not found");
6589
6597
  }
6590
6598
  }
@@ -6714,25 +6722,32 @@ class lo {
6714
6722
  var uo = Si("[RateLimiter]");
6715
6723
  class ho {
6716
6724
  constructor(t2) {
6717
- var i2, e2;
6718
6725
  this.serverLimits = {}, this.lastEventRateLimited = false, this.checkForLimiting = (t3) => {
6719
- var i3 = t3.text;
6720
- if (i3 && i3.length) try {
6721
- (JSON.parse(i3).quota_limited || []).forEach((t4) => {
6726
+ var i2 = t3.text;
6727
+ if (i2 && i2.length) try {
6728
+ (JSON.parse(i2).quota_limited || []).forEach((t4) => {
6722
6729
  uo.info((t4 || "events") + " is quota limited."), this.serverLimits[t4] = (/* @__PURE__ */ new Date()).getTime() + 6e4;
6723
6730
  });
6724
6731
  } catch (t4) {
6725
- return void uo.warn('could not rate limit - continuing. Error: "' + (null == t4 ? void 0 : t4.message) + '"', { text: i3 });
6732
+ return void uo.warn('could not rate limit - continuing. Error: "' + (null == t4 ? void 0 : t4.message) + '"', { text: i2 });
6726
6733
  }
6727
- }, this.instance = t2, this.captureEventsPerSecond = (null == (i2 = t2.config.rate_limiting) ? void 0 : i2.events_per_second) || 10, this.captureEventsBurstLimit = Math.max((null == (e2 = t2.config.rate_limiting) ? void 0 : e2.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(true).isRateLimited;
6734
+ }, this.instance = t2, this.lastEventRateLimited = this.clientRateLimitContext(true).isRateLimited;
6735
+ }
6736
+ get captureEventsPerSecond() {
6737
+ var t2;
6738
+ return (null == (t2 = this.instance.config.rate_limiting) ? void 0 : t2.events_per_second) || 10;
6739
+ }
6740
+ get captureEventsBurstLimit() {
6741
+ var t2;
6742
+ return Math.max((null == (t2 = this.instance.config.rate_limiting) ? void 0 : t2.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond);
6728
6743
  }
6729
6744
  clientRateLimitContext(t2) {
6730
6745
  var i2, e2, r2;
6731
6746
  void 0 === t2 && (t2 = false);
6732
- var s2 = (/* @__PURE__ */ new Date()).getTime(), n2 = null !== (i2 = null == (e2 = this.instance.persistence) ? void 0 : e2.get_property(ve)) && void 0 !== i2 ? i2 : { tokens: this.captureEventsBurstLimit, last: s2 };
6733
- n2.tokens += (s2 - n2.last) / 1e3 * this.captureEventsPerSecond, n2.last = s2, n2.tokens > this.captureEventsBurstLimit && (n2.tokens = this.captureEventsBurstLimit);
6734
- var o2 = n2.tokens < 1;
6735
- return o2 || t2 || (n2.tokens = Math.max(0, n2.tokens - 1)), !o2 || this.lastEventRateLimited || t2 || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to " + this.captureEventsPerSecond + " events per second and " + this.captureEventsBurstLimit + " events burst limit." }, { skip_client_rate_limiting: true }), this.lastEventRateLimited = o2, null == (r2 = this.instance.persistence) || r2.set_property(ve, n2), { isRateLimited: o2, remainingTokens: n2.tokens };
6747
+ var { captureEventsBurstLimit: s2, captureEventsPerSecond: n2 } = this, o2 = (/* @__PURE__ */ new Date()).getTime(), a2 = null !== (i2 = null == (e2 = this.instance.persistence) ? void 0 : e2.get_property(ve)) && void 0 !== i2 ? i2 : { tokens: s2, last: o2 };
6748
+ a2.tokens += (o2 - a2.last) / 1e3 * n2, a2.last = o2, a2.tokens > s2 && (a2.tokens = s2);
6749
+ var l2 = a2.tokens < 1;
6750
+ return l2 || t2 || (a2.tokens = Math.max(0, a2.tokens - 1)), !l2 || this.lastEventRateLimited || t2 || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to " + n2 + " events per second and " + s2 + " events burst limit." }, { skip_client_rate_limiting: true }), this.lastEventRateLimited = l2, null == (r2 = this.instance.persistence) || r2.set_property(ve, a2), { isRateLimited: l2, remainingTokens: a2.tokens };
6736
6751
  }
6737
6752
  isServerRateLimited(t2) {
6738
6753
  var i2 = this.serverLimits[t2 || "events"] || false;
@@ -6759,20 +6774,20 @@ class co {
6759
6774
  }
6760
6775
  load() {
6761
6776
  try {
6762
- if (this.remoteConfig) return vo.info("Using preloaded remote config", this.remoteConfig), void this.yi(this.remoteConfig);
6777
+ if (this.remoteConfig) return vo.info("Using preloaded remote config", this.remoteConfig), void this.bi(this.remoteConfig);
6763
6778
  if (this._instance.O()) return void vo.warn("Remote config is disabled. Falling back to local config.");
6764
6779
  this.Te((t2) => {
6765
6780
  if (!t2) return vo.info("No config found after loading remote JS config. Falling back to JSON."), void this.Ie((t3) => {
6766
- this.yi(t3);
6781
+ this.bi(t3);
6767
6782
  });
6768
- this.yi(t2);
6783
+ this.bi(t2);
6769
6784
  });
6770
6785
  } catch (t2) {
6771
6786
  vo.error("Error loading remote config", t2);
6772
6787
  }
6773
6788
  }
6774
- yi(t2) {
6775
- t2 ? this._instance.config.__preview_remote_config ? (this._instance.yi(t2), false !== t2.hasFeatureFlags && this._instance.featureFlags.ensureFlagsLoaded()) : vo.info("__preview_remote_config is disabled. Logging config instead", t2) : vo.error("Failed to fetch remote config from PostHog.");
6789
+ bi(t2) {
6790
+ t2 ? this._instance.config.__preview_remote_config ? (this._instance.bi(t2), false !== t2.hasFeatureFlags && this._instance.featureFlags.ensureFlagsLoaded()) : vo.info("__preview_remote_config is disabled. Logging config instead", t2) : vo.error("Failed to fetch remote config from PostHog.");
6776
6791
  }
6777
6792
  }
6778
6793
  var fo = 3e3;
@@ -6970,7 +6985,7 @@ class xo {
6970
6985
  };
6971
6986
  }
6972
6987
  dr() {
6973
- return "memory" !== this.R.persistence && !this.Xe.Si && Fr.H();
6988
+ return "memory" !== this.R.persistence && !this.Xe.ki && Fr.H();
6974
6989
  }
6975
6990
  pr(t2) {
6976
6991
  t2 !== this.rr && (this.rr = t2, this.dr() && Fr.G(this.ur, t2));
@@ -7033,7 +7048,7 @@ class So {
7033
7048
  }
7034
7049
  init() {
7035
7050
  if (this.isEnabled) {
7036
- var t2 = this._instance.Hi(this.br.bind(this));
7051
+ var t2 = this._instance._addCaptureHook(this.br.bind(this));
7037
7052
  this.wr = () => {
7038
7053
  t2(), this.yr = [], this.wr = void 0;
7039
7054
  };
@@ -7373,7 +7388,7 @@ var Lo = {}, No = () => {
7373
7388
  return g({ api_host: "https://us.i.posthog.com", flags_api_host: null, ui_host: null, token: "", autocapture: true, cross_subdomain_cookie: Ni(null == o ? void 0 : o.location), persistence: "localStorage+cookie", persistence_name: "", cookie_persisted_properties: [], loaded: No, save_campaign_params: true, custom_campaign_params: [], custom_blocked_useragents: [], save_referrer: true, capture_pageleave: "if_capture_pageview", defaults: null != i2 ? i2 : "unset", __preview_deferred_init_extensions: false, debug: a && O(null == a ? void 0 : a.search) && -1 !== a.search.indexOf("__posthog_debug=true") || false, cookie_expiration: 365, upgrade: false, disable_session_recording: false, disable_persistence: false, disable_web_experiments: true, disable_surveys: false, disable_surveys_automatic_display: false, disable_conversations: false, disable_product_tours: true, disable_external_dependency_loading: false, enable_recording_console_log: void 0, secure_cookie: "https:" === (null == t || null == (e2 = t.location) ? void 0 : e2.protocol), ip: false, opt_out_capturing_by_default: false, opt_out_persistence_by_default: false, opt_out_useragent_filter: false, opt_out_capturing_persistence_type: "localStorage", consent_persistence_name: null, opt_out_capturing_cookie_prefix: null, opt_in_site_apps: false, property_denylist: [], respect_dnt: false, sanitize_properties: null, request_headers: {}, request_batching: true, properties_string_max_length: 65535, mask_all_element_attributes: false, mask_all_text: false, mask_personal_data_properties: false, custom_personal_data_properties: [], advanced_disable_flags: false, advanced_disable_decide: false, advanced_disable_feature_flags: false, advanced_disable_feature_flags_on_first_load: false, advanced_only_evaluate_survey_feature_flags: false, advanced_enable_surveys: false, advanced_disable_toolbar_metrics: false, feature_flag_request_timeout_ms: 3e3, surveys_request_timeout_ms: 1e4, on_request_error: (t2) => {
7374
7389
  var i3 = "Bad HTTP status: " + t2.statusCode + " " + t2.text;
7375
7390
  $i.error(i3);
7376
- }, get_device_id: (t2) => t2, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: false, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: fo }, error_tracking: {}, _onCapture: No, __preview_eager_load_replay: false }, ((t2) => ({ rageclick: !(t2 && t2 >= "2025-11-30") || { content_ignorelist: true }, capture_pageview: !(t2 && t2 >= "2025-05-24") || "history_change", session_recording: t2 && t2 >= "2025-11-30" ? { strictMinimumDuration: true } : {} }))(i2));
7391
+ }, get_device_id: (t2) => t2, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: false, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: fo }, error_tracking: {}, _onCapture: No, __preview_eager_load_replay: false }, ((t2) => ({ rageclick: !(t2 && t2 >= "2025-11-30") || { content_ignorelist: true }, capture_pageview: !(t2 && t2 >= "2025-05-24") || "history_change", session_recording: t2 && t2 >= "2025-11-30" ? { strictMinimumDuration: true } : {}, external_scripts_inject_target: t2 && t2 >= "2026-01-30" ? "head" : "body" }))(i2));
7377
7392
  }, Bo = (t2) => {
7378
7393
  var i2 = {};
7379
7394
  M(t2.process_person) || (i2.person_profiles = t2.process_person), M(t2.xhr_headers) || (i2.request_headers = t2.xhr_headers), M(t2.cookie_name) || (i2.persistence_name = t2.cookie_name), M(t2.disable_cookie) || (i2.disable_persistence = t2.disable_cookie), M(t2.store_google) || (i2.save_campaign_params = t2.store_google), M(t2.verbose) || (i2.debug = t2.verbose);
@@ -7490,7 +7505,7 @@ class Wo {
7490
7505
  }), e2.push(() => {
7491
7506
  if (this.os) {
7492
7507
  var t3 = this.os;
7493
- this.os = void 0, this.yi(t3);
7508
+ this.os = void 0, this.bi(t3);
7494
7509
  }
7495
7510
  }), this.ls(e2, i2);
7496
7511
  }
@@ -7511,10 +7526,10 @@ class Wo {
7511
7526
  var r2 = Math.round(performance.now() - i2);
7512
7527
  this.register_for_session({ $sdk_debug_extensions_init_method: this.config.__preview_deferred_init_extensions ? "deferred" : "synchronous", $sdk_debug_extensions_init_time_ms: r2 }), this.config.__preview_deferred_init_extensions && $i.info("PostHog extensions initialized (" + r2 + "ms)");
7513
7528
  }
7514
- yi(t2) {
7529
+ bi(t2) {
7515
7530
  var i2, e2, r2, s2, n2, a2, l2, u2, h2;
7516
7531
  if (!o || !o.body) return $i.info("document not ready yet, trying again in 500 milliseconds..."), void setTimeout(() => {
7517
- this.yi(t2);
7532
+ this.bi(t2);
7518
7533
  }, 500);
7519
7534
  this.config.__preview_deferred_init_extensions && (this.os = t2), this.compression = void 0, t2.supportedCompression && !this.config.disable_compression && (this.compression = w(t2.supportedCompression, $s.GZipJS) ? $s.GZipJS : w(t2.supportedCompression, $s.Base64) ? $s.Base64 : void 0), null != (i2 = t2.analytics) && i2.endpoint && (this.analyticsDefaultEndpoint = t2.analytics.endpoint), this.set_config({ person_profiles: this.Vr ? this.Vr : "identified_only" }), null == (e2 = this.siteApps) || e2.onRemoteConfig(t2), null == (r2 = this.sessionRecording) || r2.onRemoteConfig(t2), null == (s2 = this.autocapture) || s2.onRemoteConfig(t2), null == (n2 = this.heatmaps) || n2.onRemoteConfig(t2), this.surveys.onRemoteConfig(t2), this.logs.onRemoteConfig(t2), this.conversations.onRemoteConfig(t2), null == (a2 = this.productTours) || a2.onRemoteConfig(t2), null == (l2 = this.webVitalsAutocapture) || l2.onRemoteConfig(t2), null == (u2 = this.exceptionObserver) || u2.onRemoteConfig(t2), this.exceptions.onRemoteConfig(t2), null == (h2 = this.deadClicksAutocapture) || h2.onRemoteConfig(t2);
7520
7535
  }
@@ -7610,7 +7625,7 @@ class Wo {
7610
7625
  } else $i.error("No event name provided to posthog.capture");
7611
7626
  } else $i.uninitializedWarning("posthog.capture");
7612
7627
  }
7613
- Hi(t2) {
7628
+ _addCaptureHook(t2) {
7614
7629
  return this.on("eventCaptured", (i2) => t2(i2.event, i2));
7615
7630
  }
7616
7631
  calculateEventProperties(t2, i2, e2, r2, s2) {
@@ -7896,8 +7911,8 @@ class Wo {
7896
7911
  }
7897
7912
  _s() {
7898
7913
  var t2, i2, e2, r2, s2 = this.Qr();
7899
- (null == (t2 = this.persistence) ? void 0 : t2.Si) !== s2 && (null == (e2 = this.persistence) || e2.set_disabled(s2));
7900
- (null == (i2 = this.sessionPersistence) ? void 0 : i2.Si) !== s2 && (null == (r2 = this.sessionPersistence) || r2.set_disabled(s2));
7914
+ (null == (t2 = this.persistence) ? void 0 : t2.ki) !== s2 && (null == (e2 = this.persistence) || e2.set_disabled(s2));
7915
+ (null == (i2 = this.sessionPersistence) ? void 0 : i2.ki) !== s2 && (null == (r2 = this.sessionPersistence) || r2.set_disabled(s2));
7901
7916
  return s2;
7902
7917
  }
7903
7918
  opt_in_capturing(t2) {
@@ -8140,7 +8155,7 @@ var __POSTHOG_ERROR_MESSAGES = {
8140
8155
  return PostHogErrorBoundary;
8141
8156
  })(React.Component);
8142
8157
  const name = "@twick/timeline";
8143
- const version = "0.15.7";
8158
+ const version = "0.15.9";
8144
8159
  const packageJson = {
8145
8160
  name,
8146
8161
  version