leesto-connect 0.2.1 → 0.4.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.
@@ -1,52 +1,82 @@
1
- var Ce = "login", Ie = 6e3;
2
- function _e(e) {
1
+ var nt = "login", rt = "rrweb-buffer", ot = 6e3;
2
+ function st(e) {
3
3
  return typeof e == "object" && e !== null && typeof e.type == "string" && e.type.startsWith("leesto:");
4
4
  }
5
- var Ne = "leesto_diag", Te = "leesto_run", ue = "X-Leesto-Run-Id", qe = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6
- function W(e) {
7
- return typeof e == "string" && qe.test(e);
5
+ var it = [
6
+ "mask_all",
7
+ "labels_visible",
8
+ "inputs_only"
9
+ ], ae = "mask_all";
10
+ function at(e) {
11
+ return typeof e == "string" && it.includes(e);
12
+ }
13
+ var lt = "leesto_diag", ct = "leesto_run", _e = "X-Leesto-Run-Id", ut = "leesto_mask", ft = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
14
+ function ee(e) {
15
+ return typeof e == "string" && ft.test(e);
8
16
  }
9
- function De() {
17
+ function dt() {
10
18
  try {
11
19
  const e = globalThis.crypto, t = e?.randomUUID?.();
12
- if (W(t)) return t;
20
+ if (ee(t)) return t;
13
21
  if (!e?.getRandomValues) return;
14
22
  const n = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
15
23
  n[6] = (n[6] ?? 0) & 15 | 64, n[8] = (n[8] ?? 0) & 63 | 128;
16
- const r = Array.from(n, (o) => o.toString(16).padStart(2, "0")).join(""), i = `${r.slice(0, 8)}-${r.slice(8, 12)}-${r.slice(12, 16)}-${r.slice(16, 20)}-${r.slice(20)}`;
17
- return W(i) ? i : void 0;
24
+ const r = Array.from(n, (s) => s.toString(16).padStart(2, "0")).join(""), o = `${r.slice(0, 8)}-${r.slice(8, 12)}-${r.slice(12, 16)}-${r.slice(16, 20)}-${r.slice(20)}`;
25
+ return ee(o) ? o : void 0;
18
26
  } catch {
19
27
  return;
20
28
  }
21
29
  }
22
- function xe(e) {
30
+ function pt(e) {
31
+ try {
32
+ const t = new URLSearchParams(e).getAll(ut), [n] = t;
33
+ return t.some((r) => r !== n) ? ae : at(n) ? n : ae;
34
+ } catch {
35
+ return ae;
36
+ }
37
+ }
38
+ function ht(e) {
23
39
  try {
24
- const t = new URLSearchParams(e).get(Te);
25
- return W(t) ? t : void 0;
40
+ const t = new URLSearchParams(e).get(ct);
41
+ return ee(t) ? t : void 0;
26
42
  } catch {
27
43
  return;
28
44
  }
29
45
  }
30
- function Me(e) {
46
+ function de(e) {
31
47
  try {
32
- return new URLSearchParams(e).get(Ne) === "1";
48
+ return new URLSearchParams(e).get(lt) === "1";
33
49
  } catch {
34
50
  return !1;
35
51
  }
36
52
  }
37
- var de = "leesto/console", Q = "leesto/network", Pe = "leesto/network-ring", $e = "leesto/console-ring", Fe = {
53
+ function mt(e, t) {
54
+ if (de(e)) return e;
55
+ if (typeof t != "string" || !t.startsWith("leesto-arming?")) return "";
56
+ const n = `?${t.slice(14)}`;
57
+ return de(n) ? n : "";
58
+ }
59
+ function gt(e) {
60
+ try {
61
+ const t = new URL(e);
62
+ return `${t.origin}${t.pathname}`;
63
+ } catch {
64
+ return e.split(/[?#]/)[0] ?? e;
65
+ }
66
+ }
67
+ var Ae = "leesto/console", yt = "leesto/network", vt = "leesto/network-ring", bt = "leesto/console-ring", wt = {
38
68
  primary: "#08783f",
39
69
  hover: "#066633",
40
70
  foreground: "#f3fff7"
41
- }, Ge = {
71
+ }, Et = {
42
72
  primary: "#46c383",
43
73
  hover: "#65d49b",
44
74
  foreground: "#082315"
45
- }, He = {
46
- light: Fe,
47
- dark: Ge
75
+ }, St = {
76
+ light: wt,
77
+ dark: Et
48
78
  };
49
- function j(e) {
79
+ function Z(e) {
50
80
  const t = [];
51
81
  return {
52
82
  push(n) {
@@ -57,126 +87,147 @@ function j(e) {
57
87
  }
58
88
  };
59
89
  }
60
- var Ue = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, Be = /\b\d{3}-\d{2}-\d{4}\b/g, ze = /\d(?:[ -]?\d){12,18}/g;
61
- function je(e) {
90
+ var Rt = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, _t = /\b\d{3}-\d{2}-\d{4}\b/g, At = /\d(?:[ -]?\d){12,18}/g, Tt = /\b(Bearer|Basic|Token)\s+(?=[A-Za-z0-9._~+/=-]*\d)[A-Za-z0-9._~+/=-]{6,}/gi, Lt = /\b((?:proxy-)?authorization)\b(["']?\s*[:=]\s*["']?)(?:Digest\s+[^\r\n]*|(?:(?:Bearer|Basic|Token)\s+)?[^\s"'&,;}]+)/gi, kt = /(token|secret|passw(?:or)?d|api[-_]?key)\b(["']?\s*[:=]\s*["']?)[^\s"'&,;}]+/gi, Ot = /\b((?:set-)?cookie)\b(["']?\s*[:=]\s*["']?)[^"'\r\n]+/gi, It = /\b(session(?:[-_]?id)?)\b(["']?\s*[:=]\s*["']?)(?=[^\s"'&,;}]{0,256}\d)[^\s"'&,;}]+/gi, Ct = /\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\b/g, Nt = /\bhttps?:\/\/[^\s"'<>)]+/gi, xt = /(?::\d+){1,2}$/;
91
+ function Mt(e) {
92
+ const t = e.search(/[?#]/);
93
+ if (t < 0) return e;
94
+ const n = xt.exec(e.slice(t))?.[0] ?? "";
95
+ return e.slice(0, t) + n;
96
+ }
97
+ function Dt(e) {
62
98
  let t = 0, n = !1;
63
99
  for (let r = e.length - 1; r >= 0; r--) {
64
- let i = e.charCodeAt(r) - 48;
65
- if (i < 0 || i > 9) return !1;
66
- n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
100
+ let o = e.charCodeAt(r) - 48;
101
+ if (o < 0 || o > 9) return !1;
102
+ n && (o *= 2, o > 9 && (o -= 9)), t += o, n = !n;
67
103
  }
68
104
  return t % 10 === 0;
69
105
  }
70
- function D(e) {
106
+ function pe(e) {
71
107
  if (!e) return e;
72
- let t = e.replace(Ue, "[email masqué]");
73
- return t = t.replace(Be, "[id masqué]"), t = t.replace(ze, (n) => {
108
+ let t = e.replace(Nt, Mt).replace(Lt, "$1$2[secret masqué]").replace(Tt, "$1 [secret masqué]").replace(Ct, "[jeton masqué]").replace(Ot, "$1$2[secret masqué]").replace(kt, "$1$2[secret masqué]").replace(It, "$1$2[secret masqué]");
109
+ return t = t.replace(Rt, "[email masqué]"), t = t.replace(_t, "[id masqué]"), t = t.replace(At, (n) => {
74
110
  const r = n.replace(/[ -]/g, "");
75
- return r.length >= 13 && r.length <= 19 && je(r) ? "[carte masquée]" : n;
111
+ return r.length >= 13 && r.length <= 19 && Dt(r) ? "[carte masquée]" : n;
76
112
  }), t;
77
113
  }
78
- function H(e) {
114
+ function W(e) {
79
115
  const t = typeof e == "string" ? e : e instanceof URL ? e.href : e instanceof Request ? e.url : String(e);
80
116
  try {
81
117
  const n = new URL(t, typeof location < "u" ? location.href : void 0);
82
- return n.origin + D(n.pathname);
118
+ return n.origin + pe(n.pathname);
83
119
  } catch {
84
- return D(t.split("?")[0] ?? t);
120
+ return pe(t.split("?")[0] ?? t);
85
121
  }
86
122
  }
87
- var Ve = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), We = ["deprecation", "intervention"], Xe = { teardown: () => {
123
+ var $t = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), Pt = ["deprecation", "intervention"], qt = { teardown: () => {
88
124
  } };
89
- function Ke(e) {
125
+ function Bt(e) {
90
126
  const t = typeof performance < "u" ? performance.timeOrigin : 0;
91
127
  return Math.round(t + e);
92
128
  }
93
- function Ye(e) {
129
+ function Ft(e) {
94
130
  const t = e.responseStatus;
95
131
  return typeof t == "number" && t > 0 ? t : void 0;
96
132
  }
97
- function Ze(e) {
98
- if (Ve.has(e.initiatorType)) return null;
99
- const t = Ye(e), n = e.transferSize || e.encodedBodySize || void 0;
133
+ function Ut(e) {
134
+ if ($t.has(e.initiatorType)) return null;
135
+ const t = Ft(e), n = e.transferSize || e.encodedBodySize || void 0;
100
136
  return {
101
137
  method: "GET",
102
- url: H(e.name),
138
+ url: W(e.name),
103
139
  ...t !== void 0 ? { status: t } : {},
104
140
  durationMs: Math.round(e.duration),
105
141
  ...n ? { responseSize: n } : {},
106
- startedAt: Ke(e.startTime),
142
+ startedAt: Bt(e.startTime),
107
143
  ...t !== void 0 && t >= 400 ? { failed: !0 } : {},
108
144
  initiatorType: e.initiatorType
109
145
  };
110
146
  }
111
- function Je(e) {
112
- if (typeof window > "u") return Xe;
147
+ function Gt(e) {
148
+ if (typeof window > "u") return qt;
113
149
  const t = [];
114
150
  if (typeof PerformanceObserver < "u") try {
115
- const o = new PerformanceObserver((s) => {
116
- for (const c of s.getEntries()) try {
117
- const l = Ze(c);
118
- l && e.onResource(l);
151
+ const s = new PerformanceObserver((u) => {
152
+ for (const l of u.getEntries()) try {
153
+ const i = Ut(l);
154
+ i && e.onResource(i);
119
155
  } catch {
120
156
  }
121
157
  });
122
- o.observe({
158
+ s.observe({
123
159
  type: "resource",
124
160
  buffered: !0
125
- }), t.push(() => o.disconnect());
161
+ }), t.push(() => s.disconnect());
126
162
  } catch {
127
163
  }
128
164
  const n = window.ReportingObserver;
129
165
  if (n) try {
130
- const o = new n(((s) => {
131
- for (const c of s) {
132
- const l = typeof c.body?.message == "string" ? c.body.message : c.type;
133
- e.onReport("warn", `Navigateur (${c.type}) : ${l}`);
166
+ const s = new n(((u) => {
167
+ for (const l of u) {
168
+ const i = typeof l.body?.message == "string" ? l.body.message : l.type;
169
+ e.onReport("warn", `Navigateur (${l.type}) : ${i}`);
134
170
  }
135
171
  }), {
136
- types: We,
172
+ types: Pt,
137
173
  buffered: !0
138
174
  });
139
- o.observe(), t.push(() => o.disconnect());
175
+ s.observe(), t.push(() => s.disconnect());
140
176
  } catch {
141
177
  }
142
- const r = (o) => {
143
- const s = o;
144
- e.onReport("error", `CSP : ${s.blockedURI || "ressource"} bloqué par « ${s.violatedDirective} »`);
178
+ const r = (s) => {
179
+ const u = s;
180
+ e.onReport("error", `CSP : ${u.blockedURI || "ressource"} bloqué par « ${u.violatedDirective} »`);
145
181
  };
146
182
  window.addEventListener("securitypolicyviolation", r), t.push(() => window.removeEventListener("securitypolicyviolation", r));
147
- let i = !1;
183
+ let o = !1;
148
184
  return { teardown: () => {
149
- if (!i) {
150
- i = !0;
151
- for (const o of t) try {
152
- o();
185
+ if (!o) {
186
+ o = !0;
187
+ for (const s of t) try {
188
+ s();
153
189
  } catch {
154
190
  }
155
191
  }
156
192
  } };
157
193
  }
158
- var Qe = 50, et = 30, tt = 100, nt = 50, G = 500, rt = 8e3;
159
- function ee(e) {
194
+ var Ht = 50, Wt = 30, jt = 100, zt = 50, K = 500, Pe = 8e3, Vt = K * 4, Xt = Pe * 2;
195
+ function qe(e, t, n) {
196
+ return pe(e.slice(0, n)).slice(0, t);
197
+ }
198
+ function V(e) {
199
+ return qe(e, K, Vt);
200
+ }
201
+ var Kt = /(token|secret|passw(or)?d|api[-_]?key|authorization|cookie)$/i;
202
+ function le(e) {
160
203
  const t = e instanceof Error ? e.stack : void 0;
161
204
  if (t)
162
- return D(t).slice(0, rt);
205
+ return qe(t, Pe, Xt);
163
206
  }
164
- function te(e) {
207
+ function ce(e) {
165
208
  if (e instanceof Error) return `${e.name}: ${e.message}`;
166
209
  if (typeof e == "string") return e;
167
- if (typeof e == "object" && e !== null) try {
168
- return JSON.stringify(e, (t, n) => /^(authorization|cookie|set-cookie|token|access_token|refresh_token|password|secret|api[-_]?key)$/i.test(t) ? "[masqué]" : n).slice(0, 500);
169
- } catch {
170
- return "[objet]";
210
+ if (typeof e == "object" && e !== null) {
211
+ const t = /* @__PURE__ */ Symbol("overflow");
212
+ let n = K * 8;
213
+ try {
214
+ return JSON.stringify(e, (r, o) => {
215
+ if (Kt.test(r)) return "[masqué]";
216
+ if (n -= r.length + (typeof o == "string" ? o.length : 8), n < 0) throw t;
217
+ return o;
218
+ }).slice(0, K);
219
+ } catch (r) {
220
+ return r === t ? "[objet volumineux]" : "[objet]";
221
+ }
171
222
  }
172
223
  return String(e);
173
224
  }
174
- function fe(e) {
225
+ function Te(e) {
175
226
  if (!e) return;
176
227
  const t = Number(e);
177
228
  return Number.isFinite(t) && t >= 0 ? t : void 0;
178
229
  }
179
- var ot = {
230
+ var Yt = {
180
231
  snapshot: () => ({
181
232
  errors: [],
182
233
  logs: [],
@@ -189,228 +240,429 @@ var ot = {
189
240
  teardown: () => {
190
241
  }
191
242
  };
192
- function Se(e) {
193
- if (typeof window > "u") return ot;
194
- const t = j(Qe), n = j(et), r = j(tt), i = j(nt), o = W(e.runId) ? e.runId : void 0, s = (a) => {
195
- if (!o) return !1;
243
+ function Be(e) {
244
+ if (typeof window > "u") return Yt;
245
+ const t = Z(Ht), n = Z(Wt), r = Z(jt), o = Z(zt), s = ee(e.runId) ? e.runId : void 0, u = (f) => {
246
+ if (!s) return !1;
196
247
  try {
197
- const u = new URL(String(a), location.href);
198
- return u.origin === location.origin || (e.runIdOrigins ?? []).includes(u.origin);
248
+ const p = new URL(String(f), location.href);
249
+ return p.origin === location.origin || (e.runIdOrigins ?? []).includes(p.origin);
199
250
  } catch {
200
251
  return !1;
201
252
  }
202
253
  };
203
- let c = e.sink ?? null;
204
- const l = (a, u) => {
205
- c?.(a, u);
206
- }, g = (a) => {
207
- e.captureNetwork && t.push(a);
208
- }, d = (a, u, f, h = {}) => {
209
- if (!u) return;
210
- const O = {
211
- level: a,
212
- message: u,
213
- ...f ? { stack: f } : {},
214
- ...h,
254
+ let l = e.sink ?? null;
255
+ const i = (f, p) => {
256
+ l?.(f, p);
257
+ }, a = (f) => {
258
+ e.captureNetwork && t.push(f);
259
+ }, c = (f) => {
260
+ e.captureNetwork && i(yt, f);
261
+ }, d = (f, p, m, E = {}) => {
262
+ if (!p) return;
263
+ const L = {
264
+ level: f,
265
+ message: p,
266
+ ...m ? { stack: m } : {},
267
+ ...E,
215
268
  at: Date.now()
216
269
  };
217
- i.push(O), l(de, O);
218
- }, w = (a, u) => {
270
+ o.push(L), i(Ae, L);
271
+ }, v = (f, p) => {
219
272
  try {
220
- const f = D(u.map(te).join(" ")).slice(0, G), h = u.find((O) => O instanceof Error);
221
- d(a, f, ee(h), {
273
+ const m = V(p.map(ce).join(" ")), E = p.find((L) => L instanceof Error);
274
+ d(f, m, le(E), {
222
275
  mechanism: "console",
223
- ...h instanceof Error && h.name ? { name: h.name } : {}
276
+ ...E instanceof Error && E.name ? { name: E.name } : {}
224
277
  });
225
278
  } catch {
226
279
  }
227
- }, v = (a, u) => {
280
+ }, g = (f, p) => {
228
281
  try {
229
- const f = D(u.map(te).join(" ")).slice(0, G);
230
- f && r.push({
231
- level: a,
232
- message: f,
282
+ const m = V(p.map(ce).join(" "));
283
+ m && r.push({
284
+ level: f,
285
+ message: m,
233
286
  at: Date.now()
234
287
  });
235
288
  } catch {
236
289
  }
237
- }, E = console.error, b = console.warn, S = console.log, A = console.info;
238
- console.error = (...a) => (w("error", a), E.apply(console, a)), console.warn = (...a) => (w("warn", a), b.apply(console, a)), console.log = (...a) => (v("log", a), S.apply(console, a)), console.info = (...a) => (v("info", a), A.apply(console, a));
239
- const x = (a) => {
240
- const u = a.target;
241
- if (u instanceof Element) {
242
- const h = u.src || u.href || "";
243
- if (!h) return;
244
- d("error", `Ressource non chargée : <${u.tagName.toLowerCase()}> ${H(h)}`.slice(0, G), void 0, {
290
+ }, w = console.error, S = console.warn, R = console.log, _ = console.info;
291
+ console.error = (...f) => (v("error", f), w.apply(console, f)), console.warn = (...f) => (v("warn", f), S.apply(console, f)), console.log = (...f) => (g("log", f), R.apply(console, f)), console.info = (...f) => (g("info", f), _.apply(console, f));
292
+ const C = (f) => {
293
+ const p = f.target;
294
+ if (p instanceof Element) {
295
+ const E = p.src || p.href || "";
296
+ if (!E) return;
297
+ d("error", `Ressource non chargée : <${p.tagName.toLowerCase()}> ${W(E)}`.slice(0, K), void 0, {
245
298
  mechanism: "resource",
246
- sourceUrl: H(h)
299
+ sourceUrl: W(E)
247
300
  });
248
301
  return;
249
302
  }
250
- const f = a;
251
- d("error", D(`Erreur non gérée : ${f.message}`).slice(0, G), ee(f.error), {
303
+ const m = f;
304
+ d("error", V(`Erreur non gérée : ${m.message}`), le(m.error), {
252
305
  mechanism: "window.error",
253
- ...typeof f.error?.name == "string" ? { name: f.error.name } : {},
254
- ...typeof f.filename == "string" && f.filename ? { sourceUrl: H(f.filename) } : {},
255
- ...typeof f.lineno == "number" && f.lineno > 0 ? { line: f.lineno } : {},
256
- ...typeof f.colno == "number" && f.colno > 0 ? { column: f.colno } : {}
306
+ ...typeof m.error?.name == "string" ? { name: m.error.name } : {},
307
+ ...typeof m.filename == "string" && m.filename ? { sourceUrl: W(m.filename) } : {},
308
+ ...typeof m.lineno == "number" && m.lineno > 0 ? { line: m.lineno } : {},
309
+ ...typeof m.colno == "number" && m.colno > 0 ? { column: m.colno } : {}
257
310
  });
258
- }, I = (a) => {
259
- d("error", D(`Promesse rejetée : ${te(a.reason)}`).slice(0, G), ee(a.reason), {
311
+ }, N = (f) => {
312
+ d("error", V(`Promesse rejetée : ${ce(f.reason)}`), le(f.reason), {
260
313
  mechanism: "unhandledrejection",
261
- ...a.reason instanceof Error && a.reason.name ? { name: a.reason.name } : {}
314
+ ...f.reason instanceof Error && f.reason.name ? { name: f.reason.name } : {}
262
315
  });
263
316
  };
264
- window.addEventListener("error", x, !0), window.addEventListener("unhandledrejection", I);
265
- const M = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
266
- M && (window.fetch = (async (a, u) => {
267
- const f = Date.now(), h = (u?.method ?? (a instanceof Request ? a.method : "GET") ?? "GET").toUpperCase(), O = H(a);
268
- let T = u;
269
- if (o && s(a)) {
270
- const R = new Headers(a instanceof Request ? a.headers : void 0);
271
- for (const [k, p] of new Headers(u?.headers)) R.set(k, p);
272
- R.set(ue, o), T = {
273
- ...u,
274
- headers: R
317
+ window.addEventListener("error", C, !0), window.addEventListener("unhandledrejection", N);
318
+ const x = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
319
+ x && (window.fetch = (async (f, p) => {
320
+ const m = Date.now(), E = (p?.method ?? (f instanceof Request ? f.method : "GET") ?? "GET").toUpperCase(), L = W(f);
321
+ let F = p;
322
+ if (s && u(f)) {
323
+ const A = new Headers(f instanceof Request ? f.headers : void 0);
324
+ for (const [T, G] of new Headers(p?.headers)) A.set(T, G);
325
+ A.set(_e, s), F = {
326
+ ...p,
327
+ headers: A
275
328
  };
276
329
  }
277
330
  try {
278
- const R = await M(a, T);
331
+ const A = await x(f, F);
279
332
  try {
280
- const k = R.headers.get("x-request-id"), p = R.headers.get("traceparent");
281
- g({
282
- method: h,
283
- url: O,
284
- status: R.status,
285
- durationMs: Date.now() - f,
286
- responseSize: fe(R.headers.get("content-length")),
287
- contentType: R.headers.get("content-type") ?? void 0,
288
- startedAt: f,
289
- ...k ? { requestId: k.slice(0, 200) } : {},
290
- ...p ? { traceparent: p.slice(0, 200) } : {},
291
- ...o ? { runId: o } : {}
292
- }), R.ok || l(Q, {
293
- method: h,
294
- url: O,
295
- status: R.status,
296
- durationMs: Date.now() - f
333
+ const T = A.headers.get("x-request-id"), G = A.headers.get("traceparent");
334
+ a({
335
+ method: E,
336
+ url: L,
337
+ status: A.status,
338
+ durationMs: Date.now() - m,
339
+ responseSize: Te(A.headers.get("content-length")),
340
+ contentType: A.headers.get("content-type") ?? void 0,
341
+ startedAt: m,
342
+ ...T ? { requestId: T.slice(0, 200) } : {},
343
+ ...G ? { traceparent: G.slice(0, 200) } : {},
344
+ ...s ? { runId: s } : {}
345
+ }), A.ok || c({
346
+ method: E,
347
+ url: L,
348
+ status: A.status,
349
+ durationMs: Date.now() - m
297
350
  });
298
351
  } catch {
299
352
  }
300
- return R;
301
- } catch (R) {
353
+ return A;
354
+ } catch (A) {
302
355
  try {
303
- const k = Date.now() - f;
304
- g({
305
- method: h,
306
- url: O,
356
+ const T = Date.now() - m;
357
+ a({
358
+ method: E,
359
+ url: L,
307
360
  status: 0,
308
- durationMs: k,
309
- startedAt: f,
361
+ durationMs: T,
362
+ startedAt: m,
310
363
  failed: !0,
311
- ...o ? { runId: o } : {}
312
- }), l(Q, {
313
- method: h,
314
- url: O,
364
+ ...s ? { runId: s } : {}
365
+ }), c({
366
+ method: E,
367
+ url: L,
315
368
  status: 0,
316
- durationMs: k
369
+ durationMs: T
317
370
  });
318
371
  } catch {
319
372
  }
320
- throw R;
373
+ throw A;
321
374
  }
322
375
  }));
323
- const U = XMLHttpRequest.prototype.open, C = XMLHttpRequest.prototype.send, $ = "__echoNet";
324
- XMLHttpRequest.prototype.open = function(a, u, ...f) {
376
+ const P = XMLHttpRequest.prototype.open, M = XMLHttpRequest.prototype.send, $ = "__echoNet";
377
+ XMLHttpRequest.prototype.open = function(f, p, ...m) {
325
378
  return this[$] = {
326
- method: (a || "GET").toUpperCase(),
327
- url: H(u),
379
+ method: (f || "GET").toUpperCase(),
380
+ url: W(p),
328
381
  start: 0,
329
- propagate: s(u)
330
- }, U.apply(this, [
331
- a,
332
- u,
333
- ...f
382
+ propagate: u(p)
383
+ }, P.apply(this, [
384
+ f,
385
+ p,
386
+ ...m
334
387
  ]);
335
- }, XMLHttpRequest.prototype.send = function(...a) {
336
- const u = this[$];
337
- if (u) {
338
- if (u.start = Date.now(), o && u.propagate) try {
339
- this.setRequestHeader(ue, o);
388
+ }, XMLHttpRequest.prototype.send = function(...f) {
389
+ const p = this[$];
390
+ if (p) {
391
+ if (p.start = Date.now(), s && p.propagate) try {
392
+ this.setRequestHeader(_e, s);
340
393
  } catch {
341
394
  }
342
395
  this.addEventListener("loadend", () => {
343
396
  try {
344
- const f = Date.now() - u.start, h = this.status, O = h === 0, T = this.getResponseHeader("x-request-id"), R = this.getResponseHeader("traceparent");
345
- g({
346
- method: u.method,
347
- url: u.url,
348
- status: h,
349
- durationMs: f,
350
- responseSize: fe(this.getResponseHeader("content-length")),
397
+ const m = Date.now() - p.start, E = this.status, L = E === 0, F = this.getResponseHeader("x-request-id"), A = this.getResponseHeader("traceparent");
398
+ a({
399
+ method: p.method,
400
+ url: p.url,
401
+ status: E,
402
+ durationMs: m,
403
+ responseSize: Te(this.getResponseHeader("content-length")),
351
404
  contentType: this.getResponseHeader("content-type") ?? void 0,
352
- startedAt: u.start,
353
- ...O ? { failed: !0 } : {},
354
- ...o ? { runId: o } : {},
355
- ...T ? { requestId: T.slice(0, 200) } : {},
356
- ...R ? { traceparent: R.slice(0, 200) } : {}
357
- }), (O || h >= 400) && l(Q, {
358
- method: u.method,
359
- url: u.url,
360
- status: h,
361
- durationMs: f
405
+ startedAt: p.start,
406
+ ...L ? { failed: !0 } : {},
407
+ ...s ? { runId: s } : {},
408
+ ...F ? { requestId: F.slice(0, 200) } : {},
409
+ ...A ? { traceparent: A.slice(0, 200) } : {}
410
+ }), (L || E >= 400) && c({
411
+ method: p.method,
412
+ url: p.url,
413
+ status: E,
414
+ durationMs: m
362
415
  });
363
416
  } catch {
364
417
  }
365
418
  }, { once: !0 });
366
419
  }
367
- return C.apply(this, a);
420
+ return M.apply(this, f);
368
421
  };
369
- const z = Je({
370
- onResource: (a) => {
371
- e.captureNetwork && n.push(o ? {
372
- ...a,
373
- runId: o
374
- } : a);
422
+ const B = Gt({
423
+ onResource: (f) => {
424
+ e.captureNetwork && n.push(s ? {
425
+ ...f,
426
+ runId: s
427
+ } : f);
375
428
  },
376
- onReport: (a, u) => d(a, D(u).slice(0, G), void 0, { mechanism: "report" })
377
- }), _ = () => e.captureNetwork ? [...t.snapshot(), ...n.snapshot()].sort((a, u) => a.startedAt - u.startedAt) : [];
378
- let N = !1;
429
+ onReport: (f, p) => d(f, V(p), void 0, { mechanism: "report" })
430
+ }), D = () => e.captureNetwork ? [...t.snapshot(), ...n.snapshot()].sort((f, p) => f.startedAt - p.startedAt) : [];
431
+ let U = !1;
379
432
  return {
380
433
  snapshot: () => ({
381
- errors: i.snapshot(),
434
+ errors: o.snapshot(),
382
435
  logs: r.snapshot(),
383
- network: _(),
384
- ...o ? { runId: o } : {}
436
+ network: D(),
437
+ ...s ? { runId: s } : {}
385
438
  }),
386
- setSink: (a) => {
387
- c = a;
439
+ setSink: (f) => {
440
+ l = f;
388
441
  },
389
442
  flushRings: () => {
390
- const a = _();
391
- a.length > 0 && l(Pe, { entries: a });
392
- const u = r.snapshot();
393
- u.length > 0 && l($e, { entries: u });
394
- const f = i.snapshot();
395
- f.length > 0 && l(de, { entries: f });
443
+ const f = D();
444
+ f.length > 0 && i(vt, { entries: f });
445
+ const p = r.snapshot();
446
+ p.length > 0 && i(bt, { entries: p });
447
+ const m = o.snapshot();
448
+ m.length > 0 && i(Ae, { entries: m });
396
449
  },
397
450
  teardown: () => {
398
- N || (N = !0, c = null, z.teardown(), console.error = E, console.warn = b, console.log = S, console.info = A, window.removeEventListener("error", x, !0), window.removeEventListener("unhandledrejection", I), M && (window.fetch = M), XMLHttpRequest.prototype.open = U, XMLHttpRequest.prototype.send = C);
451
+ U || (U = !0, l = null, B.teardown(), console.error = w, console.warn = S, console.log = R, console.info = _, window.removeEventListener("error", C, !0), window.removeEventListener("unhandledrejection", N), x && (window.fetch = x), XMLHttpRequest.prototype.open = P, XMLHttpRequest.prototype.send = M);
452
+ }
453
+ };
454
+ }
455
+ var ge = "leesto-mask", te = "[data-leesto-block]", Fe = "leesto-mask-text", Ue = "[data-private]", Ge = `.${Fe}, ${Ue}`, Zt = 'img, picture, video, canvas, object, embed, svg image, input[type="image"]', Jt = 'button, a, [role="button"], [role="link"], input[type="button"], input[type="submit"], input[type="reset"]';
456
+ var He = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select';
457
+ function We(e) {
458
+ return e.replace(/\S/g, "*");
459
+ }
460
+ function Qt(e, t) {
461
+ try {
462
+ return e.closest(t);
463
+ } catch {
464
+ return null;
465
+ }
466
+ }
467
+ function je(e) {
468
+ return Qt(e, Ge) !== null;
469
+ }
470
+ var en = `.${ge}, ${te}, ${Ge}`;
471
+ function Y(e) {
472
+ try {
473
+ return e.closest(en) !== null;
474
+ } catch {
475
+ return !0;
476
+ }
477
+ }
478
+ function ze(e) {
479
+ if (!e || typeof e.closest != "function") return !1;
480
+ try {
481
+ if (je(e) || e.matches(He)) return !1;
482
+ const t = e.closest(Jt);
483
+ return t ? (t.textContent ?? "").trim().length <= 80 : !1;
484
+ } catch {
485
+ return !1;
486
+ }
487
+ }
488
+ var Le = {
489
+ maskAllInputs: !0,
490
+ maskInputOptions: {
491
+ password: !0,
492
+ email: !0,
493
+ tel: !0,
494
+ text: !0
495
+ },
496
+ blockClass: ge,
497
+ maskTextClass: Fe
498
+ };
499
+ function Ve(e) {
500
+ if (e === "inputs_only") return {
501
+ ...Le,
502
+ blockSelector: te,
503
+ maskTextSelector: Ue
504
+ };
505
+ const t = {
506
+ ...Le,
507
+ blockSelector: `${te}, ${Zt}`,
508
+ maskTextSelector: "*"
509
+ };
510
+ return e === "labels_visible" ? {
511
+ ...t,
512
+ maskTextFn: (n, r) => ze(r) ? n : We(n)
513
+ } : t;
514
+ }
515
+ var ke = /* @__PURE__ */ new Set([
516
+ "placeholder",
517
+ "title",
518
+ "alt",
519
+ "label",
520
+ "aria-label",
521
+ "aria-description",
522
+ "aria-placeholder",
523
+ "aria-roledescription",
524
+ "aria-valuetext"
525
+ ]), tn = 2, nn = 3, rn = 4, on = 0, sn = 2;
526
+ function an(e, t, n) {
527
+ if (e) try {
528
+ return e.matches(He);
529
+ } catch {
530
+ return !0;
531
+ }
532
+ const r = t.toLowerCase();
533
+ if (r === "textarea" || r === "select") return !0;
534
+ if (r !== "input") return !1;
535
+ const o = String(n.type ?? "").toLowerCase();
536
+ return o !== "button" && o !== "submit" && o !== "reset";
537
+ }
538
+ function Xe(e, t, n) {
539
+ const r = e;
540
+ if (!r || typeof r != "object" || !r.data) return e;
541
+ const o = (a) => {
542
+ if (typeof a != "number") return null;
543
+ try {
544
+ const c = n(a);
545
+ return c && c.nodeType === 1 ? c : null;
546
+ } catch {
547
+ return null;
548
+ }
549
+ }, s = (a, c, d, v) => {
550
+ if (c === "value") {
551
+ if (an(a, d, v)) return !1;
552
+ } else if (!ke.has(c)) return !0;
553
+ return !a || je(a) ? !1 : t === "inputs_only" ? !0 : t === "labels_visible" ? ze(a) : !1;
554
+ }, u = (a, c, d) => {
555
+ if (d)
556
+ for (const v of Object.keys(d)) {
557
+ const g = d[v];
558
+ typeof g != "string" || !g || v !== "value" && !ke.has(v) || s(a, v, c, d) || (d[v] = We(g));
559
+ }
560
+ }, l = (a) => {
561
+ const c = a ? [a] : [];
562
+ for (; c.length > 0; ) {
563
+ const d = c.pop();
564
+ d.type === sn && d.attributes && u(o(d.id), String(d.tagName ?? ""), d.attributes), Array.isArray(d.childNodes) && c.push(...d.childNodes);
565
+ }
566
+ }, i = r.data;
567
+ if (r.type === rn && typeof i.href == "string") i.href = gt(i.href);
568
+ else if (r.type === tn) l(i.node);
569
+ else if (r.type === nn && i.source === on) {
570
+ for (const a of i.adds ?? []) l(a.node);
571
+ for (const a of i.attributes ?? []) {
572
+ const c = o(a.id);
573
+ u(c, c?.tagName ?? "", a.attributes);
399
574
  }
575
+ }
576
+ return e;
577
+ }
578
+ var ln = 80, cn = {
579
+ a: "link",
580
+ button: "button",
581
+ img: "img",
582
+ textarea: "textbox",
583
+ select: "combobox",
584
+ h1: "heading",
585
+ h2: "heading",
586
+ h3: "heading",
587
+ h4: "heading",
588
+ h5: "heading",
589
+ h6: "heading",
590
+ dialog: "dialog"
591
+ }, un = {
592
+ button: "button",
593
+ submit: "button",
594
+ reset: "button",
595
+ checkbox: "checkbox",
596
+ radio: "radio",
597
+ search: "searchbox"
598
+ }, H = (e) => {
599
+ const t = (e ?? "").replace(/\s+/g, " ").trim();
600
+ return t ? t.slice(0, ln) : null;
601
+ };
602
+ function fn(e) {
603
+ const t = [];
604
+ let n = 0;
605
+ const r = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT);
606
+ for (let o = r.nextNode(); o && n < 320; o = r.nextNode()) {
607
+ const s = o.parentElement;
608
+ if (s && s !== e && Y(s)) continue;
609
+ const u = o.nodeValue ?? "";
610
+ u.trim() && (t.push(u), n += u.length);
611
+ }
612
+ return t.join(" ");
613
+ }
614
+ function dn(e, t) {
615
+ const n = e.getAttribute("role")?.trim().split(/\s+/)[0];
616
+ return n || (t === "input" ? un[e.type] ?? "textbox" : t === "a" && !e.hasAttribute("href") ? null : cn[t] ?? null);
617
+ }
618
+ function pn(e) {
619
+ const t = (e.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean) ?? []).map((n) => {
620
+ const r = e.ownerDocument.getElementById(n);
621
+ return r && !Y(r) ? r.textContent ?? "" : "";
622
+ });
623
+ return H(t.join(" "));
624
+ }
625
+ function hn(e, t) {
626
+ const n = H(e.getAttribute("aria-label")) ?? pn(e) ?? (t === "img" ? H(e.getAttribute("alt")) : null) ?? H(e.getAttribute("title"));
627
+ if (n) return n;
628
+ if (t === "input" || t === "textarea" || t === "select") {
629
+ const r = e.getAttribute("id"), o = r ? e.ownerDocument.querySelector(`label[for="${CSS.escape(r)}"]`) : null, s = o && !Y(o) ? o.textContent : null;
630
+ return H(s) ?? H(e.getAttribute("placeholder"));
631
+ }
632
+ return H(fn(e));
633
+ }
634
+ function mn(e) {
635
+ if (!e) return null;
636
+ try {
637
+ const t = new URL(e, document.baseURI);
638
+ return t.protocol === "data:" || t.protocol === "blob:" ? `${t.protocol}…` : `${t.origin}${t.pathname}`;
639
+ } catch {
640
+ return null;
641
+ }
642
+ }
643
+ function gn(e) {
644
+ const t = e.tagName.toLowerCase(), n = Y(e), r = {
645
+ tag: t,
646
+ role: dn(e, t),
647
+ name: n ? null : hn(e, t)
400
648
  };
649
+ return e instanceof HTMLImageElement && (r.image = {
650
+ src: n ? null : mn(e.currentSrc || e.getAttribute("src") || ""),
651
+ loaded: e.complete && e.naturalWidth > 0
652
+ }), r;
401
653
  }
402
- var it = 100, st = [
654
+ var yn = 100, vn = [
403
655
  "hidden",
404
656
  "class",
405
657
  "style",
406
658
  "type",
407
659
  "disabled",
408
660
  "aria-hidden"
409
- ], Y = 'input[type="password"]', Re = 'input[autocomplete="username"], input[autocomplete="email"], input[type="email"]', Z = `${Y}, ${Re}`, X = /\b(connexion|se connecter|connectez[- ]vous|s'identifier|identifiez[- ]vous|login|log ?in|sign ?in)\b/, oe = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|register|create (an |your )?account|mot de passe oublie|oublie|reinitialiser|forgot|reset|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|code|newsletter|abonner|subscribe|enregistrer|sauvegarder|mettre a jour|save|update|confirmer|confirm|supprimer mon compte|delete account|payer|pay)\b/, at = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|create (an |your )?account|mot de passe oublie|reinitialiser|forgot|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|newsletter|abonner|subscribe)\b/, lt = /\b(afficher|masquer|voir|show|hide|toggle)\b/, ct = /\b(effacer|vider|supprimer|clear|reset)\b/, ut = /[\u{1F441}\u{1F576}\u{1F440}]/u;
410
- function B(e) {
661
+ ], oe = 'input[type="password"]', Ke = 'input[autocomplete="username"], input[autocomplete="email"], input[type="email"]', se = `${oe}, ${Ke}`, ne = /\b(connexion|se connecter|connectez[- ]vous|s'identifier|identifiez[- ]vous|login|log ?in|sign ?in)\b/, he = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|register|create (an |your )?account|mot de passe oublie|oublie|reinitialiser|forgot|reset|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|code|newsletter|abonner|subscribe|enregistrer|sauvegarder|mettre a jour|save|update|confirmer|confirm|supprimer mon compte|delete account|payer|pay)\b/, bn = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|create (an |your )?account|mot de passe oublie|reinitialiser|forgot|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|newsletter|abonner|subscribe)\b/, wn = /\b(afficher|masquer|voir|show|hide|toggle)\b/, En = /\b(effacer|vider|supprimer|clear|reset)\b/, Sn = /[\u{1F441}\u{1F576}\u{1F440}]/u;
662
+ function X(e) {
411
663
  return (e ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[’‘]/g, "'").replace(/\s+/g, " ").trim().toLowerCase();
412
664
  }
413
- function J(e) {
665
+ function ie(e) {
414
666
  let t = e;
415
667
  for (; t; ) {
416
668
  if (t.hasAttribute("hidden") || t.getAttribute("aria-hidden") === "true" || t instanceof HTMLInputElement && t.type === "hidden") return !1;
@@ -420,43 +672,43 @@ function J(e) {
420
672
  }
421
673
  return !0;
422
674
  }
423
- function P(e, t) {
424
- return Array.from(e.querySelectorAll(t)).filter(J);
675
+ function j(e, t) {
676
+ return Array.from(e.querySelectorAll(t)).filter(ie);
425
677
  }
426
- function dt(e) {
678
+ function Rn(e) {
427
679
  return e ? e instanceof HTMLInputElement ? e.value : e.textContent ?? "" : "";
428
680
  }
429
- function Oe(e, t) {
681
+ function Ye(e, t) {
430
682
  return !e.outsideForms || !t.closest("form");
431
683
  }
432
- function V(e, t) {
433
- return Array.from(e.scope.querySelectorAll(t)).filter((n) => J(n) && Oe(e, n));
684
+ function J(e, t) {
685
+ return Array.from(e.scope.querySelectorAll(t)).filter((n) => ie(n) && Ye(e, n));
434
686
  }
435
- function K(e) {
436
- return B(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
687
+ function re(e) {
688
+ return X(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
437
689
  }
438
- function ft(e) {
439
- const t = K(e);
440
- return lt.test(t) || ut.test(t);
690
+ function _n(e) {
691
+ const t = re(e);
692
+ return wn.test(t) || Sn.test(t);
441
693
  }
442
- function pt(e, t) {
694
+ function An(e, t) {
443
695
  if (e.getAttribute("type") === "submit" || !t) return !1;
444
696
  const n = e.parentElement;
445
- return !n || P(n, Z).length === 0 ? !1 : !n.contains(t);
697
+ return !n || j(n, se).length === 0 ? !1 : !n.contains(t);
446
698
  }
447
- var ht = 'button, input[type="submit"], input[type="button"], input[type="image"], a[href]';
448
- function gt(e) {
449
- return Array.from(e.querySelectorAll(ht)).some(J);
699
+ var Tn = 'button, input[type="submit"], input[type="button"], input[type="image"], a[href]';
700
+ function Ln(e) {
701
+ return Array.from(e.querySelectorAll(Tn)).some(ie);
450
702
  }
451
- function mt(e, t) {
703
+ function kn(e, t) {
452
704
  let n = e.parentElement;
453
705
  for (; n && !n.contains(t); ) {
454
- if (gt(n)) return !0;
706
+ if (Ln(n)) return !0;
455
707
  n = n.parentElement;
456
708
  }
457
709
  return !1;
458
710
  }
459
- function yt(e) {
711
+ function On(e) {
460
712
  const t = [
461
713
  e.getAttribute("name"),
462
714
  e.getAttribute("id"),
@@ -468,173 +720,173 @@ function yt(e) {
468
720
  const r = e.ownerDocument.querySelector(`label[for="${CSS.escape(n)}"]`);
469
721
  r && t.push(r.textContent);
470
722
  }
471
- return B(t.filter(Boolean).join(" "));
723
+ return X(t.filter(Boolean).join(" "));
472
724
  }
473
- function wt(e, t) {
725
+ function In(e, t) {
474
726
  const n = e.parentElement;
475
727
  if (!n) return null;
476
- const r = e.ownerDocument.body, i = (d) => t ? Le({
477
- scope: d,
728
+ const r = e.ownerDocument.body, o = (c) => t ? Ze({
729
+ scope: c,
478
730
  outsideForms: !0
479
- }, t) : e, o = (d) => ie({
480
- scope: d,
731
+ }, t) : e, s = (c) => me({
732
+ scope: c,
481
733
  outsideForms: !0
482
- }, e, i(d)), s = (d) => !!i(d) && !!o(d);
483
- let c = n, l = null;
484
- const g = (d) => {
485
- const w = o(d);
486
- w && !l && X.test(K(w)) && (l = d);
734
+ }, e, o(c)), u = (c) => !!o(c) && !!s(c);
735
+ let l = n, i = null;
736
+ const a = (c) => {
737
+ const d = s(c);
738
+ d && !i && ne.test(re(d)) && (i = c);
487
739
  };
488
- for (g(n); c !== r && !s(c); ) {
489
- const d = c.parentElement;
490
- if (!d || d.querySelector("form")) break;
491
- const w = [e], v = i(c);
492
- v && v !== e && w.push(v);
493
- const E = !!v;
494
- if (P(d, Z).filter((b) => !b.closest("form") && !w.includes(b)).some((b) => b.matches(Y) || E || oe.test(yt(b)) ? !0 : mt(b, e))) break;
495
- c = d, g(d);
740
+ for (a(n); l !== r && !u(l); ) {
741
+ const c = l.parentElement;
742
+ if (!c || c.querySelector("form")) break;
743
+ const d = [e], v = o(l);
744
+ v && v !== e && d.push(v);
745
+ const g = !!v;
746
+ if (j(c, se).filter((w) => !w.closest("form") && !d.includes(w)).some((w) => w.matches(oe) || g || he.test(On(w)) ? !0 : kn(w, e))) break;
747
+ l = c, a(c);
496
748
  }
497
749
  return {
498
- scope: s(c) ? c : l ?? n,
750
+ scope: u(l) ? l : i ?? n,
499
751
  outsideForms: !0
500
752
  };
501
753
  }
502
- function pe(e, t, n) {
754
+ function Oe(e, t, n) {
503
755
  return e ? {
504
756
  scope: e,
505
757
  outsideForms: !1
506
- } : wt(t, n);
758
+ } : In(t, n);
507
759
  }
508
- function vt(e, t) {
760
+ function Cn(e, t) {
509
761
  let n = e.parentElement;
510
762
  for (; n && n !== t.scope; ) {
511
- if (P(n, Z).length === 1) return !0;
763
+ if (j(n, se).length === 1) return !0;
512
764
  n = n.parentElement;
513
765
  }
514
766
  return !1;
515
767
  }
516
- function ie(e, t, n) {
517
- const r = (l) => !!(t.compareDocumentPosition(l) & Node.DOCUMENT_POSITION_FOLLOWING), i = Array.from(e.scope.querySelectorAll('button, input[type="submit"]')).filter((l) => J(l) && Oe(e, l) && (l.getAttribute("type") === "submit" || r(l)) && !ft(l) && !ct.test(K(l)) && !pt(l, n));
518
- if (i.length === 0) return null;
519
- const o = (l, g) => {
520
- const d = r(l);
768
+ function me(e, t, n) {
769
+ const r = (i) => !!(t.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_FOLLOWING), o = Array.from(e.scope.querySelectorAll('button, input[type="submit"]')).filter((i) => ie(i) && Ye(e, i) && (i.getAttribute("type") === "submit" || r(i)) && !_n(i) && !En.test(re(i)) && !An(i, n));
770
+ if (o.length === 0) return null;
771
+ const s = (i, a) => {
772
+ const c = r(i);
521
773
  return [
522
- vt(l, e) ? 1 : 0,
523
- X.test(K(l)) ? 0 : 1,
524
- l.getAttribute("type") === "submit" ? 0 : 1,
525
- d ? 0 : 1,
526
- d ? g : -g
774
+ Cn(i, e) ? 1 : 0,
775
+ ne.test(re(i)) ? 0 : 1,
776
+ i.getAttribute("type") === "submit" ? 0 : 1,
777
+ c ? 0 : 1,
778
+ c ? a : -a
527
779
  ];
528
780
  };
529
- let s = i[0], c = o(s, 0);
530
- return i.forEach((l, g) => {
531
- const d = o(l, g);
532
- for (let w = 0; w < d.length; w++) {
533
- const v = d[w], E = c[w];
534
- if (v !== E) {
535
- v < E && (s = l, c = d);
781
+ let u = o[0], l = s(u, 0);
782
+ return o.forEach((i, a) => {
783
+ const c = s(i, a);
784
+ for (let d = 0; d < c.length; d++) {
785
+ const v = c[d], g = l[d];
786
+ if (v !== g) {
787
+ v < g && (u = i, l = c);
536
788
  return;
537
789
  }
538
790
  }
539
- }), s;
791
+ }), u;
540
792
  }
541
- function he(e) {
542
- return e.querySelectorAll("form").length + (P(e, Z).some((t) => !t.closest("form")) ? 1 : 0) === 1;
793
+ function Ie(e) {
794
+ return e.querySelectorAll("form").length + (j(e, se).some((t) => !t.closest("form")) ? 1 : 0) === 1;
543
795
  }
544
- function bt(e, t) {
796
+ function Nn(e, t) {
545
797
  if (e) {
546
798
  const n = e.getAttribute("aria-label");
547
799
  if (n) return n;
548
800
  const r = e.getAttribute("aria-labelledby");
549
801
  if (r) {
550
- const c = e.ownerDocument.getElementById(r);
551
- if (c) return c.textContent ?? "";
802
+ const l = e.ownerDocument.getElementById(r);
803
+ if (l) return l.textContent ?? "";
552
804
  }
553
- const i = e.querySelector("h1, h2, h3, legend");
554
- if (i) return i.textContent ?? "";
555
- let o = e.previousElementSibling;
556
- for (; o; ) {
557
- const c = /^(h1|h2|h3|legend)$/i.test(o.tagName) ? o : o.querySelector("h1, h2, h3, legend");
558
- if (c) {
559
- const l = e.parentElement;
560
- return l && he(l) ? c.textContent ?? "" : "";
805
+ const o = e.querySelector("h1, h2, h3, legend");
806
+ if (o) return o.textContent ?? "";
807
+ let s = e.previousElementSibling;
808
+ for (; s; ) {
809
+ const l = /^(h1|h2|h3|legend)$/i.test(s.tagName) ? s : s.querySelector("h1, h2, h3, legend");
810
+ if (l) {
811
+ const i = e.parentElement;
812
+ return i && Ie(i) ? l.textContent ?? "" : "";
561
813
  }
562
- o = o.previousElementSibling;
814
+ s = s.previousElementSibling;
563
815
  }
564
- const s = e.closest("section, article, aside, dialog, fieldset, [role='dialog'], [role='region']");
565
- if (s && s !== e) {
566
- const c = s.querySelector("h1, h2, h3, legend");
567
- if (c)
568
- return he(s) ? c.textContent ?? "" : "";
816
+ const u = e.closest("section, article, aside, dialog, fieldset, [role='dialog'], [role='region']");
817
+ if (u && u !== e) {
818
+ const l = u.querySelector("h1, h2, h3, legend");
819
+ if (l)
820
+ return Ie(u) ? l.textContent ?? "" : "";
569
821
  }
570
822
  return "";
571
823
  }
572
824
  return (t instanceof Document ? t.body : t)?.querySelector("h1, h2, h3")?.textContent ?? "";
573
825
  }
574
- function ge(e, t, n) {
575
- const r = B(dt(n)), i = B(bt(e, t)), o = (e?.getAttribute("action") ?? "").split("?")[0], s = B([
826
+ function Ce(e, t, n) {
827
+ const r = X(Rn(n)), o = X(Nn(e, t)), s = (e?.getAttribute("action") ?? "").split("?")[0], u = X([
576
828
  e?.id,
577
829
  e?.getAttribute("name"),
578
830
  e?.className,
579
- o
831
+ s
580
832
  ].filter(Boolean).join(" "));
581
833
  return {
582
- positive: X.test(r) || X.test(i),
583
- negative: oe.test(r) || oe.test(i) || at.test(s)
834
+ positive: ne.test(r) || ne.test(o),
835
+ negative: he.test(r) || he.test(o) || bn.test(u)
584
836
  };
585
837
  }
586
- function Le(e, t) {
587
- const n = V(e, 'input[autocomplete="username"]')[0] ?? V(e, 'input[autocomplete="email"]')[0] ?? V(e, 'input[type="email"]')[0];
838
+ function Ze(e, t) {
839
+ const n = J(e, 'input[autocomplete="username"]')[0] ?? J(e, 'input[autocomplete="email"]')[0] ?? J(e, 'input[type="email"]')[0];
588
840
  if (n) return n;
589
841
  if (!t) return null;
590
- const r = V(e, 'input[type="text"], input:not([type])').filter((i) => i.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
842
+ const r = J(e, 'input[type="text"], input:not([type])').filter((o) => o.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
591
843
  return r[r.length - 1] ?? null;
592
844
  }
593
- function ne(e, t) {
845
+ function ue(e, t) {
594
846
  if (t.querySelector('input[autocomplete="new-password"]')) return null;
595
- const n = P(t, Y);
847
+ const n = j(t, oe);
596
848
  if (n.length > 1) return null;
597
849
  if (n.length === 1) {
598
- const l = n[0], g = pe(e, l, l);
599
- if (!g) return null;
600
- const d = Le(g, l), w = ie(g, l, d), v = ge(e, t, w);
601
- return !(l.autocomplete === "current-password" || v.positive) || v.negative ? null : {
850
+ const i = n[0], a = Oe(e, i, i);
851
+ if (!a) return null;
852
+ const c = Ze(a, i), d = me(a, i, c), v = Ce(e, t, d);
853
+ return !(i.autocomplete === "current-password" || v.positive) || v.negative ? null : {
602
854
  kind: "password",
603
855
  form: e,
604
- identifier: d,
605
- password: l,
606
- submit: w
856
+ identifier: c,
857
+ password: i,
858
+ submit: d
607
859
  };
608
860
  }
609
- const r = P(t, Re);
861
+ const r = j(t, Ke);
610
862
  if (r.length !== 1) return null;
611
- const i = r[0], o = pe(e, i, null);
612
- if (!o) return null;
613
- const s = ie(o, i, i), c = ge(e, t, s);
614
- return !(i.autocomplete === "username" || c.positive) || c.negative ? null : {
863
+ const o = r[0], s = Oe(e, o, null);
864
+ if (!s) return null;
865
+ const u = me(s, o, o), l = Ce(e, t, u);
866
+ return !(o.autocomplete === "username" || l.positive) || l.negative ? null : {
615
867
  kind: "identifier",
616
868
  form: e,
617
- identifier: i,
869
+ identifier: o,
618
870
  password: null,
619
- submit: s
871
+ submit: u
620
872
  };
621
873
  }
622
- function me(e = document) {
874
+ function Ne(e = document) {
623
875
  const t = Array.from(e.querySelectorAll("form"));
624
876
  for (const n of t) {
625
- const r = ne(n, n);
877
+ const r = ue(n, n);
626
878
  if (r) return r;
627
879
  }
628
- return t.length === 0 || P(e, Y).find((n) => !n.closest("form")) ? ne(null, e) : null;
880
+ return t.length === 0 || j(e, oe).find((n) => !n.closest("form")) ? ue(null, e) : null;
629
881
  }
630
- function ye(e, t) {
882
+ function xe(e, t) {
631
883
  const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value")?.set ?? Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
632
884
  r ? r.call(e, t) : e.value = t, e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
633
885
  }
634
- function Et(e) {
886
+ function xn(e) {
635
887
  return !!e.form || !!e.submit;
636
888
  }
637
- function St(e) {
889
+ function Mn(e) {
638
890
  const t = e.form, n = t?.noValidate;
639
891
  t && (t.noValidate = !0);
640
892
  try {
@@ -643,28 +895,28 @@ function St(e) {
643
895
  t && (t.noValidate = n ?? !1);
644
896
  }
645
897
  }
646
- var Rt = {
898
+ var Dn = {
647
899
  identifier: null,
648
900
  password: null
649
901
  };
650
- function we(e, t) {
902
+ function Me(e, t) {
651
903
  return !e || e.disabled || e.readOnly ? !1 : e.value === "" || t !== null && e.value === t;
652
904
  }
653
- function Ae(e, t, n) {
905
+ function Je(e, t, n) {
654
906
  return {
655
- identifier: we(e.identifier, n.identifier) && !t.identifier,
656
- password: we(e.password, n.password) && !t.password
907
+ identifier: Me(e.identifier, n.identifier) && !t.identifier,
908
+ password: Me(e.password, n.password) && !t.password
657
909
  };
658
910
  }
659
- function Ot(e, t, n) {
911
+ function $n(e, t, n) {
660
912
  const r = e.identifier;
661
913
  return !r || n.identifier ? !1 : r.value !== "" && r.value !== t.login;
662
914
  }
663
- function Lt(e, t, n, r = Rt) {
664
- const i = Ae(e, n, r);
665
- return !i.identifier && !i.password ? { error: "nothing-to-fill" } : Ot(e, t, i) ? { error: "identifier-mismatch" } : Et(e) ? (i.identifier && ye(e.identifier, t.login), i.password && ye(e.password, t.password), St(e) ? { step: i.identifier && i.password ? "both" : i.password ? "password" : "identifier" } : { error: "no-submit" }) : { error: "no-submit" };
915
+ function Pn(e, t, n, r = Dn) {
916
+ const o = Je(e, n, r);
917
+ return !o.identifier && !o.password ? { error: "nothing-to-fill" } : $n(e, t, o) ? { error: "identifier-mismatch" } : xn(e) ? (o.identifier && xe(e.identifier, t.login), o.password && xe(e.password, t.password), Mn(e) ? { step: o.identifier && o.password ? "both" : o.password ? "password" : "identifier" } : { error: "no-submit" }) : { error: "no-submit" };
666
918
  }
667
- function At(e) {
919
+ function qn(e) {
668
920
  if (typeof window > "u" || typeof MutationObserver > "u") return {
669
921
  watch() {
670
922
  },
@@ -681,113 +933,275 @@ function At(e) {
681
933
  }, r = {
682
934
  identifier: null,
683
935
  password: null
684
- }, i = !1, o = null, s = null, c = null;
685
- const l = () => {
686
- c && clearTimeout(c), c = null;
687
- }, g = () => {
688
- o?.disconnect(), o = null, l(), s && clearTimeout(s), s = null;
689
- }, d = () => {
690
- const E = me(document);
691
- if (!E) {
692
- i = !1, r = {
936
+ }, o = !1, s = null, u = null, l = null;
937
+ const i = () => {
938
+ l && clearTimeout(l), l = null;
939
+ }, a = () => {
940
+ s?.disconnect(), s = null, i(), u && clearTimeout(u), u = null;
941
+ }, c = () => {
942
+ const g = Ne(document);
943
+ if (!g) {
944
+ o = !1, r = {
693
945
  identifier: null,
694
946
  password: null
695
- }, l();
947
+ }, i();
696
948
  return;
697
949
  }
698
950
  if (!t)
699
- i || (i = !0, e.onDetected());
951
+ o || (o = !0, e.onDetected());
700
952
  else {
701
- const b = Ae(E, n, r), S = Lt(E, t, n, r);
702
- if ("error" in S || (b.identifier && (n = {
953
+ const w = Je(g, n, r), S = Pn(g, t, n, r);
954
+ if ("error" in S || (w.identifier && (n = {
703
955
  ...n,
704
956
  identifier: !0
705
957
  }, r = {
706
958
  ...r,
707
959
  identifier: t.login
708
- }), b.password && (n = {
960
+ }), w.password && (n = {
709
961
  ...n,
710
962
  password: !0
711
963
  }, r = {
712
964
  ...r,
713
965
  password: t.password
714
966
  })), "error" in S) {
715
- const A = S.error !== "nothing-to-fill" ? S.error : !n.identifier && !n.password ? "already-filled" : null;
716
- A && (e.onError(A), t = null, g());
967
+ const R = S.error !== "nothing-to-fill" ? S.error : !n.identifier && !n.password ? "already-filled" : null;
968
+ R && (e.onError(R), t = null, a());
717
969
  } else
718
- e.onFilled(S.step), n.password && (t = null, l(), c = setTimeout(() => {
719
- c = null, me(document) && (i = !0, e.onDetected());
720
- }, Ie));
970
+ e.onFilled(S.step), n.password && (t = null, i(), l = setTimeout(() => {
971
+ l = null, Ne(document) && (o = !0, e.onDetected());
972
+ }, ot));
721
973
  }
722
- }, w = () => {
723
- s && clearTimeout(s), s = setTimeout(() => {
724
- s = null, d();
725
- }, it);
974
+ }, d = () => {
975
+ u && clearTimeout(u), u = setTimeout(() => {
976
+ u = null, c();
977
+ }, yn);
726
978
  }, v = () => {
727
- o || (o = new MutationObserver(w), o.observe(document.body, {
979
+ s || (s = new MutationObserver(d), s.observe(document.body, {
728
980
  childList: !0,
729
981
  subtree: !0,
730
982
  attributes: !0,
731
- attributeFilter: st
983
+ attributeFilter: vn
732
984
  }));
733
985
  };
734
986
  return {
735
987
  watch() {
736
- o || (i = !1, v()), d();
988
+ s || (o = !1, v()), c();
737
989
  },
738
- fill(E) {
739
- t = E, v(), d();
990
+ fill(g) {
991
+ t = g, v(), c();
740
992
  },
741
993
  cancel() {
742
994
  t = null, n = {
743
995
  identifier: !1,
744
996
  password: !1
745
- }, i = !1, g();
997
+ }, o = !1, a();
746
998
  },
747
999
  teardown() {
748
- t = null, g();
1000
+ t = null, a();
749
1001
  }
750
1002
  };
751
1003
  }
752
- var kt = 6e5, Ct = 1e3, It = {
753
- maskAllInputs: !0,
754
- maskInputOptions: {
755
- password: !0,
756
- email: !0,
757
- tel: !0,
758
- text: !0
759
- },
760
- blockClass: "leesto-mask",
761
- blockSelector: "[data-leesto-block]",
762
- maskTextClass: "leesto-mask-text",
763
- maskTextSelector: "[data-private]"
764
- };
765
- async function _t(e) {
766
- const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = Date.now();
767
- let i = [], o = !1, s = 0;
768
- const c = () => {
769
- if (i.length === 0) return;
770
- const S = i;
771
- i = [], e.onBatch(S);
772
- }, l = t({
773
- emit(S) {
774
- i.push(S);
1004
+ var Bn = "leesto/navigation";
1005
+ function Fn(e) {
1006
+ const t = e?.timestamp;
1007
+ return typeof t == "number" ? t : void 0;
1008
+ }
1009
+ function Un(e) {
1010
+ return e?.type === 4;
1011
+ }
1012
+ function Gn(e) {
1013
+ try {
1014
+ return JSON.stringify(e)?.length ?? 0;
1015
+ } catch {
1016
+ return 0;
1017
+ }
1018
+ }
1019
+ function Hn(e) {
1020
+ const t = e.now ?? Date.now, n = e.measure ?? Gn;
1021
+ let r = [], o = 0, s = !1, u = Number.NEGATIVE_INFINITY;
1022
+ const l = () => {
1023
+ const a = r.shift();
1024
+ a && (o -= a.bytes);
1025
+ }, i = () => {
1026
+ if (!s) {
1027
+ const d = t() - e.windowMs;
1028
+ for (; r.length > 1 && (r[1]?.start ?? Number.POSITIVE_INFINITY) <= d; ) l();
1029
+ }
1030
+ const a = s ? e.heldMaxBytes : e.maxBytes;
1031
+ for (; o > a && r.length > 1; ) l();
1032
+ const c = r[r.length - 1];
1033
+ if (o > a && e.requestCheckout && (c?.events.length ?? 0) > 2) {
1034
+ const d = t();
1035
+ d - u >= e.minCheckoutIntervalMs && (u = d, e.requestCheckout());
1036
+ }
1037
+ };
1038
+ return {
1039
+ push(a) {
1040
+ const c = n(a);
1041
+ if (Un(a)) r.push({
1042
+ start: Fn(a) ?? t(),
1043
+ events: [a],
1044
+ bytes: c
1045
+ });
1046
+ else {
1047
+ const d = r[r.length - 1];
1048
+ if (!d) return;
1049
+ d.events.push(a), d.bytes += c;
1050
+ }
1051
+ o += c, i();
1052
+ },
1053
+ snapshot() {
1054
+ const a = [];
1055
+ for (const c of r) for (const d of c.events) a.push(d);
1056
+ return a;
1057
+ },
1058
+ hold() {
1059
+ i(), s = !0;
1060
+ },
1061
+ release() {
1062
+ s = !1, i();
775
1063
  },
776
- ...It
777
- }), g = e.diagnostics ?? null, d = l ? g ?? Se({ captureNetwork: e.captureNetwork !== !1 }) : null, w = d !== null && g === null;
778
- d?.setSink((S, A) => {
1064
+ stats() {
1065
+ let a = 0;
1066
+ for (const c of r) a += c.events.length;
1067
+ return {
1068
+ segments: r.length,
1069
+ events: a,
1070
+ bytes: o,
1071
+ held: s
1072
+ };
1073
+ },
1074
+ clear() {
1075
+ r = [], o = 0;
1076
+ }
1077
+ };
1078
+ }
1079
+ var Qe = 6e5, et = 1e3, Wn = {
1080
+ mousemove: 100,
1081
+ scroll: 150
1082
+ }, jn = {
1083
+ windowMs: 12e4,
1084
+ checkoutEveryNms: 6e4,
1085
+ maxBytes: 8388608,
1086
+ heldMaxBytes: 33554432,
1087
+ minCheckoutIntervalMs: 15e3,
1088
+ sampling: Wn
1089
+ }, zn = 5;
1090
+ async function Vn(e) {
1091
+ const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = e.maskPolicy ?? "mask_all", o = Date.now();
1092
+ let s = [], u = !1, l = 0;
1093
+ const i = () => {
1094
+ if (s.length === 0) return;
1095
+ const R = s;
1096
+ s = [], e.onBatch(R);
1097
+ }, a = t({
1098
+ emit(R) {
1099
+ s.push(Xe(R, r, (_) => t.mirror.getNode(_)));
1100
+ },
1101
+ ...Ve(r)
1102
+ }), c = e.diagnostics ?? null, d = a ? c ?? Be({ captureNetwork: e.captureNetwork !== !1 }) : null, v = d !== null && c === null;
1103
+ d?.setSink((R, _) => {
1104
+ try {
1105
+ n(R, _);
1106
+ } catch {
1107
+ }
1108
+ });
1109
+ const g = setInterval(i, et), w = { timer: null }, S = () => (u || (u = !0, clearInterval(g), clearTimeout(w.timer ?? void 0), d?.flushRings(), d?.setSink(null), v && d?.teardown(), a?.(), i(), l = Date.now() - o), l);
1110
+ return w.timer = setTimeout(() => {
1111
+ S(), e.onCap();
1112
+ }, Qe), { stop: S };
1113
+ }
1114
+ async function Xn(e) {
1115
+ const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = {
1116
+ ...jn,
1117
+ ...e.config
1118
+ }, { diagnostics: o } = e, s = e.maskPolicy ?? "mask_all";
1119
+ let u = !1, l = null, i = null;
1120
+ const a = () => {
779
1121
  try {
780
- n(S, A);
1122
+ t.takeFullSnapshot(!0);
781
1123
  } catch {
782
1124
  }
1125
+ }, c = Hn({
1126
+ windowMs: r.windowMs,
1127
+ maxBytes: r.maxBytes,
1128
+ heldMaxBytes: r.heldMaxBytes,
1129
+ minCheckoutIntervalMs: r.minCheckoutIntervalMs,
1130
+ requestCheckout: () => queueMicrotask(() => {
1131
+ u || a();
1132
+ })
1133
+ }), d = t({
1134
+ emit(g) {
1135
+ const w = Xe(g, s, (S) => t.mirror.getNode(S));
1136
+ c.push(w), l?.(w);
1137
+ },
1138
+ checkoutEveryNms: r.checkoutEveryNms,
1139
+ sampling: r.sampling,
1140
+ ...Ve(s)
783
1141
  });
784
- const v = setInterval(c, Ct), E = { timer: null }, b = () => (o || (o = !0, clearInterval(v), clearTimeout(E.timer ?? void 0), d?.flushRings(), d?.setSink(null), w && d?.teardown(), l?.(), c(), s = Date.now() - r), s);
785
- return E.timer = setTimeout(() => {
786
- b(), e.onCap();
787
- }, kt), { stop: b };
1142
+ if (!d) return null;
1143
+ const v = (g, w) => {
1144
+ try {
1145
+ n(g, w);
1146
+ } catch {
1147
+ }
1148
+ };
1149
+ return o.setSink(v), {
1150
+ snapshot() {
1151
+ const g = c.snapshot(), w = Date.now();
1152
+ o.setSink((R, _) => {
1153
+ g.push({
1154
+ type: zn,
1155
+ data: {
1156
+ tag: R,
1157
+ payload: _
1158
+ },
1159
+ timestamp: w
1160
+ });
1161
+ });
1162
+ try {
1163
+ o.flushRings();
1164
+ } finally {
1165
+ o.setSink(u ? null : v);
1166
+ }
1167
+ const S = g[0]?.timestamp;
1168
+ return {
1169
+ events: g,
1170
+ durationMs: typeof S == "number" ? Math.max(0, w - S) : 0
1171
+ };
1172
+ },
1173
+ hold: () => c.hold(),
1174
+ release: () => c.release(),
1175
+ markNavigation(g) {
1176
+ u || v(Bn, { href: W(g) });
1177
+ },
1178
+ stats: () => c.stats(),
1179
+ stream({ onBatch: g, onCap: w }) {
1180
+ i?.stop();
1181
+ const S = Date.now();
1182
+ let R = [], _ = !1, C = 0;
1183
+ const N = () => {
1184
+ if (R.length === 0) return;
1185
+ const B = R;
1186
+ R = [], g(B);
1187
+ }, x = (B) => {
1188
+ R.push(B);
1189
+ };
1190
+ l = x, a();
1191
+ const P = setInterval(N, et), M = { timer: null }, $ = { stop() {
1192
+ return _ || (_ = !0, clearInterval(P), clearTimeout(M.timer ?? void 0), o.flushRings(), l === x && (l = null), i === $ && (i = null), N(), C = Date.now() - S), C;
1193
+ } };
1194
+ return M.timer = setTimeout(() => {
1195
+ $.stop(), w();
1196
+ }, Qe), i = $, $;
1197
+ },
1198
+ stop() {
1199
+ u || (u = !0, i?.stop(), o.setSink(null), d(), c.clear());
1200
+ }
1201
+ };
788
1202
  }
789
- var Nt = ["https://lab.leesto.app", "https://lab-dev.leesto.app"], Tt = ["http://localhost:3505", "http://127.0.0.1:3505"];
790
- function qt(e) {
1203
+ var Kn = ["https://lab.leesto.app", "https://lab-dev.leesto.app"], Yn = ["http://localhost:3505", "http://127.0.0.1:3505"];
1204
+ function Zn(e) {
791
1205
  try {
792
1206
  const t = new URL(e).hostname;
793
1207
  return t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "[::1]";
@@ -795,7 +1209,7 @@ function qt(e) {
795
1209
  return !1;
796
1210
  }
797
1211
  }
798
- function Dt(e) {
1212
+ function Jn(e) {
799
1213
  const t = e.trim();
800
1214
  if (!t) return null;
801
1215
  try {
@@ -805,33 +1219,33 @@ function Dt(e) {
805
1219
  return null;
806
1220
  }
807
1221
  }
808
- function xt(e) {
809
- const t = (e.explicit ?? []).map(Dt).filter((r) => r !== null);
1222
+ function Qn(e) {
1223
+ const t = (e.explicit ?? []).map(Jn).filter((r) => r !== null);
810
1224
  if (t.length > 0) return [...new Set(t)];
811
- const n = [...Nt];
812
- return qt(e.pageOrigin) && n.push(...Tt), [...new Set(n)];
1225
+ const n = [...Kn];
1226
+ return Zn(e.pageOrigin) && n.push(...Yn), [...new Set(n)];
813
1227
  }
814
- function ve(e, t) {
1228
+ function fe(e, t) {
815
1229
  return !e || e === "*" || e === "null" ? !1 : t.includes(e);
816
1230
  }
817
- function re() {
1231
+ function Q() {
818
1232
  return typeof navigator < "u" && navigator.globalPrivacyControl === !0;
819
1233
  }
820
- function Mt(e) {
821
- const t = (s) => {
822
- const c = typeof s == "string" ? s.trim() : "";
823
- return c.length > 0 ? c : void 0;
824
- }, n = (s) => {
1234
+ function er(e) {
1235
+ const t = (u) => {
1236
+ const l = typeof u == "string" ? u.trim() : "";
1237
+ return l.length > 0 ? l : void 0;
1238
+ }, n = (u) => {
825
1239
  if (!(typeof document > "u"))
826
- return t(document.querySelector(`meta[name="${s}"]`)?.getAttribute("content"));
827
- }, r = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, i = t(e?.version) ?? t(r?.version) ?? n("app-version"), o = t(e?.environment) ?? t(r?.environment) ?? n("app-environment");
828
- if (!(!i && !o))
1240
+ return t(document.querySelector(`meta[name="${u}"]`)?.getAttribute("content"));
1241
+ }, r = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, o = t(e?.version) ?? t(r?.version) ?? n("app-version"), s = t(e?.environment) ?? t(r?.environment) ?? n("app-environment");
1242
+ if (!(!o && !s))
829
1243
  return {
830
- ...i ? { version: i } : {},
831
- ...o ? { environment: o } : {}
1244
+ ...o ? { version: o } : {},
1245
+ ...s ? { environment: s } : {}
832
1246
  };
833
1247
  }
834
- function Pt() {
1248
+ function tr() {
835
1249
  if (typeof document > "u") return;
836
1250
  const e = document.querySelector('link[rel~="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]');
837
1251
  if (e?.href)
@@ -841,43 +1255,59 @@ function Pt() {
841
1255
  return;
842
1256
  }
843
1257
  }
844
- function $t() {
1258
+ function nr() {
845
1259
  const e = (r) => !!r && r !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(r), t = getComputedStyle(document.body).backgroundColor;
846
1260
  if (e(t)) return t;
847
1261
  const n = getComputedStyle(document.documentElement).backgroundColor;
848
1262
  return e(n) ? n : "#ffffff";
849
1263
  }
850
- async function be(e) {
1264
+ async function De(e) {
851
1265
  const { domToPng: t } = await import("./chunks/dist-BTlWkbvW.js");
852
1266
  if (e) {
853
- const s = document.querySelector(e);
854
- if (!s) throw new Error("element_not_found");
855
- return t(s, { quality: 0.92 });
856
- }
857
- const n = document.documentElement, r = window.scrollX, i = window.scrollY, o = [];
858
- for (const s of n.querySelectorAll("*")) {
859
- const c = getComputedStyle(s).position;
860
- if (c === "fixed" || c === "sticky") {
861
- const l = s.style.transform;
862
- o.push([s, l]), s.style.transform = `translate(${r}px, ${i}px)${l ? ` ${l}` : ""}`;
863
- }
1267
+ const l = document.querySelector(e);
1268
+ if (!l) throw new Error("element_not_found");
1269
+ return t(l, { quality: 0.92 });
864
1270
  }
1271
+ const n = document.documentElement, r = window.scrollX, o = window.scrollY, s = [], u = [];
865
1272
  try {
1273
+ for (const l of n.querySelectorAll(`.${ge}, ${te}`)) {
1274
+ const i = l.getBoundingClientRect();
1275
+ if (i.width <= 0 || i.height <= 0) continue;
1276
+ const a = document.createElement("div");
1277
+ a.dataset.leestoCaptureCover = "", Object.assign(a.style, {
1278
+ position: "fixed",
1279
+ left: `${i.x}px`,
1280
+ top: `${i.y}px`,
1281
+ width: `${i.width}px`,
1282
+ height: `${i.height}px`,
1283
+ background: "#a1a1aa",
1284
+ zIndex: "2147483647",
1285
+ pointerEvents: "none"
1286
+ }), n.append(a), s.push(a);
1287
+ }
1288
+ for (const l of n.querySelectorAll("*")) {
1289
+ const i = getComputedStyle(l).position;
1290
+ if (i === "fixed" || i === "sticky") {
1291
+ const a = l.style.transform;
1292
+ u.push([l, a]), l.style.transform = `translate(${r}px, ${o}px)${a ? ` ${a}` : ""}`;
1293
+ }
1294
+ }
866
1295
  return await t(n, {
867
1296
  quality: 0.92,
868
- backgroundColor: $t(),
1297
+ backgroundColor: nr(),
869
1298
  width: n.clientWidth,
870
1299
  height: n.clientHeight,
871
1300
  style: {
872
- transform: `translate(${-r}px, ${-i}px)`,
1301
+ transform: `translate(${-r}px, ${-o}px)`,
873
1302
  transformOrigin: "top left"
874
1303
  }
875
1304
  });
876
1305
  } finally {
877
- for (const [s, c] of o) s.style.transform = c;
1306
+ for (const l of s) l.remove();
1307
+ for (const [l, i] of u) l.style.transform = i;
878
1308
  }
879
1309
  }
880
- function Ft(e) {
1310
+ function rr(e) {
881
1311
  if (e.id) return `#${CSS.escape(e.id)}`;
882
1312
  const t = [];
883
1313
  let n = e;
@@ -887,50 +1317,77 @@ function Ft(e) {
887
1317
  break;
888
1318
  }
889
1319
  let r = n.tagName.toLowerCase();
890
- const i = typeof n.className == "string" ? n.className.trim().split(/\s+/).filter(Boolean)[0] : null;
891
- i && (r += `.${CSS.escape(i)}`);
892
- const o = n.parentElement;
893
- if (o) {
894
- const s = Array.from(o.children).filter((c) => c.tagName === n?.tagName);
895
- s.length > 1 && (r += `:nth-of-type(${s.indexOf(n) + 1})`);
1320
+ const o = typeof n.className == "string" ? n.className.trim().split(/\s+/).filter(Boolean)[0] : null;
1321
+ o && (r += `.${CSS.escape(o)}`);
1322
+ const s = n.parentElement;
1323
+ if (s) {
1324
+ const u = Array.from(s.children).filter((l) => l.tagName === n?.tagName);
1325
+ u.length > 1 && (r += `:nth-of-type(${u.indexOf(n) + 1})`);
896
1326
  }
897
- t.unshift(r), n = o;
1327
+ t.unshift(r), n = s;
898
1328
  }
899
1329
  return t.join(" > ");
900
1330
  }
901
- function Gt(e) {
902
- const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
1331
+ function or(e) {
1332
+ const t = e.tagName.toLowerCase();
1333
+ if (Y(e)) return t;
1334
+ const n = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
903
1335
  return n ? `${t} · ${n}` : t;
904
1336
  }
905
- function Ee(e = {}) {
1337
+ var tt = "leesto:shell-origin";
1338
+ function sr() {
1339
+ try {
1340
+ return sessionStorage.getItem(tt);
1341
+ } catch {
1342
+ return null;
1343
+ }
1344
+ }
1345
+ function ir(e) {
1346
+ try {
1347
+ sessionStorage.setItem(tt, e);
1348
+ } catch {
1349
+ }
1350
+ }
1351
+ function ar() {
1352
+ try {
1353
+ return typeof window.name == "string" ? window.name : "";
1354
+ } catch {
1355
+ return "";
1356
+ }
1357
+ }
1358
+ function $e(e = {}) {
906
1359
  if (typeof window > "u" || window.parent === window) return () => {
907
1360
  };
908
- const t = window.parent, n = e.highlightColor ?? He.light.primary, r = xt({
1361
+ const t = window.parent, n = e.highlightColor ?? St.light.primary, r = Qn({
909
1362
  explicit: e.shellOrigins,
910
1363
  pageOrigin: location.origin
911
1364
  });
912
- let i = null;
1365
+ let o = null;
913
1366
  try {
914
- const p = document.referrer ? new URL(document.referrer).origin : "";
915
- ve(p, r) && (i = p);
1367
+ const h = document.referrer ? new URL(document.referrer).origin : "";
1368
+ fe(h, r) && (o = h);
916
1369
  } catch {
917
1370
  }
918
- const o = (p) => {
919
- if (i) {
920
- t.postMessage(p, i);
1371
+ if (!o) {
1372
+ const h = sr();
1373
+ h && fe(h, r) && (o = h);
1374
+ }
1375
+ const s = (h) => {
1376
+ if (o) {
1377
+ t.postMessage(h, o);
921
1378
  return;
922
1379
  }
923
- for (const m of r) t.postMessage(p, m);
1380
+ for (const b of r) t.postMessage(h, b);
924
1381
  };
925
- let s = null, c = "";
926
- const l = () => {
927
- s && (s.style.outline = c), s = null;
1382
+ let u = null, l = "";
1383
+ const i = () => {
1384
+ u && (u.style.outline = l), u = null;
928
1385
  };
929
- let g = null;
930
- const d = () => {
931
- g?.(), l(), document.querySelector("[data-leesto-picker-outline]")?.remove();
932
- const p = document.createElement("div");
933
- p.dataset.leestoPickerOutline = "", p.setAttribute("aria-hidden", "true"), Object.assign(p.style, {
1386
+ let a = null;
1387
+ const c = () => {
1388
+ a?.(), i(), document.querySelector("[data-leesto-picker-outline]")?.remove();
1389
+ const h = document.createElement("div");
1390
+ h.dataset.leestoPickerOutline = "", h.setAttribute("aria-hidden", "true"), Object.assign(h.style, {
934
1391
  position: "fixed",
935
1392
  pointerEvents: "none",
936
1393
  zIndex: "2147483647",
@@ -938,186 +1395,256 @@ function Ee(e = {}) {
938
1395
  border: `2px solid ${n}`,
939
1396
  borderRadius: "4px",
940
1397
  display: "none"
941
- }), document.documentElement.append(p);
942
- let m = null, y = null;
943
- const ke = document.body.style.cursor, F = () => {
944
- const L = y ?? m;
945
- if (!L) return;
946
- const q = L.getBoundingClientRect();
947
- y ? o({
1398
+ }), document.documentElement.append(h);
1399
+ let b = null, y = null, q = null;
1400
+ const z = document.body.style.cursor, O = () => {
1401
+ const k = y ?? b;
1402
+ if (!k) return;
1403
+ const I = k.getBoundingClientRect();
1404
+ y ? s({
948
1405
  type: "leesto:element-picked",
949
- selector: Ft(L),
950
- label: Gt(L),
1406
+ selector: rr(k),
1407
+ label: or(k),
951
1408
  rect: {
952
- x: q.x,
953
- y: q.y,
954
- width: q.width,
955
- height: q.height
956
- }
957
- }) : Object.assign(p.style, {
1409
+ x: I.x,
1410
+ y: I.y,
1411
+ width: I.width,
1412
+ height: I.height
1413
+ },
1414
+ ...q ? { point: {
1415
+ x: I.x + q.x,
1416
+ y: I.y + q.y
1417
+ } } : {},
1418
+ viewport: {
1419
+ width: document.documentElement.clientWidth,
1420
+ height: document.documentElement.clientHeight
1421
+ },
1422
+ context: gn(k)
1423
+ }) : Object.assign(h.style, {
958
1424
  display: "block",
959
- left: `${q.x}px`,
960
- top: `${q.y}px`,
961
- width: `${q.width}px`,
962
- height: `${q.height}px`
1425
+ left: `${I.x}px`,
1426
+ top: `${I.y}px`,
1427
+ width: `${I.width}px`,
1428
+ height: `${I.height}px`
963
1429
  });
964
- }, se = (L) => {
965
- m = L.target instanceof Element ? L.target : null, F();
966
- }, ae = () => {
967
- p.remove(), document.removeEventListener("mousemove", se, !0), document.removeEventListener("click", le, !0), document.body.style.cursor = ke;
968
- }, le = (L) => {
969
- L.preventDefault(), L.stopPropagation(), y = L.target instanceof Element ? L.target : null, ae(), F();
970
- }, ce = (L) => {
971
- L.key === "Escape" && (g?.(), o({ type: "leesto:pick-cancelled" }));
1430
+ }, we = (k) => {
1431
+ b = k.target instanceof Element ? k.target : null, O();
1432
+ }, Ee = () => {
1433
+ h.remove(), document.removeEventListener("mousemove", we, !0), document.removeEventListener("click", Se, !0), document.body.style.cursor = z;
1434
+ }, Se = (k) => {
1435
+ if (k.preventDefault(), k.stopPropagation(), y = k.target instanceof Element ? k.target : null, y) {
1436
+ const I = y.getBoundingClientRect();
1437
+ q = {
1438
+ x: k.clientX - I.x,
1439
+ y: k.clientY - I.y
1440
+ };
1441
+ }
1442
+ Ee(), O();
1443
+ }, Re = (k) => {
1444
+ k.key === "Escape" && (a?.(), s({ type: "leesto:pick-cancelled" }));
972
1445
  };
973
- g = () => {
974
- ae(), document.removeEventListener("keydown", ce, !0), document.removeEventListener("scroll", F, !0), window.removeEventListener("resize", F), g = null;
975
- }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", se, !0), document.addEventListener("click", le, !0), document.addEventListener("keydown", ce, !0), document.addEventListener("scroll", F, !0), window.addEventListener("resize", F);
976
- }, w = Me(location.search) && !re(), v = w ? xe(location.search) ?? De() : void 0, E = w ? Se({
1446
+ a = () => {
1447
+ Ee(), document.removeEventListener("keydown", Re, !0), document.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), a = null;
1448
+ }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", we, !0), document.addEventListener("click", Se, !0), document.addEventListener("keydown", Re, !0), document.addEventListener("scroll", O, !0), window.addEventListener("resize", O);
1449
+ }, d = mt(location.search, ar()), v = de(d) && !Q(), g = pt(d), w = v ? ht(d) ?? dt() : void 0, S = v ? Be({
977
1450
  captureNetwork: e.captureNetwork !== !1,
978
- runId: v,
1451
+ runId: w,
979
1452
  runIdOrigins: e.runIdOrigins
980
1453
  }) : null;
981
- let b = null, S = !1, A = !1;
982
- const x = () => {
983
- if (b) {
984
- const p = b.stop();
985
- b = null, o({
1454
+ let R = !1;
1455
+ const _ = S ? Xn({
1456
+ diagnostics: S,
1457
+ maskPolicy: g
1458
+ }).then((h) => h && R ? (h.stop(), null) : h).catch(() => null) : null;
1459
+ let C = null, N = !1, x = !1;
1460
+ const P = () => {
1461
+ if (C) {
1462
+ const h = C.stop();
1463
+ C = null, s({
986
1464
  type: "leesto:rec-stopped",
987
- durationMs: p
1465
+ durationMs: h
988
1466
  });
989
- } else S && (A = !0);
990
- }, I = At({
991
- onDetected: () => o({ type: "leesto:login-form-detected" }),
992
- onFilled: (p) => o({
1467
+ } else N && (x = !0);
1468
+ }, M = qn({
1469
+ onDetected: () => s({ type: "leesto:login-form-detected" }),
1470
+ onFilled: (h) => s({
993
1471
  type: "leesto:login-filled",
994
- step: p
1472
+ step: h
995
1473
  }),
996
- onError: (p) => o({
1474
+ onError: (h) => s({
997
1475
  type: "leesto:login-error",
998
- reason: p
1476
+ reason: h
999
1477
  })
1000
- }), M = () => I.cancel();
1001
- window.addEventListener("pagehide", M);
1002
- const U = Mt(e.build), C = window.navigation;
1003
- let $ = !1, z = !1;
1004
- const _ = () => !$ && C?.canGoBack === !0;
1005
- let N = _(), a = location.href;
1006
- const u = () => {
1007
- a = location.href, N = _();
1008
- const p = Pt();
1009
- o({
1478
+ }), $ = () => M.cancel();
1479
+ window.addEventListener("pagehide", $);
1480
+ const B = er(e.build), D = window.navigation;
1481
+ let U = !1;
1482
+ const f = () => !U && D?.canGoBack === !0, p = () => !U && D?.canGoForward === !0;
1483
+ let m = p(), E = f(), L = location.href;
1484
+ const F = () => {
1485
+ L = location.href, E = f(), m = p();
1486
+ const h = tr();
1487
+ s({
1010
1488
  type: "leesto:ready",
1011
1489
  url: location.href,
1012
1490
  bridgeVersion: 1,
1013
- capabilities: [Ce, ...C ? ["navigation"] : []],
1014
- canGoBack: N,
1015
- ...p ? { favicon: p } : {},
1016
- ...U ? { build: U } : {},
1017
- ...v ? { diagnosticRunId: v } : {},
1018
- ...re() ? { gpc: !0 } : {}
1491
+ capabilities: [
1492
+ nt,
1493
+ ...D ? ["navigation", "navigation-forward"] : [],
1494
+ ..._ ? [rt] : []
1495
+ ],
1496
+ canGoBack: E,
1497
+ canGoForward: m,
1498
+ ...h ? { favicon: h } : {},
1499
+ ...B ? { build: B } : {},
1500
+ ...w ? { diagnosticRunId: w } : {},
1501
+ ...Q() ? { gpc: !0 } : {}
1019
1502
  });
1020
- }, f = (p) => {
1021
- if (p.source !== t || !ve(p.origin, r) || !_e(p.data)) return;
1022
- i || (i = p.origin);
1023
- const m = p.data;
1024
- if (m.type === "leesto:ping")
1025
- o({ type: "leesto:pong" }), u();
1026
- else if (m.type === "leesto:navigate-back") {
1027
- if (!C || !_()) return;
1028
- $ = !0, h(), Promise.resolve(C.back().finished).catch(() => {
1503
+ }, A = (h) => {
1504
+ if (h.source !== t || !fe(h.origin, r) || !st(h.data)) return;
1505
+ o !== h.origin && (o = h.origin, ir(h.origin));
1506
+ const b = h.data;
1507
+ if (b.type === "leesto:ping")
1508
+ s({ type: "leesto:pong" }), F();
1509
+ else if (b.type === "leesto:navigate-back" || b.type === "leesto:navigate-forward") {
1510
+ const y = b.type === "leesto:navigate-forward";
1511
+ if (!D || !(y ? p() : f())) return;
1512
+ U = !0, T(), Promise.resolve((y ? D.forward() : D.back()).finished).catch(() => {
1029
1513
  }).finally(() => {
1030
- $ = !1, z || h();
1514
+ U = !1, R || T();
1031
1515
  });
1032
- } else if (m.type === "leesto:highlight") {
1033
- if (l(), m.selector) {
1516
+ } else if (b.type === "leesto:highlight") {
1517
+ if (i(), b.selector) {
1034
1518
  let y = null;
1035
1519
  try {
1036
- y = document.querySelector(m.selector);
1520
+ y = document.querySelector(b.selector);
1037
1521
  } catch {
1038
1522
  y = null;
1039
1523
  }
1040
- y && (s = y, c = y.style.outline, y.style.outline = `2px solid ${n}`, y.style.outlineOffset = "2px", y.scrollIntoView({
1524
+ y && (u = y, l = y.style.outline, y.style.outline = `2px solid ${n}`, y.style.outlineOffset = "2px", y.scrollIntoView({
1041
1525
  block: "center",
1042
1526
  behavior: "smooth"
1043
1527
  }));
1044
1528
  }
1045
- } else if (m.type === "leesto:pick-start") d();
1046
- else if (m.type === "leesto:pick-stop") g?.();
1047
- else if (m.type === "leesto:capture-request") (m.selector ? be(m.selector) : (e.capture ?? be)()).then((y) => o({
1529
+ } else if (b.type === "leesto:pick-start") c();
1530
+ else if (b.type === "leesto:pick-stop") a?.();
1531
+ else if (b.type === "leesto:capture-request") (b.selector ? De(b.selector) : (e.capture ?? De)()).then((y) => s({
1048
1532
  type: "leesto:screenshot",
1049
1533
  dataUrl: y,
1050
- ...m.selector ? { selector: m.selector } : {}
1051
- })).catch((y) => o({
1534
+ ...b.selector ? { selector: b.selector } : {}
1535
+ })).catch((y) => s({
1052
1536
  type: "leesto:capture-failed",
1053
1537
  reason: y instanceof Error ? y.message : "capture_error"
1054
1538
  }));
1055
- else if (m.type === "leesto:rec-start") {
1056
- if (b || S) return;
1057
- if (re()) {
1058
- o({
1539
+ else if (b.type === "leesto:rec-start") {
1540
+ if (C || N) return;
1541
+ if (Q()) {
1542
+ s({
1059
1543
  type: "leesto:rec-blocked",
1060
1544
  reason: "gpc"
1061
1545
  });
1062
1546
  return;
1063
1547
  }
1064
- S = !0, A = !1, _t({
1065
- onBatch: (y) => o({
1066
- type: "leesto:rec-batch",
1067
- events: y
1068
- }),
1069
- onCap: () => x(),
1548
+ N = !0, x = !1;
1549
+ const y = (O) => s({
1550
+ type: "leesto:rec-batch",
1551
+ events: O
1552
+ }), q = () => P(), z = () => Vn({
1553
+ onBatch: y,
1554
+ onCap: q,
1070
1555
  captureNetwork: e.captureNetwork,
1071
- diagnostics: E
1072
- }).then((y) => {
1073
- S = !1, b = y, A && x();
1074
- }).catch((y) => {
1075
- S = !1, o({
1556
+ maskPolicy: g,
1557
+ diagnostics: S
1558
+ });
1559
+ (_ ? _.then((O) => O ? O.stream({
1560
+ onBatch: y,
1561
+ onCap: q
1562
+ }) : z()) : z()).then((O) => {
1563
+ N = !1, C = O, x && P();
1564
+ }).catch((O) => {
1565
+ N = !1, s({
1076
1566
  type: "leesto:rec-error",
1077
- reason: y instanceof Error ? y.message : "rec_error"
1567
+ reason: O instanceof Error ? O.message : "rec_error"
1078
1568
  });
1079
1569
  });
1080
- } else m.type === "leesto:rec-stop" ? x() : m.type === "leesto:diagnostics-request" ? o({
1570
+ } else if (b.type === "leesto:rec-stop") P();
1571
+ else if (b.type === "leesto:rec-buffer-request") {
1572
+ if (!_) {
1573
+ s({
1574
+ type: "leesto:rec-buffer",
1575
+ events: [],
1576
+ durationMs: 0,
1577
+ unavailable: Q() ? "gpc" : "not-armed"
1578
+ });
1579
+ return;
1580
+ }
1581
+ _.then((y) => {
1582
+ if (R) return;
1583
+ if (!y) {
1584
+ s({
1585
+ type: "leesto:rec-buffer",
1586
+ events: [],
1587
+ durationMs: 0,
1588
+ unavailable: "error"
1589
+ });
1590
+ return;
1591
+ }
1592
+ const { events: q, durationMs: z } = y.snapshot();
1593
+ s({
1594
+ type: "leesto:rec-buffer",
1595
+ events: q,
1596
+ durationMs: z
1597
+ });
1598
+ });
1599
+ } else b.type === "leesto:rec-buffer-hold" ? _?.then((y) => y?.hold()) : b.type === "leesto:rec-buffer-release" ? _?.then((y) => y?.release()) : b.type === "leesto:diagnostics-request" ? s({
1081
1600
  type: "leesto:diagnostics",
1082
- snapshot: E?.snapshot() ?? {
1601
+ snapshot: S?.snapshot() ?? {
1083
1602
  errors: [],
1084
1603
  logs: [],
1085
1604
  network: []
1086
1605
  }
1087
- }) : m.type === "leesto:login-watch" ? I.watch() : m.type === "leesto:login-fill" ? I.fill({
1088
- login: m.login,
1089
- password: m.password
1090
- }) : m.type === "leesto:login-cancel" && I.cancel();
1606
+ }) : b.type === "leesto:login-watch" ? M.watch() : b.type === "leesto:login-fill" ? M.fill({
1607
+ login: b.login,
1608
+ password: b.password
1609
+ }) : b.type === "leesto:login-cancel" && M.cancel();
1091
1610
  };
1092
- window.addEventListener("message", f), u();
1093
- const h = () => {
1094
- location.href === a && _() === N || (a = location.href, N = _(), o({
1095
- type: "leesto:location",
1096
- url: location.href,
1097
- canGoBack: N
1098
- }));
1099
- }, O = history.pushState, T = history.replaceState, R = (...p) => {
1100
- O.apply(history, p), h();
1101
- }, k = (...p) => {
1102
- T.apply(history, p), h();
1611
+ window.addEventListener("message", A), F();
1612
+ const T = (h) => {
1613
+ if (!(location.href === L && f() === E && p() === m)) {
1614
+ if (location.href !== L) {
1615
+ const b = location.href;
1616
+ _?.then((y) => y?.markNavigation(b));
1617
+ }
1618
+ L = location.href, E = f(), m = p(), s({
1619
+ type: "leesto:location",
1620
+ url: location.href,
1621
+ canGoBack: E,
1622
+ canGoForward: m,
1623
+ navigationType: typeof h == "string" ? h : "traverse"
1624
+ });
1625
+ }
1626
+ }, G = history.pushState, ye = history.replaceState, ve = (...h) => {
1627
+ G.apply(history, h), T("push");
1628
+ }, be = (...h) => {
1629
+ ye.apply(history, h), T("replace");
1103
1630
  };
1104
- return history.pushState = R, history.replaceState = k, C?.addEventListener("currententrychange", h), window.addEventListener("popstate", h), window.addEventListener("hashchange", h), () => {
1105
- z = !0, C?.removeEventListener("currententrychange", h), x(), E?.teardown(), l(), g?.(), I.teardown(), window.removeEventListener("pagehide", M), window.removeEventListener("message", f), window.removeEventListener("popstate", h), window.removeEventListener("hashchange", h), history.pushState === R && (history.pushState = O), history.replaceState === k && (history.replaceState = T);
1631
+ return history.pushState = ve, history.replaceState = be, D?.addEventListener("currententrychange", T), window.addEventListener("popstate", T), window.addEventListener("hashchange", T), () => {
1632
+ R = !0, D?.removeEventListener("currententrychange", T), P(), _?.then((h) => h?.stop()), S?.teardown(), i(), a?.(), M.teardown(), window.removeEventListener("pagehide", $), window.removeEventListener("message", A), window.removeEventListener("popstate", T), window.removeEventListener("hashchange", T), history.pushState === ve && (history.pushState = G), history.replaceState === be && (history.replaceState = ye);
1106
1633
  };
1107
1634
  }
1108
- function Ht() {
1635
+ function lr() {
1109
1636
  return typeof document > "u" ? null : document.currentScript ?? document.querySelector("script[data-leesto-connect]");
1110
1637
  }
1111
- function Ut(e) {
1638
+ function cr(e) {
1112
1639
  const t = {}, n = e?.dataset.highlightColor;
1113
1640
  n && (t.highlightColor = n);
1114
- const r = (e?.dataset.shellOrigin ?? "").split(",").map((i) => i.trim()).filter(Boolean);
1641
+ const r = (e?.dataset.shellOrigin ?? "").split(",").map((o) => o.trim()).filter(Boolean);
1115
1642
  return r.length > 0 && (t.shellOrigins = r), t;
1116
1643
  }
1117
1644
  if (typeof window < "u") {
1118
- window.LeestoConnect = { connect: (t) => Ee(t) };
1119
- const e = Ht();
1120
- (!e || e.dataset.leestoManual === void 0) && Ee(Ut(e));
1645
+ window.LeestoConnect = { connect: (t) => $e(t) };
1646
+ const e = lr();
1647
+ (!e || e.dataset.leestoManual === void 0) && $e(cr(e));
1121
1648
  }
1122
1649
 
1123
1650
  //# sourceMappingURL=leesto-connect.js.map