@incodetech/core 2.5.0-agentic.1 → 2.5.0-agentic.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/{FaceDetectionProvider-Cy2EAL0i.esm.js → FaceDetectionProvider-CAPKXGuF.esm.js} +4 -4
  2. package/dist/ae-signature.esm.js +1 -1
  3. package/dist/{apiError-B9-B3cMq.esm.js → apiError-CmvdtW2M.esm.js} +1 -1
  4. package/dist/authentication.d.ts +3 -3
  5. package/dist/authentication.esm.js +2 -2
  6. package/dist/{authenticationManager-DNWtc0eq.esm.js → authenticationManager-CsioEjTk.esm.js} +3 -3
  7. package/dist/{authenticationManager-CkD0JR7Q.d.ts → authenticationManager-D_dz2zK4.d.ts} +1 -1
  8. package/dist/{authenticationStateMachine-CJ9i4Al-.esm.js → authenticationStateMachine-BoGEvdpR.esm.js} +3 -3
  9. package/dist/{browser-pQZA35G2-B4Dwja1e.esm.js → browser-pQZA35G2-DveVe0Ui.esm.js} +1 -1
  10. package/dist/consent.d.ts +1 -1
  11. package/dist/{consentManager-B0YKqYtZ.d.ts → consentManager-CMed_O5F.d.ts} +8 -8
  12. package/dist/curp-validation.d.ts +1 -1
  13. package/dist/{curpValidationManager-HOidAKvT.d.ts → curpValidationManager-tNhzv7vZ.d.ts} +1 -1
  14. package/dist/{deepsightCaptureConfig-BxD3mSac.esm.js → deepsightCaptureConfig-tYJhVK_Z.esm.js} +2 -2
  15. package/dist/{deepsightLoader-KYZP8_x-.esm.js → deepsightLoader-VASYET0q.esm.js} +4 -4
  16. package/dist/{desktopCameraElection-BGQRIA2u.esm.js → desktopCameraElection-Bx8PyF2-.esm.js} +4 -4
  17. package/dist/document-capture.d.ts +1 -1
  18. package/dist/document-signature.esm.js +1 -1
  19. package/dist/{documentCaptureManager-sJWgqtUy.d.ts → documentCaptureManager-Bul0b4KJ.d.ts} +5 -5
  20. package/dist/{documentSignatureStateMachine-CLljjltG.esm.js → documentSignatureStateMachine-BeA6fc5n.esm.js} +1 -1
  21. package/dist/dynamic-forms.esm.js +2 -2
  22. package/dist/{dynamicFormsManager-CnU2hRvl.esm.js → dynamicFormsManager-f5Uyu4UK.esm.js} +1 -1
  23. package/dist/{dynamicFormsStateMachine-huYmjamB.esm.js → dynamicFormsStateMachine-Dkug_fKn.esm.js} +1 -1
  24. package/dist/ekyb.d.ts +1 -1
  25. package/dist/ekyb.esm.js +2 -2
  26. package/dist/{ekybManager-CaEErq39.esm.js → ekybManager-KiG_tDCV.esm.js} +1 -1
  27. package/dist/{ekybStateMachine-BIU8KIMv.esm.js → ekybStateMachine-dDlZntM8.esm.js} +1 -1
  28. package/dist/ekyc-prefill.d.ts +1 -1
  29. package/dist/ekyc-prefill.esm.js +2 -2
  30. package/dist/ekyc.d.ts +2 -2
  31. package/dist/ekyc.esm.js +3 -3
  32. package/dist/{ekycManager-D2K8AaMV.esm.js → ekycManager-SUIAHlrm.esm.js} +1 -1
  33. package/dist/{ekycManager-DusmB-4j.d.ts → ekycManager-mv2rWxc4.d.ts} +1 -1
  34. package/dist/{ekycPrefillManager-CENQjdNq.esm.js → ekycPrefillManager-BsFZnV2a.esm.js} +1 -1
  35. package/dist/{ekycPrefillManager-BwmPXfhY.d.ts → ekycPrefillManager-QKqXYPH_.d.ts} +5 -5
  36. package/dist/{ekycPrefillStateMachine-jT3hIt2X.esm.js → ekycPrefillStateMachine-B6ZTcy7R.esm.js} +21 -4
  37. package/dist/{ekycStateMachine-6EKndBd7.esm.js → ekycStateMachine-Czn2CaTV.esm.js} +134 -3
  38. package/dist/{ekycUtils-C6HZB46m.esm.js → ekycUtils-BnTyeA-_.esm.js} +12 -0
  39. package/dist/electronic-signature.esm.js +1 -1
  40. package/dist/{electronicSignatureManager-wM8WTgzP.esm.js → electronicSignatureManager-BIjhPcO0.esm.js} +1 -1
  41. package/dist/extensibility.d.ts +15 -15
  42. package/dist/extensibility.esm.js +13 -13
  43. package/dist/{faceCaptureManagerFactory-DbEARG3h.esm.js → faceCaptureManagerFactory-6Hk2GxNz.esm.js} +2 -2
  44. package/dist/{faceCaptureManagerFactory-D1EJw36F.d.ts → faceCaptureManagerFactory-B1WfKaGJ.d.ts} +3 -3
  45. package/dist/{faceCaptureSetup-VaAjMpWX.esm.js → faceCaptureSetup-BM0mj2GE.esm.js} +7 -7
  46. package/dist/{feature-management-D7oLtULO.esm.js → feature-management-DG39VwqE.esm.js} +1 -1
  47. package/dist/feature-management.esm.js +1 -1
  48. package/dist/flow-events.d.ts +1 -1
  49. package/dist/flow.d.ts +6 -6
  50. package/dist/flow.esm.js +3 -3
  51. package/dist/{flowCompletionService-CIjaIpMH.esm.js → flowCompletionService-QycHxT5Z.esm.js} +1 -1
  52. package/dist/{flowServices-Dqt75TXx.esm.js → flowServices-5d7en_Aq.esm.js} +5 -5
  53. package/dist/geolocation.d.ts +1 -1
  54. package/dist/geolocation.esm.js +2 -2
  55. package/dist/{geolocationManager-CENrvxpK.d.ts → geolocationManager-Del2ddmt.d.ts} +1 -1
  56. package/dist/{geolocationManager-DHfgXhEs.esm.js → geolocationManager-_DJwOuei.esm.js} +1 -1
  57. package/dist/{geolocationStateMachine-CrEspaN-.esm.js → geolocationStateMachine-CyjGgKJ7.esm.js} +1 -1
  58. package/dist/home.d.ts +1 -1
  59. package/dist/id-ocr.d.ts +1 -1
  60. package/dist/id-selfie-flow.d.ts +1 -1
  61. package/dist/id-selfie-flow.esm.js +6 -6
  62. package/dist/id.d.ts +2 -2
  63. package/dist/id.esm.js +3 -3
  64. package/dist/{idCaptureManager-BPDCAV04.esm.js → idCaptureManager-BjTr4lOA.esm.js} +4 -4
  65. package/dist/{idCaptureManager-CNFBeYgV.d.ts → idCaptureManager-DXqvtLr9.d.ts} +2 -2
  66. package/dist/{idCaptureServices-CWZFmS7l.esm.js → idCaptureServices-D6sRW-qd.esm.js} +2 -2
  67. package/dist/{idCaptureStateMachine-Cyt2BvPB.esm.js → idCaptureStateMachine-BBlWr1aL.esm.js} +45 -25
  68. package/dist/{idOcrManager-DflRx-_u.d.ts → idOcrManager-voLpv_jJ.d.ts} +1 -1
  69. package/dist/identity-reuse.d.ts +1 -1
  70. package/dist/{identityReuseManager-CZ-qJ_Aa.d.ts → identityReuseManager-D_jiHp1n.d.ts} +4 -4
  71. package/dist/{index-BMr3MZEI.d.ts → index-B3BI8mVu.d.ts} +32 -4
  72. package/dist/{index-BoGlwLGK.d.ts → index-BnKhmWhM.d.ts} +1 -1
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.esm.js +1 -1
  75. package/dist/kyb-checks.esm.js +2 -2
  76. package/dist/{kybChecksManager-BF2vf0Q2.esm.js → kybChecksManager-Cpm2waJh.esm.js} +1 -1
  77. package/dist/{kybChecksStateMachine-oBQfgdka.esm.js → kybChecksStateMachine-Cg96E65N.esm.js} +1 -1
  78. package/dist/mandatory-consent.d.ts +2 -2
  79. package/dist/{mandatoryConsentManager-BcxCesP5.d.ts → mandatoryConsentManager-D2LkPii6.d.ts} +9 -9
  80. package/dist/qe-signature.esm.js +1 -1
  81. package/dist/{recordingService-DK3kjUby.esm.js → recordingService-wGNpJV_s.esm.js} +1 -1
  82. package/dist/{runChildModule-x1rrxjYY.esm.js → runChildModule-DCXy_h7V.esm.js} +1 -1
  83. package/dist/{numericRange-2e1vw1W0.esm.js → scriptCharacters-D7swUycV.esm.js} +13 -1
  84. package/dist/{sdkVersion-kRh5h82H.esm.js → sdkVersion-CzRrIbvf.esm.js} +1 -1
  85. package/dist/selfie.d.ts +3 -3
  86. package/dist/selfie.esm.js +7 -7
  87. package/dist/{selfieErrorUtils-B9GfiS9f.esm.js → selfieErrorUtils-DFJC36jx.esm.js} +1 -1
  88. package/dist/{selfieManager-CqDlUy6B.d.ts → selfieManager-B2j448t4.d.ts} +1 -1
  89. package/dist/{selfieManager-CivYjnF5.esm.js → selfieManager-KXkwfGvO.esm.js} +3 -3
  90. package/dist/{selfieStateMachine-dLwrXWll.esm.js → selfieStateMachine-CqHL6qf_.esm.js} +3 -3
  91. package/dist/{session-DeJ-rd9u.esm.js → session-DhNeT_WW.esm.js} +4 -4
  92. package/dist/session.d.ts +1 -1
  93. package/dist/session.esm.js +4 -4
  94. package/dist/{sessionInitializer-uZgyxsrL.esm.js → sessionInitializer-CfF_kFfS.esm.js} +6 -6
  95. package/dist/{setup-D0QZHkS8.esm.js → setup-BoCn7daH.esm.js} +8 -7
  96. package/dist/{setup-Cr2KCwau.d.ts → setup-DprzbOsJ.d.ts} +1 -1
  97. package/dist/tri-D5hWs0qJ.esm.js +559 -0
  98. package/dist/tri.d.ts +1 -1
  99. package/dist/{tri.esm-CftnGf9w.esm.js → tri.esm-DnXGKdlE.esm.js} +1296 -1057
  100. package/dist/tri.esm.js +1 -1
  101. package/dist/trueSight-CXzqdA0V.esm.js +1 -0
  102. package/dist/{trueSightService-BMp8g65B.esm.js → trueSightService-BYsRo-fK.esm.js} +1 -1
  103. package/dist/{types-BZsmNYom.d.ts → types-BFoC3IpR.d.ts} +2 -2
  104. package/dist/{types-PnJXvTkV.d.ts → types-BkxI3PHf.d.ts} +1 -1
  105. package/dist/{types-D-FEM1rT.d.ts → types-BxJWsAHc.d.ts} +4 -4
  106. package/dist/{types-HHgsFhZn.d.ts → types-CAzi8tyi.d.ts} +1 -1
  107. package/dist/types-CEdI4tfR.d.ts +6 -0
  108. package/dist/{types-tOSLpcSa.d.ts → types-CkzE2gPZ.d.ts} +5 -0
  109. package/dist/{types-LbccjQYX.d.ts → types-DuARPzVa.d.ts} +1 -1
  110. package/dist/video-selfie.d.ts +1 -1
  111. package/dist/video-selfie.esm.js +3 -3
  112. package/dist/{videoSelfieCameraWarmer-BpP0_lDr.esm.js → videoSelfieCameraWarmer-Co4dAC64.esm.js} +3 -3
  113. package/dist/{videoSelfieStepDetector-CxOc3kSI.d.ts → videoSelfieStepDetector-CrlbZ-rN.d.ts} +2 -2
  114. package/dist/wasm.d.ts +1 -1
  115. package/dist/wasm.esm.js +1 -1
  116. package/dist/workflow.d.ts +1 -1
  117. package/dist/workflow.esm.js +19 -19
  118. package/package.json +4 -3
  119. package/dist/tri-D_gHPWrq.esm.js +0 -402
  120. package/dist/trueSight-CbrZUzLx.esm.js +0 -1
  121. package/dist/types-BinnzVrL.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@incodetech+tri-sdk@0.6.0-dev-20261126134638-5fecd70f19ccf51aceade38a393876560c0b09d5/node_modules/@incodetech/tri-sdk/dist/tri.esm.js
