@sprig-technologies/sprig-browser 2.43.0 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/replay.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var lt = Object.defineProperty;
2
2
  var ct = (e, t, a) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
3
  var F = (e, t, a) => ct(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { b as d, s as Q, a as m, v as X, c as ut, g as pt, P as xe, r as Be, d as gt, e as V, S as Y, f as mt } from "./metricsReporter-DDWVWGid.js";
4
+ import { b as l, s as Q, a as m, v as X, c as ut, g as pt, P as xe, r as Be, d as gt, e as V, S as Y, f as mt } from "./metricsReporter-Bg5aC8mO.js";
5
5
  import { d as yt } from "./debounce-CMb8f7wh.js";
6
6
  var B = ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e))(B || {}), k = ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(k || {});
7
7
  const re = (e, t) => t.some((a) => e instanceof a);
@@ -65,32 +65,32 @@ function De(e, t) {
65
65
  if (ee.get(t)) return ee.get(t);
66
66
  const a = t.replace(/FromIndex$/, ""), n = t !== a, r = It.includes(a);
67
67
  if (!(a in (n ? IDBIndex : IDBObjectStore).prototype) || !r && !ht.includes(a)) return;
68
- const s = async function(o, ...l) {
68
+ const s = async function(o, ...d) {
69
69
  const i = this.transaction(o, r ? "readwrite" : "readonly");
70
70
  let c = i.store;
71
- return n && (c = c.index(l.shift())), (await Promise.all([c[a](...l), r && i.done]))[0];
71
+ return n && (c = c.index(d.shift())), (await Promise.all([c[a](...d), r && i.done]))[0];
72
72
  };
73
73
  return ee.set(t, s), s;
74
74
  }
75
75
  Me((e) => ({ ...e, get: (t, a, n) => De(t, a) || e.get(t, a, n), has: (t, a) => !!De(t, a) || e.has(t, a) }));
76
- const vt = ["continue", "continuePrimaryKey", "advance"], Te = {}, le = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), St = { get(e, t) {
76
+ const vt = ["continue", "continuePrimaryKey", "advance"], Te = {}, le = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakMap(), St = { get(e, t) {
77
77
  if (!vt.includes(t)) return e[t];
78
78
  let a = Te[t];
79
79
  return a || (a = Te[t] = function(...n) {
80
- le.set(this, _e.get(this)[t](...n));
80
+ le.set(this, Ae.get(this)[t](...n));
81
81
  }), a;
82
82
  } };
83
83
  async function* bt(...e) {
84
84
  let t = this;
85
85
  if (t instanceof IDBCursor || (t = await t.openCursor(...e)), !t) return;
86
86
  const a = new Proxy(t, St);
87
- for (_e.set(a, t), K.set(a, ie(t)); t; ) yield a, t = await (le.get(a) || t.continue()), le.delete(a);
87
+ for (Ae.set(a, t), K.set(a, ie(t)); t; ) yield a, t = await (le.get(a) || t.continue()), le.delete(a);
88
88
  }
89
89
  function Ee(e, t) {
90
90
  return t === Symbol.asyncIterator && re(e, [IDBIndex, IDBObjectStore, IDBCursor]) || t === "iterate" && re(e, [IDBIndex, IDBObjectStore]);
91
91
  }
92
92
  Me((e) => ({ ...e, get: (t, a, n) => Ee(t, a) ? bt : e.get(t, a, n), has: (t, a) => Ee(t, a) || e.has(t, a) }));
93
- const Dt = "sprigReplayIframeLoaded", Tt = "sprigReplayIframeSettings", Et = "sprigReplayIframeTakeFullSnapshot", Rt = "sprigReplayTeardown", fe = [], Ae = new class {
93
+ const Dt = "sprigReplayIframeLoaded", Tt = "sprigReplayIframeSettings", Et = "sprigReplayIframeTakeFullSnapshot", Ct = "sprigReplayTeardown", fe = [], _e = new class {
94
94
  constructor(e) {
95
95
  F(this, "awaitingResolvers", []);
96
96
  F(this, "activeCount", 0);
@@ -116,13 +116,13 @@ const Dt = "sprigReplayIframeLoaded", Tt = "sprigReplayIframeSettings", Et = "sp
116
116
  setLimit(e) {
117
117
  this.capacity = e;
118
118
  }
119
- }(2), Ne = async ({ apiUrl: e, surveyId: t, uploadId: a, etags: n, headers: r, responseGroupUuid: s, replayDuration: o, eventDigest: l }, i = !1) => {
119
+ }(2), Ne = async ({ apiUrl: e, surveyId: t, uploadId: a, etags: n, headers: r, responseGroupUuid: s, replayDuration: o, eventDigest: d }, i = !1) => {
120
120
  var w;
121
- if (!i && !a && !n) return void d.error("UploadErr", { isMobile: i, uploadId: a, etags: n });
122
- d.info("MarkUploadComplete", { surveyId: t });
123
- const c = await Q(`${e}/sdk/1/completeSessionReplay`, { method: "POST", body: JSON.stringify({ etags: n, uploadId: a, responseGroupUuid: s, surveyId: t, replayDuration: o, eventDigest: l, userAgent: (w = window == null ? void 0 : window.navigator) == null ? void 0 : w.userAgent }), headers: r, shouldRetryRequest: !0 });
124
- return d.info("MarkUploadDone", { surveyId: t }), c;
125
- }, Ct = (e) => {
121
+ if (!i && !a && !n) return void l.error("UploadErr", { isMobile: i, uploadId: a, etags: n });
122
+ l.info("MarkUploadComplete", { surveyId: t });
123
+ const c = await Q(`${e}/sdk/1/completeSessionReplay`, { method: "POST", body: JSON.stringify({ etags: n, uploadId: a, responseGroupUuid: s, surveyId: t, replayDuration: o, eventDigest: d, userAgent: (w = window == null ? void 0 : window.navigator) == null ? void 0 : w.userAgent }), headers: r, shouldRetryRequest: !0 });
124
+ return l.info("MarkUploadDone", { surveyId: t }), c;
125
+ }, Rt = (e) => {
126
126
  if (e instanceof Attr) return null;
127
127
  let t = 1;
128
128
  for (let a = e.previousSibling; a; a = a.previousSibling) a.nodeName === e.nodeName && ++t;
@@ -149,12 +149,12 @@ const Dt = "sprigReplayIframeLoaded", Tt = "sprigReplayIframeSettings", Et = "sp
149
149
  case Node.ELEMENT_NODE:
150
150
  n.name = a.nodeName;
151
151
  }
152
- n.position = Ct(a);
152
+ n.position = Rt(a);
153
153
  }
154
154
  return "/" + t.reverse().map((a) => a.position !== null ? `/${a.name}[${a.position}]` : `/${a.name}`).join("");
155
- }, he = (e) => e && e.trim().substring(0, 500).replace(/\s\s+/g, " ").replace(/\r?\n|\r/g, " ").substring(0, 250), R = { capture: !0, passive: !0 }, Pt = ["a", "button", "input", "option", "li", "link"], kt = ["Escape", "Enter", "Backspace", "F5", "Tab"];
155
+ }, he = (e) => e && e.trim().substring(0, 500).replace(/\s\s+/g, " ").replace(/\r?\n|\r/g, " ").substring(0, 250), C = { capture: !0, passive: !0 }, Pt = ["a", "button", "input", "option", "li", "link"], kt = ["Escape", "Enter", "Backspace", "F5", "Tab"];
156
156
  let J = !1, D = null, G = null;
157
- const Re = (e) => {
157
+ const Ce = (e) => {
158
158
  var a;
159
159
  if (((a = e.tagName) == null ? void 0 : a.toLowerCase()) === "html") return { element: "html" };
160
160
  const t = {};
@@ -166,9 +166,9 @@ const Re = (e) => {
166
166
  }, Ut = (e) => {
167
167
  var n;
168
168
  if (!e) return {};
169
- const t = { ...Re(e) }, a = e.parentElement;
169
+ const t = { ...Ce(e) }, a = e.parentElement;
170
170
  if (a && Pt.includes((n = a.tagName) == null ? void 0 : n.toLowerCase())) {
171
- const r = Re(a);
171
+ const r = Ce(a);
172
172
  Object.assign(t, r);
173
173
  }
174
174
  return t;
@@ -190,8 +190,8 @@ const Re = (e) => {
190
190
  if (!(e.target instanceof HTMLElement || e.target instanceof Document)) return;
191
191
  let t = e.target;
192
192
  "scrollTop" in t || (t = t.documentElement), G == null || G({ xPath: Le(t), x: t.scrollLeft, y: t.scrollTop, elementAttributes: { targetScrollWidth: t.scrollWidth, targetClientWidth: t.clientWidth, targetScrollHeight: t.scrollHeight, targetClientHeight: t.clientHeight } });
193
- }, 750), je = (Ce = "left_click", (e) => Oe(Ce, e));
194
- var Ce;
193
+ }, 750), je = (Re = "left_click", (e) => Oe(Re, e));
194
+ var Re;
195
195
  const Ve = (e) => {
196
196
  e.button === 2 && Oe("right_click", e);
197
197
  }, Ge = (e) => {
@@ -199,19 +199,19 @@ const Ve = (e) => {
199
199
  }, g = { isRecording: !1, scrollEventUuids: {}, stopRecording: () => {
200
200
  } }, We = () => globalThis.indexedDB && globalThis.IDBKeyRange && globalThis.CompressionStream, I = (() => {
201
201
  const e = m.getItem("sprig.sessionId");
202
- if (e) return d.info("SessionIDFound", { savedSessionId: e }), m.removeItem("sprig.sessionId"), e;
202
+ if (e) return l.info("SessionIDFound", { savedSessionId: e }), m.removeItem("sprig.sessionId"), e;
203
203
  const t = X();
204
- return d.info("GeneratedSessionID", { uuid: t }), t;
204
+ return l.info("GeneratedSessionID", { uuid: t }), t;
205
205
  })(), ce = () => {
206
206
  m.setItem("sprig.disableReplayRecording", "disabled");
207
- }, C = () => !!m.getItem("sprig.disableReplayRecording"), z = () => !!m.getItem("sprig.isReplayPaused");
207
+ }, R = () => !!m.getItem("sprig.disableReplayRecording"), z = () => !!m.getItem("sprig.isReplayPaused");
208
208
  var ke;
209
209
  (ke = globalThis.addEventListener) == null || ke.call(globalThis, "beforeunload", () => {
210
- d.info("BeforeUnload", { sessionId: I }), m.setItem("sprig.sessionId", I);
210
+ l.info("BeforeUnload", { sessionId: I }), m.setItem("sprig.sessionId", I);
211
211
  });
212
212
  const U = (e, t) => {
213
213
  var a, n;
214
- if (!C() && g.isRecording && !z()) try {
214
+ if (!R() && g.isRecording && !z()) try {
215
215
  (n = (a = globalThis.rrwebRecord) == null ? void 0 : a.addCustomEvent) == null || n.call(a, e, t);
216
216
  } catch (r) {
217
217
  H("Error recording custom event", r);
@@ -219,10 +219,10 @@ const U = (e, t) => {
219
219
  }, Mt = async (e) => {
220
220
  const { x: t, xPath: a, y: n } = e, r = g.scrollEventUuids[a];
221
221
  if (r) return b(async () => {
222
- var l, i, c, w;
222
+ var d, i, c, w;
223
223
  const s = await u.openDB(), o = await s.get("events", r);
224
224
  if (o != null && o.event) {
225
- const p = JSON.parse(o.event), h = t > ((i = (l = p.data) == null ? void 0 : l.payload) == null ? void 0 : i.x), y = n > ((w = (c = p.data) == null ? void 0 : c.payload) == null ? void 0 : w.y);
225
+ const p = JSON.parse(o.event), h = t > ((i = (d = p.data) == null ? void 0 : d.payload) == null ? void 0 : i.x), y = n > ((w = (c = p.data) == null ? void 0 : c.payload) == null ? void 0 : w.y);
226
226
  if (!h && !y) return null;
227
227
  h && (p.data.payload.x = t), y && (p.data.payload.y = n), p.data.payload.elementAttributes = e.elementAttributes, o.event = JSON.stringify(p), await s.put("events", o);
228
228
  } else U("Sprig_Scroll", e);
@@ -231,21 +231,21 @@ const U = (e, t) => {
231
231
  }, $e = () => {
232
232
  g.stopRecording && (g.stopRecording(), g.stopRecording = void 0), g.isRecording = !1, ["cleanupInterval", "inactivityInterval", "pendingCheckInterval"].forEach((e) => {
233
233
  g[e] && (clearInterval(g[e]), g[e] = void 0);
234
- }), J && (window.removeEventListener("click", je, R), window.removeEventListener("pointerdown", Ge, R), window.removeEventListener("mousedown", Ve, R), window.removeEventListener("keydown", Fe, R), window.removeEventListener("scroll", He, R), J = !1), fe.forEach((e) => {
234
+ }), J && (window.removeEventListener("click", je, C), window.removeEventListener("pointerdown", Ge, C), window.removeEventListener("mousedown", Ve, C), window.removeEventListener("keydown", Fe, C), window.removeEventListener("scroll", He, C), J = !1), fe.forEach((e) => {
235
235
  var t;
236
- (t = e.source) == null || t.postMessage({ type: Rt }, { targetOrigin: e.origin });
236
+ (t = e.source) == null || t.postMessage({ type: Ct }, { targetOrigin: e.origin });
237
237
  });
238
- }, _t = ["did not allow mutations", "called in an invalid security context"], At = (e, t, { reportError: a = !0, extraInfo: n = {} }) => {
239
- if (!C() && t instanceof Error) {
240
- if (ce(), t.name === "VersionError") return d.error("VersionErr", { message: e }), void u.deleteDB();
238
+ }, At = ["did not allow mutations", "called in an invalid security context"], _t = (e, t, { reportError: a = !0, extraInfo: n = {} }) => {
239
+ if (!R() && t instanceof Error) {
240
+ if (ce(), t.name === "VersionError") return l.error("VersionErr", { message: e }), void u.deleteDB();
241
241
  ((r) => {
242
242
  if (!r) return !0;
243
- for (const s of _t) if (r.toLowerCase().includes(s)) return !1;
243
+ for (const s of At) if (r.toLowerCase().includes(s)) return !1;
244
244
  return !0;
245
245
  })(t == null ? void 0 : t.message) && (a && globalThis.UserLeap.reportError(e, t, n), u.clearAll());
246
246
  }
247
247
  }, H = (e, t, { reportError: a } = { reportError: !0 }) => {
248
- $e(), d.error("ReplayErr", { code: t.code, name: t.name }), At(e, t, { reportError: a });
248
+ $e(), l.error("ReplayErr", { code: t.code, name: t.name }), _t(e, t, { reportError: a });
249
249
  }, b = async (e, t) => {
250
250
  try {
251
251
  return await e();
@@ -283,13 +283,13 @@ const u = new class {
283
283
  }
284
284
  openDB() {
285
285
  return function(e, t, { blocked: a, upgrade: n, blocking: r, terminated: s } = {}) {
286
- const o = indexedDB.open(e, t), l = M(o);
286
+ const o = indexedDB.open(e, t), d = M(o);
287
287
  return n && (o.onupgradeneeded = (i) => {
288
288
  n(M(o.result), i.oldVersion, i.newVersion, M(o.transaction), i);
289
- }), a && (o.onblocked = (i) => a(i.oldVersion, i.newVersion, i)), l.then((i) => {
289
+ }), a && (o.onblocked = (i) => a(i.oldVersion, i.newVersion, i)), d.then((i) => {
290
290
  s && (i.onclose = () => s()), r && (i.onversionchange = (c) => r(c.oldVersion, c.newVersion, c));
291
291
  }).catch(() => {
292
- }), l;
292
+ }), d;
293
293
  }("sprigReplay", 1, { upgrade: (e, t, a) => {
294
294
  if (a === 0 && m.setItem("sprig.pendingCount", "0"), !e.objectStoreNames.contains("events")) {
295
295
  const n = e.createObjectStore("events", { keyPath: "uuid" });
@@ -339,8 +339,8 @@ const u = new class {
339
339
  return (await this.openDB()).getAllFromIndex("events", "[sessionId+timestamp]", a);
340
340
  }
341
341
  async updateEventsExpiredAt(e, t, a = 30) {
342
- const n = /* @__PURE__ */ new Date(), r = n.setMinutes(n.getMinutes() + (a ?? 30)), s = await this.getTransaction("events"), o = s.store.index("[sessionId+timestamp]"), l = IDBKeyRange.bound([I, e], [I, t], !1, !0);
343
- for await (const i of o.iterate(l)) await i.update({ ...i.value, expiredAt: r });
342
+ const n = /* @__PURE__ */ new Date(), r = n.setMinutes(n.getMinutes() + (a ?? 30)), s = await this.getTransaction("events"), o = s.store.index("[sessionId+timestamp]"), d = IDBKeyRange.bound([I, e], [I, t], !1, !0);
343
+ for await (const i of o.iterate(d)) await i.update({ ...i.value, expiredAt: r });
344
344
  await s.done;
345
345
  }
346
346
  async deleteChunkUploads(e, t) {
@@ -358,6 +358,12 @@ const u = new class {
358
358
  async getPendingCaptures(e = {}) {
359
359
  return (await (await this.openDB()).getAllFromIndex("pendingCaptures", "sessionId", I)).filter((a) => !e.beforePresent || a.targetTimestamp < Date.now()).filter((a) => !e.isBeforeType || a.captureParams.replayParams.replayDurationType === "before").filter((a) => !e.isHeatmap || (a.captureParams.isHeatmap ?? !1));
360
360
  }
361
+ async tryAddPendingCaptureForSurvey(e) {
362
+ const { surveyId: t, record: a } = e, n = (await this.openDB()).transaction("pendingCaptures", "readwrite");
363
+ this.wrapTransactionWithCounter(n);
364
+ const r = n.store.index("sessionId"), s = await r.getAll(I), o = !!a.captureParams.isHeatmap;
365
+ return s.some((d) => d.captureParams.surveyId === t && !!d.captureParams.isHeatmap === o) ? (await n.done, { added: !1 }) : (await n.store.add(a), await n.done, { added: !0 });
366
+ }
361
367
  async markPendingCaptureToCanUpload(e) {
362
368
  const t = await this.getTransaction("pendingCaptures"), a = t.store.index("sessionId");
363
369
  for await (const n of a.iterate(I)) {
@@ -376,28 +382,28 @@ const u = new class {
376
382
  await a.done;
377
383
  }
378
384
  }(), x = [];
379
- let j, Ke, A = [], L = !1, N = 0, W = !1, Je = !1;
385
+ let j, Ke, _ = [], L = !1, N = 0, W = !1, Je = !1;
380
386
  const Ie = [];
381
387
  let q, ze, $, qe, ae = !1;
382
388
  const O = () => W && !L && Date.now() <= q, Nt = ({ apiUrl: e, config: t, triggerSnapshot: a, forceInit: n = !1 }) => {
383
- W && !n || (m.isStorageAvailable ? (A = [], Ie.splice(0), x.splice(0), N = 0, $ = a, Ke = e, j = { responseGroupUuid: t.responseGroupUuid, surveyId: t.surveyId, userAgent: t.userAgent, sdkVersion: t.sdkVersion }, ze = t.maxDurationSeconds, Ht(), W || (qe = globalThis.setInterval(Ft, 500)), W = !0) : L = !0);
389
+ W && !n || (m.isStorageAvailable ? (_ = [], Ie.splice(0), x.splice(0), N = 0, $ = a, Ke = e, j = { responseGroupUuid: t.responseGroupUuid, surveyId: t.surveyId, userAgent: t.userAgent, sdkVersion: t.sdkVersion }, ze = t.maxDurationSeconds, Ht(), W || (qe = globalThis.setInterval(Ft, 500)), W = !0) : L = !0);
384
390
  }, Lt = [k.Drag, k.Input, k.MediaInteraction, k.MouseInteraction, k.MouseMove, k.Scroll, k.Selection, k.TouchMove], Ot = (e) => e.type === B.Custom || e.type === B.IncrementalSnapshot && Lt.includes(e.data.source), ve = (e) => e.some(Ot), Ft = async () => {
385
391
  if (!O()) return void globalThis.clearInterval(qe);
386
392
  if (Qe(), !ve(x)) return;
387
393
  const e = x[0].timestamp;
388
394
  Date.now() - e > 35e3 && ($ == null || $());
389
395
  }, Qe = async () => {
390
- if (A.length || ae) return;
396
+ if (_.length || ae) return;
391
397
  ae = !0;
392
398
  const e = await Vt();
393
399
  if (!e) return void (L = !0);
394
- Ie.splice(0, e.length).forEach((t) => t(e.shift())), e.forEach((t) => A.push(t)), ae = !1;
400
+ Ie.splice(0, e.length).forEach((t) => t(e.shift())), e.forEach((t) => _.push(t)), ae = !1;
395
401
  }, Ht = () => {
396
402
  const e = m.getItem("sprig.alwayson.info");
397
403
  if (e) {
398
- d.info("Read stored session state", e);
404
+ l.info("Read stored session state", e);
399
405
  const t = JSON.parse(e);
400
- L = t.disabled, j = t.metadata, A = t.uploadUrls, N = t.currentIndex, q = t.expirationTimestamp, t.pendingEventTimestamp && (d.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`), jt(t.pendingEventTimestamp));
406
+ L = t.disabled, j = t.metadata, _ = t.uploadUrls, N = t.currentIndex, q = t.expirationTimestamp, t.pendingEventTimestamp && (l.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`), jt(t.pendingEventTimestamp));
401
407
  } else q = 1e3 * ze + Date.now();
402
408
  }, jt = async (e) => {
403
409
  const t = Date.now(), a = (await u.getEventsBetween(e, t)).map((r) => JSON.parse(r.event));
@@ -416,20 +422,20 @@ const O = () => W && !L && Date.now() <= q, Nt = ({ apiUrl: e, config: t, trigge
416
422
  }, Ye = async (e, t) => {
417
423
  if (!O() || !e) return;
418
424
  const a = await (async (n) => {
419
- const r = new TextEncoder(), s = new CompressionStream("gzip"), o = s.writable.getWriter(), l = r.encode(JSON.stringify(n));
420
- return o.write(l), o.close(), new Uint8Array(await new Response(s.readable).arrayBuffer());
425
+ const r = new TextEncoder(), s = new CompressionStream("gzip"), o = s.writable.getWriter(), d = r.encode(JSON.stringify(n));
426
+ return o.write(d), o.close(), new Uint8Array(await new Response(s.readable).arrayBuffer());
421
427
  })(t);
422
- d.info("Uploading always-on events with presigned url"), await Xe(() => Q(e, { body: a, method: "PUT" }), "uploading always-on with presigned url");
428
+ l.info("Uploading always-on events with presigned url"), await Xe(() => Q(e, { body: a, method: "PUT" }), "uploading always-on with presigned url");
423
429
  }, Vt = async () => {
424
430
  if (!O()) return;
425
431
  const { surveyId: e, responseGroupUuid: t } = j, a = { responseGroupUuid: t, surveyId: e, index: N + 1 };
426
- d.info("Fetching always-on upload urls", a);
432
+ l.info("Fetching always-on upload urls", a);
427
433
  const n = await Xe(() => Q(`${Ke}/sdk/1/replayUrls`, { method: "POST", body: JSON.stringify(a), headers: pt(globalThis.UserLeap) }), "fetching always-on signed urls");
428
434
  if (!n) return;
429
435
  const r = n.json.signedUrls;
430
- return d.info("Fetched more always-on upload urls", { body: a, urls: r }), r;
436
+ return l.info("Fetched more always-on upload urls", { body: a, urls: r }), r;
431
437
  }, Ze = async () => {
432
- if (A.length) return A.shift();
438
+ if (_.length) return _.shift();
433
439
  const e = new Promise((t) => {
434
440
  Ie.push(t);
435
441
  });
@@ -442,18 +448,18 @@ const O = () => W && !L && Date.now() <= q, Nt = ({ apiUrl: e, config: t, trigge
442
448
  O() && !Je && (e || x.length) && (e && x.length && (async () => {
443
449
  const a = x.splice(0);
444
450
  if (!ve(a)) return;
445
- d.info("Capturing always-on event array to upload"), et(a);
451
+ l.info("Capturing always-on event array to upload"), et(a);
446
452
  const n = await Ze();
447
453
  n && await Ye(n, a);
448
454
  })(), x.push(t));
449
455
  };
450
456
  var Ue;
451
457
  (Ue = globalThis.addEventListener) == null || Ue.call(globalThis, "beforeunload", async () => {
452
- Je = !0, O() && (d.info("Always On handle page unload"), (() => {
458
+ Je = !0, O() && (l.info("Always On handle page unload"), (() => {
453
459
  let e;
454
460
  x.length && (e = x[0].timestamp);
455
- const t = { disabled: L, metadata: j, uploadUrls: A, currentIndex: N, pendingEventTimestamp: e, expirationTimestamp: q };
456
- d.info("Storing session state on unload", t), m.setItem("sprig.alwayson.info", JSON.stringify(t));
461
+ const t = { disabled: L, metadata: j, uploadUrls: _, currentIndex: N, pendingEventTimestamp: e, expirationTimestamp: q };
462
+ l.info("Storing session state on unload", t), m.setItem("sprig.alwayson.info", JSON.stringify(t));
457
463
  })());
458
464
  });
459
465
  const tt = async (e, t) => {
@@ -477,7 +483,7 @@ const tt = async (e, t) => {
477
483
  r || (r = Be(t)), r.report(n / 1e3);
478
484
  }
479
485
  };
480
- let nt = 5e3, pe = 6e4, ge = 0, _, me = !1, ye = [];
486
+ let nt = 5e3, pe = 6e4, ge = 0, A, me = !1, ye = [];
481
487
  const Wt = (e) => {
482
488
  var t, a, n, r;
483
489
  if ((t = e.event) != null && t.includes("Sprig_Scroll")) {
@@ -488,7 +494,7 @@ const Wt = (e) => {
488
494
  ye.push(e), me || $t();
489
495
  }, $t = () => {
490
496
  me = !0, setTimeout(async () => {
491
- if (C() || z()) return;
497
+ if (R() || z()) return;
492
498
  const e = ye;
493
499
  ye = [], me = !1, at(async () => {
494
500
  await (async (t) => {
@@ -501,8 +507,8 @@ const Wt = (e) => {
501
507
  g.cleanupInterval = window.setInterval(() => {
502
508
  const n = Date.now();
503
509
  tt(() => b(async () => {
504
- C() || await Promise.all([u.deleteRowsBefore("events", n - 1e3 * e, (r) => r.expiredAt === void 0 || r.expiredAt < n - 1e3 * e), u.deleteRowsBefore("chunkUploads", n - 1e3 * t), u.deleteRowsBefore("pendingCaptures", n - 1e3 * a, (r) => !r.canUpload)]);
505
- }, "Error deleting table rows"), "sdk_replay_cleanup_seconds"), d.debug("CleanupComplete");
510
+ R() || await Promise.all([u.deleteRowsBefore("events", n - 1e3 * e, (r) => r.expiredAt === void 0 || r.expiredAt < n - 1e3 * e), u.deleteRowsBefore("chunkUploads", n - 1e3 * t), u.deleteRowsBefore("pendingCaptures", n - 1e3 * a, (r) => !r.canUpload)]);
511
+ }, "Error deleting table rows"), "sdk_replay_cleanup_seconds"), l.debug("CleanupComplete");
506
512
  }, 3e4);
507
513
  }, Jt = () => {
508
514
  g.pendingCheckInterval = window.setInterval(async () => {
@@ -515,32 +521,32 @@ let ne = !1;
515
521
  const we = async (e = !1) => {
516
522
  if (!ne) try {
517
523
  ne = !0;
518
- const t = parseInt(_ ?? "0");
524
+ const t = parseInt(A ?? "0");
519
525
  if (t === 0) return;
520
526
  const a = await u.getPendingCaptures({ beforePresent: !0, isBeforeType: e }), n = await u.openDB();
521
- await Promise.all(a.map(async (r) => (await n.delete("pendingCaptures", r.uuid), ot(r.captureParams, r.canUpload)))), _ = (t - a.length).toString(), m.setItem("sprig.pendingCount", _);
527
+ await Promise.all(a.map(async (r) => (await n.delete("pendingCaptures", r.uuid), ot(r.captureParams, r.canUpload)))), A = (t - a.length).toString(), m.setItem("sprig.pendingCount", A);
522
528
  } finally {
523
529
  ne = !1;
524
530
  }
525
531
  }, zt = async (e, t, a, n, r) => {
526
532
  const s = Math.min(e + r, a), o = await tt(() => u.getEventsBetween(e, s), "sdk_replay_get_events_between_seconds");
527
- if (!(o != null && o.length)) return d.debug("NoEventsFound"), { validStartFound: n, events: [] };
533
+ if (!(o != null && o.length)) return l.debug("NoEventsFound"), { validStartFound: n, events: [] };
528
534
  if (!n) {
529
- d.debug("ValidStartSearch");
530
- let l = -1;
535
+ l.debug("ValidStartSearch");
536
+ let d = -1;
531
537
  return o == null || o.forEach((i, c) => {
532
538
  if (!i.isValidStart) return;
533
539
  const w = i.timestamp <= t;
534
- (l < 0 || w) && (l = c);
535
- }), l < 0 ? (d.debug("ValidStartNotFound"), { validStartFound: n, events: [] }) : { validStartFound: !0, events: o == null ? void 0 : o.slice(l) };
540
+ (d < 0 || w) && (d = c);
541
+ }), d < 0 ? (l.debug("ValidStartNotFound"), { validStartFound: n, events: [] }) : { validStartFound: !0, events: o == null ? void 0 : o.slice(d) };
536
542
  }
537
543
  return { validStartFound: n, events: o };
538
544
  }, rt = (e) => Promise.all(e.map(async (t) => {
539
- const a = await (async (n) => Ae.execute(async () => {
545
+ const a = await (async (n) => _e.execute(async () => {
540
546
  var o;
541
- d.info("UploadChunkStart", { chunkIndex: n.chunkIndex, surveyId: n.surveyId });
547
+ l.info("UploadChunkStart", { chunkIndex: n.chunkIndex, surveyId: n.surveyId });
542
548
  const r = await Q(n.uploadUrl, { body: n.data, method: "PUT" });
543
- d.http("UploadChunkEnd", { url: n.uploadUrl, method: "PUT", status_code: r.status, reason: r.statusText ?? "OK", chunkIndex: n.chunkIndex, surveyId: n.surveyId });
549
+ l.http("UploadChunkEnd", { url: n.uploadUrl, method: "PUT", status_code: r.status, reason: r.statusText ?? "OK", chunkIndex: n.chunkIndex, surveyId: n.surveyId });
544
550
  const s = (o = r.headers) == null ? void 0 : o.get("ETag");
545
551
  if (!s) throw new Error(`Upload response did not include etag for upload ${n.uploadId}, part ${n.chunkIndex}`);
546
552
  return s;
@@ -548,8 +554,8 @@ const we = async (e = !1) => {
548
554
  return await u.updatePartial("chunkUploads", t.uuid, { data: null, etag: a, status: "UploadComplete" }), t.uploadId;
549
555
  })), st = async (e) => {
550
556
  const t = await u.getChunkUploadsByStatus({ status: "UploadComplete", uploadId: e });
551
- if (!(t != null && t.length)) return void d.info("NoChunksForUpload", { uploadId: e });
552
- const a = t.reduce((s, o) => (s.find((l) => l.chunkIndex === o.chunkIndex) || s.push(o), s), []);
557
+ if (!(t != null && t.length)) return void l.info("NoChunksForUpload", { uploadId: e });
558
+ const a = t.reduce((s, o) => (s.find((d) => d.chunkIndex === o.chunkIndex) || s.push(o), s), []);
553
559
  a.sort((s, o) => s.chunkIndex - o.chunkIndex);
554
560
  const n = a.map((s) => ({ ETag: s.etag, PartNumber: s.chunkIndex })).filter((s) => s.ETag !== null), r = a[0];
555
561
  await Ne({ apiUrl: r.apiUrl, surveyId: r.surveyId, uploadId: e, responseGroupUuid: r.responseGroupId, etags: n, headers: r.completeUploadHeaders, replayDuration: r.replayDuration }), await u.deleteChunkUploads("UploadComplete", e);
@@ -567,11 +573,11 @@ const we = async (e = !1) => {
567
573
  return (async (n, r) => {
568
574
  const s = new TextEncoder();
569
575
  let o = null;
570
- const l = new CompressionStream("gzip"), i = l.writable.getWriter();
576
+ const d = new CompressionStream("gzip"), i = d.writable.getWriter();
571
577
  let c = !1, w = !1, [p, h] = [0, 0], y = [];
572
578
  for (let P = n - 35e3; P < r; P += pe) {
573
579
  if ({ validStartFound: w, events: y } = await zt(P, n, r, w, pe), !(y != null && y.length)) {
574
- d.debug("NoEventsFound");
580
+ l.debug("NoEventsFound");
575
581
  continue;
576
582
  }
577
583
  p === 0 && (p = y[0].timestamp), h = y[y.length - 1].timestamp;
@@ -582,57 +588,56 @@ const we = async (e = !1) => {
582
588
  i.write(S);
583
589
  }, "sdk_replay_compression_seconds"), c = !0;
584
590
  }
585
- if (h - p < nt) return d.debug("ReplayTooShort"), null;
591
+ if (h - p < nt) return l.debug("ReplayTooShort"), null;
586
592
  const T = s.encode("]");
587
- return i.write(T), i.close(), o = new Uint8Array(await new Response(l.readable).arrayBuffer()), o;
593
+ return i.write(T), i.close(), o = new Uint8Array(await new Response(d.readable).arrayBuffer()), o;
588
594
  })(a - e, a);
589
595
  }, Pe = async (e) => {
590
- const { surveyId: t, responseGroupId: a, visitorId: n, apiUrl: r, completeUploadHeaders: s, replayParams: o, triggerTimestamp: l } = e, i = await Qt(1e3 * o.replayDurationSeconds, l);
591
- if (!(i != null && i.length)) return void d.info("FileDataEmpty", { surveyId: t });
596
+ const { surveyId: t, responseGroupId: a, visitorId: n, apiUrl: r, completeUploadHeaders: s, replayParams: o, triggerTimestamp: d } = e, i = await Qt(1e3 * o.replayDurationSeconds, d);
597
+ if (!(i != null && i.length)) return void l.info("FileDataEmpty", { surveyId: t });
592
598
  const c = ((p, h, y) => {
593
599
  const T = p.length, P = 1024 * h * 1024, f = Math.ceil(T / y), v = Math.max(P, f), S = [];
594
600
  let E = 0;
595
601
  for (; E < T; ) S.push(p.slice(E, E + v)), E += v;
596
602
  return S;
597
603
  })(i, o.minimumChunkSizeMb, o.signedUrls.length), w = await Promise.all(c.map(async (p, h) => {
598
- const y = X(), T = { apiUrl: r, chunkIndex: h + 1, completeUploadHeaders: s, etag: null, responseGroupId: a, status: "ReadyForUpload", surveyId: t, timestamp: l, totalChunks: c.length, data: p, uploadId: o.uploadId, uploadUrl: o.signedUrls[h].url, uuid: y, visitorId: n };
604
+ const y = X(), T = { apiUrl: r, chunkIndex: h + 1, completeUploadHeaders: s, etag: null, responseGroupId: a, status: "ReadyForUpload", surveyId: t, timestamp: d, totalChunks: c.length, data: p, uploadId: o.uploadId, uploadUrl: o.signedUrls[h].url, uuid: y, visitorId: n };
599
605
  return await (await u.openDB()).add("chunkUploads", { ...T, sessionId: T.sessionId ?? I }), T;
600
606
  }));
601
607
  await (async (p, h) => {
602
608
  await rt(h), await Promise.all(p.map((y) => st(y)));
603
609
  })([o.uploadId], w);
604
610
  }, ot = async (e, t) => {
605
- if (C()) return d.debug("ReplayDisabled-ScheduleOrCapture");
606
- const { isHeatmap: a, isStandalone: n, replayParams: r, triggerTimestamp: s, responseGroupId: o } = e, l = async () => {
607
- setTimeout(() => V.removeListener(Y.QuestionAnswered, l), 0), b(async () => {
611
+ if (R()) return l.debug("ReplayDisabled-ScheduleOrCapture");
612
+ const { isHeatmap: a, isStandalone: n, replayParams: r, triggerTimestamp: s, responseGroupId: o } = e, d = async () => {
613
+ setTimeout(() => V.removeListener(Y.QuestionAnswered, d), 0), b(async () => {
608
614
  r.replayDurationType === "before" ? await Pe(e) : await u.markPendingCaptureToCanUpload(o);
609
615
  }, "Error in schedule/capture callback");
610
616
  };
611
617
  b(async () => {
612
618
  if (r.replayDurationType === "after" || r.replayDurationType === "beforeAndAfter")
613
- return !n && !a && V.on(Y.QuestionAnswered, l), void await dt(e);
619
+ return !n && !a && V.on(Y.QuestionAnswered, d), void await dt(e);
614
620
  if (n || a || t) await Pe(e), a && Xt();
615
621
  else {
616
622
  const i = 35 + r.replayDurationSeconds, c = s - 1e3 * i, w = s;
617
- await u.updateEventsExpiredAt(c, w, r.expirationTimeLimitMinutes), V.on(Y.QuestionAnswered, l);
623
+ await u.updateEventsExpiredAt(c, w, r.expirationTimeLimitMinutes), V.on(Y.QuestionAnswered, d);
618
624
  }
619
625
  }, "Error in scheduling/capturing replay");
620
626
  }, Xt = async () => {
621
- parseInt(_ ?? "0") || m.removeItem("sprig.isCapturingHeatmap"), m.getItem("sprig.teardownAfterCapture") && ($e(), it(), m.removeItem("sprig.teardownAfterCapture"));
622
- }, it = async () => C() ? d.debug("ReplayDisabled-ClearData") : Promise.all([u.deleteBySessionId("events", I), u.deleteBySessionId("pendingCaptures", I)]).catch((e) => {
627
+ parseInt(A ?? "0") || m.removeItem("sprig.isCapturingHeatmap"), m.getItem("sprig.teardownAfterCapture") && ($e(), it(), m.removeItem("sprig.teardownAfterCapture"));
628
+ }, it = async () => R() ? l.debug("ReplayDisabled-ClearData") : Promise.all([u.deleteBySessionId("events", I), u.deleteBySessionId("pendingCaptures", I)]).catch((e) => {
623
629
  H("Error clearing user replay data", e);
624
630
  }), dt = async (e) => {
625
- if (C()) return;
626
- const { isHeatmap: t, surveyId: a } = e, n = await u.getPendingCaptures(), r = n == null ? void 0 : n.filter((i) => i.captureParams.surveyId === a);
627
- if (r != null && r.length) return void d.info("PendingCaptureExists", { surveyId: a });
628
- t && (ue(), m.setItem("sprig.isCapturingHeatmap", "true"), ge = Date.now(), g.inactivityInterval || (g.inactivityInterval = window.setInterval(() => {
629
- var i;
630
- i = ge, Date.now() - i >= 3e4 && b(() => u.markPendingHeatmapsReady(), "Error in heatmap inactivity");
631
- }, 1e3)));
632
- const s = { ...e, replayParams: { ...e.replayParams } };
633
- e.replayParams.replayDurationType === "beforeAndAfter" && (s.replayParams.replayDurationSeconds *= 2), s.replayParams.replayDurationType = "before";
634
- const o = e.triggerTimestamp + 1e3 * e.replayParams.replayDurationSeconds;
635
- s.triggerTimestamp = o, _ = (parseInt(_ ?? "0") + 1).toString(), m.setItem("sprig.pendingCount", _), await (await u.openDB()).add("pendingCaptures", { canUpload: !1, captureParams: s, sessionId: I, targetTimestamp: o, timestamp: Date.now(), uuid: X() });
631
+ if (R()) return;
632
+ const { isHeatmap: t, surveyId: a } = e, n = { ...e, replayParams: { ...e.replayParams } };
633
+ e.replayParams.replayDurationType === "beforeAndAfter" && (n.replayParams.replayDurationSeconds *= 2), n.replayParams.replayDurationType = "before";
634
+ const r = e.triggerTimestamp + 1e3 * e.replayParams.replayDurationSeconds;
635
+ n.triggerTimestamp = r;
636
+ const s = { canUpload: !1, captureParams: n, sessionId: I, targetTimestamp: r, timestamp: Date.now(), uuid: X() }, { added: o } = await u.tryAddPendingCaptureForSurvey({ surveyId: a, record: s });
637
+ o ? (A = (parseInt(A ?? "0") + 1).toString(), m.setItem("sprig.pendingCount", A), t && (ue(), m.setItem("sprig.isCapturingHeatmap", "true"), ge = Date.now(), g.inactivityInterval || (g.inactivityInterval = window.setInterval(() => {
638
+ var d;
639
+ d = ge, Date.now() - d >= 3e4 && b(() => u.markPendingHeatmapsReady(), "Error in heatmap inactivity");
640
+ }, 1e3)))) : l.info("PendingCaptureExists", { surveyId: a });
636
641
  }, Yt = Object.freeze(Object.defineProperty({ __proto__: null, RecordEvent: (e) => {
637
642
  U("Sprig_TrackEvent", e);
638
643
  }, RecordPageView: (e) => {
@@ -643,39 +648,39 @@ const we = async (e = !1) => {
643
648
  if (!e || !t) return !1;
644
649
  const r = globalThis.UserLeap._API_URL, s = await Ne({ surveyId: e, responseGroupUuid: t, eventDigest: a, apiUrl: r, headers: n }, !0);
645
650
  return !(s != null && s.error);
646
- }, checkPendingHeatmapsUrl: () => C() ? d.debug("ReplayDisabled-PendingHeatmaps") : b(async () => {
651
+ }, checkPendingHeatmapsUrl: () => R() ? l.debug("ReplayDisabled-PendingHeatmaps") : b(async () => {
647
652
  const e = (await u.getPendingCaptures({ isHeatmap: !0 })).map((t) => ({ eventId: t.captureParams.eventId, uuid: t.uuid })).filter(({ eventId: t }) => !ut(t)).map(({ uuid: t }) => t);
648
- return d.info("PendingHeatmapsToComplete", { count: e.length }), e.length && (await u.markPendingHeatmapsReady(e), d.info("MarkedPendingHeatmapsReady")), e.length;
653
+ return l.info("PendingHeatmapsToComplete", { count: e.length }), e.length && (await u.markPendingHeatmapsReady(e), l.info("MarkedPendingHeatmapsReady")), e.length;
649
654
  }, "Error marking pending heatmaps ready"), clearUserReplayData: it, disableRecording: H, initializeReplay: async ({ maxReplayDurationSeconds: e, maxInflightRequests: t = 2, replaySettings: a, teardownAfter: n = !1, apiUrl: r, alwaysOnConfig: s }) => {
650
655
  if (s && Nt({ apiUrl: r, config: s, triggerSnapshot: () => {
651
656
  ue();
652
- } }), _ = m.getItem("sprig.pendingCount"), g.isRecording) return;
653
- if (n && m.setItem("sprig.teardownAfterCapture", "true"), C()) return d.debug("ReplayDisabled");
657
+ } }), A = m.getItem("sprig.pendingCount"), g.isRecording) return;
658
+ if (n && m.setItem("sprig.teardownAfterCapture", "true"), R()) return l.debug("ReplayDisabled");
654
659
  if (await (async () => {
655
660
  var i;
656
661
  if (!We()) return !0;
657
662
  if ((i = globalThis.navigator.storage) != null && i.estimate) try {
658
663
  const { quota: c = 0, usage: w = 0 } = await globalThis.navigator.storage.estimate(), p = (c - w) / 1024 ** 3;
659
- return d.info("Storage", { availableGb: p }), p < 0.5;
664
+ return l.info("Storage", { availableGb: p }), p < 0.5;
660
665
  } catch {
661
666
  return !0;
662
667
  }
663
668
  return !1;
664
- })()) return d.debug("IDBNotSupported"), ce();
669
+ })()) return l.debug("IDBNotSupported"), ce();
665
670
  try {
666
671
  const i = await u.openDB();
667
- d.info("DBVersion", { version: i.version });
672
+ l.info("DBVersion", { version: i.version });
668
673
  } catch (i) {
669
- return d.error("ReplayOpenErr", { name: i.name }), i.name === "VersionError" && u.deleteDB(), ce();
674
+ return l.error("ReplayOpenErr", { name: i.name }), i.name === "VersionError" && u.deleteDB(), ce();
670
675
  }
671
676
  b(async () => {
672
677
  await we(!0);
673
678
  }, "Error uploading ready pending captures");
674
- const o = O() ? 30 : 0, l = Math.max(e ?? 0, o);
675
- if (!l) return d.debug("MissingDuration");
676
- d.debug("ReplayInit"), await b(async () => {
679
+ const o = O() ? 30 : 0, d = Math.max(e ?? 0, o);
680
+ if (!d) return l.debug("MissingDuration");
681
+ l.debug("ReplayInit"), await b(async () => {
677
682
  var i;
678
- a != null && a.minDuration && (nt = a.minDuration), a != null && a.batchDuration && (pe = a.batchDuration), i = t, Ae.setLimit(i), qt(), Kt(l + 35, 1800, l + 35), Jt();
683
+ a != null && a.minDuration && (nt = a.minDuration), a != null && a.batchDuration && (pe = a.batchDuration), i = t, _e.setLimit(i), qt(), Kt(d + 35, 1800, d + 35), Jt();
679
684
  const c = window.UserLeap.replayLibraryURL ?? "https://cdn.sprig.com/dependencies/record.min.js";
680
685
  if (!window.rrwebRecord) {
681
686
  const { record: f } = await import(
@@ -686,12 +691,12 @@ const we = async (e = !1) => {
686
691
  window.rrwebRecord = f;
687
692
  }
688
693
  const w = window.rrwebRecord;
689
- if (!w) return d.error("RecordScriptFailed");
694
+ if (!w) return l.error("RecordScriptFailed");
690
695
  let p = !0, h = 0;
691
696
  const y = { checkoutEveryNms: 3e4, sampling: { input: "last", scroll: 250, media: 800 }, ...a, mutationQueueEnabled: a == null ? void 0 : a.enableMutationQueue };
692
697
  var T, P;
693
698
  g.stopRecording = w({ emit: (f, v) => {
694
- if (f.type === B.Custom && (ge = Date.now()), C() || z()) return;
699
+ if (f.type === B.Custom && (ge = Date.now()), R() || z()) return;
695
700
  if (v && f.type === B.Meta) h = performance.now();
696
701
  else if (v && h && f.type === B.FullSnapshot) {
697
702
  const E = performance.now() - h;
@@ -707,7 +712,7 @@ const we = async (e = !1) => {
707
712
  })(y, c), V.on("survey.complete", (f) => {
708
713
  var v;
709
714
  v = { id: f, userAgent: window.navigator.userAgent }, U("Sprig_SubmitSurvey", v);
710
- }), T = U, P = Mt, J || (D = T, G = P, window.addEventListener("click", je, R), window.addEventListener("pointerdown", Ge, R), window.addEventListener("mousedown", Ve, R), window.addEventListener("keydown", Fe, R), window.addEventListener("scroll", He, R), J = !0, xt(), Bt()));
715
+ }), T = U, P = Mt, J || (D = T, G = P, window.addEventListener("click", je, C), window.addEventListener("pointerdown", Ge, C), window.addEventListener("mousedown", Ve, C), window.addEventListener("keydown", Fe, C), window.addEventListener("scroll", He, C), J = !0, xt(), Bt()));
711
716
  }, "Error initializing replay");
712
717
  }, isReplayPaused: z, isReplayRecording: () => g.isRecording, recordFullSnapshot: ue, recordReplayPaused: () => {
713
718
  U("Sprig_ReplayPaused", { timestamp: Date.now() }), m.setItem("sprig.isReplayPaused", "true");