leesto-connect 0.1.0 → 0.2.1

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,169 +1,182 @@
1
- function J(e) {
1
+ var Ce = "login", Ie = 6e3;
2
+ function _e(e) {
2
3
  return typeof e == "object" && e !== null && typeof e.type == "string" && e.type.startsWith("leesto:");
3
4
  }
4
- var Q = "leesto_diag", ee = "leesto_run", F = "X-Leesto-Run-Id", te = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
5
- function G(e) {
6
- return typeof e == "string" && te.test(e);
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);
7
8
  }
8
- function ne() {
9
+ function De() {
9
10
  try {
10
11
  const e = globalThis.crypto, t = e?.randomUUID?.();
11
- if (G(t)) return t;
12
+ if (W(t)) return t;
12
13
  if (!e?.getRandomValues) return;
13
- const r = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
14
- r[6] = (r[6] ?? 0) & 15 | 64, r[8] = (r[8] ?? 0) & 63 | 128;
15
- const c = Array.from(r, (s) => s.toString(16).padStart(2, "0")).join(""), l = `${c.slice(0, 8)}-${c.slice(8, 12)}-${c.slice(12, 16)}-${c.slice(16, 20)}-${c.slice(20)}`;
16
- return G(l) ? l : void 0;
14
+ const n = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
15
+ 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;
17
18
  } catch {
18
19
  return;
19
20
  }
20
21
  }
21
- function re(e) {
22
+ function xe(e) {
22
23
  try {
23
- const t = new URLSearchParams(e).get(ee);
24
- return G(t) ? t : void 0;
24
+ const t = new URLSearchParams(e).get(Te);
25
+ return W(t) ? t : void 0;
25
26
  } catch {
26
27
  return;
27
28
  }
28
29
  }
29
- function oe(e) {
30
+ function Me(e) {
30
31
  try {
31
- return new URLSearchParams(e).get(Q) === "1";
32
+ return new URLSearchParams(e).get(Ne) === "1";
32
33
  } catch {
33
34
  return !1;
34
35
  }
35
36
  }
36
- var W = "leesto/console", B = "leesto/network", se = "leesto/network-ring", ie = "leesto/console-ring", ce = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, ae = /\b\d{3}-\d{2}-\d{4}\b/g, le = /\d(?:[ -]?\d){12,18}/g;
37
- function ue(e) {
38
- let t = 0, r = !1;
39
- for (let c = e.length - 1; c >= 0; c--) {
40
- let l = e.charCodeAt(c) - 48;
41
- if (l < 0 || l > 9) return !1;
42
- r && (l *= 2, l > 9 && (l -= 9)), t += l, r = !r;
37
+ var de = "leesto/console", Q = "leesto/network", Pe = "leesto/network-ring", $e = "leesto/console-ring", Fe = {
38
+ primary: "#08783f",
39
+ hover: "#066633",
40
+ foreground: "#f3fff7"
41
+ }, Ge = {
42
+ primary: "#46c383",
43
+ hover: "#65d49b",
44
+ foreground: "#082315"
45
+ }, He = {
46
+ light: Fe,
47
+ dark: Ge
48
+ };
49
+ function j(e) {
50
+ const t = [];
51
+ return {
52
+ push(n) {
53
+ t.push(n), t.length > e && t.shift();
54
+ },
55
+ snapshot() {
56
+ return t.slice();
57
+ }
58
+ };
59
+ }
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) {
62
+ let t = 0, n = !1;
63
+ 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;
43
67
  }
44
68
  return t % 10 === 0;
45
69
  }
46
- function b(e) {
70
+ function D(e) {
47
71
  if (!e) return e;
48
- let t = e.replace(ce, "[email masqué]");
49
- return t = t.replace(ae, "[id masqué]"), t = t.replace(le, (r) => {
50
- const c = r.replace(/[ -]/g, "");
51
- return c.length >= 13 && c.length <= 19 && ue(c) ? "[carte masquée]" : r;
72
+ let t = e.replace(Ue, "[email masqué]");
73
+ return t = t.replace(Be, "[id masqué]"), t = t.replace(ze, (n) => {
74
+ const r = n.replace(/[ -]/g, "");
75
+ return r.length >= 13 && r.length <= 19 && je(r) ? "[carte masquée]" : n;
52
76
  }), t;
53
77
  }
54
- function I(e) {
78
+ function H(e) {
55
79
  const t = typeof e == "string" ? e : e instanceof URL ? e.href : e instanceof Request ? e.url : String(e);
56
80
  try {
57
- const r = new URL(t, typeof location < "u" ? location.href : void 0);
58
- return r.origin + b(r.pathname);
81
+ const n = new URL(t, typeof location < "u" ? location.href : void 0);
82
+ return n.origin + D(n.pathname);
59
83
  } catch {
60
- return b(t.split("?")[0] ?? t);
84
+ return D(t.split("?")[0] ?? t);
61
85
  }
62
86
  }
63
- var de = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), fe = ["deprecation", "intervention"], pe = { teardown: () => {
87
+ var Ve = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), We = ["deprecation", "intervention"], Xe = { teardown: () => {
64
88
  } };
65
- function he(e) {
89
+ function Ke(e) {
66
90
  const t = typeof performance < "u" ? performance.timeOrigin : 0;
67
91
  return Math.round(t + e);
68
92
  }
69
- function ge(e) {
93
+ function Ye(e) {
70
94
  const t = e.responseStatus;
71
95
  return typeof t == "number" && t > 0 ? t : void 0;
72
96
  }
73
- function me(e) {
74
- if (de.has(e.initiatorType)) return null;
75
- const t = ge(e), r = e.transferSize || e.encodedBodySize || void 0;
97
+ function Ze(e) {
98
+ if (Ve.has(e.initiatorType)) return null;
99
+ const t = Ye(e), n = e.transferSize || e.encodedBodySize || void 0;
76
100
  return {
77
101
  method: "GET",
78
- url: I(e.name),
102
+ url: H(e.name),
79
103
  ...t !== void 0 ? { status: t } : {},
80
104
  durationMs: Math.round(e.duration),
81
- ...r ? { responseSize: r } : {},
82
- startedAt: he(e.startTime),
105
+ ...n ? { responseSize: n } : {},
106
+ startedAt: Ke(e.startTime),
83
107
  ...t !== void 0 && t >= 400 ? { failed: !0 } : {},
84
108
  initiatorType: e.initiatorType
85
109
  };
86
110
  }
87
- function ye(e) {
88
- if (typeof window > "u") return pe;
111
+ function Je(e) {
112
+ if (typeof window > "u") return Xe;
89
113
  const t = [];
90
114
  if (typeof PerformanceObserver < "u") try {
91
- const s = new PerformanceObserver((u) => {
92
- for (const d of u.getEntries()) try {
93
- const h = me(d);
94
- h && e.onResource(h);
115
+ const o = new PerformanceObserver((s) => {
116
+ for (const c of s.getEntries()) try {
117
+ const l = Ze(c);
118
+ l && e.onResource(l);
95
119
  } catch {
96
120
  }
97
121
  });
98
- s.observe({
122
+ o.observe({
99
123
  type: "resource",
100
124
  buffered: !0
101
- }), t.push(() => s.disconnect());
125
+ }), t.push(() => o.disconnect());
102
126
  } catch {
103
127
  }
104
- const r = window.ReportingObserver;
105
- if (r) try {
106
- const s = new r(((u) => {
107
- for (const d of u) {
108
- const h = typeof d.body?.message == "string" ? d.body.message : d.type;
109
- e.onReport("warn", `Navigateur (${d.type}) : ${h}`);
128
+ const n = window.ReportingObserver;
129
+ 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}`);
110
134
  }
111
135
  }), {
112
- types: fe,
136
+ types: We,
113
137
  buffered: !0
114
138
  });
115
- s.observe(), t.push(() => s.disconnect());
139
+ o.observe(), t.push(() => o.disconnect());
116
140
  } catch {
117
141
  }
118
- const c = (s) => {
119
- const u = s;
120
- e.onReport("error", `CSP : ${u.blockedURI || "ressource"} bloqué par « ${u.violatedDirective} »`);
142
+ const r = (o) => {
143
+ const s = o;
144
+ e.onReport("error", `CSP : ${s.blockedURI || "ressource"} bloqué par « ${s.violatedDirective} »`);
121
145
  };
122
- window.addEventListener("securitypolicyviolation", c), t.push(() => window.removeEventListener("securitypolicyviolation", c));
123
- let l = !1;
146
+ window.addEventListener("securitypolicyviolation", r), t.push(() => window.removeEventListener("securitypolicyviolation", r));
147
+ let i = !1;
124
148
  return { teardown: () => {
125
- if (!l) {
126
- l = !0;
127
- for (const s of t) try {
128
- s();
149
+ if (!i) {
150
+ i = !0;
151
+ for (const o of t) try {
152
+ o();
129
153
  } catch {
130
154
  }
131
155
  }
132
156
  } };
133
157
  }
134
- function x(e) {
135
- const t = [];
136
- return {
137
- push(r) {
138
- t.push(r), t.length > e && t.shift();
139
- },
140
- snapshot() {
141
- return t.slice();
142
- }
143
- };
144
- }
145
- var we = 50, ve = 30, Re = 100, Se = 50, N = 500, Ee = 8e3;
146
- function j(e) {
158
+ var Qe = 50, et = 30, tt = 100, nt = 50, G = 500, rt = 8e3;
159
+ function ee(e) {
147
160
  const t = e instanceof Error ? e.stack : void 0;
148
161
  if (t)
149
- return b(t).slice(0, Ee);
162
+ return D(t).slice(0, rt);
150
163
  }
151
- function X(e) {
164
+ function te(e) {
152
165
  if (e instanceof Error) return `${e.name}: ${e.message}`;
153
166
  if (typeof e == "string") return e;
154
167
  if (typeof e == "object" && e !== null) try {
155
- return JSON.stringify(e, (t, r) => /^(authorization|cookie|set-cookie|token|access_token|refresh_token|password|secret|api[-_]?key)$/i.test(t) ? "[masqué]" : r).slice(0, 500);
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);
156
169
  } catch {
157
170
  return "[objet]";
158
171
  }
159
172
  return String(e);
160
173
  }
161
- function V(e) {
174
+ function fe(e) {
162
175
  if (!e) return;
163
176
  const t = Number(e);
164
177
  return Number.isFinite(t) && t >= 0 ? t : void 0;
165
178
  }
166
- var ke = {
179
+ var ot = {
167
180
  snapshot: () => ({
168
181
  errors: [],
169
182
  logs: [],
@@ -176,217 +189,567 @@ var ke = {
176
189
  teardown: () => {
177
190
  }
178
191
  };
179
- function Z(e) {
180
- if (typeof window > "u") return ke;
181
- const t = x(we), r = x(ve), c = x(Re), l = x(Se), s = G(e.runId) ? e.runId : void 0, u = (o) => {
182
- if (!s) return !1;
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;
183
196
  try {
184
- const n = new URL(String(o), location.href);
185
- return n.origin === location.origin || (e.runIdOrigins ?? []).includes(n.origin);
197
+ const u = new URL(String(a), location.href);
198
+ return u.origin === location.origin || (e.runIdOrigins ?? []).includes(u.origin);
186
199
  } catch {
187
200
  return !1;
188
201
  }
189
202
  };
190
- let d = e.sink ?? null;
191
- const h = (o, n) => {
192
- d?.(o, n);
193
- }, m = (o) => {
194
- e.captureNetwork && t.push(o);
195
- }, w = (o, n, i, a = {}) => {
196
- if (!n) return;
197
- const g = {
198
- level: o,
199
- message: n,
200
- ...i ? { stack: i } : {},
201
- ...a,
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,
202
215
  at: Date.now()
203
216
  };
204
- l.push(g), h(W, g);
205
- }, O = (o, n) => {
217
+ i.push(O), l(de, O);
218
+ }, w = (a, u) => {
206
219
  try {
207
- const i = b(n.map(X).join(" ")).slice(0, N), a = n.find((g) => g instanceof Error);
208
- w(o, i, j(a), {
220
+ const f = D(u.map(te).join(" ")).slice(0, G), h = u.find((O) => O instanceof Error);
221
+ d(a, f, ee(h), {
209
222
  mechanism: "console",
210
- ...a instanceof Error && a.name ? { name: a.name } : {}
223
+ ...h instanceof Error && h.name ? { name: h.name } : {}
211
224
  });
212
225
  } catch {
213
226
  }
214
- }, E = (o, n) => {
227
+ }, v = (a, u) => {
215
228
  try {
216
- const i = b(n.map(X).join(" ")).slice(0, N);
217
- i && c.push({
218
- level: o,
219
- message: i,
229
+ const f = D(u.map(te).join(" ")).slice(0, G);
230
+ f && r.push({
231
+ level: a,
232
+ message: f,
220
233
  at: Date.now()
221
234
  });
222
235
  } catch {
223
236
  }
224
- }, R = console.error, v = console.warn, y = console.log, k = console.info;
225
- console.error = (...o) => (O("error", o), R.apply(console, o)), console.warn = (...o) => (O("warn", o), v.apply(console, o)), console.log = (...o) => (E("log", o), y.apply(console, o)), console.info = (...o) => (E("info", o), k.apply(console, o));
226
- const _ = (o) => {
227
- const n = o.target;
228
- if (n instanceof Element) {
229
- const a = n.src || n.href || "";
230
- if (!a) return;
231
- w("error", `Ressource non chargée : <${n.tagName.toLowerCase()}> ${I(a)}`.slice(0, N), void 0, {
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, {
232
245
  mechanism: "resource",
233
- sourceUrl: I(a)
246
+ sourceUrl: H(h)
234
247
  });
235
248
  return;
236
249
  }
237
- const i = o;
238
- w("error", b(`Erreur non gérée : ${i.message}`).slice(0, N), j(i.error), {
250
+ const f = a;
251
+ d("error", D(`Erreur non gérée : ${f.message}`).slice(0, G), ee(f.error), {
239
252
  mechanism: "window.error",
240
- ...typeof i.error?.name == "string" ? { name: i.error.name } : {},
241
- ...typeof i.filename == "string" && i.filename ? { sourceUrl: I(i.filename) } : {},
242
- ...typeof i.lineno == "number" && i.lineno > 0 ? { line: i.lineno } : {},
243
- ...typeof i.colno == "number" && i.colno > 0 ? { column: i.colno } : {}
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 } : {}
244
257
  });
245
- }, T = (o) => {
246
- w("error", b(`Promesse rejetée : ${X(o.reason)}`).slice(0, N), j(o.reason), {
258
+ }, I = (a) => {
259
+ d("error", D(`Promesse rejetée : ${te(a.reason)}`).slice(0, G), ee(a.reason), {
247
260
  mechanism: "unhandledrejection",
248
- ...o.reason instanceof Error && o.reason.name ? { name: o.reason.name } : {}
261
+ ...a.reason instanceof Error && a.reason.name ? { name: a.reason.name } : {}
249
262
  });
250
263
  };
251
- window.addEventListener("error", _, !0), window.addEventListener("unhandledrejection", T);
252
- const A = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
253
- A && (window.fetch = (async (o, n) => {
254
- const i = Date.now(), a = (n?.method ?? (o instanceof Request ? o.method : "GET") ?? "GET").toUpperCase(), g = I(o);
255
- let L = n;
256
- if (s && u(o)) {
257
- const p = new Headers(o instanceof Request ? o.headers : void 0);
258
- for (const [f, C] of new Headers(n?.headers)) p.set(f, C);
259
- p.set(F, s), L = {
260
- ...n,
261
- headers: p
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
262
275
  };
263
276
  }
264
277
  try {
265
- const p = await A(o, L);
278
+ const R = await M(a, T);
266
279
  try {
267
- const f = p.headers.get("x-request-id"), C = p.headers.get("traceparent");
268
- m({
269
- method: a,
270
- url: g,
271
- status: p.status,
272
- durationMs: Date.now() - i,
273
- responseSize: V(p.headers.get("content-length")),
274
- contentType: p.headers.get("content-type") ?? void 0,
275
- startedAt: i,
276
- ...f ? { requestId: f.slice(0, 200) } : {},
277
- ...C ? { traceparent: C.slice(0, 200) } : {},
278
- ...s ? { runId: s } : {}
279
- }), p.ok || h(B, {
280
- method: a,
281
- url: g,
282
- status: p.status,
283
- durationMs: Date.now() - i
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
284
297
  });
285
298
  } catch {
286
299
  }
287
- return p;
288
- } catch (p) {
300
+ return R;
301
+ } catch (R) {
289
302
  try {
290
- const f = Date.now() - i;
291
- m({
292
- method: a,
293
- url: g,
303
+ const k = Date.now() - f;
304
+ g({
305
+ method: h,
306
+ url: O,
294
307
  status: 0,
295
- durationMs: f,
296
- startedAt: i,
308
+ durationMs: k,
309
+ startedAt: f,
297
310
  failed: !0,
298
- ...s ? { runId: s } : {}
299
- }), h(B, {
300
- method: a,
301
- url: g,
311
+ ...o ? { runId: o } : {}
312
+ }), l(Q, {
313
+ method: h,
314
+ url: O,
302
315
  status: 0,
303
- durationMs: f
316
+ durationMs: k
304
317
  });
305
318
  } catch {
306
319
  }
307
- throw p;
320
+ throw R;
308
321
  }
309
322
  }));
310
- const M = XMLHttpRequest.prototype.open, q = XMLHttpRequest.prototype.send, S = "__echoNet";
311
- XMLHttpRequest.prototype.open = function(o, n, ...i) {
312
- return this[S] = {
313
- method: (o || "GET").toUpperCase(),
314
- url: I(n),
323
+ const U = XMLHttpRequest.prototype.open, C = XMLHttpRequest.prototype.send, $ = "__echoNet";
324
+ XMLHttpRequest.prototype.open = function(a, u, ...f) {
325
+ return this[$] = {
326
+ method: (a || "GET").toUpperCase(),
327
+ url: H(u),
315
328
  start: 0,
316
- propagate: u(n)
317
- }, M.apply(this, [
318
- o,
319
- n,
320
- ...i
329
+ propagate: s(u)
330
+ }, U.apply(this, [
331
+ a,
332
+ u,
333
+ ...f
321
334
  ]);
322
- }, XMLHttpRequest.prototype.send = function(...o) {
323
- const n = this[S];
324
- if (n) {
325
- if (n.start = Date.now(), s && n.propagate) try {
326
- this.setRequestHeader(F, s);
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);
327
340
  } catch {
328
341
  }
329
342
  this.addEventListener("loadend", () => {
330
343
  try {
331
- const i = Date.now() - n.start, a = this.status, g = a === 0, L = this.getResponseHeader("x-request-id"), p = this.getResponseHeader("traceparent");
332
- m({
333
- method: n.method,
334
- url: n.url,
335
- status: a,
336
- durationMs: i,
337
- responseSize: V(this.getResponseHeader("content-length")),
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")),
338
351
  contentType: this.getResponseHeader("content-type") ?? void 0,
339
- startedAt: n.start,
340
- ...g ? { failed: !0 } : {},
341
- ...s ? { runId: s } : {},
342
- ...L ? { requestId: L.slice(0, 200) } : {},
343
- ...p ? { traceparent: p.slice(0, 200) } : {}
344
- }), (g || a >= 400) && h(B, {
345
- method: n.method,
346
- url: n.url,
347
- status: a,
348
- durationMs: i
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
349
362
  });
350
363
  } catch {
351
364
  }
352
365
  }, { once: !0 });
353
366
  }
354
- return q.apply(this, o);
367
+ return C.apply(this, a);
355
368
  };
356
- const D = ye({
357
- onResource: (o) => {
358
- e.captureNetwork && r.push(s ? {
359
- ...o,
360
- runId: s
361
- } : o);
369
+ const z = Je({
370
+ onResource: (a) => {
371
+ e.captureNetwork && n.push(o ? {
372
+ ...a,
373
+ runId: o
374
+ } : a);
362
375
  },
363
- onReport: (o, n) => w(o, b(n).slice(0, N), void 0, { mechanism: "report" })
364
- }), $ = () => e.captureNetwork ? [...t.snapshot(), ...r.snapshot()].sort((o, n) => o.startedAt - n.startedAt) : [];
365
- let P = !1;
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;
366
379
  return {
367
380
  snapshot: () => ({
368
- errors: l.snapshot(),
369
- logs: c.snapshot(),
370
- network: $(),
371
- ...s ? { runId: s } : {}
381
+ errors: i.snapshot(),
382
+ logs: r.snapshot(),
383
+ network: _(),
384
+ ...o ? { runId: o } : {}
372
385
  }),
373
- setSink: (o) => {
374
- d = o;
386
+ setSink: (a) => {
387
+ c = a;
375
388
  },
376
389
  flushRings: () => {
377
- const o = $();
378
- o.length > 0 && h(se, { entries: o });
379
- const n = c.snapshot();
380
- n.length > 0 && h(ie, { entries: n });
381
- const i = l.snapshot();
382
- i.length > 0 && h(W, { entries: i });
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 });
383
396
  },
384
397
  teardown: () => {
385
- P || (P = !0, d = null, D.teardown(), console.error = R, console.warn = v, console.log = y, console.info = k, window.removeEventListener("error", _, !0), window.removeEventListener("unhandledrejection", T), A && (window.fetch = A), XMLHttpRequest.prototype.open = M, XMLHttpRequest.prototype.send = q);
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);
386
399
  }
387
400
  };
388
401
  }
389
- var Le = 6e5, be = 1e3, Oe = {
402
+ var it = 100, st = [
403
+ "hidden",
404
+ "class",
405
+ "style",
406
+ "type",
407
+ "disabled",
408
+ "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) {
411
+ return (e ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[’‘]/g, "'").replace(/\s+/g, " ").trim().toLowerCase();
412
+ }
413
+ function J(e) {
414
+ let t = e;
415
+ for (; t; ) {
416
+ if (t.hasAttribute("hidden") || t.getAttribute("aria-hidden") === "true" || t instanceof HTMLInputElement && t.type === "hidden") return !1;
417
+ const n = t.ownerDocument.defaultView?.getComputedStyle(t);
418
+ if (n && (n.display === "none" || n.visibility === "hidden")) return !1;
419
+ t = t.parentElement;
420
+ }
421
+ return !0;
422
+ }
423
+ function P(e, t) {
424
+ return Array.from(e.querySelectorAll(t)).filter(J);
425
+ }
426
+ function dt(e) {
427
+ return e ? e instanceof HTMLInputElement ? e.value : e.textContent ?? "" : "";
428
+ }
429
+ function Oe(e, t) {
430
+ return !e.outsideForms || !t.closest("form");
431
+ }
432
+ function V(e, t) {
433
+ return Array.from(e.scope.querySelectorAll(t)).filter((n) => J(n) && Oe(e, n));
434
+ }
435
+ function K(e) {
436
+ return B(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
437
+ }
438
+ function ft(e) {
439
+ const t = K(e);
440
+ return lt.test(t) || ut.test(t);
441
+ }
442
+ function pt(e, t) {
443
+ if (e.getAttribute("type") === "submit" || !t) return !1;
444
+ const n = e.parentElement;
445
+ return !n || P(n, Z).length === 0 ? !1 : !n.contains(t);
446
+ }
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);
450
+ }
451
+ function mt(e, t) {
452
+ let n = e.parentElement;
453
+ for (; n && !n.contains(t); ) {
454
+ if (gt(n)) return !0;
455
+ n = n.parentElement;
456
+ }
457
+ return !1;
458
+ }
459
+ function yt(e) {
460
+ const t = [
461
+ e.getAttribute("name"),
462
+ e.getAttribute("id"),
463
+ e.getAttribute("placeholder"),
464
+ e.getAttribute("aria-label"),
465
+ e.closest("label")?.textContent ?? null
466
+ ], n = e.getAttribute("id");
467
+ if (n) {
468
+ const r = e.ownerDocument.querySelector(`label[for="${CSS.escape(n)}"]`);
469
+ r && t.push(r.textContent);
470
+ }
471
+ return B(t.filter(Boolean).join(" "));
472
+ }
473
+ function wt(e, t) {
474
+ const n = e.parentElement;
475
+ if (!n) return null;
476
+ const r = e.ownerDocument.body, i = (d) => t ? Le({
477
+ scope: d,
478
+ outsideForms: !0
479
+ }, t) : e, o = (d) => ie({
480
+ scope: d,
481
+ 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);
487
+ };
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);
496
+ }
497
+ return {
498
+ scope: s(c) ? c : l ?? n,
499
+ outsideForms: !0
500
+ };
501
+ }
502
+ function pe(e, t, n) {
503
+ return e ? {
504
+ scope: e,
505
+ outsideForms: !1
506
+ } : wt(t, n);
507
+ }
508
+ function vt(e, t) {
509
+ let n = e.parentElement;
510
+ for (; n && n !== t.scope; ) {
511
+ if (P(n, Z).length === 1) return !0;
512
+ n = n.parentElement;
513
+ }
514
+ return !1;
515
+ }
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);
521
+ 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
527
+ ];
528
+ };
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);
536
+ return;
537
+ }
538
+ }
539
+ }), s;
540
+ }
541
+ function he(e) {
542
+ return e.querySelectorAll("form").length + (P(e, Z).some((t) => !t.closest("form")) ? 1 : 0) === 1;
543
+ }
544
+ function bt(e, t) {
545
+ if (e) {
546
+ const n = e.getAttribute("aria-label");
547
+ if (n) return n;
548
+ const r = e.getAttribute("aria-labelledby");
549
+ if (r) {
550
+ const c = e.ownerDocument.getElementById(r);
551
+ if (c) return c.textContent ?? "";
552
+ }
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 ?? "" : "";
561
+ }
562
+ o = o.previousElementSibling;
563
+ }
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 ?? "" : "";
569
+ }
570
+ return "";
571
+ }
572
+ return (t instanceof Document ? t.body : t)?.querySelector("h1, h2, h3")?.textContent ?? "";
573
+ }
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([
576
+ e?.id,
577
+ e?.getAttribute("name"),
578
+ e?.className,
579
+ o
580
+ ].filter(Boolean).join(" "));
581
+ return {
582
+ positive: X.test(r) || X.test(i),
583
+ negative: oe.test(r) || oe.test(i) || at.test(s)
584
+ };
585
+ }
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];
588
+ if (n) return n;
589
+ if (!t) return null;
590
+ const r = V(e, 'input[type="text"], input:not([type])').filter((i) => i.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
591
+ return r[r.length - 1] ?? null;
592
+ }
593
+ function ne(e, t) {
594
+ if (t.querySelector('input[autocomplete="new-password"]')) return null;
595
+ const n = P(t, Y);
596
+ if (n.length > 1) return null;
597
+ 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 : {
602
+ kind: "password",
603
+ form: e,
604
+ identifier: d,
605
+ password: l,
606
+ submit: w
607
+ };
608
+ }
609
+ const r = P(t, Re);
610
+ 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 : {
615
+ kind: "identifier",
616
+ form: e,
617
+ identifier: i,
618
+ password: null,
619
+ submit: s
620
+ };
621
+ }
622
+ function me(e = document) {
623
+ const t = Array.from(e.querySelectorAll("form"));
624
+ for (const n of t) {
625
+ const r = ne(n, n);
626
+ if (r) return r;
627
+ }
628
+ return t.length === 0 || P(e, Y).find((n) => !n.closest("form")) ? ne(null, e) : null;
629
+ }
630
+ function ye(e, t) {
631
+ const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value")?.set ?? Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
632
+ r ? r.call(e, t) : e.value = t, e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
633
+ }
634
+ function Et(e) {
635
+ return !!e.form || !!e.submit;
636
+ }
637
+ function St(e) {
638
+ const t = e.form, n = t?.noValidate;
639
+ t && (t.noValidate = !0);
640
+ try {
641
+ return t && typeof t.requestSubmit == "function" ? (t.requestSubmit(), !0) : e.submit ? (e.submit.click(), !0) : t ? (t.submit(), !0) : !1;
642
+ } finally {
643
+ t && (t.noValidate = n ?? !1);
644
+ }
645
+ }
646
+ var Rt = {
647
+ identifier: null,
648
+ password: null
649
+ };
650
+ function we(e, t) {
651
+ return !e || e.disabled || e.readOnly ? !1 : e.value === "" || t !== null && e.value === t;
652
+ }
653
+ function Ae(e, t, n) {
654
+ return {
655
+ identifier: we(e.identifier, n.identifier) && !t.identifier,
656
+ password: we(e.password, n.password) && !t.password
657
+ };
658
+ }
659
+ function Ot(e, t, n) {
660
+ const r = e.identifier;
661
+ return !r || n.identifier ? !1 : r.value !== "" && r.value !== t.login;
662
+ }
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" };
666
+ }
667
+ function At(e) {
668
+ if (typeof window > "u" || typeof MutationObserver > "u") return {
669
+ watch() {
670
+ },
671
+ fill() {
672
+ },
673
+ cancel() {
674
+ },
675
+ teardown() {
676
+ }
677
+ };
678
+ let t = null, n = {
679
+ identifier: !1,
680
+ password: !1
681
+ }, r = {
682
+ identifier: null,
683
+ 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 = {
693
+ identifier: null,
694
+ password: null
695
+ }, l();
696
+ return;
697
+ }
698
+ if (!t)
699
+ i || (i = !0, e.onDetected());
700
+ else {
701
+ const b = Ae(E, n, r), S = Lt(E, t, n, r);
702
+ if ("error" in S || (b.identifier && (n = {
703
+ ...n,
704
+ identifier: !0
705
+ }, r = {
706
+ ...r,
707
+ identifier: t.login
708
+ }), b.password && (n = {
709
+ ...n,
710
+ password: !0
711
+ }, r = {
712
+ ...r,
713
+ password: t.password
714
+ })), "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());
717
+ } else
718
+ e.onFilled(S.step), n.password && (t = null, l(), c = setTimeout(() => {
719
+ c = null, me(document) && (i = !0, e.onDetected());
720
+ }, Ie));
721
+ }
722
+ }, w = () => {
723
+ s && clearTimeout(s), s = setTimeout(() => {
724
+ s = null, d();
725
+ }, it);
726
+ }, v = () => {
727
+ o || (o = new MutationObserver(w), o.observe(document.body, {
728
+ childList: !0,
729
+ subtree: !0,
730
+ attributes: !0,
731
+ attributeFilter: st
732
+ }));
733
+ };
734
+ return {
735
+ watch() {
736
+ o || (i = !1, v()), d();
737
+ },
738
+ fill(E) {
739
+ t = E, v(), d();
740
+ },
741
+ cancel() {
742
+ t = null, n = {
743
+ identifier: !1,
744
+ password: !1
745
+ }, i = !1, g();
746
+ },
747
+ teardown() {
748
+ t = null, g();
749
+ }
750
+ };
751
+ }
752
+ var kt = 6e5, Ct = 1e3, It = {
390
753
  maskAllInputs: !0,
391
754
  maskInputOptions: {
392
755
  password: !0,
@@ -399,32 +762,32 @@ var Le = 6e5, be = 1e3, Oe = {
399
762
  maskTextClass: "leesto-mask-text",
400
763
  maskTextSelector: "[data-private]"
401
764
  };
402
- async function _e(e) {
403
- const { record: t, addCustomEvent: r } = await import("./chunks/rrweb-qwppqH_c.js"), c = Date.now();
404
- let l = [], s = !1, u = 0;
405
- const d = () => {
406
- if (l.length === 0) return;
407
- const y = l;
408
- l = [], e.onBatch(y);
409
- }, h = t({
410
- emit(y) {
411
- l.push(y);
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);
412
775
  },
413
- ...Oe
414
- }), m = e.diagnostics ?? null, w = h ? m ?? Z({ captureNetwork: e.captureNetwork !== !1 }) : null, O = w !== null && m === null;
415
- w?.setSink((y, k) => {
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) => {
416
779
  try {
417
- r(y, k);
780
+ n(S, A);
418
781
  } catch {
419
782
  }
420
783
  });
421
- const E = setInterval(d, be), R = { timer: null }, v = () => (s || (s = !0, clearInterval(E), clearTimeout(R.timer ?? void 0), w?.flushRings(), w?.setSink(null), O && w?.teardown(), h?.(), d(), u = Date.now() - c), u);
422
- return R.timer = setTimeout(() => {
423
- v(), e.onCap();
424
- }, Le), { stop: v };
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 };
425
788
  }
426
- var Ae = ["https://lab.leesto.app", "https://studio-dev.leesto.app"], Ce = ["http://localhost:3505", "http://127.0.0.1:3505"];
427
- function Ne(e) {
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) {
428
791
  try {
429
792
  const t = new URL(e).hostname;
430
793
  return t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "[::1]";
@@ -432,43 +795,43 @@ function Ne(e) {
432
795
  return !1;
433
796
  }
434
797
  }
435
- function Ie(e) {
798
+ function Dt(e) {
436
799
  const t = e.trim();
437
800
  if (!t) return null;
438
801
  try {
439
- const { origin: r } = new URL(t);
440
- return r === "null" ? null : r;
802
+ const { origin: n } = new URL(t);
803
+ return n === "null" ? null : n;
441
804
  } catch {
442
805
  return null;
443
806
  }
444
807
  }
445
- function Te(e) {
446
- const t = (e.explicit ?? []).map(Ie).filter((c) => c !== null);
808
+ function xt(e) {
809
+ const t = (e.explicit ?? []).map(Dt).filter((r) => r !== null);
447
810
  if (t.length > 0) return [...new Set(t)];
448
- const r = [...Ae];
449
- return Ne(e.pageOrigin) && r.push(...Ce), [...new Set(r)];
811
+ const n = [...Nt];
812
+ return qt(e.pageOrigin) && n.push(...Tt), [...new Set(n)];
450
813
  }
451
- function K(e, t) {
814
+ function ve(e, t) {
452
815
  return !e || e === "*" || e === "null" ? !1 : t.includes(e);
453
816
  }
454
- function z() {
817
+ function re() {
455
818
  return typeof navigator < "u" && navigator.globalPrivacyControl === !0;
456
819
  }
457
- function Me(e) {
458
- const t = (u) => {
459
- const d = typeof u == "string" ? u.trim() : "";
460
- return d.length > 0 ? d : void 0;
461
- }, r = (u) => {
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) => {
462
825
  if (!(typeof document > "u"))
463
- return t(document.querySelector(`meta[name="${u}"]`)?.getAttribute("content"));
464
- }, c = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, l = t(e?.version) ?? t(c?.version) ?? r("app-version"), s = t(e?.environment) ?? t(c?.environment) ?? r("app-environment");
465
- if (!(!l && !s))
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))
466
829
  return {
467
- ...l ? { version: l } : {},
468
- ...s ? { environment: s } : {}
830
+ ...i ? { version: i } : {},
831
+ ...o ? { environment: o } : {}
469
832
  };
470
833
  }
471
- function qe() {
834
+ function Pt() {
472
835
  if (typeof document > "u") return;
473
836
  const e = document.querySelector('link[rel~="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]');
474
837
  if (e?.href)
@@ -478,228 +841,283 @@ function qe() {
478
841
  return;
479
842
  }
480
843
  }
481
- function $e() {
482
- const e = (c) => !!c && c !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(c), t = getComputedStyle(document.body).backgroundColor;
844
+ function $t() {
845
+ const e = (r) => !!r && r !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(r), t = getComputedStyle(document.body).backgroundColor;
483
846
  if (e(t)) return t;
484
- const r = getComputedStyle(document.documentElement).backgroundColor;
485
- return e(r) ? r : "#ffffff";
486
- }
487
- async function Pe() {
488
- const { domToPng: e } = await import("./chunks/dist-BTlWkbvW.js"), t = document.documentElement, r = window.scrollX, c = window.scrollY, l = [];
489
- for (const s of t.querySelectorAll("*")) {
490
- const u = getComputedStyle(s).position;
491
- if (u === "fixed" || u === "sticky") {
492
- const d = s.style.transform;
493
- l.push([s, d]), s.style.transform = `translate(${r}px, ${c}px)${d ? ` ${d}` : ""}`;
847
+ const n = getComputedStyle(document.documentElement).backgroundColor;
848
+ return e(n) ? n : "#ffffff";
849
+ }
850
+ async function be(e) {
851
+ const { domToPng: t } = await import("./chunks/dist-BTlWkbvW.js");
852
+ 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}` : ""}`;
494
863
  }
495
864
  }
496
865
  try {
497
- return await e(t, {
866
+ return await t(n, {
498
867
  quality: 0.92,
499
- backgroundColor: $e(),
500
- width: t.clientWidth,
501
- height: t.clientHeight,
868
+ backgroundColor: $t(),
869
+ width: n.clientWidth,
870
+ height: n.clientHeight,
502
871
  style: {
503
- transform: `translate(${-r}px, ${-c}px)`,
872
+ transform: `translate(${-r}px, ${-i}px)`,
504
873
  transformOrigin: "top left"
505
874
  }
506
875
  });
507
876
  } finally {
508
- for (const [s, u] of l) s.style.transform = u;
877
+ for (const [s, c] of o) s.style.transform = c;
509
878
  }
510
879
  }
511
- function De(e) {
880
+ function Ft(e) {
512
881
  if (e.id) return `#${CSS.escape(e.id)}`;
513
882
  const t = [];
514
- let r = e;
515
- for (; r && r.nodeType === 1 && r !== document.body && t.length < 4; ) {
516
- if (r.id) {
517
- t.unshift(`#${CSS.escape(r.id)}`);
883
+ let n = e;
884
+ for (; n && n.nodeType === 1 && n !== document.body && t.length < 4; ) {
885
+ if (n.id) {
886
+ t.unshift(`#${CSS.escape(n.id)}`);
518
887
  break;
519
888
  }
520
- let c = r.tagName.toLowerCase();
521
- const l = typeof r.className == "string" ? r.className.trim().split(/\s+/).filter(Boolean)[0] : null;
522
- l && (c += `.${CSS.escape(l)}`);
523
- const s = r.parentElement;
524
- if (s) {
525
- const u = Array.from(s.children).filter((d) => d.tagName === r?.tagName);
526
- u.length > 1 && (c += `:nth-of-type(${u.indexOf(r) + 1})`);
889
+ 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})`);
527
896
  }
528
- t.unshift(c), r = s;
897
+ t.unshift(r), n = o;
529
898
  }
530
899
  return t.join(" > ");
531
900
  }
532
- function He(e) {
533
- const t = e.tagName.toLowerCase(), r = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
534
- return r ? `${t} · ${r}` : t;
901
+ function Gt(e) {
902
+ const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
903
+ return n ? `${t} · ${n}` : t;
535
904
  }
536
- function Y(e = {}) {
905
+ function Ee(e = {}) {
537
906
  if (typeof window > "u" || window.parent === window) return () => {
538
907
  };
539
- const t = window.parent, r = e.highlightColor ?? "#6B8E23", c = Te({
908
+ const t = window.parent, n = e.highlightColor ?? He.light.primary, r = xt({
540
909
  explicit: e.shellOrigins,
541
910
  pageOrigin: location.origin
542
911
  });
543
- let l = null;
912
+ let i = null;
544
913
  try {
545
- const n = document.referrer ? new URL(document.referrer).origin : "";
546
- K(n, c) && (l = n);
914
+ const p = document.referrer ? new URL(document.referrer).origin : "";
915
+ ve(p, r) && (i = p);
547
916
  } catch {
548
917
  }
549
- const s = (n) => {
550
- if (l) {
551
- t.postMessage(n, l);
918
+ const o = (p) => {
919
+ if (i) {
920
+ t.postMessage(p, i);
552
921
  return;
553
922
  }
554
- for (const i of c) t.postMessage(n, i);
923
+ for (const m of r) t.postMessage(p, m);
555
924
  };
556
- let u = null, d = "";
557
- const h = () => {
558
- u && (u.style.outline = d), u = null;
925
+ let s = null, c = "";
926
+ const l = () => {
927
+ s && (s.style.outline = c), s = null;
559
928
  };
560
- let m = null;
561
- const w = () => {
562
- if (m) return;
563
- let n = null, i = "";
564
- const a = (f) => {
565
- n !== f && (n && (n.style.outline = i), n = f, f && (i = f.style.outline, f.style.outline = `2px dashed ${r}`, f.style.outlineOffset = "1px"));
566
- }, g = (f) => a(f.target instanceof HTMLElement ? f.target : null), L = (f) => {
567
- f.preventDefault(), f.stopPropagation();
568
- const C = f.target, H = C instanceof HTMLElement ? C : null;
569
- if (m?.(), H) {
570
- const U = H.getBoundingClientRect();
571
- s({
572
- type: "leesto:element-picked",
573
- selector: De(H),
574
- label: He(H),
575
- rect: {
576
- x: U.x,
577
- y: U.y,
578
- width: U.width,
579
- height: U.height
580
- }
581
- });
582
- }
583
- }, p = (f) => {
584
- f.key === "Escape" && (m?.(), s({ type: "leesto:pick-cancelled" }));
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, {
934
+ position: "fixed",
935
+ pointerEvents: "none",
936
+ zIndex: "2147483647",
937
+ boxSizing: "border-box",
938
+ border: `2px solid ${n}`,
939
+ borderRadius: "4px",
940
+ 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({
948
+ type: "leesto:element-picked",
949
+ selector: Ft(L),
950
+ label: Gt(L),
951
+ rect: {
952
+ x: q.x,
953
+ y: q.y,
954
+ width: q.width,
955
+ height: q.height
956
+ }
957
+ }) : Object.assign(p.style, {
958
+ display: "block",
959
+ left: `${q.x}px`,
960
+ top: `${q.y}px`,
961
+ width: `${q.width}px`,
962
+ height: `${q.height}px`
963
+ });
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" }));
585
972
  };
586
- m = () => {
587
- n && (n.style.outline = i), n = null, document.removeEventListener("mousemove", g, !0), document.removeEventListener("click", L, !0), document.removeEventListener("keydown", p, !0), document.body.style.cursor = "", m = null;
588
- }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", g, !0), document.addEventListener("click", L, !0), document.addEventListener("keydown", p, !0);
589
- }, O = oe(location.search) && !z(), E = O ? re(location.search) ?? ne() : void 0, R = O ? Z({
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({
590
977
  captureNetwork: e.captureNetwork !== !1,
591
- runId: E,
978
+ runId: v,
592
979
  runIdOrigins: e.runIdOrigins
593
980
  }) : null;
594
- let v = null, y = !1, k = !1;
595
- const _ = () => {
596
- if (v) {
597
- const n = v.stop();
598
- v = null, s({
981
+ let b = null, S = !1, A = !1;
982
+ const x = () => {
983
+ if (b) {
984
+ const p = b.stop();
985
+ b = null, o({
599
986
  type: "leesto:rec-stopped",
600
- durationMs: n
987
+ durationMs: p
601
988
  });
602
- } else y && (k = !0);
603
- }, T = (n) => {
604
- if (n.source !== t || !K(n.origin, c) || !J(n.data)) return;
605
- l || (l = n.origin);
606
- const i = n.data;
607
- if (i.type === "leesto:ping") s({ type: "leesto:pong" });
608
- else if (i.type === "leesto:highlight") {
609
- if (h(), i.selector) {
610
- let a = null;
989
+ } else S && (A = !0);
990
+ }, I = At({
991
+ onDetected: () => o({ type: "leesto:login-form-detected" }),
992
+ onFilled: (p) => o({
993
+ type: "leesto:login-filled",
994
+ step: p
995
+ }),
996
+ onError: (p) => o({
997
+ type: "leesto:login-error",
998
+ reason: p
999
+ })
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({
1010
+ type: "leesto:ready",
1011
+ url: location.href,
1012
+ 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 } : {}
1019
+ });
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(() => {
1029
+ }).finally(() => {
1030
+ $ = !1, z || h();
1031
+ });
1032
+ } else if (m.type === "leesto:highlight") {
1033
+ if (l(), m.selector) {
1034
+ let y = null;
611
1035
  try {
612
- a = document.querySelector(i.selector);
1036
+ y = document.querySelector(m.selector);
613
1037
  } catch {
614
- a = null;
1038
+ y = null;
615
1039
  }
616
- a && (u = a, d = a.style.outline, a.style.outline = `2px solid ${r}`, a.style.outlineOffset = "2px", a.scrollIntoView({
1040
+ y && (s = y, c = y.style.outline, y.style.outline = `2px solid ${n}`, y.style.outlineOffset = "2px", y.scrollIntoView({
617
1041
  block: "center",
618
1042
  behavior: "smooth"
619
1043
  }));
620
1044
  }
621
- } else if (i.type === "leesto:pick-start") w();
622
- else if (i.type === "leesto:pick-stop") m?.();
623
- else if (i.type === "leesto:capture-request") (e.capture ?? Pe)().then((a) => s({
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({
624
1048
  type: "leesto:screenshot",
625
- dataUrl: a
626
- })).catch((a) => s({
1049
+ dataUrl: y,
1050
+ ...m.selector ? { selector: m.selector } : {}
1051
+ })).catch((y) => o({
627
1052
  type: "leesto:capture-failed",
628
- reason: a instanceof Error ? a.message : "capture_error"
1053
+ reason: y instanceof Error ? y.message : "capture_error"
629
1054
  }));
630
- else if (i.type === "leesto:rec-start") {
631
- if (v || y) return;
632
- if (z()) {
633
- s({
1055
+ else if (m.type === "leesto:rec-start") {
1056
+ if (b || S) return;
1057
+ if (re()) {
1058
+ o({
634
1059
  type: "leesto:rec-blocked",
635
1060
  reason: "gpc"
636
1061
  });
637
1062
  return;
638
1063
  }
639
- y = !0, k = !1, _e({
640
- onBatch: (a) => s({
1064
+ S = !0, A = !1, _t({
1065
+ onBatch: (y) => o({
641
1066
  type: "leesto:rec-batch",
642
- events: a
1067
+ events: y
643
1068
  }),
644
- onCap: () => _(),
1069
+ onCap: () => x(),
645
1070
  captureNetwork: e.captureNetwork,
646
- diagnostics: R
647
- }).then((a) => {
648
- y = !1, v = a, k && _();
649
- }).catch((a) => {
650
- y = !1, s({
1071
+ diagnostics: E
1072
+ }).then((y) => {
1073
+ S = !1, b = y, A && x();
1074
+ }).catch((y) => {
1075
+ S = !1, o({
651
1076
  type: "leesto:rec-error",
652
- reason: a instanceof Error ? a.message : "rec_error"
1077
+ reason: y instanceof Error ? y.message : "rec_error"
653
1078
  });
654
1079
  });
655
- } else i.type === "leesto:rec-stop" ? _() : i.type === "leesto:diagnostics-request" && s({
1080
+ } else m.type === "leesto:rec-stop" ? x() : m.type === "leesto:diagnostics-request" ? o({
656
1081
  type: "leesto:diagnostics",
657
- snapshot: R?.snapshot() ?? {
1082
+ snapshot: E?.snapshot() ?? {
658
1083
  errors: [],
659
1084
  logs: [],
660
1085
  network: []
661
1086
  }
662
- });
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();
663
1091
  };
664
- window.addEventListener("message", T);
665
- const A = Me(e.build), M = qe();
666
- s({
667
- type: "leesto:ready",
668
- url: location.href,
669
- bridgeVersion: 1,
670
- ...M ? { favicon: M } : {},
671
- ...A ? { build: A } : {},
672
- ...E ? { diagnosticRunId: E } : {},
673
- ...z() ? { gpc: !0 } : {}
674
- });
675
- let q = location.href;
676
- const S = () => {
677
- location.href !== q && (q = location.href, s({
1092
+ window.addEventListener("message", f), u();
1093
+ const h = () => {
1094
+ location.href === a && _() === N || (a = location.href, N = _(), o({
678
1095
  type: "leesto:location",
679
- url: location.href
1096
+ url: location.href,
1097
+ canGoBack: N
680
1098
  }));
681
- }, D = history.pushState, $ = history.replaceState, P = (...n) => {
682
- D.apply(history, n), S();
683
- }, o = (...n) => {
684
- $.apply(history, n), S();
1099
+ }, O = history.pushState, T = history.replaceState, R = (...p) => {
1100
+ O.apply(history, p), h();
1101
+ }, k = (...p) => {
1102
+ T.apply(history, p), h();
685
1103
  };
686
- return history.pushState = P, history.replaceState = o, window.addEventListener("popstate", S), window.addEventListener("hashchange", S), () => {
687
- _(), R?.teardown(), h(), m?.(), window.removeEventListener("message", T), window.removeEventListener("popstate", S), window.removeEventListener("hashchange", S), history.pushState === P && (history.pushState = D), history.replaceState === o && (history.replaceState = $);
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);
688
1106
  };
689
1107
  }
690
- function Ue() {
1108
+ function Ht() {
691
1109
  return typeof document > "u" ? null : document.currentScript ?? document.querySelector("script[data-leesto-connect]");
692
1110
  }
693
- function xe(e) {
694
- const t = {}, r = e?.dataset.highlightColor;
695
- r && (t.highlightColor = r);
696
- const c = (e?.dataset.shellOrigin ?? "").split(",").map((l) => l.trim()).filter(Boolean);
697
- return c.length > 0 && (t.shellOrigins = c), t;
1111
+ function Ut(e) {
1112
+ const t = {}, n = e?.dataset.highlightColor;
1113
+ n && (t.highlightColor = n);
1114
+ const r = (e?.dataset.shellOrigin ?? "").split(",").map((i) => i.trim()).filter(Boolean);
1115
+ return r.length > 0 && (t.shellOrigins = r), t;
698
1116
  }
699
1117
  if (typeof window < "u") {
700
- window.LeestoConnect = { connect: (t) => Y(t) };
701
- const e = Ue();
702
- (!e || e.dataset.leestoManual === void 0) && Y(xe(e));
1118
+ window.LeestoConnect = { connect: (t) => Ee(t) };
1119
+ const e = Ht();
1120
+ (!e || e.dataset.leestoManual === void 0) && Ee(Ut(e));
703
1121
  }
704
1122
 
705
1123
  //# sourceMappingURL=leesto-connect.js.map