1
+ //#region ../../node_modules/.pnpm/@incodetech+tri-sdk@0.6.0-dev-20261130153510-2a00381e18ea88407aeb423f468bc502470035cb/node_modules/@incodetech/tri-sdk/dist/tri.esm.js
2
2
  function t(t, n, e) {
3
3
  let i = t, r = n;
4
4
  if ("devicepixelratiochange" === n) {
@@ -44,28 +44,28 @@ const i = class e {
44
44
  this.l(t, n, e, ...i);
45
45
  }
46
46
  l(t, n, e, ...i) {
47
- const r = n ? `[${n}]` : "", o = console?.[t];
48
- o && o(`[IncodeTRI]${r} ${e}`, ...i);
47
+ const r = n ? `[${n}]` : "", s = console?.[t];
48
+ s && s(`[IncodeTRI]${r} ${e}`, ...i);
49
49
  }
50
50
  }.instance;
51
51
  const r = globalThis.setTimeout.bind(globalThis);
52
- const o = globalThis.clearTimeout.bind(globalThis);
53
- function s(t, n) {
52
+ const s = globalThis.clearTimeout.bind(globalThis);
53
+ function o(t, n) {
54
54
  try {
55
55
  return t();
56
56
  } catch (t) {
57
57
  i.warn("utils", "safeSync swallowed error:", t);
58
58
  }
59
59
  }
60
- async function a(t) {
60
+ async function u(t) {
61
61
  try {
62
62
  return await t();
63
63
  } catch (t) {
64
64
  i.warn("utils", "safeAsync swallowed error:", t);
65
65
  }
66
66
  }
67
- function u(t) {
68
- return (n) => s(() => t(n));
67
+ function a(t) {
68
+ return (n) => o(() => t(n));
69
69
  }
70
70
  function l(t) {
71
71
  return (...n) => {
@@ -81,7 +81,7 @@ function c(t, n) {
81
81
  }
82
82
  function f(t) {
83
83
  if (null !== t) try {
84
- o(t);
84
+ s(t);
85
85
  } catch (t) {
86
86
  i.warn("utils", "safeClearTimeout swallowed error:", t);
87
87
  }
@@ -94,8 +94,17 @@ function h(t, n) {
94
94
  return Promise.race([t.finally(() => f(e)), i]);
95
95
  }
96
96
  function d(t) {
97
+ let n = t.length;
98
+ for (; n > 0 && 47 === t.charCodeAt(n - 1);) n--;
99
+ return t.slice(0, n);
100
+ }
101
+ function p(t) {
97
102
  function n() {
98
- return globalThis.window && globalThis.window[t] && void 0 !== globalThis.window[t];
103
+ try {
104
+ return Boolean(globalThis.window && globalThis.window[t] && void 0 !== globalThis.window[t]);
105
+ } catch {
106
+ return !1;
107
+ }
99
108
  }
100
109
  return {
101
110
  get: function(e) {
@@ -107,11 +116,19 @@ function d(t) {
107
116
  return null;
108
117
  }
109
118
  },
119
+ has: function(e) {
120
+ if (!n()) return !1;
121
+ try {
122
+ return null !== window[t].getItem(e);
123
+ } catch {
124
+ return !1;
125
+ }
126
+ },
110
127
  set: function(e, i) {
111
- n() && s(() => window[t].setItem(e, JSON.stringify(i)));
128
+ n() && o(() => window[t].setItem(e, JSON.stringify(i)));
112
129
  },
113
130
  remove: function(e) {
114
- n() && s(() => window[t].removeItem(e));
131
+ n() && o(() => window[t].removeItem(e));
115
132
  },
116
133
  key: function(e) {
117
134
  return n() ? window[t].key(e) : null;
@@ -121,11 +138,11 @@ function d(t) {
121
138
  }
122
139
  };
123
140
  }
124
- const p = d("localStorage");
125
- const y = d("sessionStorage");
126
- const g = "__tri_session";
127
- function w() {
128
- const t = s(() => y.get(g)), n = {
141
+ const y = p("localStorage");
142
+ const g = p("sessionStorage");
143
+ const w = "__tri_session";
144
+ function v() {
145
+ const t = o(() => g.get(w)), n = {
129
146
  setups: 0,
130
147
  resets: 0,
131
148
  activities: 0,
@@ -134,55 +151,233 @@ function w() {
134
151
  };
135
152
  return t && "object" == typeof t ? ("number" == typeof t.setups && (n.setups = t.setups), "number" == typeof t.resets && (n.resets = t.resets), "number" == typeof t.activities && (n.activities = t.activities), "string" == typeof t.activityId && (n.activityId = t.activityId), "string" == typeof t.previousActivityId && (n.previousActivityId = t.previousActivityId), n) : n;
136
153
  }
137
- function v(t) {
138
- s(() => {
139
- const n = w();
140
- t(n), y.set(g, n);
154
+ function m(t) {
155
+ o(() => {
156
+ const n = v();
157
+ t(n), g.set(w, n);
141
158
  });
142
159
  }
143
- const b = {
160
+ function b(t) {
161
+ if (!t) return null;
162
+ const n = t.split(".")[1], e = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
163
+ return JSON.parse(e);
164
+ }
165
+ const k = {
166
+ decode: b,
167
+ isExpired: function(t, n = 30) {
168
+ if (!t) return !0;
169
+ const e = b(t);
170
+ return !e || "number" != typeof e.exp || 1e3 * e.exp <= Date.now() + 1e3 * n;
171
+ }
172
+ };
173
+ async function S(t, n) {
174
+ return globalThis.navigator && "locks" in globalThis.navigator && "request" in globalThis.navigator.locks && "query" in globalThis.navigator.locks ? navigator.locks.request(t, { mode: "exclusive" }, async () => u(n)) : u(n);
175
+ }
176
+ const T = "__tri";
177
+ const _ = `${T}_activity_token`;
178
+ const A = `${T}_activity_id`;
179
+ const I = `${T}_activity_status`;
180
+ const R = "__tri_activity_lock";
181
+ const E = [
182
+ 2e3,
183
+ 4e3,
184
+ 8e3,
185
+ 16e3,
186
+ 32e3,
187
+ 6e4
188
+ ];
189
+ const M = 6e5;
190
+ const C = [
191
+ _,
192
+ A,
193
+ I
194
+ ];
195
+ var P = class {
196
+ constructor(t) {
197
+ this.context = t, this.h = null, this.p = null, this.m = null, this.k = null, this.S = null, this.T = null, this._ = 0, this.A = !1, this.I = null, this.R = null, this.M = 0, this.C = 0, this.P = 0;
198
+ }
199
+ startFailure() {
200
+ return this.I;
201
+ }
202
+ retryNow() {
203
+ this.A && "retrying" === this.I && !1 !== globalThis.navigator?.onLine && (Date.now() - this.P < 2e3 || (this.$(), this.U()));
204
+ }
205
+ getToken() {
206
+ return this.h;
207
+ }
208
+ getActivityId() {
209
+ return this.p ?? "";
210
+ }
211
+ isActive() {
212
+ return "ACTIVE" === this.m && null !== this.h;
213
+ }
214
+ async start() {
215
+ if (!this.k) {
216
+ const t = this.j();
217
+ this.k = t;
218
+ const n = () => {
219
+ this.k === t && (this.k = null);
220
+ };
221
+ t.then(n, n);
222
+ }
223
+ return this.k;
224
+ }
225
+ beginStop() {
226
+ if (this.A = !1, this._++, this.k = null, this.$(), this.M = 0, this.B(null), !this.T) {
227
+ let t = () => {};
228
+ const n = new Promise((n) => {
229
+ t = n;
230
+ });
231
+ this.T = {
232
+ done: n,
233
+ open: t,
234
+ pending: 0
235
+ };
236
+ }
237
+ this.T.pending++;
238
+ }
239
+ release() {
240
+ this.A = !1, this._++, this.k = null, this.$(), this.M = 0, this.I = null;
241
+ }
242
+ async stop() {
243
+ const t = this.T, n = this.O();
244
+ this.S = n;
245
+ try {
246
+ await n;
247
+ } finally {
248
+ this.S === n && (this.S = null), t && this.T === t && --t.pending <= 0 && (this.T = null, t.open());
249
+ }
250
+ }
251
+ async O() {
252
+ this.A = !1, this.$(), this.M = 0, this.I = null, this.m = "INACTIVE", this.T || (this.B(null), this.k = null), this.h && await this.context.stopActivity(), this.D(null);
253
+ }
254
+ async refresh(t) {
255
+ if (!this.A) return;
256
+ const n = this._, e = t ?? this.h;
257
+ await S(R, async () => {
258
+ if (n !== this._) return;
259
+ if (this.h && this.h !== e && !k.isExpired(this.h) && "ACTIVE" === this.m) return;
260
+ const t = this.L();
261
+ if (t && t.token !== e && !k.isExpired(t.token) && "ACTIVE" === t.activityStatus) return this.D(t), void this.context.onActivityAdopted?.();
262
+ this.F(), await this.N(n);
263
+ });
264
+ }
265
+ async j() {
266
+ const t = this._;
267
+ for (; this.T || this.S;) await (this.T?.done ?? this.S);
268
+ t === this._ && (this.A = !0, this.h && !k.isExpired(this.h) || await S(R, async () => {
269
+ await this.N(t);
270
+ }));
271
+ }
272
+ async N(t) {
273
+ if (t !== this._) return;
274
+ const n = this.L();
275
+ if (n && !k.isExpired(n.token) && "ACTIVE" === n.activityStatus) return this.D(n), void this.context.onActivityAdopted?.();
276
+ n && this.F(), this.P = Date.now();
277
+ const e = await this.context.startActivity();
278
+ if (t !== this._) return;
279
+ if (!e.ok) return this.context.onActivityStarted?.(null), void (function(t) {
280
+ return !t.ok && "client" === t.kind && 408 !== t.status;
281
+ }(e) ? this.q() : this.H());
282
+ const i = e.data;
283
+ if (!i?.token) return this.context.onActivityStarted?.(null), void this.q();
284
+ const r = i;
285
+ this.D(r), this.J(r), this.context.onActivityStarted?.(r.pulseguard);
286
+ }
287
+ L() {
288
+ const [t, n, e] = [
289
+ y.get(_),
290
+ y.get(A),
291
+ y.get(I)
292
+ ];
293
+ return t && n && e ? {
294
+ token: t,
295
+ activityId: n,
296
+ activityStatus: e
297
+ } : ((t || n || e) && this.F(), null);
298
+ }
299
+ J(t) {
300
+ y.set(_, t.token), y.set(A, t.activityId), y.set(I, t.activityStatus);
301
+ }
302
+ F() {
303
+ this.B(null), this.D(null);
304
+ }
305
+ B(t) {
306
+ if (!t) return y.remove(_), y.remove(A), void y.remove(I);
307
+ y.set(_, t.token), y.set(A, t.activityId), y.set(I, t.activityStatus);
308
+ }
309
+ D(t) {
310
+ if (!t) return this.h = null, this.p = null, void (this.m = null);
311
+ var n;
312
+ (n = t.activityId) && m(function(t) {
313
+ t.activityId !== n && (t.previousActivityId = t.activityId, t.activityId = n, t.activities += 1);
314
+ }), this.h = t.token, this.p = t.activityId, this.m = t.activityStatus, this.I = null, this.M = 0, this.$();
315
+ }
316
+ H() {
317
+ if (this.I = "retrying", null !== this.R || !this.A) return;
318
+ const t = Date.now();
319
+ if (0 === this.M && (this.C = t), t - this.C >= M) return;
320
+ const n = E[Math.min(this.M, E.length - 1)];
321
+ this.M++, this.R = c(() => {
322
+ this.R = null, this.A && "retrying" === this.I && (Date.now() - this.C >= M || this.U());
323
+ }, n * (.5 + .5 * Math.random()));
324
+ }
325
+ U() {
326
+ const t = this._;
327
+ this.start().catch(() => {
328
+ t === this._ && "retrying" === this.I && this.H();
329
+ });
330
+ }
331
+ q() {
332
+ this.I = "refused", this.$(), this.context.onRefused?.();
333
+ }
334
+ $() {
335
+ f(this.R), this.R = null;
336
+ }
337
+ };
338
+ const U = {
144
339
  "fpSignalsLib.js": "5248ca624da2f1551ff2b6264a4494368d16aa0eaba50484dfe03f940acf4611",
145
340
  "fpSignalsLib.wasm": "d15c1930d57310356a7ea6cb803f590d98792409d8d8b455c00cecd9af4bf2ea",
146
341
  "fpSignalsLibSimd.js": "08abec3f0f04dd816076b493712ae27920769f36e232ea8038a218cac15a3a60",
147
342
  "fpSignalsLibSimd.wasm": "08c3faf6d5615dfa1ede01875c9d29305626ab2e85603bae8c4af3a15b933d3a"
148
343
  };
149
- var k = class extends Error {
344
+ var x = class extends Error {
150
345
  constructor(t, n) {
151
346
  super(n), this.name = "FpSignalsLoadError", this.reason = t;
152
347
  }
153
348
  };
154
- async function S(t) {
155
- const n = new URL(t).pathname.split("/").pop() ?? "", e = b[n];
156
- if (!e) throw new k("integrity-mismatch", `fpSignals: no digest for ${n}`);
349
+ async function j(t) {
350
+ const n = new URL(t).pathname.split("/").pop() ?? "", e = U[n];
351
+ if (!e) throw new x("integrity-mismatch", `fpSignals: no digest for ${n}`);
157
352
  const i = globalThis.crypto?.subtle;
158
- if (!i) throw new k("no-crypto-subtle", "fpSignals: crypto.subtle is unavailable, so the files cannot be verified. Serve the page over HTTPS.");
353
+ if (!i) throw new x("no-crypto-subtle", "fpSignals: crypto.subtle is unavailable, so the files cannot be verified. Serve the page over HTTPS.");
159
354
  const r = await async function(t, n) {
160
355
  try {
161
356
  const n = await fetch(t);
162
357
  if (!n.ok) throw new Error(`HTTP ${n.status}`);
163
358
  return new Uint8Array(await n.arrayBuffer());
164
359
  } catch (t) {
165
- throw new k("network-or-csp", `fpSignals: ${n} could not be fetched: ${String(t)}`);
360
+ throw new x("network-or-csp", `fpSignals: ${n} could not be fetched: ${String(t)}`);
166
361
  }
167
362
  }(t, n);
168
- if (T(await i.digest("SHA-256", r)) !== e) throw new k("integrity-mismatch", `fpSignals: ${n} does not match the pinned build`);
363
+ if (z(await i.digest("SHA-256", r)) !== e) throw new x("integrity-mismatch", `fpSignals: ${n} does not match the pinned build`);
169
364
  return r;
170
365
  }
171
- function T(t) {
366
+ function z(t) {
172
367
  let n = "";
173
368
  for (const e of new Uint8Array(t)) n += e.toString(16).padStart(2, "0");
174
369
  return n;
175
370
  }
176
- async function _(t, n, e, i = 0) {
177
- const r = i > 0 && "function" == typeof AbortController ? new AbortController() : null, o = r ? setTimeout(function() {
371
+ async function B(t, n, e, i = 0) {
372
+ const r = i > 0 && "function" == typeof AbortController ? new AbortController() : null, s = r ? setTimeout(function() {
178
373
  r.abort();
179
374
  }, i) : null;
180
375
  try {
181
376
  const i = globalThis.crypto?.subtle;
182
377
  if (!(i && e > 0)) return null;
183
- const o = await fetch(t, r ? { signal: r.signal } : void 0);
184
- if (!o.ok) return null;
185
- const s = await async function(t, n) {
378
+ const s = await fetch(t, r ? { signal: r.signal } : void 0);
379
+ if (!s.ok) return null;
380
+ const o = await async function(t, n) {
186
381
  const e = t.body?.getReader();
187
382
  if (!e) {
188
383
  const e = await t.arrayBuffer();
@@ -191,24 +386,24 @@ async function _(t, n, e, i = 0) {
191
386
  const i = new Uint8Array(n);
192
387
  let r = 0;
193
388
  for (;;) {
194
- const { done: t, value: o } = await e.read();
389
+ const { done: t, value: s } = await e.read();
195
390
  if (t) break;
196
- if (r + o.byteLength > n) return e.cancel().catch(function() {}), null;
197
- i.set(o, r), r += o.byteLength;
391
+ if (r + s.byteLength > n) return e.cancel().catch(function() {}), null;
392
+ i.set(s, r), r += s.byteLength;
198
393
  }
199
394
  return r === n ? i : null;
200
- }(o, e);
201
- return s && T(await i.digest("SHA-256", s)) === n.toLowerCase() ? s : null;
395
+ }(s, e);
396
+ return o && z(await i.digest("SHA-256", o)) === n.toLowerCase() ? o : null;
202
397
  } catch {
203
398
  return null;
204
399
  } finally {
205
- null !== o && clearTimeout(o);
400
+ null !== s && clearTimeout(s);
206
401
  }
207
402
  }
208
- var A;
209
- async function I(t) {
403
+ var O;
404
+ async function D(t) {
210
405
  const n = t.replace(/\.wasm($|\?)/, ".js$1"), e = await async function(t) {
211
- const n = await S(t), e = URL.createObjectURL(new Blob([n], { type: "text/javascript" }));
406
+ const n = await j(t), e = URL.createObjectURL(new Blob([n], { type: "text/javascript" }));
212
407
  try {
213
408
  return await import(
214
409
  /* @vite-ignore */
@@ -216,35 +411,35 @@ async function I(t) {
216
411
  e
217
412
  );
218
413
  } catch (t) {
219
- throw new k("network-or-csp", `fpSignals: the verified glue could not be imported: ${String(t)}`);
414
+ throw new x("network-or-csp", `fpSignals: the verified glue could not be imported: ${String(t)}`);
220
415
  } finally {
221
416
  URL.revokeObjectURL(e);
222
417
  }
223
418
  }(n), i = e.Module ?? e.default;
224
419
  if (!i) throw new Error(`Failed to import Module from ${n}`);
225
- const r = await S(t), o = window.wasmArrayBuffer;
420
+ const r = await j(t), s = window.wasmArrayBuffer;
226
421
  window.wasmArrayBuffer = r;
227
422
  try {
228
423
  return await i({ wasmBinary: r });
229
424
  } finally {
230
- window.wasmArrayBuffer = o;
425
+ window.wasmArrayBuffer = s;
231
426
  }
232
427
  }
233
428
  (function(t) {
234
429
  t[t.Device = 1] = "Device", t[t.Behaviour = 2] = "Behaviour", t[t.PID = 3] = "PID", t[t.Network = 4] = "Network", t[t.External = 5] = "External";
235
- })(A || (A = {}));
236
- var R = class {
430
+ })(O || (O = {}));
431
+ var L = class {
237
432
  constructor() {
238
433
  this.wasmModule = null, this.signalsApi = null, this.usedSimd_ = !1;
239
434
  }
240
- async initialize(t, n, e = !0, r, o) {
435
+ async initialize(t, n, e = !0, r, s) {
241
436
  if (this.signalsApi) return;
242
- const s = e && !!n;
437
+ const o = e && !!n;
243
438
  try {
244
- this.wasmModule = await I(s ? n : t), this.usedSimd_ = s;
439
+ this.wasmModule = await D(o ? n : t), this.usedSimd_ = o;
245
440
  } catch (n) {
246
- if (!s) throw n;
247
- i.warn("FpSignals", "SIMD init error:", n), this.wasmModule = await I(t), this.usedSimd_ = !1;
441
+ if (!o) throw n;
442
+ i.warn("FpSignals", "SIMD init error:", n), this.wasmModule = await D(t), this.usedSimd_ = !1;
248
443
  }
249
444
  this.signalsApi = function(t, n, e) {
250
445
  const r = void 0 === e ? "" : String(e);
@@ -255,7 +450,7 @@ var R = class {
255
450
  i.warn("FpSignals", "constructor arguments not supported:", t);
256
451
  }
257
452
  return new t.FpSignals();
258
- }(this.wasmModule, r, o);
453
+ }(this.wasmModule, r, s);
259
454
  }
260
455
  get usedSimd() {
261
456
  return this.usedSimd_;
@@ -313,10 +508,10 @@ var R = class {
313
508
  return this.signalsApi;
314
509
  }
315
510
  };
316
- function E(t, n) {
511
+ function F(t, n) {
317
512
  return !t || (t[n]?.enabled ?? !1);
318
513
  }
319
- const M = {
514
+ const N = {
320
515
  pointer: { events: {
321
516
  pointer: ["pointerButtons"],
322
517
  click: ["clicks"],
@@ -356,32 +551,32 @@ const M = {
356
551
  screen: { all: ["screenChanges"] },
357
552
  networkconnection: { all: ["online"] }
358
553
  };
359
- const C = ["pointerButtons", "pointerMoves"];
360
- function $(t, n) {
554
+ const q = ["pointerButtons", "pointerMoves"];
555
+ function H(t, n) {
361
556
  return !0 === t[n]?.enabled;
362
557
  }
363
- function P(t, n, e) {
558
+ function J(t, n, e) {
364
559
  const i = t[n];
365
560
  if (!i || !i.enabled) return !1;
366
561
  return ("events" in i ? i.events : void 0)?.[e]?.enabled ?? !0;
367
562
  }
368
- function x(t) {
563
+ function V(t) {
369
564
  const n = [];
370
- for (const e of Object.keys(M)) {
371
- const i = M[e];
372
- if ("all" in i) $(t, e) || n.push(...i.all);
373
- else for (const r of Object.keys(i.events)) P(t, e, r) || n.push(...i.events[r]);
565
+ for (const e of Object.keys(N)) {
566
+ const i = N[e];
567
+ if ("all" in i) H(t, e) || n.push(...i.all);
568
+ else for (const r of Object.keys(i.events)) J(t, e, r) || n.push(...i.events[r]);
374
569
  }
375
570
  let e = !0;
376
- for (const t of C) n.includes(t) || (e = !1);
571
+ for (const t of q) n.includes(t) || (e = !1);
377
572
  return e && n.push("touch"), n;
378
573
  }
379
- const U = "idle";
380
- const B = "ready";
381
- const O = "started";
382
- const j = "collection-disabled";
383
- const z = "init-failed";
384
- const D = {
574
+ const W = "idle";
575
+ const G = "ready";
576
+ const K = "started";
577
+ const Z = "collection-disabled";
578
+ const X = "init-failed";
579
+ const Q = {
385
580
  flush: {
386
581
  intervalMs: 2e3,
387
582
  maxIntervalMs: 3e4,
@@ -390,8 +585,9 @@ const D = {
390
585
  },
391
586
  queue: { size: 100 }
392
587
  };
393
- const F = "redact";
394
- const L = [
588
+ const Y = "redact";
589
+ const tt = "off";
590
+ const nt = [
395
591
  "session",
396
592
  "tab",
397
593
  "navigation",
@@ -399,10 +595,10 @@ const L = [
399
595
  "network_request",
400
596
  "fp_signals_load"
401
597
  ];
402
- const N = D.queue.size;
403
- const q = D.flush.size;
404
- const H = ["navigation", "network-request"];
405
- const J = Object.freeze({
598
+ const et = Q.queue.size;
599
+ const it = Q.flush.size;
600
+ const rt = ["navigation", "network-request"];
601
+ const st = Object.freeze({
406
602
  session: 80,
407
603
  tab: 80,
408
604
  navigation: 80,
@@ -411,12 +607,12 @@ const J = Object.freeze({
411
607
  fp_signals_load: 80,
412
608
  network_request: 60
413
609
  });
414
- function V(t) {
415
- return J[t.name];
610
+ function ot(t) {
611
+ return st[t.name];
416
612
  }
417
- let W = null;
418
- const G = 524288;
419
- const K = /* @__PURE__ */ new Set([
613
+ let ut = null;
614
+ const at = 524288;
615
+ const lt = /* @__PURE__ */ new Set([
420
616
  "xmlhttprequest",
421
617
  "fetch",
422
618
  "beacon",
@@ -429,52 +625,52 @@ const K = /* @__PURE__ */ new Set([
429
625
  "video",
430
626
  "audio"
431
627
  ]);
432
- const Z = /* @__PURE__ */ new Set([
628
+ const ct = /* @__PURE__ */ new Set([
433
629
  "xmlhttprequest",
434
630
  "fetch",
435
631
  "beacon"
436
632
  ]);
437
- function X(t, n) {
633
+ function ft(t, n) {
438
634
  return n ? t : null;
439
635
  }
440
- function Q(t, n) {
441
- const e = t.responseStart > 0, i = e ? t.transferSize : null, r = e ? t.encodedBodySize : null, o = e ? t.decodedBodySize : null, s = e && t.nextHopProtocol || null, a = e && void 0 !== t.deliveryType ? t.deliveryType : null, u = t.responseStatus, l = void 0 !== u && 0 !== u ? u : null, c = {
636
+ function ht(t, n) {
637
+ const e = t.responseStart > 0, i = e ? t.transferSize : null, r = e ? t.encodedBodySize : null, s = e ? t.decodedBodySize : null, o = e && t.nextHopProtocol || null, u = e && void 0 !== t.deliveryType ? t.deliveryType : null, a = t.responseStatus, l = void 0 !== a && 0 !== a ? a : null, c = {
442
638
  name: "network_request",
443
639
  timestamp: Date.now(),
444
640
  performanceTime: t.startTime + t.duration,
445
641
  url: n(t.name),
446
- initiatorType: (f = t.initiatorType, K.has(f) ? f : "other"),
642
+ initiatorType: (f = t.initiatorType, lt.has(f) ? f : "other"),
447
643
  startTime: t.startTime,
448
644
  durationMs: t.duration,
449
645
  fetchStart: t.fetchStart,
450
- domainLookupStart: X(t.domainLookupStart, e),
451
- domainLookupEnd: X(t.domainLookupEnd, e),
452
- connectStart: X(t.connectStart, e),
453
- connectEnd: X(t.connectEnd, e),
454
- secureConnectionStart: X(t.secureConnectionStart, e),
455
- requestStart: X(t.requestStart, e),
456
- responseStart: X(t.responseStart, e),
646
+ domainLookupStart: ft(t.domainLookupStart, e),
647
+ domainLookupEnd: ft(t.domainLookupEnd, e),
648
+ connectStart: ft(t.connectStart, e),
649
+ connectEnd: ft(t.connectEnd, e),
650
+ secureConnectionStart: ft(t.secureConnectionStart, e),
651
+ requestStart: ft(t.requestStart, e),
652
+ responseStart: ft(t.responseStart, e),
457
653
  responseEnd: t.responseEnd,
458
654
  transferSize: i,
459
655
  encodedBodySize: r,
460
- decodedBodySize: o,
461
- nextHopProtocol: s,
462
- deliveryType: a,
656
+ decodedBodySize: s,
657
+ nextHopProtocol: o,
658
+ deliveryType: u,
463
659
  responseStatus: l
464
660
  };
465
661
  var f;
466
662
  return Object.assign(c, function(t, n) {
467
663
  return {
468
- dnsLookupMs: X(t.domainLookupEnd - t.domainLookupStart, n),
469
- tcpConnectMs: X(t.connectEnd - t.connectStart, n),
470
- tlsHandshakeMs: X(t.connectEnd > 0 && t.secureConnectionStart > 0 ? t.connectEnd - t.secureConnectionStart : 0, n),
471
- ttfbMs: X(t.responseStart - t.requestStart, n),
472
- responseDownloadMs: X(t.responseEnd - t.responseStart, n)
664
+ dnsLookupMs: ft(t.domainLookupEnd - t.domainLookupStart, n),
665
+ tcpConnectMs: ft(t.connectEnd - t.connectStart, n),
666
+ tlsHandshakeMs: ft(t.connectEnd > 0 && t.secureConnectionStart > 0 ? t.connectEnd - t.secureConnectionStart : 0, n),
667
+ ttfbMs: ft(t.responseStart - t.requestStart, n),
668
+ responseDownloadMs: ft(t.responseEnd - t.responseStart, n)
473
669
  };
474
670
  }(t, e)), c;
475
671
  }
476
- function Y() {}
477
- function tt(t, n, e, i, r) {
672
+ function dt() {}
673
+ function pt(t, n, e, i, r) {
478
674
  return {
479
675
  name: "navigation",
480
676
  timestamp: Date.now(),
@@ -487,7 +683,7 @@ function tt(t, n, e, i, r) {
487
683
  timing: r
488
684
  };
489
685
  }
490
- function nt(t, n) {
686
+ function yt(t, n) {
491
687
  if (t.firstElementChild) return t.firstElementChild;
492
688
  let e = t;
493
689
  for (; null !== e && e !== n;) {
@@ -496,7 +692,7 @@ function nt(t, n) {
496
692
  }
497
693
  return null;
498
694
  }
499
- function et(t, n) {
695
+ function gt(t, n) {
500
696
  switch (t) {
501
697
  case "FORM":
502
698
  n.formCount++;
@@ -525,25 +721,25 @@ function et(t, n) {
525
721
  case "IMG": n.imageCount++;
526
722
  }
527
723
  }
528
- function it(t) {
724
+ function wt(t) {
529
725
  let n = null, e = null, i = null;
530
726
  function r() {
531
727
  if (f(n), n = null, f(i), i = null, null !== e) {
532
728
  const t = e;
533
- e = null, s(() => window.cancelIdleCallback?.(t));
729
+ e = null, o(() => window.cancelIdleCallback?.(t));
534
730
  }
535
731
  }
536
732
  return {
537
- schedule: function(o, s, a) {
733
+ schedule: function(s, o, u) {
538
734
  r();
539
- const u = function(t) {
735
+ const a = function(t) {
540
736
  if (!t) return null;
541
737
  try {
542
738
  return new URL(t, location.href).pathname;
543
739
  } catch {
544
740
  return null;
545
741
  }
546
- }(a);
742
+ }(u);
547
743
  n = c(() => {
548
744
  n = null, function(t) {
549
745
  const n = window;
@@ -577,10 +773,10 @@ function it(t) {
577
773
  n.truncated = !0;
578
774
  break;
579
775
  }
580
- n.nodeCount++, et(i.tagName, n), i = nt(i, e);
776
+ n.nodeCount++, gt(i.tagName, n), i = yt(i, e);
581
777
  }
582
778
  return n.textLength = document.body?.textContent?.length ?? 0, n.interactiveCount = document.querySelectorAll("input,button,a,select,textarea").length, n.scrollHeight = document.documentElement?.scrollHeight ?? 0, n.innerHeight = window.innerHeight, n;
583
- }(), o = {
779
+ }(), s = {
584
780
  name: "page_complexity",
585
781
  timestamp: Date.now(),
586
782
  ts: performance.now(),
@@ -589,19 +785,19 @@ function it(t) {
589
785
  path: i,
590
786
  ...r
591
787
  };
592
- t.push(o);
593
- }(o, s, u));
594
- }, "load" === o ? 1500 : 500);
788
+ t.push(s);
789
+ }(s, o, a));
790
+ }, "load" === s ? 1500 : 500);
595
791
  },
596
792
  dispose: r
597
793
  };
598
794
  }
599
- function rt() {
795
+ function vt() {
600
796
  return function() {};
601
797
  }
602
- const ot = {
798
+ const mt = {
603
799
  pointer: {
604
- create: rt,
800
+ create: vt,
605
801
  layer: "behavioral",
606
802
  events: [
607
803
  "pointer",
@@ -611,23 +807,23 @@ const ot = {
611
807
  ]
612
808
  },
613
809
  pointermove: {
614
- create: rt,
810
+ create: vt,
615
811
  layer: "behavioral"
616
812
  },
617
813
  focus: {
618
- create: rt,
814
+ create: vt,
619
815
  layer: "behavioral"
620
816
  },
621
817
  input: {
622
- create: rt,
818
+ create: vt,
623
819
  layer: "behavioral"
624
820
  },
625
821
  keystroke: {
626
- create: rt,
822
+ create: vt,
627
823
  layer: "behavioral"
628
824
  },
629
825
  clipboard: {
630
- create: rt,
826
+ create: vt,
631
827
  layer: "behavioral",
632
828
  events: [
633
829
  "paste",
@@ -636,7 +832,7 @@ const ot = {
636
832
  ]
637
833
  },
638
834
  form: {
639
- create: rt,
835
+ create: vt,
640
836
  layer: "behavioral",
641
837
  events: [
642
838
  "submit",
@@ -645,33 +841,33 @@ const ot = {
645
841
  ]
646
842
  },
647
843
  change: {
648
- create: rt,
844
+ create: vt,
649
845
  layer: "behavioral"
650
846
  },
651
847
  selection: {
652
- create: rt,
848
+ create: vt,
653
849
  layer: "behavioral"
654
850
  },
655
851
  tab: {
656
- create: rt,
852
+ create: vt,
657
853
  layer: "session",
658
854
  events: ["state", "count"]
659
855
  },
660
856
  visibility: {
661
- create: rt,
857
+ create: vt,
662
858
  layer: "session"
663
859
  },
664
860
  navigation: {
665
861
  create: function(e) {
666
862
  let i = e.sanitizeUrl(document.referrer || "");
667
- const r = it(e);
668
- function o(t) {
863
+ const r = wt(e);
864
+ function s(t) {
669
865
  e.push(t), i = t.to ?? "", r && "hide" !== t.phase && r.schedule(t.phase, t.type, t.to);
670
866
  }
671
- const a = u(() => {
867
+ const u = a(() => {
672
868
  const [t] = performance.getEntriesByType("navigation");
673
869
  var n;
674
- o(tt("load", t?.type ?? "navigate", {
870
+ s(pt("load", t?.type ?? "navigate", {
675
871
  from: document.referrer ? e.sanitizeUrl(document.referrer) : null,
676
872
  to: e.sanitizeUrl(location.href)
677
873
  }, performance.timeOrigin, t ? {
@@ -694,54 +890,54 @@ const ot = {
694
890
  encodedBodySize: n.encodedBodySize,
695
891
  decodedBodySize: n.decodedBodySize
696
892
  } : void 0));
697
- }), l = u((t) => {
893
+ }), l = a((t) => {
698
894
  const n = t;
699
895
  if (null === n.navigationType) return;
700
896
  const r = e.sanitizeUrl(location.href);
701
- r !== i && o(tt("change", n.navigationType, {
897
+ r !== i && s(pt("change", n.navigationType, {
702
898
  from: i,
703
899
  to: r
704
900
  }, performance.timeOrigin));
705
- }), c = u(() => h("traverse")), f = u(() => h("hashchange"));
901
+ }), c = a(() => h("traverse")), f = a(() => h("hashchange"));
706
902
  function h(t) {
707
903
  const n = e.sanitizeUrl(location.href);
708
- "hashchange" === t && n === i || o(tt("change", t, {
904
+ "hashchange" === t && n === i || s(pt("change", t, {
709
905
  from: i,
710
906
  to: n
711
907
  }, performance.timeOrigin));
712
908
  }
713
909
  const d = history.pushState, p = history.replaceState, y = function(...t) {
714
910
  const n = d.apply(this, t);
715
- return s(() => h("push")), n;
911
+ return o(() => h("push")), n;
716
912
  }, g = function(...t) {
717
913
  const n = p.apply(this, t);
718
- return s(() => h("replace")), n;
914
+ return o(() => h("replace")), n;
719
915
  };
720
- return window.navigation ? t(window.navigation, "currententrychange", l) : (history.pushState = y, history.replaceState = g, t(window, "popstate", c), t(window, "hashchange", f)), "complete" === document.readyState ? a(new Event("load")) : t(window, "load", a), () => {
721
- r?.dispose(), window.navigation ? n(window.navigation, "currententrychange", l) : (history.pushState === y && (history.pushState = d), history.replaceState === g && (history.replaceState = p), n(window, "popstate", c), n(window, "hashchange", f)), n(window, "load", a);
916
+ return window.navigation ? t(window.navigation, "currententrychange", l) : (history.pushState = y, history.replaceState = g, t(window, "popstate", c), t(window, "hashchange", f)), "complete" === document.readyState ? u(new Event("load")) : t(window, "load", u), () => {
917
+ r?.dispose(), window.navigation ? n(window.navigation, "currententrychange", l) : (history.pushState === y && (history.pushState = d), history.replaceState === g && (history.replaceState = p), n(window, "popstate", c), n(window, "hashchange", f)), n(window, "load", u);
722
918
  };
723
919
  },
724
920
  layer: "session"
725
921
  },
726
922
  networkconnection: {
727
- create: rt,
923
+ create: vt,
728
924
  layer: "session"
729
925
  },
730
926
  scroll: {
731
- create: rt,
927
+ create: vt,
732
928
  layer: "behavioral"
733
929
  },
734
930
  viewportresize: {
735
- create: rt,
931
+ create: vt,
736
932
  layer: "behavioral"
737
933
  },
738
934
  viewport: {
739
- create: rt,
935
+ create: vt,
740
936
  layer: "behavioral",
741
937
  events: ["orientationchange", "devicepixelratiochange"]
742
938
  },
743
939
  sensors: {
744
- create: rt,
940
+ create: vt,
745
941
  layer: "behavioral",
746
942
  events: [
747
943
  "motion",
@@ -752,27 +948,27 @@ const ot = {
752
948
  "network-request": {
753
949
  create: function(t) {
754
950
  var n, e;
755
- const r = function(t, n, e, r = Z) {
756
- if ("undefined" == typeof PerformanceObserver) return Y;
757
- let o = null;
951
+ const r = function(t, n, e, r = ct) {
952
+ if ("undefined" == typeof PerformanceObserver) return dt;
953
+ let s = null;
758
954
  try {
759
- o = new PerformanceObserver((i) => {
760
- for (const o of i.getEntries()) {
761
- const i = o;
762
- r.has(i.initiatorType) && (n(i.name) || t(Q(i, e)));
955
+ s = new PerformanceObserver((i) => {
956
+ for (const s of i.getEntries()) {
957
+ const i = s;
958
+ r.has(i.initiatorType) && (n(i.name) || t(ht(i, e)));
763
959
  }
764
- }), o.observe({
960
+ }), s.observe({
765
961
  type: "resource",
766
962
  buffered: !0
767
963
  });
768
964
  } catch {
769
- return i.warn("network-request", "PerformanceObserver failed to start"), Y;
965
+ return i.warn("network-request", "PerformanceObserver failed to start"), dt;
770
966
  }
771
967
  return function() {
772
- o?.disconnect(), o = null;
968
+ s?.disconnect(), s = null;
773
969
  };
774
970
  }(function(n) {
775
- s(() => t.push(n));
971
+ o(() => t.push(n));
776
972
  }, (n = t.ignoredOrigins, e = t.ignoredUrls, function(t) {
777
973
  try {
778
974
  return !!e?.has(t) || n.has(new URL(t).origin);
@@ -787,25 +983,25 @@ const ot = {
787
983
  layer: "session"
788
984
  },
789
985
  screen: {
790
- create: rt,
986
+ create: vt,
791
987
  layer: "session"
792
988
  },
793
989
  wheel: {
794
- create: rt,
990
+ create: vt,
795
991
  layer: "behavioral"
796
992
  },
797
993
  hover: {
798
- create: rt,
994
+ create: vt,
799
995
  layer: "behavioral"
800
996
  },
801
997
  fpsignals: {
802
- create: function(e, r = "off", o) {
803
- const c = E(o, "device"), f = E(o, "pid"), h = E(o, "behaviour"), d = performance.now(), p = new R();
804
- let y, g = !1, v = !1, b = null, S = null, T = null, _ = null, I = null, M = null, C = null, $ = !1, P = !1, U = 0, B = !1, O = null, j = "", z = null, D = "", F = [], H = 0, J = null;
805
- const K = new Promise(function(t) {
998
+ create: function(e, r = "off", s) {
999
+ const c = F(s, "device"), f = F(s, "pid"), h = F(s, "behaviour"), d = performance.now(), p = new L();
1000
+ let y, g = !1, w = !1, m = null, b = null, k = null, S = null, T = null, _ = null, A = null, I = !1, R = !1, E = 0, M = !1, C = null, P = "", U = null, j = "", z = [], B = 0, D = null;
1001
+ const N = new Promise(function(t) {
806
1002
  y = t;
807
1003
  });
808
- function Z(t, n) {
1004
+ function q(t, n) {
809
1005
  if (!t) return !1;
810
1006
  const i = {
811
1007
  name: "fp_signals",
@@ -814,140 +1010,140 @@ const ot = {
814
1010
  };
815
1011
  return n && (i.reason = n), e.push(i), !0;
816
1012
  }
817
- function X(t, n) {
818
- if (!0 === s(() => e.pulseGuard?.isOff?.())) return F = [], void (H = 0);
819
- if (!(t.length > G)) for (F.push({
1013
+ function H(t, n) {
1014
+ if (!0 === o(() => e.pulseGuard?.isOff?.())) return z = [], void (B = 0);
1015
+ if (!(t.length > at)) for (z.push({
820
1016
  text: t,
821
1017
  reason: n
822
- }), H += t.length; F.length > 16 || H > G;) {
823
- const t = F.shift();
1018
+ }), B += t.length; z.length > 16 || B > at;) {
1019
+ const t = z.shift();
824
1020
  if (!t) break;
825
- H -= t.text.length;
1021
+ B -= t.text.length;
826
1022
  }
827
1023
  }
828
- function Q() {
1024
+ function J() {
829
1025
  const t = e.getActivityId?.() ?? "";
830
- t !== O && p.setSessionToken(t) && (O = t);
1026
+ t !== C && p.setSessionToken(t) && (C = t);
831
1027
  }
832
- function Y() {
1028
+ function W() {
833
1029
  const t = e.getActivityId?.() ?? "";
834
- t && t !== j && ct();
1030
+ t && t !== P && ct();
835
1031
  }
836
- function tt(t, n) {
837
- if (!v || !p.isReady()) return null;
838
- s(Q), s(Y);
839
- const i = n ? p.getSignalsWithReason(t, n) : p.getSignals(t), r = i ? s(() => e.pulseGuard?.signDocument(i) ?? null) ?? i : i;
840
- return Z(r, n) ? (t === A.Device ? (z = {
1032
+ function G(t, n) {
1033
+ if (!w || !p.isReady()) return null;
1034
+ o(J), o(W);
1035
+ const i = n ? p.getSignalsWithReason(t, n) : p.getSignals(t), r = i ? o(() => e.pulseGuard?.signDocument(i) ?? null) ?? i : i;
1036
+ return q(r, n) ? (t === O.Device ? (U = {
841
1037
  text: i,
842
1038
  reason: n
843
- }, D = r === i ? "" : s(() => e.pulseGuard?.sessionId?.() ?? "") ?? "") : !e.pulseGuard || r !== i || t !== A.Network && t !== A.External || X(i, n), i) : null;
1039
+ }, j = r === i ? "" : o(() => e.pulseGuard?.sessionId?.() ?? "") ?? "") : !e.pulseGuard || r !== i || t !== O.Network && t !== O.External || H(i, n), i) : null;
844
1040
  }
845
- function nt(t) {
846
- return !!h && null !== tt(A.Behaviour, t);
1041
+ function K(t) {
1042
+ return !!h && null !== G(O.Behaviour, t);
847
1043
  }
848
- function et(t) {
849
- if (!v || !b) return !1;
850
- U = 0;
851
- const n = null !== tt(A.Network, t), e = null !== tt(A.External, t);
1044
+ function Z(t) {
1045
+ if (!w || !m) return !1;
1046
+ E = 0;
1047
+ const n = null !== G(O.Network, t), e = null !== G(O.External, t);
852
1048
  return n || e;
853
1049
  }
854
- function it(t) {
855
- s(() => et(function(t) {
1050
+ function X(t) {
1051
+ o(() => Z(function(t) {
856
1052
  return "interval" === t || "submit" === t ? t : "capacity" === t ? "fill" : void 0;
857
1053
  }(t)));
858
1054
  }
859
- function rt(t) {
860
- U += t, B || e.requestFlush?.(U >= q);
1055
+ function Q(t) {
1056
+ E += t, M || e.requestFlush?.(E >= it);
861
1057
  }
862
- function ot(t) {
863
- return s(() => tt(t)) ?? null;
1058
+ function Y(t) {
1059
+ return o(() => G(t)) ?? null;
864
1060
  }
865
- function st() {
866
- null !== I && clearInterval(I), null !== M && clearTimeout(M), I = null, M = null;
1061
+ function tt() {
1062
+ null !== T && clearInterval(T), null !== _ && clearTimeout(_), T = null, _ = null;
867
1063
  }
868
- function at(t = "partial") {
869
- return !(!c || $ || P || !v || !p.isReady() || !p.hasMethod("gsr") || null === tt(A.Device, t) || ($ = !0, st(), 0));
1064
+ function rt(t = "partial") {
1065
+ return !(!c || I || R || !w || !p.isReady() || !p.hasMethod("gsr") || null === G(O.Device, t) || (I = !0, tt(), 0));
870
1066
  }
871
- function ut() {
872
- c && p.hasMethod("gsr") && (I = setInterval(l(function() {
873
- at();
874
- }), 250), M = setTimeout(l(st), 5e3));
1067
+ function st() {
1068
+ c && p.hasMethod("gsr") && (T = setInterval(l(function() {
1069
+ rt();
1070
+ }), 250), _ = setTimeout(l(tt), 5e3));
875
1071
  }
876
1072
  function lt() {
877
- if (!v || !p.isReady()) return;
1073
+ if (!w || !p.isReady()) return;
878
1074
  const t = p.getBufferFill();
879
- null !== t && t >= .5 && (nt("fill"), et("fill"));
1075
+ null !== t && t >= .5 && (K("fill"), Z("fill"));
880
1076
  }
881
1077
  function ct() {
882
1078
  var t;
883
- j = e.getActivityId?.() ?? "", e.push((t = e.collectorSelection ?? {}, {
1079
+ P = e.getActivityId?.() ?? "", e.push((t = e.collectorSelection ?? {}, {
884
1080
  name: "session",
885
1081
  timestamp: Date.now(),
886
1082
  ts: performance.now(),
887
- ...w(),
1083
+ ...v(),
888
1084
  collectors: t
889
1085
  }));
890
1086
  }
891
1087
  function ft() {
892
- if (b) if (p.hasMethod("as")) {
893
- B = !0;
1088
+ if (m) if (p.hasMethod("as")) {
1089
+ M = !0;
894
1090
  try {
895
- b.open(function(t, n) {
1091
+ m.open(function(t, n) {
896
1092
  return p.addSignal(t, n);
897
1093
  });
898
1094
  } finally {
899
- B = !1;
1095
+ M = !1;
900
1096
  }
901
- U > 0 && et("load") && e.requestFlush?.(!0);
902
- } else b.close();
1097
+ E > 0 && Z("load") && e.requestFlush?.(!0);
1098
+ } else m.close();
903
1099
  }
904
1100
  function ht() {
905
1101
  p.setUrlSanitizer(null);
906
1102
  }
907
- W = K;
908
- const dt = u((t) => {
909
- ("click" !== t.type || t.target instanceof Element && t.target.closest("[data-tri-flush]")) && (nt("click" === t.type ? "flush-click" : "submit"), e.flush());
1103
+ ut = N;
1104
+ const dt = a((t) => {
1105
+ ("click" !== t.type || t.target instanceof Element && t.target.closest("[data-tri-flush]")) && (K("click" === t.type ? "flush-click" : "submit"), e.flush());
910
1106
  }), pt = e.registerBehaviourReader ? e.registerBehaviourReader(function(t) {
911
- s(() => J?.());
912
- const n = s(() => at("partial-now")) ?? !1, e = s(() => nt(t)) ?? !1, i = s(() => et(t)) ?? !1;
1107
+ o(() => D?.());
1108
+ const n = o(() => rt("partial-now")) ?? !1, e = o(() => K(t)) ?? !1, i = o(() => Z(t)) ?? !1;
913
1109
  return n || e || i;
914
1110
  }) : null;
915
- return s(() => e.pulseGuard?.onSessionInstalled?.(function(t) {
916
- s(() => function(t) {
917
- const n = z, i = e.pulseGuard;
1111
+ return o(() => e.pulseGuard?.onSessionInstalled?.(function(t) {
1112
+ o(() => function(t) {
1113
+ const n = U, i = e.pulseGuard;
918
1114
  if (g || !n || !i) return;
919
- if (D === t.session) return;
920
- if (D && t.linkedFrom === D) return void (D = t.session);
1115
+ if (j === t.session) return;
1116
+ if (j && t.linkedFrom === j) return void (j = t.session);
921
1117
  const r = i.signDocument(n.text);
922
- r && i.sessionId?.() === t.session && Z(r, n.reason) && (D = t.session);
923
- }(t)), s(() => function(t) {
1118
+ r && i.sessionId?.() === t.session && q(r, n.reason) && (j = t.session);
1119
+ }(t)), o(() => function(t) {
924
1120
  const n = e.pulseGuard;
925
- if (g || !n || 0 === F.length) return;
1121
+ if (g || !n || 0 === z.length) return;
926
1122
  if (n.sessionId?.() !== t.session) return;
927
- const i = F;
928
- F = [], H = 0;
1123
+ const i = z;
1124
+ z = [], B = 0;
929
1125
  for (const t of i) {
930
1126
  const e = n.signDocument(t.text);
931
- e && e !== t.text ? Z(e, t.reason) : X(t.text, t.reason);
1127
+ e && e !== t.text ? q(e, t.reason) : H(t.text, t.reason);
932
1128
  }
933
1129
  }(t));
934
- })), s(function() {
1130
+ })), o(function() {
935
1131
  if (!e.registerEventRouter) return;
936
1132
  const t = function(t = {}) {
937
- const n = t.maxPending ?? N;
938
- let e = [], r = null, o = !1;
939
- function s(t, n) {
1133
+ const n = t.maxPending ?? et;
1134
+ let e = [], r = null, s = !1;
1135
+ function o(t, n) {
940
1136
  try {
941
1137
  const { signalsType: e, jsonValue: r } = function(t) {
942
1138
  if ("network_request" === t.name) {
943
1139
  const { name: n, ...e } = t;
944
1140
  return {
945
- signalsType: A.Network,
1141
+ signalsType: O.Network,
946
1142
  jsonValue: JSON.stringify(e)
947
1143
  };
948
1144
  }
949
1145
  return {
950
- signalsType: A.External,
1146
+ signalsType: O.External,
951
1147
  jsonValue: JSON.stringify(t)
952
1148
  };
953
1149
  }(n);
@@ -958,63 +1154,63 @@ const ot = {
958
1154
  }
959
1155
  return !1;
960
1156
  }
961
- function a(n) {
1157
+ function u(n) {
962
1158
  if (0 !== n && t.onHanded) try {
963
1159
  t.onHanded(n);
964
1160
  } catch (t) {
965
1161
  i.warn("fpSignals", "onHanded threw:", t);
966
1162
  }
967
1163
  }
968
- const u = {
1164
+ const a = {
969
1165
  route: function(t) {
970
1166
  return !(!function(t) {
971
- return !(!L.includes(t.name) || "fp_signals_load" === t.name && !1 === t.ok);
972
- }(t) || !o && (r ? (a(s(r, t) ? 1 : 0), 0) : (e.length < n ? e.push(t) : function(t) {
973
- const n = V(t);
974
- for (let r = 0; r < e.length; r++) if (V(e[r]) < n) return e.splice(r, 1), e.push(t), void i.warn("fpSignals", "TRI event buffer full — a lower-priority event dropped");
1167
+ return !(!nt.includes(t.name) || "fp_signals_load" === t.name && !1 === t.ok);
1168
+ }(t) || !s && (r ? (u(o(r, t) ? 1 : 0), 0) : (e.length < n ? e.push(t) : function(t) {
1169
+ const n = ot(t);
1170
+ for (let r = 0; r < e.length; r++) if (ot(e[r]) < n) return e.splice(r, 1), e.push(t), void i.warn("fpSignals", "TRI event buffer full — a lower-priority event dropped");
975
1171
  i.warn("fpSignals", "TRI event buffer full — event dropped", t.name);
976
1172
  }(t), 0)));
977
1173
  },
978
1174
  open: function(t) {
979
- if (o) return;
1175
+ if (s) return;
980
1176
  r = t;
981
1177
  const n = e;
982
1178
  e = [];
983
1179
  let i = 0;
984
- for (let e = 0; e < n.length; e++) s(t, n[e]) && i++;
985
- a(i);
1180
+ for (let e = 0; e < n.length; e++) o(t, n[e]) && i++;
1181
+ u(i);
986
1182
  },
987
1183
  close: function() {
988
- o = !0, r = null, e = [];
1184
+ s = !0, r = null, e = [];
989
1185
  }
990
1186
  };
991
- return t.beforeFlush && (u.beforeFlush = t.beforeFlush), u;
1187
+ return t.beforeFlush && (a.beforeFlush = t.beforeFlush), a;
992
1188
  }({
993
- onHanded: rt,
994
- beforeFlush: it
1189
+ onHanded: Q,
1190
+ beforeFlush: X
995
1191
  });
996
- b = t, S = e.registerEventRouter(t), ct();
997
- }), a(async () => {
1192
+ m = t, b = e.registerEventRouter(t), ct();
1193
+ }), u(async () => {
998
1194
  const n = await ("object" != typeof WebAssembly || null === WebAssembly ? Promise.resolve("no-webassembly") : new Promise(function(t) {
999
1195
  let n = !1;
1000
- C = function() {
1196
+ A = function() {
1001
1197
  n || (n = !0, clearTimeout(r), t("timeout"));
1002
1198
  };
1003
1199
  const r = setTimeout(l(function() {
1004
1200
  n || (n = !0, t("timeout"));
1005
1201
  }), 3e4);
1006
- function o(e) {
1007
- n ? null === e && s(() => p.freeResources()) : (n = !0, clearTimeout(r), t(e));
1202
+ function s(e) {
1203
+ n ? null === e && o(() => p.freeResources()) : (n = !0, clearTimeout(r), t(e));
1008
1204
  }
1009
- p.initialize("https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLib.wasm", "https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLibSimd.wasm", !0, s(() => e.getTabId()) || void 0).then(function() {
1010
- o(null);
1205
+ p.initialize("https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLib.wasm", "https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLibSimd.wasm", !0, o(() => e.getTabId()) || void 0).then(function() {
1206
+ s(null);
1011
1207
  }, function(t) {
1012
- i.warn("fpSignals", "module failed to load:", t), o(function(t) {
1013
- return t instanceof k ? t.reason : "instantiate-failed";
1208
+ i.warn("fpSignals", "module failed to load:", t), s(function(t) {
1209
+ return t instanceof x ? t.reason : "instantiate-failed";
1014
1210
  }(t));
1015
1211
  });
1016
1212
  }));
1017
- if (null !== n && s(() => b?.close()), g || s(() => function(t) {
1213
+ if (null !== n && o(() => m?.close()), g || o(() => function(t) {
1018
1214
  const n = null === t, i = {
1019
1215
  name: "fp_signals_load",
1020
1216
  timestamp: Date.now(),
@@ -1025,16 +1221,16 @@ const ot = {
1025
1221
  null !== t && (i.reason = t);
1026
1222
  const r = e.pulseGuard;
1027
1223
  if (!r) return void e.push(i);
1028
- let o = !1;
1029
- const a = r.telemetry(d, function(t) {
1030
- o = !0, J = null, g || (i.pulseguard = t.pulseguard, void 0 !== t.pulseguardMs && (i.pulseguardMs = t.pulseguardMs), s(() => e.push(i)));
1224
+ let s = !1;
1225
+ const u = r.telemetry(d, function(t) {
1226
+ s = !0, D = null, g || (i.pulseguard = t.pulseguard, void 0 !== t.pulseguardMs && (i.pulseguardMs = t.pulseguardMs), o(() => e.push(i)));
1031
1227
  });
1032
- o || "function" != typeof a || (J = a);
1228
+ s || "function" != typeof u || (D = u);
1033
1229
  }(n)), null !== n) return;
1034
1230
  if (g) return void p.freeResources();
1035
- if (v = !0, s(() => p.setHostInfo(e.host.platform, e.host.version)), s(() => p.setUrlSanitizer(function(t) {
1231
+ if (w = !0, o(() => p.setHostInfo(e.host.platform, e.host.version)), o(() => p.setUrlSanitizer(function(t) {
1036
1232
  return e.sanitizeUrl(t);
1037
- })), s(() => {
1233
+ })), o(() => {
1038
1234
  return p.setCapturePolicy({
1039
1235
  v: 2,
1040
1236
  element: e.captureElementLevel,
@@ -1043,26 +1239,26 @@ const ot = {
1043
1239
  redact: ["[data-tri-redact]"],
1044
1240
  redactAttrsAttribute: "data-tri-redact-attrs",
1045
1241
  interactive: ["[data-tri-interactive]"],
1046
- off: (t = e.collectorSelection) ? x(t) : []
1242
+ off: (t = e.collectorSelection) ? V(t) : []
1047
1243
  });
1048
1244
  var t;
1049
- }), s(Q), s(ft), h && (s(() => p.setBehaviourCollectionEnabled(!0)), T = setInterval(l(function() {
1050
- nt("interval");
1051
- }), 2e3), t(document, "submit", dt), t(document, "click", dt)), p.hasMethod("gbf") && (_ = setInterval(l(lt), 1e3)), !c && !f) return;
1052
- if (s(ut), await p.collect(), P = !0, st(), g) return;
1053
- const o = c ? ot(A.Device) : null, a = f ? ot(A.PID) : null;
1245
+ }), o(J), o(ft), h && (o(() => p.setBehaviourCollectionEnabled(!0)), k = setInterval(l(function() {
1246
+ K("interval");
1247
+ }), 2e3), t(document, "submit", dt), t(document, "click", dt)), p.hasMethod("gbf") && (S = setInterval(l(lt), 1e3)), !c && !f) return;
1248
+ if (o(st), await p.collect(), R = !0, tt(), g) return;
1249
+ const s = c ? Y(O.Device) : null, u = f ? Y(O.PID) : null;
1054
1250
  y({
1055
- pid: a,
1056
- device: o
1251
+ pid: u,
1252
+ device: s
1057
1253
  });
1058
1254
  }).then(function() {
1059
1255
  y(null);
1060
1256
  }), function() {
1061
- s(() => J?.()), g = !0, s(() => e.pulseGuard?.onSessionInstalled?.(null)), C?.(), y(null), W === K && (W = null), null !== T && clearInterval(T), null !== _ && clearInterval(_), st(), n(document, "submit", dt), n(document, "click", dt), pt?.(), s(() => {
1062
- nt("stop");
1063
- }), s(() => {
1064
- et("stop");
1065
- }), s(() => b?.close()), s(() => S?.()), v && s(ht), s(() => p.freeResources());
1257
+ o(() => D?.()), g = !0, o(() => e.pulseGuard?.onSessionInstalled?.(null)), A?.(), y(null), ut === N && (ut = null), null !== k && clearInterval(k), null !== S && clearInterval(S), tt(), n(document, "submit", dt), n(document, "click", dt), pt?.(), o(() => {
1258
+ K("stop");
1259
+ }), o(() => {
1260
+ Z("stop");
1261
+ }), o(() => m?.close()), o(() => b?.()), w && o(ht), o(() => p.freeResources());
1066
1262
  };
1067
1263
  },
1068
1264
  layer: "device-fingerprinting",
@@ -1073,8 +1269,8 @@ const ot = {
1073
1269
  ]
1074
1270
  }
1075
1271
  };
1076
- const st = Object.keys(ot);
1077
- const at = [
1272
+ const bt = Object.keys(mt);
1273
+ const kt = [
1078
1274
  /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
1079
1275
  /^0b[01]+$/i,
1080
1276
  /^0o[0-7]+$/i,
@@ -1087,13 +1283,13 @@ const at = [
1087
1283
  /^[A-Za-z0-9_-]{20,}={0,2}$/,
1088
1284
  /^[0-9a-f]{7,}$/i
1089
1285
  ];
1090
- function ut(t) {
1286
+ function St(t) {
1091
1287
  try {
1092
1288
  const n = new URL(t, location.href);
1093
1289
  n.username = "", n.password = "", n.hash = "";
1094
1290
  const e = [...n.searchParams.keys()], i = e.length > 0 ? "?" + e.map((t) => `${encodeURIComponent(t)}=<redacted>`).join("&") : "";
1095
1291
  n.search = "", n.pathname = n.pathname.split("/").map((t) => "" !== t && function(t) {
1096
- for (const n of at) if (n.test(t)) return !0;
1292
+ for (const n of kt) if (n.test(t)) return !0;
1097
1293
  return !1;
1098
1294
  }(t) ? ":param" : t).join("/");
1099
1295
  const r = n.origin + n.pathname + i;
@@ -1102,208 +1298,140 @@ function ut(t) {
1102
1298
  return "";
1103
1299
  }
1104
1300
  }
1105
- function lt() {
1301
+ function Tt(t) {
1302
+ if ("undefined" == typeof document) return i.fatal("error", "IncodeTRI", "TRI is not available in a non-browser environment."), null;
1303
+ if (!t?.token) return i.fatal("error", "SDK", "token is required."), null;
1304
+ if (!t.apiURL) return i.fatal("error", "SDK", "Couldn't initialise SDK — apiURL isn't provided."), null;
1305
+ const { element: n, content: e } = t.capture ?? {}, r = {
1306
+ token: t.token,
1307
+ capture: {
1308
+ element: n ?? Y,
1309
+ content: e ?? tt
1310
+ },
1311
+ api: {
1312
+ version: t.apiVersion ?? "1.0",
1313
+ url: d(t.apiURL)
1314
+ },
1315
+ sanitizeUrl: (u = t.sanitizeUrl, u ? function(t) {
1316
+ return o(() => u(t, St)) ?? St(t);
1317
+ } : St),
1318
+ host: (s = t.host, "string" == typeof s?.platform && "" !== s.platform && "string" == typeof s.version && "" !== s.version ? {
1319
+ platform: s.platform,
1320
+ version: s.version
1321
+ } : (void 0 !== s && i.warn("SDK", "host needs a non-empty platform and version — reporting TRI itself."), {
1322
+ platform: "tri-web",
1323
+ version: "0.5.1"
1324
+ })),
1325
+ DEBUG: t.DEBUG ?? !1
1326
+ };
1327
+ var s, u;
1328
+ return void 0 === t.collectors && void 0 === t.layers ? {
1329
+ sdk: r,
1330
+ collectors: _t()
1331
+ } : void 0 !== t.collectors ? {
1332
+ sdk: r,
1333
+ collectors: It(t.collectors)
1334
+ } : {
1335
+ sdk: r,
1336
+ collectors: At(t.layers)
1337
+ };
1338
+ }
1339
+ function _t() {
1106
1340
  const t = {};
1107
- for (const n of st) t[n] = ht(n, void 0, !0);
1341
+ for (const n of bt) t[n] = Rt(n, void 0, !0);
1108
1342
  return t;
1109
1343
  }
1110
- function ct(t) {
1344
+ function At(t) {
1111
1345
  const n = {};
1112
- for (const e of st) n[e] = ht(e, void 0, t[ot[e].layer] ?? !1);
1346
+ for (const e of bt) n[e] = Rt(e, void 0, t[mt[e].layer] ?? !1);
1113
1347
  return n;
1114
1348
  }
1115
- function ft(t) {
1116
- for (const n of Object.keys(t)) -1 === st.indexOf(n) && i.fatal("warn", "SDK", `collectors has an unknown key '${n}' — ignored. Known collectors: ${st.join(", ")}.`);
1349
+ function It(t) {
1350
+ for (const n of Object.keys(t)) -1 === bt.indexOf(n) && i.fatal("warn", "SDK", `collectors has an unknown key '${n}' — ignored. Known collectors: ${bt.join(", ")}.`);
1117
1351
  const n = {};
1118
- for (const e of st) {
1352
+ for (const e of bt) {
1119
1353
  const i = t[e];
1120
- n[e] = ht(e, i, i?.enabled ?? !1);
1354
+ n[e] = Rt(e, i, i?.enabled ?? !1);
1121
1355
  }
1122
1356
  return n;
1123
1357
  }
1124
- function ht(t, n, e) {
1125
- const i = ot[t]?.events ?? [];
1358
+ function Rt(t, n, e) {
1359
+ const i = mt[t]?.events ?? [];
1126
1360
  if (0 === i.length) return { enabled: e };
1127
- const r = n?.events, o = {};
1128
- for (const t of i) o[t] = { enabled: r?.[t] ?? !0 };
1361
+ const r = n?.events, s = {};
1362
+ for (const t of i) s[t] = { enabled: r?.[t] ?? !0 };
1129
1363
  return {
1130
1364
  enabled: e,
1131
- events: o
1365
+ events: s
1132
1366
  };
1133
1367
  }
1134
- function dt(t) {
1135
- if (!t) return null;
1136
- const n = t.split(".")[1], e = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
1137
- return JSON.parse(e);
1138
- }
1139
- const pt = function(t, n = 30) {
1140
- if (!t) return !0;
1141
- const e = dt(t);
1142
- return !e || "number" != typeof e.exp || 1e3 * e.exp <= Date.now() + 1e3 * n;
1143
- };
1144
- async function yt(t, n) {
1145
- return globalThis.navigator && "locks" in globalThis.navigator && "request" in globalThis.navigator.locks && "query" in globalThis.navigator.locks ? navigator.locks.request(t, { mode: "exclusive" }, async () => a(n)) : a(n);
1146
- }
1147
- const gt = "__tri";
1148
- const wt = `${gt}_activity_token`;
1149
- const vt = `${gt}_activity_id`;
1150
- const mt = `${gt}_activity_status`;
1151
- const bt = "__tri_activity_lock";
1152
- var kt = class {
1153
- constructor(t) {
1154
- this.context = t, this.h = null, this.p = null, this.m = null, this.k = null, this.S = null, this.T = !1;
1155
- }
1156
- getToken() {
1157
- return this.h;
1158
- }
1159
- getActivityId() {
1160
- return this.p ?? "";
1161
- }
1162
- isActive() {
1163
- return "ACTIVE" === this.m && null !== this.h;
1164
- }
1165
- async start() {
1166
- return this.T = !0, this.k || (this.k = this._()), this.k;
1167
- }
1168
- async stop() {
1169
- const t = this.A();
1170
- this.S = t;
1171
- try {
1172
- await t;
1173
- } finally {
1174
- this.S === t && (this.S = null);
1175
- }
1176
- }
1177
- async A() {
1178
- this.T = !1, this.m = "INACTIVE", this.I(null), this.k = null, this.h && await this.context.stopActivity(), this.R(null);
1179
- }
1180
- async refresh() {
1181
- if (!this.T) return;
1182
- const t = this.h;
1183
- await yt(bt, async () => {
1184
- if (this.h && this.h !== t && !pt(this.h) && "ACTIVE" === this.m) return;
1185
- const n = this.M();
1186
- if (n && n.token !== t && !pt(n.token) && "ACTIVE" === n.activityStatus) return this.R(n), void this.context.onActivityAdopted?.();
1187
- this.C(), await this.$();
1188
- });
1189
- }
1190
- async _() {
1191
- try {
1192
- if (this.S && await this.S, this.h && !pt(this.h)) return;
1193
- await yt(bt, async () => {
1194
- await this.$();
1195
- });
1196
- } finally {
1197
- this.k = null;
1198
- }
1199
- }
1200
- async $() {
1201
- const t = this.M();
1202
- if (t && !pt(t.token) && "ACTIVE" === t.activityStatus) return this.R(t), void this.context.onActivityAdopted?.();
1203
- t && this.C();
1204
- const n = await this.context.startActivity();
1205
- if (!n.ok) return void this.context.onActivityStarted?.(null);
1206
- if (!n.data.token) return void this.context.onActivityStarted?.(null);
1207
- const e = n.data;
1208
- this.R(e), this.P(e), this.context.onActivityStarted?.(e.pulseguard);
1209
- }
1210
- M() {
1211
- const [t, n, e] = [
1212
- p.get(wt),
1213
- p.get(vt),
1214
- p.get(mt)
1215
- ];
1216
- return t && n && e ? {
1217
- token: t,
1218
- activityId: n,
1219
- activityStatus: e
1220
- } : ((t || n || e) && this.C(), null);
1221
- }
1222
- P(t) {
1223
- p.set(wt, t.token), p.set(vt, t.activityId), p.set(mt, t.activityStatus);
1224
- }
1225
- C() {
1226
- this.I(null), this.R(null);
1227
- }
1228
- I(t) {
1229
- if (!t) return p.remove(wt), p.remove(vt), void p.remove(mt);
1230
- p.set(wt, t.token), p.set(vt, t.activityId), p.set(mt, t.activityStatus);
1231
- }
1232
- R(t) {
1233
- if (!t) return this.h = null, this.p = null, void (this.m = null);
1234
- var n;
1235
- (n = t.activityId) && v(function(t) {
1236
- t.activityId !== n && (t.previousActivityId = t.activityId, t.activityId = n, t.activities += 1);
1237
- }), this.h = t.token, this.p = t.activityId, this.m = t.activityStatus;
1238
- }
1239
- };
1240
- const St = [
1368
+ const Et = [
1241
1369
  401,
1242
1370
  403,
1243
1371
  409
1244
1372
  ];
1245
- const Tt = Object.freeze({ "fp-signals": "/events/capture/fp-signals" });
1246
- function _t(t) {
1373
+ const Mt = Object.freeze({ "fp-signals": "/events/capture/fp-signals" });
1374
+ function Ct(t) {
1247
1375
  return "fp_signals" === t.name || "fp_signals_load" === t.name && !1 === t.ok ? "fp-signals" : null;
1248
1376
  }
1249
- const At = new Array(256);
1250
- for (let t = 0; t < 256; t++) At[t] = (t + 256).toString(16).slice(1);
1251
- const It = /* @__PURE__ */ new Uint8Array(16);
1252
- function Rt(t) {
1253
- return At[t[0]] + At[t[1]] + At[t[2]] + At[t[3]] + "-" + At[t[4]] + At[t[5]] + "-" + At[t[6]] + At[t[7]] + "-" + At[t[8]] + At[t[9]] + "-" + At[t[10]] + At[t[11]] + At[t[12]] + At[t[13]] + At[t[14]] + At[t[15]];
1377
+ const Pt = new Array(256);
1378
+ for (let t = 0; t < 256; t++) Pt[t] = (t + 256).toString(16).slice(1);
1379
+ const $t = /* @__PURE__ */ new Uint8Array(16);
1380
+ function Ut(t) {
1381
+ return Pt[t[0]] + Pt[t[1]] + Pt[t[2]] + Pt[t[3]] + "-" + Pt[t[4]] + Pt[t[5]] + "-" + Pt[t[6]] + Pt[t[7]] + "-" + Pt[t[8]] + Pt[t[9]] + "-" + Pt[t[10]] + Pt[t[11]] + Pt[t[12]] + Pt[t[13]] + Pt[t[14]] + Pt[t[15]];
1254
1382
  }
1255
- function Et() {
1383
+ function xt() {
1256
1384
  return crypto.randomUUID();
1257
1385
  }
1258
- function Mt() {
1259
- return crypto.getRandomValues(It), It[6] = 15 & It[6] | 64, It[8] = 63 & It[8] | 128, Rt(It);
1386
+ function jt() {
1387
+ return crypto.getRandomValues($t), $t[6] = 15 & $t[6] | 64, $t[8] = 63 & $t[8] | 128, Ut($t);
1260
1388
  }
1261
- function Ct() {
1262
- for (let t = 0; t < 16; t++) It[t] = 256 * Math.random() | 0;
1263
- return It[6] = 15 & It[6] | 64, It[8] = 63 & It[8] | 128, Rt(It);
1389
+ function zt() {
1390
+ for (let t = 0; t < 16; t++) $t[t] = 256 * Math.random() | 0;
1391
+ return $t[6] = 15 & $t[6] | 64, $t[8] = 63 & $t[8] | 128, Ut($t);
1264
1392
  }
1265
- const $t = function() {
1393
+ const Bt = function() {
1266
1394
  if ("undefined" != typeof crypto) {
1267
- if ("function" == typeof crypto.randomUUID) return Et;
1268
- if ("function" == typeof crypto.getRandomValues) return Mt;
1395
+ if ("function" == typeof crypto.randomUUID) return xt;
1396
+ if ("function" == typeof crypto.getRandomValues) return jt;
1269
1397
  }
1270
- return Ct;
1398
+ return zt;
1271
1399
  }();
1272
- function Pt() {
1273
- return $t();
1400
+ function Ot() {
1401
+ return Bt();
1274
1402
  }
1275
- function xt() {
1403
+ function Dt() {
1276
1404
  try {
1277
1405
  if ("undefined" != typeof crypto && "function" == typeof crypto.getRandomValues) {
1278
1406
  const t = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
1279
1407
  let n = "";
1280
- for (let e = 0; e < 16; e++) n += At[t[e]];
1408
+ for (let e = 0; e < 16; e++) n += Pt[t[e]];
1281
1409
  return n;
1282
1410
  }
1283
1411
  } catch {}
1284
- return Pt().replace(/-/g, "");
1412
+ return Ot().replace(/-/g, "");
1285
1413
  }
1286
- const Ut = 1048576;
1287
- const Bt = "__tri_pulseguard_prev";
1288
- const Ot = 524288;
1289
- var jt = class {
1414
+ const Lt = 1048576;
1415
+ const Ft = "__tri_pulseguard_prev";
1416
+ const Nt = 524288;
1417
+ var qt = class {
1290
1418
  constructor(t, n) {
1291
- this.U = t, this.B = n, this.O = [], this.j = null, this.D = [], this.F = null, this.T = !1, this.L = !0, this.N = 0, this.q = 0, this.H = 0, this.J = null, this.V = !1, this.W = !1, this.G = t.flush.intervalMs;
1419
+ this.V = t, this.W = n, this.G = [], this.K = null, this.Z = [], this.X = null, this.A = !1, this.Y = 0, this.tt = !0, this.nt = 0, this.et = 0, this.it = 0, this.rt = null, this.st = !1, this.ot = !1, this.ut = t.flush.intervalMs;
1292
1420
  }
1293
1421
  push(t) {
1294
- this.T ? this.J && this.K(this.J, t) || (null !== _t(t) ? (this.Z(t), this.X()) : i.warn("Transport", "event has no capture route — dropped", t.name)) : i.warn("Transport", "push() called before start() — event dropped");
1422
+ this.A ? this.rt && this.lt(this.rt, t) || (null !== Ct(t) ? (this.ct(t), this.ft()) : i.warn("Transport", "event has no capture route — dropped", t.name)) : i.warn("Transport", "push() called before start() — event dropped");
1295
1423
  }
1296
1424
  setEventRouter(t) {
1297
- this.J = t;
1425
+ this.rt = t;
1298
1426
  }
1299
1427
  getEventRouter() {
1300
- return this.J;
1428
+ return this.rt;
1301
1429
  }
1302
1430
  requestFlush(t) {
1303
- if (this.T && this.L) return t && !this.V && this.B.isActivityActive() ? (f(this.j), this.j = null, void this.flush("capacity")) : void this.Y();
1431
+ if (this.A && this.tt) return t && !this.st && this.W.isActivityActive() ? (f(this.K), this.K = null, void this.flush("capacity")) : void this.ht();
1304
1432
  }
1305
- tt(t) {
1306
- const n = this.J;
1433
+ dt(t) {
1434
+ const n = this.rt;
1307
1435
  n?.beforeFlush && this.holdCapacityFlush(() => {
1308
1436
  try {
1309
1437
  n.beforeFlush?.(t);
@@ -1312,192 +1440,199 @@ var jt = class {
1312
1440
  }
1313
1441
  });
1314
1442
  }
1315
- K(t, n) {
1443
+ lt(t, n) {
1316
1444
  try {
1317
1445
  return !0 === t.route(n);
1318
1446
  } catch (t) {
1319
1447
  return i.warn("Transport", "event router threw:", t), !1;
1320
1448
  }
1321
1449
  }
1322
- Z(t) {
1323
- this.O.length < this.nt() ? this.O.push(t) : this.et(t);
1450
+ ct(t) {
1451
+ this.G.length < this.yt() ? this.G.push(t) : this.gt(t);
1324
1452
  }
1325
1453
  holdCapacityFlush(t) {
1326
- const n = this.V;
1327
- this.V = !0;
1454
+ const n = this.st;
1455
+ this.st = !0;
1328
1456
  try {
1329
1457
  t();
1330
1458
  } finally {
1331
- this.V = n;
1459
+ this.st = n;
1332
1460
  }
1333
1461
  }
1334
- X() {
1335
- if (this.L) return this.O.length >= this.U.flush.size && !this.V ? (f(this.j), this.j = null, void this.flush("capacity")) : void this.Y();
1462
+ ft() {
1463
+ if (this.tt) return this.G.length >= this.V.flush.size && !this.st ? (f(this.K), this.K = null, void this.flush("capacity")) : void this.ht();
1336
1464
  }
1337
1465
  flush(t) {
1338
- if (this.T && this.B.isActivityActive()) try {
1339
- if (this.tt(t ?? "interval"), "lifecycle" === t) return void this.it();
1340
- if (0 === this.O.length) return;
1341
- if ("submit" === t && !this.L) return;
1342
- if ("submit" !== t && this.rt()) return;
1466
+ if (this.A && this.W.isActivityActive()) try {
1467
+ if (this.dt(t ?? "interval"), "lifecycle" === t) return void this.wt();
1468
+ if (0 === this.G.length) return;
1469
+ if ("submit" === t && !this.tt) return;
1470
+ if ("submit" !== t && this.vt()) return;
1343
1471
  const n = "submit" === t;
1344
- for (const e of this.ot(!1, n)) {
1345
- const r = this.st(e, t, n ? this.ut() : this.lt());
1346
- r && (n ? this.ct(r) : this.B.ingest(r, !1)).then((t) => this.ft(t, r)).catch(() => {
1472
+ for (const e of this.bt(!1, n)) {
1473
+ const r = this.kt(e, t, n ? this.St() : this.Tt());
1474
+ if (!r) continue;
1475
+ const s = this._t();
1476
+ (n ? this.At(r) : this.W.ingest(r, !1, s)).then((t) => this.It(t, r, s)).catch(() => {
1347
1477
  i.warn("Transport", "ingest threw unexpectedly — batch dropped");
1348
1478
  });
1349
1479
  }
1350
- this.O.length > 0 && this.Y();
1480
+ this.G.length > 0 && this.ht();
1351
1481
  } catch (t) {
1352
1482
  i.warn("Transport", "flush() threw unexpectedly:", t);
1353
1483
  }
1354
1484
  }
1355
1485
  releaseBindHold() {
1356
- this.W && (this.W = !1, this.T && this.L && 0 !== this.O.length && (f(this.j), this.j = null, this.flush("interval")));
1486
+ this.ot && (this.ot = !1, this.A && this.tt && 0 !== this.G.length && (f(this.K), this.K = null, this.flush("interval")));
1357
1487
  }
1358
- rt() {
1359
- const t = this.B.getBindHoldMs?.() ?? 0;
1360
- return t > 0 ? (this.W = !0, null === this.j && this.L && (this.j = c(() => {
1361
- this.j = null, this.flush("interval");
1362
- }, t)), !0) : (this.W = !1, !1);
1488
+ vt() {
1489
+ const t = this.W.getBindHoldMs?.() ?? 0;
1490
+ return t > 0 ? (this.ot = !0, null === this.K && this.tt && (this.K = c(() => {
1491
+ this.K = null, this.flush("interval");
1492
+ }, t)), !0) : (this.ot = !1, !1);
1363
1493
  }
1364
- lt() {
1365
- return this.B.isBound?.() ? Ut : void 0;
1494
+ Tt() {
1495
+ return this.W.isBound?.() ? Lt : void 0;
1366
1496
  }
1367
1497
  start() {
1368
- this.T || (this.T = !0, this.L = "undefined" == typeof navigator || navigator.onLine);
1498
+ this.A || (this.A = !0, this.tt = "undefined" == typeof navigator || navigator.onLine);
1369
1499
  }
1370
1500
  stop() {
1371
- if (!this.T) return Promise.resolve();
1372
- f(this.j), this.j = null, f(this.F), this.F = null, this.B.isActivityActive() && this.tt("lifecycle");
1373
- const t = this.it();
1374
- return this.T = !1, this.D = [], t;
1501
+ if (!this.A) return Promise.resolve();
1502
+ f(this.K), this.K = null, f(this.X), this.X = null, this.W.isActivityActive() && this.dt("lifecycle");
1503
+ const t = this.wt();
1504
+ return this.A = !1, this.G = [], this.Z = [], this.Y++, t;
1375
1505
  }
1376
1506
  onConnectionChange() {
1377
1507
  const t = "undefined" == typeof navigator || navigator.onLine;
1378
- if (t !== this.L) {
1379
- if (this.L = t, !this.L) return f(this.j), this.j = null, f(this.F), void (this.F = null);
1380
- (this.O.length > 0 || this.J?.beforeFlush) && this.Y(), this.D.length > 0 && this.ht();
1508
+ if (t !== this.tt) {
1509
+ if (this.tt = t, !this.tt) return f(this.K), this.K = null, f(this.X), void (this.X = null);
1510
+ (this.G.length > 0 || this.rt?.beforeFlush) && this.ht(), this.Z.length > 0 && this.Rt();
1381
1511
  }
1382
1512
  }
1383
- Y() {
1384
- this.T && this.L && null === this.j && (this.j = c(() => {
1385
- this.j = null, this.flush("interval");
1386
- }, this.G));
1387
- }
1388
1513
  ht() {
1389
- this.T && this.L && null === this.F && (this.F = c(() => {
1390
- this.F = null, this.dt();
1391
- }, this.G));
1392
- }
1393
- dt() {
1394
- if (!this.T || !this.L || 0 === this.D.length || !this.B.isActivityActive()) return;
1395
- const t = this.D.shift();
1396
- this.B.ingest(t.batch, !1).then((n) => this.yt(n, t)).catch(() => {
1397
- i.warn("Transport", "retry drain ingest threw unexpectedly — batch dropped"), this.D.length > 0 && this.ht();
1514
+ this.A && this.tt && null === this.K && (this.K = c(() => {
1515
+ this.K = null, this.flush("interval");
1516
+ }, this.ut));
1517
+ }
1518
+ Rt() {
1519
+ this.A && this.tt && null === this.X && (this.X = c(() => {
1520
+ this.X = null, this.Et();
1521
+ }, this.ut));
1522
+ }
1523
+ Et() {
1524
+ if (!this.A || !this.tt || 0 === this.Z.length || !this.W.isActivityActive()) return;
1525
+ const t = this.Z.shift(), n = this._t();
1526
+ this.W.ingest(t.batch, !1, n).then((e) => this.Mt(e, t, n)).catch(() => {
1527
+ i.warn("Transport", "retry drain ingest threw unexpectedly — batch dropped"), this.Z.length > 0 && this.Rt();
1398
1528
  });
1399
1529
  }
1400
- gt(t, n) {
1401
- this.D.length >= 5 && (this.D.shift(), i.warn("Transport", "retry queue full — oldest batch evicted")), this.D.push({
1530
+ Ct(t, n) {
1531
+ this.Z.length >= 5 && (this.Z.shift(), i.warn("Transport", "retry queue full — oldest batch evicted")), this.Z.push({
1402
1532
  batch: t,
1403
1533
  attempts: n
1404
- }), this.ht();
1405
- }
1406
- ft(t, n) {
1407
- this.T && this.B.isActivityActive() && (t.ok ? this.wt() : this.vt(t) && this.gt(n, 1));
1408
- }
1409
- yt(t, n) {
1410
- if (this.T && this.B.isActivityActive()) {
1411
- if (t.ok) return this.wt(), void (this.D.length > 0 && this.ht());
1412
- if (this.vt(t)) {
1413
- if (n.attempts >= 3) return this.bt(), i.warn("Transport", "batch dropped after MAX_RETRY_ATTEMPTS", n.batch.batchId), void (this.D.length > 0 && this.ht());
1414
- this.bt(), this.gt(n.batch, n.attempts + 1);
1415
- } else this.D.length > 0 && this.ht();
1534
+ }), this.Rt();
1535
+ }
1536
+ It(t, n, e) {
1537
+ this.A && e() && this.W.isActivityActive() && (t.ok ? this.Pt() : this.$t(t) && this.Ct(n, 1));
1538
+ }
1539
+ Mt(t, n, e) {
1540
+ if (this.A && e() && this.W.isActivityActive()) {
1541
+ if (t.ok) return this.Pt(), void (this.Z.length > 0 && this.Rt());
1542
+ if (this.$t(t)) {
1543
+ if (n.attempts >= 3) return this.Ut(), i.warn("Transport", "batch dropped after MAX_RETRY_ATTEMPTS", n.batch.batchId), void (this.Z.length > 0 && this.Rt());
1544
+ this.Ut(), this.Ct(n.batch, n.attempts + 1);
1545
+ } else this.Z.length > 0 && this.Rt();
1416
1546
  }
1417
1547
  }
1418
- bt() {
1419
- this.N++, this.N % this.U.flush.backoffFailureThreshold === 0 && (this.G = Math.min(2 * this.G, this.U.flush.maxIntervalMs));
1548
+ Ut() {
1549
+ this.nt++, this.nt % this.V.flush.backoffFailureThreshold === 0 && (this.ut = Math.min(2 * this.ut, this.V.flush.maxIntervalMs));
1420
1550
  }
1421
- wt() {
1422
- this.N = 0, this.G = this.U.flush.intervalMs;
1551
+ Pt() {
1552
+ this.nt = 0, this.ut = this.V.flush.intervalMs;
1423
1553
  }
1424
- nt() {
1425
- return this.U.queue.size * (this.L ? 1 : 2);
1554
+ yt() {
1555
+ return this.V.queue.size * (this.tt ? 1 : 2);
1426
1556
  }
1427
- async it() {
1428
- if (!this.B.isActivityActive()) return Promise.resolve();
1429
- if (!this.L) return;
1557
+ async wt() {
1558
+ if (!this.W.isActivityActive()) return Promise.resolve();
1559
+ if (!this.tt) return;
1430
1560
  const t = [];
1431
- let n = this.ut();
1432
- for (const e of this.ot(!0, !0)) {
1433
- const r = this.st(e, "lifecycle", n);
1434
- r && (n -= zt(r.events), t.push(this.ct(r).then((t) => this.ft(t, r)).catch(() => {
1561
+ let n = this.St();
1562
+ const e = this._t();
1563
+ for (const r of this.bt(!0, !0)) {
1564
+ const s = this.kt(r, "lifecycle", n);
1565
+ s && (n -= Ht(s.events), t.push(this.At(s).then((t) => this.It(t, s, e)).catch(() => {
1435
1566
  i.warn("Transport", "lifecycle ingest threw — batch dropped");
1436
1567
  })));
1437
1568
  }
1438
- const e = [];
1439
- for (const r of this.D) {
1440
- const o = zt(r.batch.events);
1441
- o > n ? e.push(r) : (n -= o, t.push(this.ct(r.batch).then((t) => this.yt(t, r)).catch(() => {
1569
+ const r = [];
1570
+ for (const s of this.Z) {
1571
+ const o = Ht(s.batch.events);
1572
+ o > n ? r.push(s) : (n -= o, t.push(this.At(s.batch).then((t) => this.Mt(t, s, e)).catch(() => {
1442
1573
  i.warn("Transport", "lifecycle retry ingest threw — batch dropped");
1443
1574
  })));
1444
1575
  }
1445
- return this.D = e, Promise.allSettled(t).then(() => {});
1576
+ return this.Z = r, Promise.allSettled(t).then(() => {});
1446
1577
  }
1447
- ut() {
1448
- return Math.max(0, 49152 - this.H);
1578
+ St() {
1579
+ return Math.max(0, 49152 - this.it);
1449
1580
  }
1450
- ct(t) {
1451
- const n = zt(t.events);
1452
- return this.H += n, this.B.ingest(t, !0).finally(() => {
1453
- this.H -= n;
1581
+ _t() {
1582
+ const t = this.Y;
1583
+ return () => t === this.Y;
1584
+ }
1585
+ At(t) {
1586
+ const n = Ht(t.events);
1587
+ return this.it += n, this.W.ingest(t, !0).finally(() => {
1588
+ this.it -= n;
1454
1589
  });
1455
1590
  }
1456
- et(t) {
1457
- const n = V(t);
1458
- for (let e = 0; e < this.O.length; e++) if (V(this.O[e]) < n) {
1459
- for (let t = e; t < this.O.length - 1; t++) this.O[t] = this.O[t + 1];
1460
- this.O.length -= 1, this.O.push(t);
1591
+ gt(t) {
1592
+ const n = ot(t);
1593
+ for (let e = 0; e < this.G.length; e++) if (ot(this.G[e]) < n) {
1594
+ for (let t = e; t < this.G.length - 1; t++) this.G[t] = this.G[t + 1];
1595
+ this.G.length -= 1, this.G.push(t);
1461
1596
  return;
1462
1597
  }
1463
1598
  }
1464
- st(t, n, e) {
1465
- const i = "lifecycle" === n, r = this.kt(t, i, i ? 200 : this.U.flush.size, e);
1599
+ kt(t, n, e) {
1600
+ const i = "lifecycle" === n, r = this.xt(t, i, i ? 200 : this.V.flush.size, e);
1466
1601
  return 0 === r.length ? null : {
1467
1602
  activityId: "",
1468
- batchId: Pt(),
1469
- batchSequence: this.q++,
1603
+ batchId: Ot(),
1604
+ batchSequence: this.et++,
1470
1605
  clientTimestamp: Date.now(),
1471
1606
  schemaVersion: "0.1.0",
1472
1607
  sdkVersion: "0.5.1",
1473
1608
  sdkPlatform: "web",
1474
- tabId: this.B.getTabId(),
1609
+ tabId: this.W.getTabId(),
1475
1610
  events: r
1476
1611
  };
1477
1612
  }
1478
- kt(t, n, e, i) {
1613
+ xt(t, n, e, i) {
1479
1614
  const r = /* @__PURE__ */ new Set();
1480
- let o = 0;
1481
- for (let s = 0; s < this.O.length && r.size < e; s++) {
1482
- const e = n ? this.O.length - 1 - s : s, a = this.O[e];
1483
- if (_t(a) === t) {
1615
+ let s = 0;
1616
+ for (let o = 0; o < this.G.length && r.size < e; o++) {
1617
+ const e = n ? this.G.length - 1 - o : o, u = this.G[e];
1618
+ if (Ct(u) === t) {
1484
1619
  if (void 0 !== i) {
1485
- const t = Dt(a);
1486
- if (o + t > i) continue;
1487
- o += t;
1620
+ const t = Jt(u);
1621
+ if (s + t > i) continue;
1622
+ s += t;
1488
1623
  }
1489
1624
  r.add(e);
1490
1625
  }
1491
1626
  }
1492
1627
  if (0 === r.size) return [];
1493
- const s = [], a = [];
1494
- for (let t = 0; t < this.O.length; t++) r.has(t) ? s.push(this.O[t]) : a.push(this.O[t]);
1495
- return this.O = a, s;
1628
+ const o = [], u = [];
1629
+ for (let t = 0; t < this.G.length; t++) r.has(t) ? o.push(this.G[t]) : u.push(this.G[t]);
1630
+ return this.G = u, o;
1496
1631
  }
1497
- ot(t, n = !1) {
1632
+ bt(t, n = !1) {
1498
1633
  const e = [];
1499
- for (let n = 0; n < this.O.length; n++) {
1500
- const i = _t(this.O[t ? this.O.length - 1 - n : n]);
1634
+ for (let n = 0; n < this.G.length; n++) {
1635
+ const i = Ct(this.G[t ? this.G.length - 1 - n : n]);
1501
1636
  null === i || e.includes(i) || e.push(i);
1502
1637
  }
1503
1638
  if (n) {
@@ -1506,7 +1641,7 @@ var jt = class {
1506
1641
  }
1507
1642
  return e;
1508
1643
  }
1509
- vt(t) {
1644
+ $t(t) {
1510
1645
  if (t.ok) return !1;
1511
1646
  switch (t.kind) {
1512
1647
  case "timeout":
@@ -1517,20 +1652,20 @@ var jt = class {
1517
1652
  }
1518
1653
  }
1519
1654
  };
1520
- function zt(t) {
1655
+ function Ht(t) {
1521
1656
  let n = 0;
1522
- for (let e = 0; e < t.length; e++) n += Dt(t[e]);
1657
+ for (let e = 0; e < t.length; e++) n += Jt(t[e]);
1523
1658
  return n;
1524
1659
  }
1525
- function Dt(t) {
1660
+ function Jt(t) {
1526
1661
  try {
1527
1662
  return JSON.stringify(t).length + 1;
1528
1663
  } catch {
1529
1664
  return 0;
1530
1665
  }
1531
1666
  }
1532
- const Ft = "tri:bcast:";
1533
- const Lt = "function" == typeof BroadcastChannel ? BroadcastChannel : function() {
1667
+ const Vt = "tri:bcast:";
1668
+ const Wt = "function" == typeof BroadcastChannel ? BroadcastChannel : function() {
1534
1669
  if ("undefined" == typeof Storage || "undefined" == typeof window) return !1;
1535
1670
  try {
1536
1671
  const t = "__tri_bcast_probe__";
@@ -1544,24 +1679,24 @@ const Lt = "function" == typeof BroadcastChannel ? BroadcastChannel : function()
1544
1679
  constructor(t) {
1545
1680
  this.seq = 0, this.closed = !1, this.listeners = /* @__PURE__ */ new Set(), this.onStorageEvent = (t) => {
1546
1681
  if (this.closed) return;
1547
- if (!t.key || !t.key.startsWith(`${Ft}${this.channelName}:`)) return;
1682
+ if (!t.key || !t.key.startsWith(`${Vt}${this.channelName}:`)) return;
1548
1683
  if (null === t.newValue) return;
1549
1684
  let n;
1550
- s(() => p.remove(t.key));
1685
+ o(() => y.remove(t.key));
1551
1686
  try {
1552
1687
  n = JSON.parse(t.newValue);
1553
1688
  } catch {
1554
1689
  return;
1555
1690
  }
1556
1691
  const e = { data: n };
1557
- for (const t of this.listeners) s(() => t(e));
1558
- }, this.channelName = t, this.senderId = Pt(), window.addEventListener("storage", this.onStorageEvent);
1692
+ for (const t of this.listeners) o(() => t(e));
1693
+ }, this.channelName = t, this.senderId = Ot(), window.addEventListener("storage", this.onStorageEvent);
1559
1694
  }
1560
1695
  postMessage(t) {
1561
1696
  if (this.closed) return;
1562
- const n = `${Ft}${this.channelName}:${this.senderId}:${this.seq++}`;
1563
- s(() => {
1564
- p.set(n, t), p.remove(n);
1697
+ const n = `${Vt}${this.channelName}:${this.senderId}:${this.seq++}`;
1698
+ o(() => {
1699
+ y.set(n, t), y.remove(n);
1565
1700
  });
1566
1701
  }
1567
1702
  addEventListener(t, n) {
@@ -1582,201 +1717,201 @@ const Lt = "function" == typeof BroadcastChannel ? BroadcastChannel : function()
1582
1717
  removeEventListener(t, n) {}
1583
1718
  close() {}
1584
1719
  };
1585
- const Nt = "__tri_tabId";
1586
- var qt = class {
1720
+ const Gt = "__tri_tabId";
1721
+ var Kt = class {
1587
1722
  constructor(t) {
1588
- this.context = t, this.St = "", this.T = !1, this.Tt = null, this._t = null, this.At = null, this.It = /* @__PURE__ */ new Map(), this.Rt = -1, this.Et = null;
1723
+ this.context = t, this.jt = "", this.A = !1, this.zt = null, this.Bt = null, this.Ot = null, this.Dt = /* @__PURE__ */ new Map(), this.Lt = -1, this.Ft = null;
1589
1724
  }
1590
1725
  async start() {
1591
- this.T || (this.T = !0, this.getTabId(), this.Mt(), this.Ct({
1726
+ this.A || (this.A = !0, this.getTabId(), this.Nt(), this.qt({
1592
1727
  type: "hello",
1593
- tabId: this.St,
1728
+ tabId: this.jt,
1594
1729
  ts: Date.now()
1595
- }), this.$t(), this.Pt("active"), this.xt());
1730
+ }), this.Ht(), this.Jt("active"), this.Vt());
1596
1731
  }
1597
1732
  stop() {
1598
- this.T && (this.T = !1, this.Pt("inactive"), this.Ct({
1733
+ this.A && (this.A = !1, this.Jt("inactive"), this.qt({
1599
1734
  type: "bye",
1600
- tabId: this.St,
1735
+ tabId: this.jt,
1601
1736
  ts: Date.now()
1602
- }), this.Ut(this.Bt()), this.Ot(), this.jt(), this.zt());
1737
+ }), this.Wt(this.Gt()), this.Kt(), this.Zt(), this.Xt());
1603
1738
  }
1604
1739
  getTabId() {
1605
- return this.St || (this.St = this.Dt()), this.St;
1740
+ return this.jt || (this.jt = this.Qt()), this.jt;
1606
1741
  }
1607
1742
  queryTabsNumber() {
1608
- return this.It.size + 1;
1743
+ return this.Dt.size + 1;
1609
1744
  }
1610
- Mt() {
1745
+ Nt() {
1611
1746
  try {
1612
- this.Tt = new Lt("__tri_tab_channel"), this.Et = this.Ft.bind(this), this.Tt.addEventListener("message", this.Et);
1747
+ this.zt = new Wt("__tri_tab_channel"), this.Ft = this.Yt.bind(this), this.zt.addEventListener("message", this.Ft);
1613
1748
  } catch (t) {
1614
1749
  i.warn("TabManager", "failed to open broadcast channel:", t);
1615
1750
  }
1616
1751
  }
1617
- zt() {
1752
+ Xt() {
1618
1753
  try {
1619
- if (!this.Tt) return;
1620
- this.Et && this.Tt.removeEventListener("message", this.Et), this.Tt.close();
1754
+ if (!this.zt) return;
1755
+ this.Ft && this.zt.removeEventListener("message", this.Ft), this.zt.close();
1621
1756
  } catch {} finally {
1622
- this.Tt = null, this.Et = null;
1757
+ this.zt = null, this.Ft = null;
1623
1758
  }
1624
1759
  }
1625
- $t() {
1626
- this._t = setInterval(() => {
1760
+ Ht() {
1761
+ this.Bt = setInterval(() => {
1627
1762
  const t = Date.now();
1628
- this.Ct({
1763
+ this.qt({
1629
1764
  type: "heartbeat",
1630
- tabId: this.St,
1765
+ tabId: this.jt,
1631
1766
  ts: t
1632
1767
  });
1633
1768
  }, 1e3);
1634
1769
  }
1635
- Ot() {
1636
- null != this._t && (clearInterval(this._t), this._t = null);
1770
+ Kt() {
1771
+ null != this.Bt && (clearInterval(this.Bt), this.Bt = null);
1637
1772
  }
1638
- xt() {
1639
- null != this.At && clearTimeout(this.At), this.At = setTimeout(() => {
1640
- this.At = null;
1641
- const t = this.Bt() + 1;
1642
- t !== this.Rt && (this.Rt = t, this.Ut(t));
1773
+ Vt() {
1774
+ null != this.Ot && clearTimeout(this.Ot), this.Ot = setTimeout(() => {
1775
+ this.Ot = null;
1776
+ const t = this.Gt() + 1;
1777
+ t !== this.Lt && (this.Lt = t, this.Wt(t));
1643
1778
  }, 1e3);
1644
1779
  }
1645
- jt() {
1646
- null != this.At && (clearTimeout(this.At), this.At = null);
1780
+ Zt() {
1781
+ null != this.Ot && (clearTimeout(this.Ot), this.Ot = null);
1647
1782
  }
1648
- Ct(t) {
1783
+ qt(t) {
1649
1784
  try {
1650
- if (!this.Tt) return;
1651
- this.Tt.postMessage(t);
1785
+ if (!this.zt) return;
1786
+ this.zt.postMessage(t);
1652
1787
  } catch {
1653
1788
  i.warn("TabManager", "failed to broadcast message:", t);
1654
1789
  }
1655
1790
  }
1656
- Ft(t) {
1791
+ Yt(t) {
1657
1792
  const { type: n, tabId: e } = t.data;
1658
- if (e === this.St) return;
1793
+ if (e === this.jt) return;
1659
1794
  const i = Date.now();
1660
- "hello" === n ? (this.Ct({
1795
+ "hello" === n ? (this.qt({
1661
1796
  type: "ack",
1662
- tabId: this.St,
1797
+ tabId: this.jt,
1663
1798
  ts: i,
1664
1799
  to: e
1665
- }), this.It.set(e, i)) : "heartbeat" === n || "ack" === n ? this.It.set(e, i) : "bye" === n && this.It.delete(e);
1800
+ }), this.Dt.set(e, i)) : "heartbeat" === n || "ack" === n ? this.Dt.set(e, i) : "bye" === n && this.Dt.delete(e);
1666
1801
  }
1667
- Ut(t) {
1802
+ Wt(t) {
1668
1803
  this.context.events.count && this.context.push({
1669
1804
  name: "tab",
1670
1805
  type: "count",
1671
- tabId: this.St,
1806
+ tabId: this.jt,
1672
1807
  timestamp: Date.now(),
1673
1808
  ts: performance.now(),
1674
1809
  value: t
1675
1810
  });
1676
1811
  }
1677
- Pt(t) {
1812
+ Jt(t) {
1678
1813
  this.context.events.state && this.context.push({
1679
1814
  name: "tab",
1680
1815
  type: "state",
1681
- tabId: this.St,
1816
+ tabId: this.jt,
1682
1817
  timestamp: Date.now(),
1683
1818
  ts: performance.now(),
1684
1819
  value: t
1685
1820
  });
1686
1821
  }
1687
- Dt() {
1688
- const t = y.get(Nt);
1822
+ Qt() {
1823
+ const t = g.get(Gt);
1689
1824
  if (t) return t;
1690
- const n = Pt();
1691
- return y.set(Nt, n), n;
1825
+ const n = Ot();
1826
+ return g.set(Gt, n), n;
1692
1827
  }
1693
- Bt(t = Date.now()) {
1828
+ Gt(t = Date.now()) {
1694
1829
  let n = 0;
1695
- for (const [e, i] of this.It.entries()) t - i >= 3e3 ? this.It.delete(e) : n++;
1830
+ for (const [e, i] of this.Dt.entries()) t - i >= 3e3 ? this.Dt.delete(e) : n++;
1696
1831
  return n;
1697
1832
  }
1698
1833
  };
1699
- const Ht = globalThis.CompressionStream;
1700
- const Jt = globalThis.Response;
1701
- const Vt = globalThis.Blob;
1702
- const Wt = new TextEncoder();
1703
- let Gt = null;
1704
- async function Kt(t) {
1705
- if ("function" != typeof Ht) return null;
1834
+ const Zt = globalThis.CompressionStream;
1835
+ const Xt = globalThis.Response;
1836
+ const Qt = globalThis.Blob;
1837
+ const Yt = new TextEncoder();
1838
+ let tn = null;
1839
+ async function nn(t) {
1840
+ if ("function" != typeof Zt) return null;
1706
1841
  try {
1707
- const n = "string" == typeof t ? Wt.encode(t) : t, e = new Vt([n]).stream().pipeThrough(new Ht("gzip"));
1708
- return await new Jt(e).arrayBuffer();
1842
+ const n = "string" == typeof t ? Yt.encode(t) : t, e = new Qt([n]).stream().pipeThrough(new Zt("gzip"));
1843
+ return await new Xt(e).arrayBuffer();
1709
1844
  } catch (t) {
1710
1845
  return i.warn("compression", "Native gzip failed:", t), null;
1711
1846
  }
1712
1847
  }
1713
- async function Zt(t) {
1848
+ async function en(t) {
1714
1849
  try {
1715
1850
  const n = await function() {
1716
- if (null === Gt) {
1851
+ if (null === tn) {
1717
1852
  const t = function(t, n = 1e4) {
1718
1853
  let e = null;
1719
1854
  const r = new Promise((t) => {
1720
1855
  e = c(() => {
1721
1856
  i.warn("import", `Import timed out after ${n}ms`), t(null);
1722
1857
  }, n);
1723
- }), o = Promise.resolve().then(t).catch((t) => (i.warn("import", "Import failed:", t), null));
1724
- return Promise.race([o, r]).finally(() => {
1858
+ }), s = Promise.resolve().then(t).catch((t) => (i.warn("import", "Import failed:", t), null));
1859
+ return Promise.race([s, r]).finally(() => {
1725
1860
  f(e);
1726
1861
  });
1727
- }(() => import("./browser-pQZA35G2-B4Dwja1e.esm.js"), 1e4);
1728
- Gt = t, t.then((n) => {
1862
+ }(() => import("./browser-pQZA35G2-DveVe0Ui.esm.js"), 1e4);
1863
+ tn = t, t.then((n) => {
1729
1864
  null === n && c(() => {
1730
- Gt === t && (Gt = null);
1865
+ tn === t && (tn = null);
1731
1866
  }, 1e4);
1732
1867
  });
1733
1868
  }
1734
- return Gt;
1869
+ return tn;
1735
1870
  }();
1736
1871
  if (null === n) return null;
1737
- const { gzipSync: e } = n, r = e("string" == typeof t ? Wt.encode(t) : t);
1872
+ const { gzipSync: e } = n, r = e("string" == typeof t ? Yt.encode(t) : t);
1738
1873
  return r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength);
1739
1874
  } catch (t) {
1740
1875
  return i.warn("compression", "fflate gzip failed:", t), null;
1741
1876
  }
1742
1877
  }
1743
- function Xt(t, n) {
1878
+ function rn(t, n) {
1744
1879
  const e = [JSON.stringify(t)];
1745
1880
  for (let t = 0; t < n.length; t++) try {
1746
1881
  e.push(JSON.stringify(n[t]));
1747
1882
  } catch {}
1748
1883
  return e.join("\n");
1749
1884
  }
1750
- function Qt(t) {
1885
+ function sn(t) {
1751
1886
  const n = { Accept: "application/json" };
1752
1887
  return t?.hasBody && ("json" === t.contentType ? n["Content-Type"] = "application/json" : "ndjson" === t.contentType && (n["Content-Type"] = "application/x-ndjson"), "gzip" === t.contentEncoding && (n["Content-Encoding"] = "gzip")), t?.token && (n.Authorization = `Bearer ${t.token}`), t?.profileId && (n["x-profile-id"] = t.profileId), t?.api?.version && (n["x-api-version"] = t.api.version), t?.customHeaders && Object.entries(t.customHeaders).forEach(([t, e]) => {
1753
1888
  n[t] = e;
1754
1889
  }), n;
1755
1890
  }
1756
- const Yt = "function" == typeof globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0;
1757
- function tn(t) {
1891
+ const on = "function" == typeof globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0;
1892
+ function un(t) {
1758
1893
  "undefined" != typeof document && "function" == typeof globalThis.fetch || i.warn("FalconService", "createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");
1759
1894
  const n = function(t) {
1760
1895
  const n = t?.timeout, e = t?.baseUrl ?? "", i = t?.api;
1761
- async function r(t, r, o) {
1762
- if (void 0 === Yt) return {
1896
+ async function r(t, r, s) {
1897
+ if (void 0 === on) return {
1763
1898
  ok: !1,
1764
1899
  kind: "network"
1765
1900
  };
1766
- const s = e ? `${e}${r}` : r, a = new AbortController();
1767
- let u = null, l = !1;
1768
- const h = o?.timeoutMs ?? n;
1769
- h && (u = c(() => {
1770
- l = !0, a.abort();
1901
+ const o = e ? `${e}${r}` : r, u = new AbortController();
1902
+ let a = null, l = !1;
1903
+ const h = s?.timeoutMs ?? n;
1904
+ h && (a = c(() => {
1905
+ l = !0, u.abort();
1771
1906
  }, h));
1772
- const d = o?.signal;
1907
+ const d = s?.signal;
1773
1908
  let p, y = () => {};
1774
- if (d) if (d.aborted) a.abort();
1909
+ if (d) if (d.aborted) u.abort();
1775
1910
  else {
1776
- const t = () => a.abort();
1911
+ const t = () => u.abort();
1777
1912
  d.addEventListener("abort", t, { once: !0 }), y = () => d.removeEventListener("abort", t);
1778
1913
  }
1779
- if (null != o && "body" in o && null != o.body) {
1914
+ if (null != s && "body" in s && null != s.body) {
1780
1915
  const t = function(t) {
1781
1916
  if (null == t) return {
1782
1917
  ok: !0,
@@ -1794,28 +1929,28 @@ function tn(t) {
1794
1929
  } catch {
1795
1930
  return { ok: !1 };
1796
1931
  }
1797
- }(o.body);
1798
- if (!t.ok) return f(u), y(), {
1932
+ }(s.body);
1933
+ if (!t.ok) return f(a), y(), {
1799
1934
  ok: !1,
1800
1935
  kind: "serialize"
1801
1936
  };
1802
1937
  p = t.body;
1803
1938
  }
1804
1939
  try {
1805
- const n = await Yt(s, {
1940
+ const n = await on(o, {
1806
1941
  method: t,
1807
- headers: Qt({
1808
- token: o?.token,
1809
- profileId: o?.profileId,
1810
- contentType: o?.contentType,
1811
- contentEncoding: o?.contentEncoding,
1942
+ headers: sn({
1943
+ token: s?.token,
1944
+ profileId: s?.profileId,
1945
+ contentType: s?.contentType,
1946
+ contentEncoding: s?.contentEncoding,
1812
1947
  api: i,
1813
1948
  hasBody: void 0 !== p,
1814
- customHeaders: o?.customHeaders
1949
+ customHeaders: s?.customHeaders
1815
1950
  }),
1816
1951
  body: p,
1817
- signal: a.signal,
1818
- keepalive: o?.keepalive
1952
+ signal: u.signal,
1953
+ keepalive: s?.keepalive
1819
1954
  });
1820
1955
  if (!n.ok) return 429 === (g = n.status) ? {
1821
1956
  ok: !1,
@@ -1842,7 +1977,7 @@ function tn(t) {
1842
1977
  status: n.status
1843
1978
  };
1844
1979
  } catch {
1845
- return a.signal.aborted ? l ? {
1980
+ return u.signal.aborted ? l ? {
1846
1981
  ok: !1,
1847
1982
  kind: "timeout"
1848
1983
  } : {
@@ -1858,7 +1993,7 @@ function tn(t) {
1858
1993
  return l ? {
1859
1994
  ok: !1,
1860
1995
  kind: "timeout"
1861
- } : a.signal.aborted ? {
1996
+ } : u.signal.aborted ? {
1862
1997
  ok: !1,
1863
1998
  kind: "abort"
1864
1999
  } : {
@@ -1866,7 +2001,7 @@ function tn(t) {
1866
2001
  kind: "network"
1867
2002
  };
1868
2003
  } finally {
1869
- f(u), y();
2004
+ f(a), y();
1870
2005
  }
1871
2006
  var g;
1872
2007
  }
@@ -1885,32 +2020,34 @@ function tn(t) {
1885
2020
  }), e = function(t) {
1886
2021
  const { getToken: n, refresh: e } = t;
1887
2022
  let r = null;
1888
- return { withAuth: async function(t, o) {
2023
+ return { withAuth: async function(t, s) {
1889
2024
  if (r) {
1890
2025
  const n = await r;
1891
2026
  if (n) return t(n);
1892
2027
  }
1893
- const s = n() ?? "", a = await t(s);
1894
- if ((u = a).ok || !("rejected" === u.kind || "client" === u.kind && St.includes(u.status)) || !1 === o?.refreshable) return a;
1895
- var u;
1896
- const l = await (r || (r = async function() {
2028
+ const o = n() ?? "", u = await t(o);
2029
+ if ((a = u).ok || !("rejected" === a.kind || "client" === a.kind && Et.includes(a.status)) || !1 === s?.refreshable) return u;
2030
+ var a;
2031
+ if (!1 === s?.isCurrent?.()) return u;
2032
+ const l = await (c = o, r || (r = async function(t) {
1897
2033
  try {
1898
- return await e(), n();
2034
+ return await e(t), n();
1899
2035
  } catch (t) {
1900
2036
  return i.warn("AuthMiddleware", "auth refresh failed", t), null;
1901
2037
  }
1902
- }().finally(() => {
2038
+ }(c).finally(() => {
1903
2039
  r = null;
1904
2040
  }), r));
1905
- return l && l !== s ? t(l) : a;
2041
+ var c;
2042
+ return l && l !== o ? !1 === s?.isCurrent?.() ? u : t(l) : u;
1906
2043
  } };
1907
2044
  }(t), r = () => ({ profileId: t.getProfileId() ?? void 0 });
1908
2045
  return { api: {
1909
- ingest: async function(i, o) {
1910
- let s = null;
2046
+ ingest: async function(i, s, o) {
2047
+ let u = null;
1911
2048
  return e.withAuth(async (e) => {
1912
- const { events: a, ...u } = i, l = {
1913
- ...u,
2049
+ const { events: o, ...a } = i, l = {
2050
+ ...a,
1914
2051
  activityId: t.getActivityId()
1915
2052
  };
1916
2053
  let c, f = !1, h = null;
@@ -1918,24 +2055,24 @@ function tn(t) {
1918
2055
  try {
1919
2056
  let t = null;
1920
2057
  if (d && d.canBind()) {
1921
- if (!o) {
2058
+ if (!s) {
1922
2059
  const t = d.settling();
1923
2060
  t && await t;
1924
2061
  }
1925
- null === s && (s = function(t) {
2062
+ null === u && (u = function(t) {
1926
2063
  const n = [];
1927
2064
  for (let e = 0; e < t.length; e++) try {
1928
2065
  n.push(JSON.stringify(t[e]));
1929
2066
  } catch {}
1930
2067
  return n.join("\n");
1931
- }(a)), t = d.bind(l, s);
2068
+ }(o)), t = d.bind(l, u);
1932
2069
  }
1933
- if (t) if (h = t.sessionId, o) c = t.body;
2070
+ if (t) if (h = t.sessionId, s) c = t.body;
1934
2071
  else {
1935
2072
  const n = await async function(t) {
1936
2073
  const n = await async function(t) {
1937
- const n = await Kt(t);
1938
- return null !== n ? n : Zt(t);
2074
+ const n = await nn(t);
2075
+ return null !== n ? n : en(t);
1939
2076
  }(t);
1940
2077
  return n ? {
1941
2078
  type: "gzip",
@@ -1947,12 +2084,12 @@ function tn(t) {
1947
2084
  }(t.body);
1948
2085
  c = n.body, f = "gzip" === n.type;
1949
2086
  }
1950
- else if (o) c = Xt(l, a);
2087
+ else if (s) c = rn(l, o);
1951
2088
  else {
1952
2089
  const t = await async function(t, n) {
1953
- const e = Xt(t, n), i = await async function(t) {
1954
- const n = await Kt(t);
1955
- return null !== n ? n : Zt(t);
2090
+ const e = rn(t, n), i = await async function(t) {
2091
+ const n = await nn(t);
2092
+ return null !== n ? n : en(t);
1956
2093
  }(e);
1957
2094
  return i ? {
1958
2095
  type: "gzip",
@@ -1961,7 +2098,7 @@ function tn(t) {
1961
2098
  type: "ndjson",
1962
2099
  body: e
1963
2100
  };
1964
- }(l, a);
2101
+ }(l, o);
1965
2102
  c = t.body, f = "gzip" === t.type;
1966
2103
  }
1967
2104
  } catch {
@@ -1971,12 +2108,12 @@ function tn(t) {
1971
2108
  };
1972
2109
  }
1973
2110
  const p = await n.post(function(t) {
1974
- const n = t.length > 0 ? _t(t[0]) : null;
1975
- return Tt[n ?? "fp-signals"];
1976
- }(a), {
2111
+ const n = t.length > 0 ? Ct(t[0]) : null;
2112
+ return Mt[n ?? "fp-signals"];
2113
+ }(o), {
1977
2114
  body: c,
1978
2115
  token: e,
1979
- keepalive: o,
2116
+ keepalive: s,
1980
2117
  contentType: "ndjson",
1981
2118
  contentEncoding: f ? "gzip" : void 0,
1982
2119
  ...r()
@@ -1988,7 +2125,10 @@ function tn(t) {
1988
2125
  kind: "rejected",
1989
2126
  status: p.status
1990
2127
  } : p;
1991
- }, { refreshable: !o });
2128
+ }, {
2129
+ refreshable: !s,
2130
+ isCurrent: o
2131
+ });
1992
2132
  },
1993
2133
  reportEvent: async function(t) {
1994
2134
  return e.withAuth((e) => n.post("/events/report-event", {
@@ -2031,8 +2171,8 @@ function tn(t) {
2031
2171
  });
2032
2172
  },
2033
2173
  linkInterview: async function(i) {
2034
- const o = t.getToken();
2035
- return o && !pt(o) || await t.refresh(), e.withAuth((t) => n.post("/events/link-interview", {
2174
+ const s = t.getToken();
2175
+ return s && !k.isExpired(s) || await t.refresh(), e.withAuth((t) => n.post("/events/link-interview", {
2036
2176
  token: t,
2037
2177
  contentType: "json",
2038
2178
  ...r(),
@@ -2041,7 +2181,7 @@ function tn(t) {
2041
2181
  }
2042
2182
  } };
2043
2183
  }
2044
- var nn = class {
2184
+ var an = class {
2045
2185
  constructor(t) {
2046
2186
  this.context = t;
2047
2187
  }
@@ -2062,50 +2202,50 @@ var nn = class {
2062
2202
  }
2063
2203
  }
2064
2204
  };
2065
- const en = "function" == typeof TextEncoder ? new TextEncoder() : null;
2066
- const rn = "function" == typeof TextDecoder ? new TextDecoder() : null;
2067
- function on(t, n) {
2068
- if (!en) return -1;
2205
+ const ln = "function" == typeof TextEncoder ? new TextEncoder() : null;
2206
+ const cn = "function" == typeof TextDecoder ? new TextDecoder() : null;
2207
+ function fn(t, n) {
2208
+ if (!ln) return -1;
2069
2209
  if (t.length > n.length) return -1;
2070
- const e = en.encodeInto(t, n);
2210
+ const e = ln.encodeInto(t, n);
2071
2211
  return e.read === t.length ? e.written : -1;
2072
2212
  }
2073
- function sn(t) {
2074
- return rn ? rn.decode(t) : "";
2213
+ function hn(t) {
2214
+ return cn ? cn.decode(t) : "";
2075
2215
  }
2076
- function an(t, n) {
2216
+ function dn(t, n) {
2077
2217
  if ("string" != typeof t) return null;
2078
2218
  if (t.length !== Math.ceil(4 * n / 3)) return null;
2079
2219
  const e = new Uint8Array(n);
2080
- let i = 0, r = 0, o = 0;
2220
+ let i = 0, r = 0, s = 0;
2081
2221
  for (let n = 0; n < t.length; n++) {
2082
- const s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(t[n]);
2083
- if (s < 0) return null;
2084
- i = i << 6 | s, r += 6, r >= 8 && (r -= 8, e[o++] = i >> r & 255);
2222
+ const o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(t[n]);
2223
+ if (o < 0) return null;
2224
+ i = i << 6 | o, r += 6, r >= 8 && (r -= 8, e[s++] = i >> r & 255);
2085
2225
  }
2086
- return o === n ? e : null;
2226
+ return s === n ? e : null;
2087
2227
  }
2088
- const un = /^function [\w$ ]*\(\) \{\s*\[native code\]\s*\}$/;
2089
- function ln(t) {
2228
+ const pn = /^function [\w$ ]*\(\) \{\s*\[native code\]\s*\}$/;
2229
+ function yn(t) {
2090
2230
  return t > 0 ? t >= 4294967295 ? 4294967295 : Math.floor(t) : 0;
2091
2231
  }
2092
- function cn() {
2232
+ function gn() {
2093
2233
  return "undefined" != typeof document && "visible" !== document.visibilityState;
2094
2234
  }
2095
- const fn = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
2096
- const hn = 15;
2097
- function dn(t) {
2098
- const n = t.s.startsWith("pulseguard_") ? an(t.s.slice(11), 16) : null;
2235
+ const wn = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
2236
+ const vn = 15;
2237
+ function mn(t) {
2238
+ const n = t.s.startsWith("pulseguard_") ? dn(t.s.slice(11), 16) : null;
2099
2239
  if (!n || 32 !== t.kw.length) return null;
2100
2240
  const e = /* @__PURE__ */ new Uint8Array(48);
2101
2241
  return e.set(n, 0), e.set(t.kw, 16), e;
2102
2242
  }
2103
- function pn(t, n) {
2243
+ function bn(t, n) {
2104
2244
  if (!Number.isInteger(t) || t < 0 || t > 4294967295 || 16 !== n.length) return null;
2105
2245
  const e = /* @__PURE__ */ new Uint8Array(20);
2106
2246
  return new DataView(e.buffer).setUint32(0, t, !0), e.set(n, 4), e;
2107
2247
  }
2108
- async function yn(t) {
2248
+ async function kn(t) {
2109
2249
  const n = performance.now();
2110
2250
  let e;
2111
2251
  try {
@@ -2116,7 +2256,7 @@ async function yn(t) {
2116
2256
  }
2117
2257
  const i = performance.now() - n;
2118
2258
  let r = 0;
2119
- function o(t, n) {
2259
+ function s(t, n) {
2120
2260
  if (!e || !n) return null;
2121
2261
  const i = performance.now();
2122
2262
  try {
@@ -2137,10 +2277,10 @@ async function yn(t) {
2137
2277
  return r;
2138
2278
  },
2139
2279
  init: function(t) {
2140
- return Promise.resolve(null !== o(1, dn(t)));
2280
+ return Promise.resolve(null !== s(1, mn(t)));
2141
2281
  },
2142
2282
  advance: function(t, n) {
2143
- return Promise.resolve(o(2, pn(t, n)));
2283
+ return Promise.resolve(s(2, bn(t, n)));
2144
2284
  },
2145
2285
  stalled: function() {
2146
2286
  return !1;
@@ -2150,32 +2290,32 @@ async function yn(t) {
2150
2290
  }
2151
2291
  };
2152
2292
  }
2153
- function gn() {
2293
+ function Sn() {
2154
2294
  return performance.now();
2155
2295
  }
2156
- function wn(t, n) {
2296
+ function Tn(t, n) {
2157
2297
  return !!t && "string" == typeof t.url && t.url.length > 0 && "string" == typeof t.sha256 && /^[0-9a-f]{64}$/i.test(t.sha256) && Number.isInteger(t.bytes) && t.bytes > 0 && t.bytes <= n;
2158
2298
  }
2159
- async function vn(t) {
2160
- if (!wn(t, 40960)) return null;
2161
- const n = await _(t.url, t.sha256, t.bytes, 3e4);
2299
+ async function _n(t) {
2300
+ if (!Tn(t, 40960)) return null;
2301
+ const n = await B(t.url, t.sha256, t.bytes, 3e4);
2162
2302
  if (!n) return null;
2163
2303
  try {
2164
2304
  const t = await WebAssembly.compile(n);
2165
2305
  let i = null;
2166
2306
  const r = (e = () => i, function(t, n) {
2167
2307
  try {
2168
- if (n <= 0 || n > 64) return hn;
2308
+ if (n <= 0 || n > 64) return vn;
2169
2309
  const i = e();
2170
- if (!i) return hn;
2171
- const r = t >>> 0, o = new Uint8Array(i.buffer);
2172
- return r + n > o.length ? hn : function(t) {
2173
- if (t.length < 3 || ":" !== t[1]) return hn;
2310
+ if (!i) return vn;
2311
+ const r = t >>> 0, s = new Uint8Array(i.buffer);
2312
+ return r + n > s.length ? vn : function(t) {
2313
+ if (t.length < 3 || ":" !== t[1]) return vn;
2174
2314
  const n = t[0];
2175
- if ("t" !== n && "v" !== n) return hn;
2315
+ if ("t" !== n && "v" !== n) return vn;
2176
2316
  const e = t.slice(2).split(".");
2177
- if (e.length < 1 || e.length > 4) return hn;
2178
- for (const t of e) if (!fn.test(t)) return hn;
2317
+ if (e.length < 1 || e.length > 4) return vn;
2318
+ for (const t of e) if (!wn.test(t)) return vn;
2179
2319
  try {
2180
2320
  let t = globalThis;
2181
2321
  for (const n of e) t = t[n];
@@ -2190,32 +2330,32 @@ async function vn(t) {
2190
2330
  case "boolean": return 5;
2191
2331
  case "symbol": return 6;
2192
2332
  case "bigint": return 7;
2193
- default: return hn;
2333
+ default: return vn;
2194
2334
  }
2195
- }(t) : "number" != typeof t ? hn : Number.isInteger(t) && t >= 0 && t <= 13 ? t : 14;
2335
+ }(t) : "number" != typeof t ? vn : Number.isInteger(t) && t >= 0 && t <= 13 ? t : 14;
2196
2336
  } catch {
2197
- return hn;
2337
+ return vn;
2198
2338
  }
2199
- }(sn(o.subarray(r, r + n)));
2339
+ }(hn(s.subarray(r, r + n)));
2200
2340
  } catch {
2201
- return hn;
2341
+ return vn;
2202
2342
  }
2203
- }), o = (await WebAssembly.instantiate(t, { env: {
2204
- now: gn,
2343
+ }), s = (await WebAssembly.instantiate(t, { env: {
2344
+ now: Sn,
2205
2345
  probe: r
2206
2346
  } })).exports;
2207
- return o.memory instanceof WebAssembly.Memory && (i = o.memory), function(t) {
2347
+ return s.memory instanceof WebAssembly.Memory && (i = s.memory), function(t) {
2208
2348
  if (!(t.memory instanceof WebAssembly.Memory) || "function" != typeof t.buf || "function" != typeof t.scratch || "function" != typeof t.setEpoch || "function" != typeof t.bindBatch || "function" != typeof t.read) return null;
2209
2349
  const n = t.buf() >>> 0, e = t.scratch() >>> 0;
2210
- let i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Ut), o = 0;
2211
- function s() {
2212
- i.buffer !== t.memory.buffer && (o++, i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Ut));
2350
+ let i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Lt), s = 0;
2351
+ function o() {
2352
+ i.buffer !== t.memory.buffer && (s++, i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Lt));
2213
2353
  }
2214
- function a(t) {
2215
- return s(), sn(i.subarray(n, n + t));
2354
+ function u(t) {
2355
+ return o(), hn(i.subarray(n, n + t));
2216
2356
  }
2217
- function u(t, n) {
2218
- const e = on(t, i.subarray(n + 2, n + 2 + 128));
2357
+ function a(t, n) {
2358
+ const e = fn(t, i.subarray(n + 2, n + 2 + 128));
2219
2359
  return e < 0 ? -1 : (i[n] = 255 & e, i[n + 1] = e >> 8, n + 2 + e);
2220
2360
  }
2221
2361
  function l(t, n) {
@@ -2225,77 +2365,77 @@ async function vn(t) {
2225
2365
  setEpoch: function(n, i) {
2226
2366
  if (68 !== n.length || 64 !== i.length) return !1;
2227
2367
  try {
2228
- return s(), r.set(n, 0), r.set(i, 68), 1 === t.setEpoch(e, 132);
2368
+ return o(), r.set(n, 0), r.set(i, 68), 1 === t.setEpoch(e, 132);
2229
2369
  } catch {
2230
2370
  return !1;
2231
2371
  }
2232
2372
  },
2233
2373
  scratch: function() {
2234
- return s(), r;
2374
+ return o(), r;
2235
2375
  },
2236
- bind: function(r, o, c, f, h, d) {
2376
+ bind: function(r, s, c, f, h, d) {
2237
2377
  try {
2238
- s();
2378
+ o();
2239
2379
  let p = n;
2240
- if (i[p++] = r, p = u(o, p), p < 0) return null;
2241
- if (p = l(c >>> 0, p), p = u(f, p), p < 0) return null;
2380
+ if (i[p++] = r, p = a(s, p), p < 0) return null;
2381
+ if (p = l(c >>> 0, p), p = a(f, p), p < 0) return null;
2242
2382
  const y = h > 0 ? Math.floor(h) : 0;
2243
2383
  p = l(y % 4294967296, p), l(Math.floor(y / 4294967296), p);
2244
2384
  const g = t.bindBatch(e, d, n);
2245
- return g > 0 ? a(g) : null;
2385
+ return g > 0 ? u(g) : null;
2246
2386
  } catch {
2247
2387
  return null;
2248
2388
  }
2249
2389
  },
2250
2390
  sign: function(n, i) {
2251
- if (0 === n.length || n.length > Ot) return null;
2391
+ if (0 === n.length || n.length > Nt) return null;
2252
2392
  try {
2253
- s();
2254
- const o = on(n, r.subarray(0, Ot));
2255
- if (o <= 0) return null;
2256
- const u = t.read(e, o, i >>> 0);
2257
- return u > 0 ? a(u) : null;
2393
+ o();
2394
+ const s = fn(n, r.subarray(0, Nt));
2395
+ if (s <= 0) return null;
2396
+ const a = t.read(e, s, i >>> 0);
2397
+ return a > 0 ? u(a) : null;
2258
2398
  } catch {
2259
2399
  return null;
2260
2400
  }
2261
2401
  },
2262
2402
  memoryGrowths: function() {
2263
- return o;
2403
+ return s;
2264
2404
  }
2265
2405
  };
2266
- }(o);
2406
+ }(s);
2267
2407
  } catch {
2268
2408
  return null;
2269
2409
  }
2270
2410
  var e;
2271
2411
  }
2272
- function mn(t) {
2273
- const n = bn(t);
2412
+ function An(t) {
2413
+ const n = In(t);
2274
2414
  let e = 2166136261;
2275
2415
  for (let t = 0; t < n.length; t++) e ^= n.charCodeAt(t), e = Math.imul(e, 16777619);
2276
2416
  return `fnv1a:${(e >>> 0).toString(16).padStart(8, "0")}`;
2277
2417
  }
2278
- function bn(t) {
2279
- return Array.isArray(t) ? `[${t.map(bn).join(",")}]` : t && "object" == typeof t ? `{${Object.keys(t).sort().map((n) => `${JSON.stringify(n)}:${bn(t[n])}`).join(",")}}` : JSON.stringify(t) ?? "null";
2418
+ function In(t) {
2419
+ return Array.isArray(t) ? `[${t.map(In).join(",")}]` : t && "object" == typeof t ? `{${Object.keys(t).sort().map((n) => `${JSON.stringify(n)}:${In(t[n])}`).join(",")}}` : JSON.stringify(t) ?? "null";
2280
2420
  }
2281
- let kn = "";
2282
- function Sn() {
2421
+ let Rn = "";
2422
+ function En() {
2283
2423
  return "object" == typeof WebAssembly && null !== WebAssembly && "function" == typeof TextEncoder && "function" == typeof TextDecoder && !!globalThis.crypto?.subtle;
2284
2424
  }
2285
- function Tn(t) {
2425
+ function Mn(t) {
2286
2426
  const n = function() {
2287
- let t = 0, n = cn() ? performance.now() : null;
2427
+ let t = 0, n = gn() ? performance.now() : null;
2288
2428
  return {
2289
2429
  noteVisibility: function() {
2290
2430
  const e = performance.now();
2291
- cn() ? null === n && (n = e) : null !== n && (t += e - n, n = null);
2431
+ gn() ? null === n && (n = e) : null !== n && (t += e - n, n = null);
2292
2432
  },
2293
2433
  restart: function() {
2294
- t = 0, n = cn() ? performance.now() : null;
2434
+ t = 0, n = gn() ? performance.now() : null;
2295
2435
  },
2296
2436
  record: function(e) {
2297
- const i = /* @__PURE__ */ new Uint8Array(64), r = new DataView(i.buffer), o = "undefined" != typeof window, s = t + (null === n ? 0 : performance.now() - n);
2298
- return r.setUint32(4, ln(e.keyHolderRealm), !0), r.setUint32(8, ln(e.keyHolderRoundTripMs), !0), r.setUint32(12, ln(e.keyHolderStartMs), !0), r.setUint32(20, function() {
2437
+ const i = /* @__PURE__ */ new Uint8Array(64), r = new DataView(i.buffer), s = "undefined" != typeof window, o = t + (null === n ? 0 : performance.now() - n);
2438
+ return r.setUint32(4, yn(e.keyHolderRealm), !0), r.setUint32(8, yn(e.keyHolderRoundTripMs), !0), r.setUint32(12, yn(e.keyHolderStartMs), !0), r.setUint32(20, function() {
2299
2439
  const t = Function.prototype.toString, n = [
2300
2440
  globalThis.fetch,
2301
2441
  globalThis.EventTarget?.prototype?.addEventListener,
@@ -2311,20 +2451,20 @@ function Tn(t) {
2311
2451
  let e = 0;
2312
2452
  for (let i = 0; i < n.length; i++) {
2313
2453
  const r = n[i];
2314
- let o = !1;
2454
+ let s = !1;
2315
2455
  try {
2316
- o = "function" == typeof r && un.test(t.call(r));
2456
+ s = "function" == typeof r && pn.test(t.call(r));
2317
2457
  } catch {
2318
- o = !1;
2458
+ s = !1;
2319
2459
  }
2320
- o || (e |= 1 << i);
2460
+ s || (e |= 1 << i);
2321
2461
  }
2322
2462
  return e >>> 0;
2323
- }(), !0), r.setUint32(24, "undefined" != typeof navigator && !0 === navigator.webdriver ? 1 : 0, !0), r.setUint32(28, o ? ln(window.outerWidth - window.innerWidth) : 0, !0), r.setUint32(32, o ? ln(window.outerHeight - window.innerHeight) : 0, !0), r.setUint32(36, ln(s), !0), r.setUint32(40, cn() ? 0 : 1, !0), r.setUint32(44, ln(e.memoryGrowths), !0), i;
2463
+ }(), !0), r.setUint32(24, "undefined" != typeof navigator && !0 === navigator.webdriver ? 1 : 0, !0), r.setUint32(28, s ? yn(window.outerWidth - window.innerWidth) : 0, !0), r.setUint32(32, s ? yn(window.outerHeight - window.innerHeight) : 0, !0), r.setUint32(36, yn(o), !0), r.setUint32(40, gn() ? 0 : 1, !0), r.setUint32(44, yn(e.memoryGrowths), !0), i;
2324
2464
  }
2325
2465
  };
2326
2466
  }(), e = function(t, n) {
2327
- let e = null, i = null, r = null, o = "", s = "", a = "", l = -1, h = null, d = 0;
2467
+ let e = null, i = null, r = null, s = "", o = "", u = "", l = -1, h = null, d = 0;
2328
2468
  function p(t) {
2329
2469
  if ("string" == typeof t && n) try {
2330
2470
  n(new URL(t, globalThis.location?.href).href);
@@ -2339,24 +2479,24 @@ function Tn(t) {
2339
2479
  });
2340
2480
  }
2341
2481
  function g() {
2342
- return s ? e : null;
2482
+ return o ? e : null;
2343
2483
  }
2344
2484
  return {
2345
2485
  install: async function(n) {
2346
- const g = ++d, w = an(n?.n, 16), v = an(n?.kw, 32), m = n?.artifacts;
2486
+ const g = ++d, w = dn(n?.n, 16), v = dn(n?.kw, 32), m = n?.artifacts;
2347
2487
  if (!w || !v || !m || "string" != typeof n.s || !Number.isInteger(n.e) || n.e < 0) return "failed";
2348
2488
  const b = `${m.core?.sha256}|${m.keyHolder?.sha256}`;
2349
2489
  let k = e, S = r, T = i;
2350
- if (!k || !S || b !== o) {
2490
+ if (!k || !S || b !== s) {
2351
2491
  p(m.core?.url), p(m.keyHolder?.url);
2352
- const [t, n] = await Promise.all([vn(m.core), (A = m.keyHolder, wn(A, 24576) ? _(A.url, A.sha256, A.bytes, 3e4) : Promise.resolve(null))]);
2492
+ const [t, n] = await Promise.all([_n(m.core), (_ = m.keyHolder, Tn(_, 24576) ? B(_.url, _.sha256, _.bytes, 3e4) : Promise.resolve(null))]);
2353
2493
  if (g !== d) return "stale";
2354
2494
  if (!t || !n) return "failed";
2355
2495
  k = t, S = n, T = null;
2356
2496
  }
2357
- var A;
2358
- let I = null === T;
2359
- if (T) a = n.s, l = n.e, h = null;
2497
+ var _;
2498
+ let A = null === T;
2499
+ if (T) u = n.s, l = n.e, h = null;
2360
2500
  else {
2361
2501
  if (T = await async function(t) {
2362
2502
  return await function(t) {
@@ -2369,7 +2509,7 @@ function Tn(t) {
2369
2509
  p(), n(null);
2370
2510
  return;
2371
2511
  }
2372
- let o = 0, s = 0, a = 0, l = !1, h = !1;
2512
+ let s = 0, o = 0, u = 0, l = !1, h = !1;
2373
2513
  const d = /* @__PURE__ */ new Map();
2374
2514
  function p() {
2375
2515
  if (r) {
@@ -2392,30 +2532,30 @@ function Tn(t) {
2392
2532
  }
2393
2533
  function w(t, n, e) {
2394
2534
  return l ? Promise.resolve(null) : new Promise(function(r) {
2395
- const a = s++, u = c(function() {
2396
- d.delete(a) && (h = !0, r(null));
2535
+ const u = o++, a = c(function() {
2536
+ d.delete(u) && (h = !0, r(null));
2397
2537
  }, e);
2398
- d.set(a, {
2538
+ d.set(u, {
2399
2539
  settle: r,
2400
- timer: u,
2540
+ timer: a,
2401
2541
  sentAt: performance.now()
2402
2542
  });
2403
2543
  try {
2404
2544
  i.postMessage({
2405
- generation: o,
2406
- id: a,
2545
+ generation: s,
2546
+ id: u,
2407
2547
  op: t,
2408
2548
  input: n.buffer
2409
2549
  });
2410
2550
  } catch {
2411
- d.delete(a), f(u), r(null);
2551
+ d.delete(u), f(a), r(null);
2412
2552
  }
2413
2553
  });
2414
2554
  }
2415
- const v = u((t) => {
2555
+ const v = a((t) => {
2416
2556
  const n = t.data, e = d.get(n?.id);
2417
- e && (d.delete(n.id), f(e.timer), h = !1, a = performance.now() - e.sentAt, e.settle(n.generation === o ? n.output : null));
2418
- }), m = u((t) => {
2557
+ e && (d.delete(n.id), f(e.timer), h = !1, u = performance.now() - e.sentAt, e.settle(n.generation === s ? n.output : null));
2558
+ }), m = a((t) => {
2419
2559
  h = !0, y();
2420
2560
  });
2421
2561
  i.addEventListener("message", v), i.addEventListener("error", m), w(0, t.slice(), 2e3).then(function(t) {
@@ -2424,14 +2564,14 @@ function Tn(t) {
2424
2564
  realm: 1,
2425
2565
  startMs: performance.now() - e,
2426
2566
  lastRoundTripMs: function() {
2427
- return a;
2567
+ return u;
2428
2568
  },
2429
2569
  init: async function(t) {
2430
- const n = dn(t);
2431
- return !!n && (o++, y(), null !== await w(1, n, 2e3));
2570
+ const n = mn(t);
2571
+ return !!n && (s++, y(), null !== await w(1, n, 2e3));
2432
2572
  },
2433
2573
  advance: async function(t, n) {
2434
- const e = pn(t, n);
2574
+ const e = bn(t, n);
2435
2575
  if (!e) return null;
2436
2576
  const i = await w(2, e, 2e3);
2437
2577
  return i && 68 === i.byteLength ? new Uint8Array(i) : null;
@@ -2443,40 +2583,40 @@ function Tn(t) {
2443
2583
  });
2444
2584
  });
2445
2585
  });
2446
- }(t) || yn(t);
2586
+ }(t) || kn(t);
2447
2587
  }(S), g !== d) return T?.dispose(), "stale";
2448
2588
  if (!T) return "failed";
2449
2589
  }
2450
- let R = await T.init({
2590
+ let I = await T.init({
2451
2591
  s: n.s,
2452
2592
  kw: v
2453
- }), E = R ? await T.advance(n.e, w) : null;
2454
- if (g !== d) return I && T.dispose(), "stale";
2455
- if (!E && 1 === T.realm && T.stalled()) {
2456
- const t = await yn(S);
2457
- if (t && (R = await t.init({
2593
+ }), R = I ? await T.advance(n.e, w) : null;
2594
+ if (g !== d) return A && T.dispose(), "stale";
2595
+ if (!R && 1 === T.realm && T.stalled()) {
2596
+ const t = await kn(S);
2597
+ if (t && (I = await t.init({
2458
2598
  s: n.s,
2459
2599
  kw: v
2460
- }), E = R ? await t.advance(n.e, w) : null), g !== d) return t?.dispose(), I && T.dispose(), "stale";
2461
- t && (I && T.dispose(), T = t, I = !0);
2600
+ }), R = I ? await t.advance(n.e, w) : null), g !== d) return t?.dispose(), A && T.dispose(), "stale";
2601
+ t && (A && T.dispose(), T = t, A = !0);
2462
2602
  }
2463
- return t.restart(), E && k.setEpoch(E, y(T, k)) ? (i && i !== T && i.dispose(), e = k, i = T, r = S, o = b, s = n.s, a = n.s, l = n.e, h = null, "ok") : (I && T.dispose(), "failed");
2603
+ return t.restart(), R && k.setEpoch(R, y(T, k)) ? (i && i !== T && i.dispose(), e = k, i = T, r = S, s = b, o = n.s, u = n.s, l = n.e, h = null, "ok") : (A && T.dispose(), "failed");
2464
2604
  },
2465
2605
  advance: function(t, n, r) {
2466
- const o = i, s = e;
2467
- if (!o || !s || t !== a) return;
2606
+ const s = i, o = e;
2607
+ if (!s || !o || t !== u) return;
2468
2608
  if (!Number.isInteger(n) || n <= l) return;
2469
2609
  if (h && n <= h.e) return;
2470
- const u = an(r, 16);
2471
- if (!u) return;
2610
+ const a = dn(r, 16);
2611
+ if (!a) return;
2472
2612
  const c = { e: n };
2473
- h = c, o.advance(n, u).then(function(r) {
2474
- h === c && (h = null), r && o === i && s === e && (t !== a || n <= l || s.setEpoch(r, y(o, s)) && (l = n));
2613
+ h = c, s.advance(n, a).then(function(r) {
2614
+ h === c && (h = null), r && s === i && o === e && (t !== u || n <= l || o.setEpoch(r, y(s, o)) && (l = n));
2475
2615
  });
2476
2616
  },
2477
2617
  boundCore: g,
2478
2618
  sessionId: function() {
2479
- return s;
2619
+ return o;
2480
2620
  },
2481
2621
  prove: function(t) {
2482
2622
  const n = g()?.bind(1, "", 0, t, 0, 0);
@@ -2492,183 +2632,183 @@ function Tn(t) {
2492
2632
  }
2493
2633
  };
2494
2634
  }(n, t.onArtifactUrl);
2495
- let i = !1, r = "idle", o = 0, s = null, a = !1, l = null, d = null, p = 0, g = null, w = null, v = !1, m = !1, b = 0, k = 0, S = null, T = !1, A = !1, I = !1, R = [], E = !1, M = null;
2496
- function C(n) {
2635
+ let i = !1, r = "idle", s = 0, o = null, u = !1, l = null, d = null, p = 0, y = null, w = null, v = !1, m = !1, b = 0, k = 0, S = null, T = !1, _ = !1, A = !1, I = [], R = !1, E = null;
2636
+ function M(n) {
2497
2637
  const e = "pending" === r;
2498
2638
  if (r = n, "pending" === n) return;
2499
- const i = R;
2500
- R = [];
2639
+ const i = I;
2640
+ I = [];
2501
2641
  for (const t of i) t();
2502
- e && !I && (I = !0, t.onBindSettled());
2642
+ e && !A && (A = !0, t.onBindSettled());
2503
2643
  }
2504
- function $() {
2505
- if (P(), !a) return;
2644
+ function C() {
2645
+ if (P(), !u) return;
2506
2646
  const t = h(new Promise(function(t) {
2507
2647
  w = t;
2508
2648
  }), 1e3).then(function() {
2509
- g === t && (g = null);
2649
+ y === t && (y = null);
2510
2650
  });
2511
- g = t;
2651
+ y = t;
2512
2652
  }
2513
2653
  function P() {
2514
2654
  const t = w;
2515
- w = null, g = null, t?.();
2655
+ w = null, y = null, t?.();
2516
2656
  }
2517
- function x() {
2657
+ function $() {
2518
2658
  d && (f(d.timer), d = null);
2519
2659
  }
2520
2660
  function U(n) {
2521
- x(), A = !1;
2522
- const i = t.ensureTabId(), s = l ? null : e.prove(i), a = l ?? s, u = {
2661
+ $(), _ = !1;
2662
+ const i = t.ensureTabId(), o = l ? null : e.prove(i), u = l ?? o, a = {
2523
2663
  v: 1,
2524
- rid: xt(),
2664
+ rid: Dt(),
2525
2665
  tabId: i,
2526
2666
  release: "ts-1.5.0"
2527
2667
  };
2528
- return S && (u.avoid = S, S = null), t.collectorsFingerprint && (u.collectors = t.collectorsFingerprint), a && (u.prev = a), d = {
2529
- body: u,
2668
+ return S && (a.avoid = S, S = null), t.collectorsFingerprint && (a.collectors = t.collectorsFingerprint), u && (a.prev = u), d = {
2669
+ body: a,
2530
2670
  viaActivity: n,
2531
2671
  attempt: 0,
2532
2672
  timer: null,
2533
2673
  dueAt: 0,
2534
- ownProof: s ? s.s : ""
2535
- }, e.boundCore() || "pending" === r || (r = "pending", o = performance.now()), d;
2674
+ ownProof: o ? o.s : ""
2675
+ }, e.boundCore() || "pending" === r || (r = "pending", s = performance.now()), d;
2536
2676
  }
2537
- function B(t, n) {
2538
- if (!0 !== n.enabled) return d = null, l = null, P(), void (e.boundCore() || C("off"));
2677
+ function x(t, n) {
2678
+ if (!0 !== n.enabled) return d = null, l = null, P(), void (e.boundCore() || M("off"));
2539
2679
  n.session ? (d = null, function(t, n) {
2540
- const r = Number(t.renewAfterMs), o = r > 0 ? performance.now() + r : 0;
2680
+ const r = Number(t.renewAfterMs), s = r > 0 ? performance.now() + r : 0;
2541
2681
  v = !0, e.install(t).then(function(r) {
2542
2682
  if ("stale" !== r) {
2543
2683
  if (v = !1, P(), "ok" === r) {
2544
- l = null, m = !1, b = 0, k = 0, p = o, null === s && (s = performance.now()), C("ok");
2545
- const t = E || !n ? null : n;
2546
- E = !1;
2684
+ l = null, m = !1, b = 0, k = 0, p = s, null === o && (o = performance.now()), M("ok");
2685
+ const t = R || !n ? null : n;
2686
+ R = !1;
2547
2687
  try {
2548
- M?.({
2688
+ E?.({
2549
2689
  session: e.sessionId(),
2550
2690
  linkedFrom: t
2551
2691
  });
2552
2692
  } catch {}
2553
2693
  return;
2554
2694
  }
2555
- e.boundCore() || C("core-failed"), b++, k = performance.now() + Math.min(1e3 * 2 ** (b - 1), 3e4), !m && i && (m = !0, "string" == typeof t.variant && (S = t.variant), z(), e.boundCore() || C("core-failed"));
2695
+ e.boundCore() || M("core-failed"), b++, k = performance.now() + Math.min(1e3 * 2 ** (b - 1), 3e4), !m && i && (m = !0, "string" == typeof t.variant && (S = t.variant), O(), e.boundCore() || M("core-failed"));
2556
2696
  }
2557
2697
  });
2558
- }(n.session, t.ownProof)) : O(t);
2698
+ }(n.session, t.ownProof)) : j(t);
2559
2699
  }
2560
- function O(t) {
2561
- if (P(), e.boundCore() || C("session-failed"), !i) return void (d = null);
2700
+ function j(t) {
2701
+ if (P(), e.boundCore() || M("session-failed"), !i) return void (d = null);
2562
2702
  t.attempt++;
2563
2703
  const n = Math.min(1e3 * 2 ** (t.attempt - 1), 3e4);
2564
2704
  t.dueAt = performance.now() + n, t.timer = c(function() {
2565
- t.timer = null, j(t);
2705
+ t.timer = null, z(t);
2566
2706
  }, n);
2567
2707
  }
2568
- function j(n) {
2708
+ function z(n) {
2569
2709
  if (d === n) {
2570
2710
  if (!i || !t.isActivityActive()) return d = null, void P();
2571
2711
  n.dueAt = 0, t.requestSession(n.body).then(function(t) {
2572
2712
  if (d !== n) return;
2573
2713
  const e = t.ok ? t.data : null, i = e && "enabled" in e ? e : e?.pulseguard;
2574
- i ? B(n, i) : O(n);
2714
+ i ? x(n, i) : j(n);
2575
2715
  }).catch(function() {
2576
- d === n && O(n);
2716
+ d === n && j(n);
2577
2717
  });
2578
2718
  }
2579
2719
  }
2580
- function z() {
2581
- i && Sn() && "off" !== r && (d || v || j(U(!1)));
2720
+ function O() {
2721
+ i && En() && "off" !== r && (d || v || z(U(!1)));
2582
2722
  }
2583
2723
  function D() {
2584
2724
  const t = performance.now();
2585
- d ? null !== d.timer && d.dueAt > 0 && t >= d.dueAt && (f(d.timer), d.timer = null, j(d)) : p > 0 && t >= p && (p = 0, z());
2725
+ d ? null !== d.timer && d.dueAt > 0 && t >= d.dueAt && (f(d.timer), d.timer = null, z(d)) : p > 0 && t >= p && (p = 0, O());
2586
2726
  }
2587
- function F() {
2727
+ function L() {
2588
2728
  T = !1;
2589
- const t = y.get(Bt);
2729
+ const t = g.get(Ft);
2590
2730
  (function(t) {
2591
2731
  const n = t;
2592
2732
  return !!n && "string" == typeof n.s && n.s.startsWith("pulseguard_") && Number.isInteger(n.e) && "string" == typeof n.o && "string" == typeof n.t;
2593
- })(t) && t.s !== kn && t.s !== e.sessionId() && (l = t), y.remove(Bt);
2733
+ })(t) && t.s !== Rn && t.s !== e.sessionId() && (l = t), g.remove(Ft);
2594
2734
  }
2595
- function L(t) {
2596
- return e.boundCore() && null !== s ? {
2735
+ function F(t) {
2736
+ return e.boundCore() && null !== o ? {
2597
2737
  pulseguard: "ok",
2598
- pulseguardMs: Math.max(0, s - t)
2738
+ pulseguardMs: Math.max(0, o - t)
2599
2739
  } : "off" === r || "session-failed" === r || "core-failed" === r ? { pulseguard: r } : { pulseguard: "timeout" };
2600
2740
  }
2601
2741
  return {
2602
2742
  start: function() {
2603
- i = !0, I = !1, Sn() ? F() : r = "core-failed";
2743
+ i = !0, A = !1, En() ? L() : r = "core-failed";
2604
2744
  },
2605
2745
  stop: function() {
2606
- i = !1, x(), P(), v = !1, A = !1, E = !1, e.stop(), "pending" === r && C(null === s ? "idle" : "ok");
2746
+ i = !1, $(), P(), v = !1, _ = !1, R = !1, e.stop(), "pending" === r && M(null === o ? "idle" : "ok");
2607
2747
  },
2608
2748
  beginActivityRequest: function() {
2609
- if (i && Sn()) return U(!0).body;
2749
+ if (i && En()) return U(!0).body;
2610
2750
  },
2611
2751
  onActivityStarted: function(t) {
2612
2752
  const n = d;
2613
2753
  if (n && n.viaActivity) {
2614
- if (null === t) return d = null, P(), void (e.boundCore() || C("session-failed"));
2615
- "pending" === r && (o = performance.now()), t ? ($(), B(n, t)) : B(n, { enabled: !1 });
2754
+ if (null === t) return d = null, P(), void (e.boundCore() || M("session-failed"));
2755
+ "pending" === r && (s = performance.now()), t ? (C(), x(n, t)) : x(n, { enabled: !1 });
2616
2756
  }
2617
2757
  },
2618
2758
  onActivityAdopted: function() {
2619
- $(), z(), d || v || P();
2759
+ C(), O(), d || v || P();
2620
2760
  },
2621
2761
  onRestore: function() {
2622
- A = !0;
2762
+ _ = !0;
2623
2763
  },
2624
2764
  onResumed: function() {
2625
- A && (A = !1, z());
2765
+ _ && (_ = !1, O());
2626
2766
  },
2627
2767
  bindHoldMs: function() {
2628
- return "pending" !== r || I || e.boundCore() ? 0 : Math.max(0, o + 3e3 - performance.now());
2768
+ return "pending" !== r || A || e.boundCore() ? 0 : Math.max(0, s + 3e3 - performance.now());
2629
2769
  },
2630
2770
  canBind: function() {
2631
2771
  return null !== e.boundCore();
2632
2772
  },
2633
2773
  isOff: function() {
2634
- return "off" === r || !Sn();
2774
+ return "off" === r || !En();
2635
2775
  },
2636
2776
  bind: function(t, n) {
2637
2777
  const i = e.boundCore();
2638
2778
  if (!i) return null;
2639
2779
  const r = function(t, n, e) {
2640
- const i = on(e, t.scratch());
2780
+ const i = fn(e, t.scratch());
2641
2781
  if (i < 0) return null;
2642
2782
  const r = t.bind(0, n.batchId, n.batchSequence, n.tabId, n.clientTimestamp, i);
2643
2783
  if (!r) return null;
2644
- let o;
2784
+ let s;
2645
2785
  try {
2646
- o = JSON.parse(r);
2786
+ s = JSON.parse(r);
2647
2787
  } catch {
2648
2788
  return null;
2649
2789
  }
2650
- const s = (a = JSON.stringify({
2790
+ const o = (u = JSON.stringify({
2651
2791
  ...n,
2652
- pulseguard: o
2653
- }), en ? en.encode(a) : /* @__PURE__ */ new Uint8Array(0));
2654
- var a;
2792
+ pulseguard: s
2793
+ }), ln ? ln.encode(u) : /* @__PURE__ */ new Uint8Array(0));
2794
+ var u;
2655
2795
  if (0 === i) return {
2656
- body: s,
2657
- sessionId: o.s
2796
+ body: o,
2797
+ sessionId: s.s
2658
2798
  };
2659
- const u = new Uint8Array(s.length + 1 + i);
2660
- return u.set(s, 0), u[s.length] = 10, u.set(t.scratch().subarray(0, i), s.length + 1), {
2661
- body: u,
2662
- sessionId: o.s
2799
+ const a = new Uint8Array(o.length + 1 + i);
2800
+ return a.set(o, 0), a[o.length] = 10, a.set(t.scratch().subarray(0, i), o.length + 1), {
2801
+ body: a,
2802
+ sessionId: s.s
2663
2803
  };
2664
2804
  }(i, t, n);
2665
- return r ? (a = !0, D(), r) : null;
2805
+ return r ? (u = !0, D(), r) : null;
2666
2806
  },
2667
2807
  settling: function() {
2668
- return g;
2808
+ return y;
2669
2809
  },
2670
2810
  onIngestResponse: function(t, n) {
2671
- T && F(), t && "object" == typeof t && (1 === t.r && n === e.sessionId() && performance.now() >= k && (E = !0, z()), e.advance(n, t.e, t.n));
2811
+ T && L(), t && "object" == typeof t && (1 === t.r && n === e.sessionId() && performance.now() >= k && (R = !0, O()), e.advance(n, t.e, t.n));
2672
2812
  },
2673
2813
  signDocument: function(t) {
2674
2814
  return e.boundCore()?.sign(t, 0) ?? null;
@@ -2677,33 +2817,33 @@ function Tn(t) {
2677
2817
  return e.sessionId();
2678
2818
  },
2679
2819
  onSessionInstalled: function(t) {
2680
- M = t;
2820
+ E = t;
2681
2821
  },
2682
2822
  telemetry: function(t, n) {
2683
2823
  const e = t + 3e3 - performance.now();
2684
- if ("pending" !== r || e <= 0) return n(L(t)), function() {};
2824
+ if ("pending" !== r || e <= 0) return n(F(t)), function() {};
2685
2825
  let i = !1;
2686
- function o() {
2687
- i || (i = !0, f(s), n(L(t)));
2826
+ function s() {
2827
+ i || (i = !0, f(o), n(F(t)));
2688
2828
  }
2689
- const s = c(o, e);
2690
- return R.push(o), o;
2829
+ const o = c(s, e);
2830
+ return I.push(s), s;
2691
2831
  },
2692
2832
  storeProof: function() {
2693
2833
  const n = e.prove(t.ensureTabId());
2694
- n && (kn = n.s, T = !0, y.set(Bt, n));
2834
+ n && (Rn = n.s, T = !0, g.set(Ft, n));
2695
2835
  },
2696
- settleStoredProof: F,
2836
+ settleStoredProof: L,
2697
2837
  onVisibilityChange: function() {
2698
2838
  n.noteVisibility(), "undefined" != typeof document && "visible" === document.visibilityState && D();
2699
2839
  }
2700
2840
  };
2701
2841
  }
2702
- async function _n(e, r) {
2703
- const { collectors: o, sdk: a } = e;
2704
- let l = null, c = null, f = null, h = null;
2842
+ async function Cn(e, r) {
2843
+ const { collectors: s, sdk: u } = e;
2844
+ let l = null, c = null, f = null, h = null, d = !1;
2705
2845
  try {
2706
- const e = /* @__PURE__ */ new Set(), d = Tn({
2846
+ const e = /* @__PURE__ */ new Set(), p = Mn({
2707
2847
  onArtifactUrl: (t) => {
2708
2848
  e.add(t);
2709
2849
  },
@@ -2711,48 +2851,55 @@ async function _n(e, r) {
2711
2851
  ensureTabId: () => h?.getTabId() ?? "",
2712
2852
  isActivityActive: () => c?.isActive() ?? !1,
2713
2853
  onBindSettled: () => f?.releaseBindHold(),
2714
- collectorsFingerprint: mn(o)
2854
+ collectorsFingerprint: An(s)
2715
2855
  });
2716
- l = tn({
2856
+ l = un({
2717
2857
  api: {
2718
- version: a.api.version,
2719
- url: a.api.url
2858
+ version: u.api.version,
2859
+ url: u.api.url
2720
2860
  },
2721
- getSdkToken: () => a.token,
2861
+ getSdkToken: () => u.token,
2722
2862
  getProfileId: () => r.getProfileId(),
2723
2863
  getToken: () => c?.getToken() ?? null,
2724
- refresh: async () => c?.refresh() ?? Promise.resolve(),
2864
+ refresh: async (t) => c?.refresh(t) ?? Promise.resolve(),
2725
2865
  getActivityId: () => c?.getActivityId() ?? "",
2726
- pulseGuard: d
2866
+ pulseGuard: p
2727
2867
  });
2728
- const p = await l.api.collectionStatus();
2729
- if (!p.ok || !0 !== p.data.eventsCollectionEnabled) return { status: "collection-disabled" };
2730
- c = new kt({
2731
- startActivity: () => l.api.startActivity(d.beginActivityRequest()),
2868
+ const y = await l.api.collectionStatus();
2869
+ if (!y.ok || !0 !== y.data.eventsCollectionEnabled) return { status: "collection-disabled" };
2870
+ c = new P({
2871
+ startActivity: () => l.api.startActivity(p.beginActivityRequest()),
2732
2872
  stopActivity: () => l.api.stopActivity(),
2733
- onActivityStarted: (t) => d.onActivityStarted(t),
2734
- onActivityAdopted: () => d.onActivityAdopted()
2735
- }), f = new jt(D, {
2736
- ingest: (t, n) => l.api.ingest(t, n),
2873
+ onActivityStarted: (t) => {
2874
+ p.onActivityStarted(t), null !== t && f?.requestFlush(!1);
2875
+ },
2876
+ onActivityAdopted: () => {
2877
+ p.onActivityAdopted(), f?.requestFlush(!1);
2878
+ },
2879
+ onRefused: () => {
2880
+ d = !0, r.onActivityRefused?.();
2881
+ }
2882
+ }), f = new qt(Q, {
2883
+ ingest: (t, n, e) => l.api.ingest(t, n, e),
2737
2884
  getTabId: () => h?.getTabId() ?? "unknown",
2738
2885
  isActivityActive: () => c?.isActive() ?? !1,
2739
- getBindHoldMs: () => d.bindHoldMs(),
2740
- isBound: () => d.canBind()
2886
+ getBindHoldMs: () => p.bindHoldMs(),
2887
+ isBound: () => p.canBind()
2741
2888
  });
2742
- const y = o.tab;
2743
- h = new qt({
2889
+ const g = s.tab;
2890
+ h = new Kt({
2744
2891
  push: (t) => f?.push(t),
2745
2892
  events: {
2746
- state: y.enabled && y.events.state.enabled,
2747
- count: y.enabled && y.events.count.enabled
2893
+ state: g.enabled && g.events.state.enabled,
2894
+ count: g.enabled && g.events.count.enabled
2748
2895
  }
2749
2896
  });
2750
- const g = /* @__PURE__ */ new Set();
2897
+ const w = /* @__PURE__ */ new Set();
2751
2898
  try {
2752
- g.add(new URL(a.api.url).origin);
2899
+ w.add(new URL(u.api.url).origin);
2753
2900
  } catch {}
2754
- const w = function(t, n, e = "off") {
2755
- const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), o = {
2901
+ const v = function(t, n, e = tt) {
2902
+ const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = {
2756
2903
  ...t,
2757
2904
  registerBehaviourReader: function(t) {
2758
2905
  return r.add(t), function() {
@@ -2761,20 +2908,20 @@ async function _n(e, r) {
2761
2908
  },
2762
2909
  collectorSelection: n
2763
2910
  };
2764
- function a(t) {
2911
+ function u(t) {
2765
2912
  if (i.has(t)) return;
2766
- const r = ot[t];
2913
+ const r = mt[t];
2767
2914
  if (!r || !function(t, n) {
2768
2915
  return n[t]?.enabled ?? !1;
2769
2916
  }(t, n)) return;
2770
- if (H.includes(t) && !function(t) {
2917
+ if (rt.includes(t) && !function(t) {
2771
2918
  return !0 === t.fpsignals?.enabled;
2772
2919
  }(n)) return;
2773
- const s = n[t], a = r.create(o, e, s && "events" in s ? s.events : void 0);
2774
- i.set(t, a);
2920
+ const o = n[t], u = r.create(s, e, o && "events" in o ? o.events : void 0);
2921
+ i.set(t, u);
2775
2922
  }
2776
2923
  return {
2777
- start: a,
2924
+ start: u,
2778
2925
  stopCollector: function(t) {
2779
2926
  const n = i.get(t);
2780
2927
  n && (n(), i.delete(t));
@@ -2787,67 +2934,67 @@ async function _n(e, r) {
2787
2934
  return i.has(t);
2788
2935
  },
2789
2936
  autocapture: function() {
2790
- a("fpsignals");
2791
- for (const t of st) a(t);
2937
+ u("fpsignals");
2938
+ for (const t of bt) u(t);
2792
2939
  },
2793
2940
  readBehaviour: function(t) {
2794
2941
  let n = !1;
2795
- for (const e of r) s(() => e(t)) && (n = !0);
2942
+ for (const e of r) o(() => e(t)) && (n = !0);
2796
2943
  return n;
2797
2944
  }
2798
2945
  };
2799
2946
  }({
2800
2947
  push: (t) => f?.push(t),
2801
2948
  flush: () => f?.flush("submit"),
2802
- sanitizeUrl: a.sanitizeUrl,
2803
- ignoredOrigins: g,
2949
+ sanitizeUrl: u.sanitizeUrl,
2950
+ ignoredOrigins: w,
2804
2951
  ignoredUrls: e,
2805
- host: a.host,
2952
+ host: u.host,
2806
2953
  getTabId: () => h?.getTabId() ?? "",
2807
- captureElementLevel: a.capture?.element ?? F,
2954
+ captureElementLevel: u.capture?.element ?? Y,
2808
2955
  requestFlush: (t) => f?.requestFlush(t),
2809
2956
  getActivityId: () => c?.getActivityId() ?? "",
2810
2957
  registerEventRouter: (t) => (f?.setEventRouter(t), function() {
2811
2958
  f?.getEventRouter() === t && f.setEventRouter(null);
2812
2959
  }),
2813
2960
  pulseGuard: {
2814
- signDocument: (t) => d.signDocument(t),
2815
- sessionId: () => d.sessionId(),
2816
- onSessionInstalled: (t) => d.onSessionInstalled(t),
2817
- isOff: () => d.isOff(),
2818
- telemetry: (t, n) => d.telemetry(t, n)
2961
+ signDocument: (t) => p.signDocument(t),
2962
+ sessionId: () => p.sessionId(),
2963
+ onSessionInstalled: (t) => p.onSessionInstalled(t),
2964
+ isOff: () => p.isOff(),
2965
+ telemetry: (t, n) => p.telemetry(t, n)
2819
2966
  }
2820
- }, o, a.capture?.content), v = function(e) {
2967
+ }, s, u.capture?.content), m = function(e) {
2821
2968
  let i = !1;
2822
2969
  function r(t) {
2823
- s(() => e.isActivityActive()) && (s(() => e.holdCapacityFlush(function() {
2824
- "pagehide" === t && s(() => e.stopTab()), s(() => e.readBehaviour(t));
2825
- })), s(() => e.flush()), s(() => e.storeSessionProof?.()), "pagehide" === t && (e.getShouldSkipStopActivity() || e.stopActivity()));
2970
+ o(() => e.isActivityActive()) && (o(() => e.holdCapacityFlush(function() {
2971
+ "pagehide" === t && o(() => e.stopTab()), o(() => e.readBehaviour(t));
2972
+ })), o(() => e.flush()), o(() => e.storeSessionProof?.()), "pagehide" === t && (e.getShouldSkipStopActivity() || e.stopActivity()));
2826
2973
  }
2827
- const o = u((t) => {
2828
- "visible" === document.visibilityState && s(() => e.settleSessionProof?.()), s(() => e.onVisibilityChange?.()), "hidden" === document.visibilityState && r("hidden");
2829
- }), a = u((t) => {
2974
+ const s = a((t) => {
2975
+ "visible" === document.visibilityState && o(() => e.settleSessionProof?.()), o(() => e.onVisibilityChange?.()), "hidden" === document.visibilityState && r("hidden");
2976
+ }), u = a((t) => {
2830
2977
  r("pagehide");
2831
- }), l = u((t) => {
2978
+ }), l = a((t) => {
2832
2979
  r("beforeunload");
2833
- }), c = u((t) => {
2834
- s(() => e.settleSessionProof?.()), t.persisted && e.resume();
2835
- }), f = u(() => e.onConnectionChange());
2980
+ }), c = a((t) => {
2981
+ o(() => e.settleSessionProof?.()), t.persisted && e.resume();
2982
+ }), f = a(() => e.onConnectionChange());
2836
2983
  return {
2837
2984
  start: function() {
2838
- t(document, "visibilitychange", o), t(window, "pagehide", a), function() {
2985
+ t(document, "visibilitychange", s), t(window, "pagehide", u), function() {
2839
2986
  if ("undefined" == typeof navigator) return !1;
2840
2987
  const t = navigator.userAgentData;
2841
2988
  return t && "boolean" == typeof t.mobile ? !t.mobile : !/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent ?? "");
2842
2989
  }() && !/Firefox\//.test(navigator.userAgent ?? "") && (t(window, "beforeunload", l), i = !0), t(window, "pageshow", c), t(window, "online", f), t(window, "offline", f);
2843
2990
  },
2844
2991
  stop: function() {
2845
- n(document, "visibilitychange", o), n(window, "pagehide", a), i && (n(window, "beforeunload", l), i = !1), n(window, "pageshow", c), n(window, "online", f), n(window, "offline", f);
2992
+ n(document, "visibilitychange", s), n(window, "pagehide", u), i && (n(window, "beforeunload", l), i = !1), n(window, "pageshow", c), n(window, "online", f), n(window, "offline", f);
2846
2993
  },
2847
2994
  onHide: r
2848
2995
  };
2849
2996
  }({
2850
- readBehaviour: (t) => w.readBehaviour(t),
2997
+ readBehaviour: (t) => v.readBehaviour(t),
2851
2998
  isActivityActive: () => c?.isActive() ?? !1,
2852
2999
  holdCapacityFlush: (t) => {
2853
3000
  f ? f.holdCapacityFlush(t) : t();
@@ -2856,18 +3003,23 @@ async function _n(e, r) {
2856
3003
  stopActivity: async () => c?.stop(),
2857
3004
  stopTab: () => h?.stop(),
2858
3005
  getShouldSkipStopActivity: () => (h?.queryTabsNumber() ?? 0) > 1,
2859
- onConnectionChange: () => f?.onConnectionChange(),
2860
- storeSessionProof: () => d.storeProof(),
2861
- settleSessionProof: () => d.settleStoredProof(),
2862
- onVisibilityChange: () => d.onVisibilityChange(),
3006
+ onConnectionChange: () => {
3007
+ f?.onConnectionChange(), c?.retryNow();
3008
+ },
3009
+ storeSessionProof: () => p.storeProof(),
3010
+ settleSessionProof: () => p.settleStoredProof(),
3011
+ onVisibilityChange: () => {
3012
+ p.onVisibilityChange(), "visible" === document.visibilityState && c?.retryNow();
3013
+ },
2863
3014
  resume: async () => {
2864
3015
  try {
2865
- d.onRestore(), await c?.start(), await h?.start(), d.onResumed();
3016
+ if (p.onRestore(), await c?.start(), d) return;
3017
+ await h?.start(), p.onResumed();
2866
3018
  } catch (t) {
2867
3019
  i.warn("IncodeTRI", "resume after bfcache restore failed:", t);
2868
3020
  }
2869
3021
  }
2870
- }), m = new nn({
3022
+ }), b = new an({
2871
3023
  getActivityId: () => c?.getActivityId() ?? "",
2872
3024
  reportEvent: (t) => l.api.reportEvent(t)
2873
3025
  });
@@ -2878,130 +3030,217 @@ async function _n(e, r) {
2878
3030
  activityManager: c,
2879
3031
  transportManager: f,
2880
3032
  tabManager: h,
2881
- lifecycleManager: v,
2882
- collectorManager: w,
2883
- eventReportManager: m,
2884
- pulseGuard: d
3033
+ lifecycleManager: m,
3034
+ collectorManager: v,
3035
+ eventReportManager: b,
3036
+ pulseGuard: p
2885
3037
  }
2886
3038
  };
2887
3039
  } catch (t) {
2888
3040
  return i.warn("IncodeTRI", "setup() failed during construction:", t), { status: "init-failed" };
2889
3041
  }
2890
3042
  }
2891
- let An = class t {
3043
+ function Pn(t) {
3044
+ return "object" == typeof t && null !== t && !Array.isArray(t);
3045
+ }
3046
+ function $n(t) {
3047
+ return "string" == typeof t && "" !== t ? t : void 0;
3048
+ }
3049
+ function Un(t, n) {
3050
+ if (!Pn(n)) return n;
3051
+ const e = {};
3052
+ for (const t of Object.keys(n).sort()) e[t] = n[t];
3053
+ return e;
3054
+ }
3055
+ const xn = {
3056
+ apiURL: "",
3057
+ org: void 0,
3058
+ source: void 0,
3059
+ settings: null,
3060
+ sanitizeUrl: void 0
3061
+ };
3062
+ function jn(t) {
3063
+ return o(() => function(t) {
3064
+ const n = function(t) {
3065
+ if ("string" != typeof t) return {};
3066
+ const n = o(() => k.decode(t));
3067
+ return Pn(n) ? n : {};
3068
+ }(t?.token);
3069
+ return {
3070
+ apiURL: "string" == typeof t?.apiURL ? d(t.apiURL) : "",
3071
+ org: $n(n.org_ref),
3072
+ source: $n(n.source_id),
3073
+ settings: o(() => JSON.stringify({
3074
+ capture: {
3075
+ element: t?.capture?.element ?? Y,
3076
+ content: t?.capture?.content ?? tt
3077
+ },
3078
+ layers: t?.layers,
3079
+ collectors: t?.collectors,
3080
+ apiVersion: t?.apiVersion ?? "1.0"
3081
+ }, Un)) ?? null,
3082
+ sanitizeUrl: t?.sanitizeUrl
3083
+ };
3084
+ }(t)) ?? xn;
3085
+ }
3086
+ let zn = class t {
2892
3087
  constructor() {
2893
- this.Lt = 0, this.Nt = null, this.qt = U;
3088
+ this.tn = 0, this.nn = null, this.en = W, this.rn = null, this.sn = /* @__PURE__ */ new Map();
2894
3089
  }
2895
3090
  static get instance() {
2896
3091
  return t.u || (t.u = new t()), t.u;
2897
3092
  }
2898
3093
  async setup(t) {
2899
- if (this.qt !== U) return i.fatal("error", "setup()", `cannot set up from state '${this.qt}' — call reset() (or reload) first. Ignoring.`), z;
3094
+ const n = this.rn;
3095
+ if (n) {
3096
+ if (!o(() => Tt(t))) return X;
3097
+ const e = function(t, n) {
3098
+ return n.apiURL !== t.apiURL ? `with another apiURL (${t.apiURL})` : t.org && n.org && t.org !== n.org ? "for another organization" : n.source && n.source !== t.source ? "for another source" : null === n.settings || n.settings !== t.settings ? "with other capture, layers, collectors or apiVersion settings" : n.sanitizeUrl !== t.sanitizeUrl ? "with another sanitizeUrl" : void 0;
3099
+ }(n.identity, jn(t));
3100
+ return e ? (i.fatal("warn", "setup()", `another setup() is still running ${e}. Ignoring.`), X) : (i.warn("setup()", "joining the setup() that is still running."), n.result);
3101
+ }
3102
+ if (this.en !== W) return i.fatal("error", "setup()", `cannot set up from state '${this.en}' — call reset() (or reload) first. Ignoring.`), X;
3103
+ const e = {
3104
+ identity: jn(t),
3105
+ result: Promise.resolve(W),
3106
+ stopped: !1,
3107
+ cancelled: !1
3108
+ };
3109
+ return this.rn = e, e.result = this.un(t, e), e.result;
3110
+ }
3111
+ async un(t, n) {
2900
3112
  try {
2901
- const n = function(t) {
2902
- if ("undefined" == typeof document) return i.fatal("error", "IncodeTRI", "TRI is not available in a non-browser environment."), null;
2903
- if (!t?.token) return i.fatal("error", "SDK", "token is required."), null;
2904
- if (!t.apiURL) return i.fatal("error", "SDK", "Couldn't initialise SDK — apiURL isn't provided."), null;
2905
- const { element: n, content: e } = t.capture ?? {}, r = {
2906
- token: t.token,
2907
- capture: {
2908
- element: n ?? F,
2909
- content: e ?? "off"
2910
- },
2911
- api: {
2912
- version: t.apiVersion ?? "1.0",
2913
- url: t.apiURL
2914
- },
2915
- sanitizeUrl: (a = t.sanitizeUrl, a ? function(t) {
2916
- return s(() => a(t, ut)) ?? ut(t);
2917
- } : ut),
2918
- host: (o = t.host, "string" == typeof o?.platform && "" !== o.platform && "string" == typeof o.version && "" !== o.version ? {
2919
- platform: o.platform,
2920
- version: o.version
2921
- } : (void 0 !== o && i.warn("SDK", "host needs a non-empty platform and version — reporting TRI itself."), {
2922
- platform: "tri-web",
2923
- version: "0.5.1"
2924
- })),
2925
- DEBUG: t.DEBUG ?? !1
2926
- };
2927
- var o, a;
2928
- return void 0 === t.collectors && void 0 === t.layers ? {
2929
- sdk: r,
2930
- collectors: lt()
2931
- } : void 0 !== t.collectors ? {
2932
- sdk: r,
2933
- collectors: ft(t.collectors)
2934
- } : {
2935
- sdk: r,
2936
- collectors: ct(t.layers)
2937
- };
2938
- }(t);
2939
- if (!n) return this.qt = z, z;
2940
- i.DEBUG = n.sdk.DEBUG;
2941
- const e = await _n(n, { getProfileId: () => null });
2942
- return "collection-disabled" === e.status ? (i.fatal("warn", "setup()", "Collection is disabled for the provided API Key."), this.qt = j, j) : "init-failed" === e.status ? (this.qt = z, z) : (this.Nt = e.managers, this.qt = B, v(function(t) {
3113
+ const e = Tt(t);
3114
+ if (!e) return this.en = X, X;
3115
+ const r = !1 !== t.autostart;
3116
+ i.DEBUG = e.sdk.DEBUG;
3117
+ let s = null;
3118
+ const o = await Cn(e, {
3119
+ getProfileId: () => null,
3120
+ onActivityRefused: () => {
3121
+ s && this.an(s);
3122
+ }
3123
+ });
3124
+ if (n.cancelled) return W;
3125
+ if ("collection-disabled" === o.status) return i.fatal("warn", "setup()", "Collection is disabled for the provided API Key."), this.en = Z, Z;
3126
+ if ("init-failed" === o.status) return this.en = X, X;
3127
+ if (this.nn = o.managers, s = o.managers, this.en = G, m(function(t) {
2943
3128
  t.setups += 1;
2944
- }), !1 !== t.autostart ? this.start() : B);
3129
+ }), r && !n.stopped) {
3130
+ const { state: t, threw: e } = await this.ln();
3131
+ return n.cancelled ? W : n.stopped ? G : e ? (this.nn === o.managers && (this.nn = null, this.en = X), X) : t;
3132
+ }
3133
+ return G;
2945
3134
  } catch (t) {
2946
- return i.warn("setup()", "failed:", t), this.qt = z, z;
3135
+ return i.warn("setup()", "failed:", t), n.cancelled ? W : (this.en = X, X);
3136
+ } finally {
3137
+ this.rn === n && (this.rn = null);
2947
3138
  }
2948
3139
  }
2949
3140
  async start() {
2950
- if (this.qt === U) return i.warn("start()", "start() requires a prior successful setup() — ignoring."), this.qt;
2951
- if (this.qt !== B) return i.fatal("warn", "start()", "TRI is either already started or isn't ready — ignoring."), this.qt;
2952
- this.qt = "starting";
2953
- const t = ++this.Lt;
2954
- return await this._(t), this.qt;
3141
+ return (await this.ln()).state;
3142
+ }
3143
+ async ln() {
3144
+ if (this.en === W) return i.warn("start()", "start() requires a prior successful setup() — ignoring."), {
3145
+ state: this.en,
3146
+ threw: !1
3147
+ };
3148
+ if (this.en !== G) return i.fatal("warn", "start()", "TRI is either already started or isn't ready — ignoring."), {
3149
+ state: this.en,
3150
+ threw: !1
3151
+ };
3152
+ this.en = "starting";
3153
+ const t = ++this.tn, n = await this.j(t);
3154
+ return {
3155
+ state: this.en,
3156
+ threw: n
3157
+ };
2955
3158
  }
2956
3159
  async stop() {
2957
3160
  i.warn("stop()", "called");
2958
- const t = this.Nt;
2959
- return t ? (++this.Lt, t.lifecycleManager.stop(), t.tabManager.stop(), t.collectorManager.stop(), t.eventReportManager.stop(), t.pulseGuard.stop(), this.qt = B, this.Ht(t)) : Promise.resolve(this.qt);
3161
+ const t = this.rn;
3162
+ t && (t.stopped = !0);
3163
+ const n = this.nn;
3164
+ if (!n) {
3165
+ const n = t ? t.result : Promise.resolve(this.en);
3166
+ return Promise.all([n, this.cn()]).then(([t]) => t);
3167
+ }
3168
+ ++this.tn, n.activityManager.beginStop(), o(() => n.lifecycleManager.stop()), o(() => n.tabManager.stop()), o(() => n.collectorManager.stop()), o(() => n.eventReportManager.stop()), o(() => n.pulseGuard.stop()), this.en = G;
3169
+ const e = this.sn.get(n), r = () => this.fn(n), s = e ? e.then(r, r) : r();
3170
+ this.sn.set(n, s);
3171
+ const u = () => {
3172
+ this.sn.get(n) === s && this.sn.delete(n);
3173
+ };
3174
+ return s.then(u, u), this.cn().then(() => G);
3175
+ }
3176
+ cn() {
3177
+ return Promise.allSettled(Array.from(this.sn.values()));
2960
3178
  }
2961
3179
  async reset() {
2962
- this.Nt && v(function(t) {
3180
+ this.rn && (this.rn.cancelled = !0, this.rn = null);
3181
+ const t = !this.nn && this.en === W && function() {
3182
+ let t = !1;
3183
+ for (const n of C) y.has(n) && (t = !0), y.remove(n);
3184
+ return t;
3185
+ }();
3186
+ (this.nn || t) && m(function(t) {
2963
3187
  t.resets += 1;
2964
3188
  });
2965
- const t = this.stop();
2966
- return this.qt = U, this.Nt = null, t.then(() => this.qt);
3189
+ const n = this.stop();
3190
+ return this.en = W, this.nn = null, n.then(() => W);
2967
3191
  }
2968
- async Ht(t) {
2969
- return await h(Promise.resolve(t.transportManager.stop()), 2e3), await t.activityManager.stop(), this.qt;
3192
+ hn(t) {
3193
+ this.dn(t), this.nn === t && (this.nn = null);
2970
3194
  }
2971
- async _(t) {
2972
- const n = this.Nt;
2973
- if (n) {
2974
- try {
2975
- if (n.tabManager.getTabId(), n.pulseGuard.start(), await n.activityManager.start(), t !== this.Lt) return;
2976
- if (n.transportManager.start(), n.collectorManager.autocapture(), await n.tabManager.start(), t !== this.Lt) return;
2977
- n.lifecycleManager.start();
2978
- } catch (n) {
2979
- i.warn("start()", "failed during monitoring start:", n), t === this.Lt && (this.qt = B);
2980
- return;
2981
- }
2982
- t === this.Lt && (this.qt = O);
3195
+ dn(t) {
3196
+ o(() => t.lifecycleManager.stop()), o(() => t.tabManager.stop()), o(() => t.collectorManager.stop()), o(() => t.eventReportManager.stop()), o(() => t.pulseGuard.stop()), o(() => t.activityManager.release()), u(() => Promise.resolve(t.transportManager.stop()));
3197
+ }
3198
+ an(t) {
3199
+ this.nn === t && this.en === K && (i.fatal("warn", "start()", "The backend refused the activity for the provided token."), this.hn(t), this.en = Z);
3200
+ }
3201
+ async fn(t) {
3202
+ try {
3203
+ await h(Promise.resolve(t.transportManager.stop()), 2e3);
3204
+ } catch (t) {
3205
+ i.warn("stop()", "transport drain failed:", t);
3206
+ } finally {
3207
+ await t.activityManager.stop();
3208
+ }
3209
+ return this.en;
3210
+ }
3211
+ async j(t) {
3212
+ const n = this.nn;
3213
+ if (!n) return !1;
3214
+ try {
3215
+ if (n.tabManager.getTabId(), n.pulseGuard.start(), await n.activityManager.start(), t !== this.tn) return !1;
3216
+ if ("refused" === n.activityManager.startFailure()) return i.fatal("warn", "start()", "The backend refused the activity for the provided token."), n.pulseGuard.stop(), n.activityManager.release(), this.nn = null, this.en = Z, !1;
3217
+ if (n.transportManager.start(), n.collectorManager.autocapture(), await n.tabManager.start(), t !== this.tn) return !1;
3218
+ n.lifecycleManager.start();
3219
+ } catch (e) {
3220
+ return i.warn("start()", "failed during monitoring start:", e), t === this.tn && (this.dn(n), this.en = G, !0);
2983
3221
  }
3222
+ return t === this.tn && (this.en = K), !1;
2984
3223
  }
2985
3224
  async linkInterview(t) {
2986
- if (this.qt !== O || !this.Nt) return i.warn("linkInterview()", "linkInterview() called before start() completed — ignoring."), !1;
3225
+ if (this.en !== K || !this.nn) return i.warn("linkInterview()", "linkInterview() called before start() completed — ignoring."), !1;
2987
3226
  if (!t) return i.warn("linkInterview()", "linkInterview() called without sessionToken — ignoring."), !1;
2988
3227
  try {
2989
- return (await this.Nt.falconServiceManager.api.linkInterview(t)).ok;
3228
+ return (await this.nn.falconServiceManager.api.linkInterview(t)).ok;
2990
3229
  } catch (t) {
2991
3230
  return i.warn("linkInterview()", "failed:", t), !1;
2992
3231
  }
2993
3232
  }
2994
3233
  async getFpSignals() {
2995
- if (this.qt !== O) return i.warn("getFpSignals()", "getFpSignals() called before start() completed — ignoring."), null;
3234
+ if (this.en !== K) return i.warn("getFpSignals()", "getFpSignals() called before start() completed — ignoring."), null;
2996
3235
  try {
2997
- return await (W ?? Promise.resolve(null));
3236
+ return await (ut ?? Promise.resolve(null));
2998
3237
  } catch (t) {
2999
3238
  return i.warn("getFpSignals()", "failed:", t), null;
3000
3239
  }
3001
3240
  }
3002
3241
  addFpSignals(t) {
3003
- const n = this.Nt;
3004
- if (this.qt !== O || !n) return i.warn("addFpSignals()", "addFpSignals() called before start() completed — ignoring."), !1;
3242
+ const n = this.nn;
3243
+ if (this.en !== K || !n) return i.warn("addFpSignals()", "addFpSignals() called before start() completed — ignoring."), !1;
3005
3244
  if (n.collectorManager.isRunning("fpsignals")) return i.warn("addFpSignals()", "the fpsignals collector is on and sends its own results — ignoring."), !1;
3006
3245
  if ("string" != typeof t || !t) return i.warn("addFpSignals()", "signals is empty — ignoring."), !1;
3007
3246
  try {
@@ -3016,8 +3255,8 @@ let An = class t {
3016
3255
  }
3017
3256
  }
3018
3257
  getActivityId() {
3019
- const t = this.Nt;
3020
- if (this.qt !== O || !t) return i.warn("getActivityId()", "getActivityId() called before start() completed — returning null."), null;
3258
+ const t = this.nn;
3259
+ if (this.en !== K || !t) return i.warn("getActivityId()", "getActivityId() called before start() completed — returning null."), null;
3021
3260
  try {
3022
3261
  const { activityManager: n } = t;
3023
3262
  return n.isActive() && n.getActivityId() || null;
@@ -3026,42 +3265,42 @@ let An = class t {
3026
3265
  }
3027
3266
  }
3028
3267
  };
3029
- async function In(t, n) {
3030
- const e = "object" == typeof t && null !== t, i = e ? null : t, r = e ? t : n, o = function(t) {
3268
+ async function Bn(t, n) {
3269
+ const e = "object" == typeof t && null !== t, i = e ? null : t, r = e ? t : n, s = function(t) {
3031
3270
  if ("string" != typeof t) return null;
3032
3271
  const n = t.trim();
3033
3272
  try {
3034
3273
  const { protocol: t } = new URL(n);
3035
- return "http:" === t || "https:" === t ? n : null;
3274
+ return "http:" === t || "https:" === t ? d(n) : null;
3036
3275
  } catch {
3037
3276
  return null;
3038
3277
  }
3039
3278
  }(r?.apiURL);
3040
- if (!o) return Rn("[TRI] createSession: apiURL must be an absolute http(s) URL.");
3041
- if (null !== i && !En(i)) return Rn("[TRI] createSession: apiKey must be a non-empty string.");
3042
- const s = r?.sourceId;
3043
- if ((e || void 0 !== s) && !En(s)) return Rn("[TRI] createSession: sourceId must be a non-empty string.");
3044
- const a = r?.timeout ?? 1e4, u = new AbortController();
3045
- let l = null, h = !1, d = () => {};
3046
- a && (l = c(() => {
3047
- h = !0, u.abort();
3048
- }, a));
3049
- const p = r?.signal;
3050
- if (p) if (p.aborted) u.abort();
3279
+ if (!s) return On("[TRI] createSession: apiURL must be an absolute http(s) URL.");
3280
+ if (null !== i && !Dn(i)) return On("[TRI] createSession: apiKey must be a non-empty string.");
3281
+ const o = r?.sourceId;
3282
+ if ((e || void 0 !== o) && !Dn(o)) return On("[TRI] createSession: sourceId must be a non-empty string.");
3283
+ const u = r?.timeout ?? 1e4, a = new AbortController();
3284
+ let l = null, h = !1, p = () => {};
3285
+ u && (l = c(() => {
3286
+ h = !0, a.abort();
3287
+ }, u));
3288
+ const y = r?.signal;
3289
+ if (y) if (y.aborted) a.abort();
3051
3290
  else {
3052
- const t = () => u.abort();
3053
- p.addEventListener("abort", t, { once: !0 }), d = () => p.removeEventListener("abort", t);
3291
+ const t = () => a.abort();
3292
+ y.addEventListener("abort", t, { once: !0 }), p = () => y.removeEventListener("abort", t);
3054
3293
  }
3055
3294
  try {
3056
- const t = await fetch(`${o}/api/v1/sdk/init`, {
3295
+ const t = await fetch(`${s}/api/v1/sdk/init`, {
3057
3296
  method: "POST",
3058
3297
  headers: {
3059
3298
  "content-type": "application/json",
3060
3299
  ...null === i ? {} : { "x-api-key": i },
3061
3300
  "x-api-version": "1.0"
3062
3301
  },
3063
- ...void 0 === s ? {} : { body: JSON.stringify({ source_id: s.trim() }) },
3064
- signal: u.signal
3302
+ ...void 0 === o ? {} : { body: JSON.stringify({ source_id: o.trim() }) },
3303
+ signal: a.signal
3065
3304
  });
3066
3305
  if (!t.ok) {
3067
3306
  let n = t.statusText;
@@ -3091,10 +3330,10 @@ async function In(t, n) {
3091
3330
  } catch (t) {
3092
3331
  throw new Error((h ? "[TRI] createSession timed out" : "[TRI] Failed to create session:") + " " + t.message);
3093
3332
  } finally {
3094
- f(l), d();
3333
+ f(l), p();
3095
3334
  }
3096
3335
  }
3097
- function Rn(t) {
3336
+ function On(t) {
3098
3337
  return {
3099
3338
  token: null,
3100
3339
  expiresAt: null,
@@ -3106,10 +3345,10 @@ function Rn(t) {
3106
3345
  }
3107
3346
  };
3108
3347
  }
3109
- function En(t) {
3348
+ function Dn(t) {
3110
3349
  return "string" == typeof t && "" !== t.trim();
3111
3350
  }
3112
- An.u = null;
3113
- const Mn = An.instance;
3351
+ zn.u = null;
3352
+ const Ln = zn.instance;
3114
3353
  //#endregion
3115
- export { In as createSession, Mn as default };
3354
+ export { Bn as createSession, Ln as default };