@getpinax/widget 0.0.0-stage → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +513 -2
- package/dist/a11y/scan.d.ts +25 -0
- package/dist/api.d.ts +83 -0
- package/dist/capture/breadcrumbs.d.ts +49 -0
- package/dist/capture/console.d.ts +17 -0
- package/dist/capture/env.d.ts +25 -0
- package/dist/capture/network.d.ts +23 -0
- package/dist/capture/ring.d.ts +14 -0
- package/dist/capture/signature.d.ts +7 -0
- package/dist/capture/text.d.ts +23 -0
- package/dist/capture/ua.d.ts +13 -0
- package/dist/chunks/editor-0Kr31Uly.mjs +1368 -0
- package/dist/chunks/privacy-B_b1_Y1n.mjs +39 -0
- package/dist/chunks/recorder-tu4yugLw.mjs +2874 -0
- package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
- package/dist/chunks/text-D9SaDBT0.mjs +36 -0
- package/dist/chunks/widget-BpTBdX2R.mjs +1272 -0
- package/dist/editor/annotator.d.ts +20 -0
- package/dist/editor/capture.d.ts +28 -0
- package/dist/editor/encode.d.ts +7 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/mask.d.ts +29 -0
- package/dist/editor/pii.d.ts +22 -0
- package/dist/editor/shapes.d.ts +31 -0
- package/dist/editor-loader.d.ts +9 -0
- package/dist/editor-loader.embed.d.ts +6 -0
- package/dist/fixcheck.d.ts +42 -0
- package/dist/index.d.ts +85 -0
- package/dist/known.d.ts +27 -0
- package/dist/mount.d.ts +8 -0
- package/dist/navigation.d.ts +1 -0
- package/dist/paths.d.ts +4 -0
- package/dist/pinax-axe.js +46167 -0
- package/dist/pinax-editor.js +1417 -0
- package/dist/pinax-recorder.js +2915 -0
- package/dist/pinax.js +135 -0
- package/dist/pinax.mjs +1270 -0
- package/dist/preview.d.ts +48 -0
- package/dist/preview.mjs +67 -0
- package/dist/privacy.d.ts +24 -0
- package/dist/queue.d.ts +10 -0
- package/dist/replay/buffer.d.ts +40 -0
- package/dist/replay/recorder.d.ts +25 -0
- package/dist/replay/sanitize.d.ts +19 -0
- package/dist/report.d.ts +128 -0
- package/dist/segment.d.ts +31 -0
- package/dist/settings.d.ts +40 -0
- package/dist/types.d.ts +247 -0
- package/dist/ui/color.d.ts +7 -0
- package/dist/ui/dom.d.ts +14 -0
- package/dist/ui/styles.d.ts +3 -0
- package/dist/ui/widget.d.ts +241 -0
- package/package.json +74 -4
package/dist/pinax.mjs
ADDED
|
@@ -0,0 +1,1270 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, o as a, s as o, t as s, u as c } from "./chunks/widget-BpTBdX2R.mjs";
|
|
2
|
+
import { a as l, i as u, n as d, r as f } from "./chunks/text-D9SaDBT0.mjs";
|
|
3
|
+
import { o as p } from "./chunks/privacy-B_b1_Y1n.mjs";
|
|
4
|
+
function m(e) {
|
|
5
|
+
return (e || "https://api.getpinax.com").replace(/\/+$/, "");
|
|
6
|
+
}
|
|
7
|
+
function h(e, t) {
|
|
8
|
+
let n = e ?? (t ? "" : "https://cdn.getpinax.com");
|
|
9
|
+
return n ? n.replace(/\/+$/, "") : null;
|
|
10
|
+
}
|
|
11
|
+
function g(e, t) {
|
|
12
|
+
return `${e}/config/${encodeURIComponent(t)}.json`;
|
|
13
|
+
}
|
|
14
|
+
function _(e, t, n) {
|
|
15
|
+
return `${e}/v1/widget/${encodeURIComponent(t)}/${n}`;
|
|
16
|
+
}
|
|
17
|
+
async function v(e, t) {
|
|
18
|
+
let n = await e(t, { credentials: "omit" });
|
|
19
|
+
if (!n.ok) return {
|
|
20
|
+
status: n.status,
|
|
21
|
+
config: null
|
|
22
|
+
};
|
|
23
|
+
let r = await n.json();
|
|
24
|
+
return {
|
|
25
|
+
status: n.status,
|
|
26
|
+
config: r?.data ?? null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function ee(e, t, n, r = null) {
|
|
30
|
+
if (r) try {
|
|
31
|
+
let { config: t } = await v(e, g(r, n));
|
|
32
|
+
if (t) return t;
|
|
33
|
+
} catch {}
|
|
34
|
+
return (await v(e, _(t, n, "config"))).config;
|
|
35
|
+
}
|
|
36
|
+
function te(e, t, r, i) {
|
|
37
|
+
try {
|
|
38
|
+
if (!new URL(i).searchParams.has("pinax_verify")) return;
|
|
39
|
+
e(_(t, r, "ping"), {
|
|
40
|
+
method: "POST",
|
|
41
|
+
credentials: "omit",
|
|
42
|
+
headers: { "Content-Type": "application/json" },
|
|
43
|
+
body: JSON.stringify({ url: n(i) })
|
|
44
|
+
}).catch(() => {});
|
|
45
|
+
} catch {}
|
|
46
|
+
}
|
|
47
|
+
var ne = {
|
|
48
|
+
403: "Feedback isn't switched on for this website yet.",
|
|
49
|
+
404: "Feedback isn't switched on for this website yet.",
|
|
50
|
+
413: "That screenshot is too big to send. Remove it and try again.",
|
|
51
|
+
429: "Too many reports from this device. Please try again in a few minutes."
|
|
52
|
+
};
|
|
53
|
+
async function y(e, t, n, r) {
|
|
54
|
+
let i;
|
|
55
|
+
try {
|
|
56
|
+
i = await e(_(t, n, "reports"), {
|
|
57
|
+
method: "POST",
|
|
58
|
+
credentials: "omit",
|
|
59
|
+
headers: { "Content-Type": "application/json" },
|
|
60
|
+
body: JSON.stringify(r)
|
|
61
|
+
});
|
|
62
|
+
} catch {
|
|
63
|
+
return {
|
|
64
|
+
ok: !1,
|
|
65
|
+
retry: !0,
|
|
66
|
+
status: 0,
|
|
67
|
+
message: "You're offline. We'll send it when you're back."
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
let a = null;
|
|
71
|
+
try {
|
|
72
|
+
a = await i.json();
|
|
73
|
+
} catch {}
|
|
74
|
+
if (i.ok) return {
|
|
75
|
+
ok: !0,
|
|
76
|
+
id: a?.data?.id ?? ""
|
|
77
|
+
};
|
|
78
|
+
let o = i.status;
|
|
79
|
+
return {
|
|
80
|
+
ok: !1,
|
|
81
|
+
retry: o >= 500,
|
|
82
|
+
status: o,
|
|
83
|
+
message: ne[o] ?? (o === 400 && a?.message ? a.message : "Something went wrong. Please try again.")
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
var re = 4e3;
|
|
87
|
+
async function ie(e, t, n, r, i = re) {
|
|
88
|
+
let a = typeof AbortController == "function" ? new AbortController() : null, o, s = new Promise((e) => {
|
|
89
|
+
o = setTimeout(() => {
|
|
90
|
+
a?.abort(), e(null);
|
|
91
|
+
}, i);
|
|
92
|
+
}), c = (async () => {
|
|
93
|
+
try {
|
|
94
|
+
let i = await e(_(t, n, "follow-up"), {
|
|
95
|
+
method: "POST",
|
|
96
|
+
credentials: "omit",
|
|
97
|
+
headers: { "Content-Type": "application/json" },
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
type: r.type,
|
|
100
|
+
message: r.message.trim().slice(0, 2e3),
|
|
101
|
+
pagePath: r.pagePath.slice(0, 500) || "/"
|
|
102
|
+
}),
|
|
103
|
+
signal: a?.signal
|
|
104
|
+
});
|
|
105
|
+
if (!i.ok) return null;
|
|
106
|
+
let o = (await i.json())?.data?.question;
|
|
107
|
+
return typeof o == "string" && o.trim() ? o.trim().slice(0, 300) : null;
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
try {
|
|
113
|
+
return await Promise.race([c, s]);
|
|
114
|
+
} finally {
|
|
115
|
+
clearTimeout(o);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function b(e, t, n, r, i = "fix-check") {
|
|
119
|
+
try {
|
|
120
|
+
e(_(t, n, i), {
|
|
121
|
+
method: "POST",
|
|
122
|
+
credentials: "omit",
|
|
123
|
+
keepalive: !0,
|
|
124
|
+
headers: { "Content-Type": "application/json" },
|
|
125
|
+
body: JSON.stringify({
|
|
126
|
+
checkId: r.checkId.slice(0, 64),
|
|
127
|
+
signature: r.signature.slice(0, 300),
|
|
128
|
+
...i === "sighting" && r.basket ? { basket: r.basket } : {},
|
|
129
|
+
...r.consent ? { consent: !0 } : {}
|
|
130
|
+
})
|
|
131
|
+
}).catch(() => {});
|
|
132
|
+
} catch {}
|
|
133
|
+
}
|
|
134
|
+
function ae(e, t, n) {
|
|
135
|
+
return n ? `${n}/count/${encodeURIComponent(t)}` : _(e, t, "count");
|
|
136
|
+
}
|
|
137
|
+
function oe(e, t, n, r) {
|
|
138
|
+
try {
|
|
139
|
+
e(ae(t, n, r), {
|
|
140
|
+
method: "POST",
|
|
141
|
+
credentials: "omit",
|
|
142
|
+
keepalive: !0
|
|
143
|
+
}).catch(() => {});
|
|
144
|
+
} catch {}
|
|
145
|
+
}
|
|
146
|
+
async function se(e, t, n) {
|
|
147
|
+
try {
|
|
148
|
+
return (await e(t, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
credentials: "omit",
|
|
151
|
+
headers: { "Content-Type": "application/json" },
|
|
152
|
+
body: JSON.stringify(n)
|
|
153
|
+
})).ok;
|
|
154
|
+
} catch {
|
|
155
|
+
return !1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function ce(e, t, n, r, i) {
|
|
159
|
+
return se(e, _(t, n, `known/${encodeURIComponent(r)}/me-too`), i ? { email: i.trim().slice(0, 254) } : {});
|
|
160
|
+
}
|
|
161
|
+
var le = "input,textarea,select,[contenteditable]:not([contenteditable=false]),[data-pinax-mask],.pinax-mask", ue = "[data-pinax-mask],.pinax-mask", de = "a[href],button,input,select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=radio],[role=switch],[role=option],[contenteditable]:not([contenteditable=false])", fe = {
|
|
162
|
+
button: "button",
|
|
163
|
+
submit: "button",
|
|
164
|
+
reset: "button",
|
|
165
|
+
image: "button",
|
|
166
|
+
checkbox: "checkbox",
|
|
167
|
+
radio: "radio",
|
|
168
|
+
range: "slider",
|
|
169
|
+
search: "searchbox"
|
|
170
|
+
};
|
|
171
|
+
function x(e, t) {
|
|
172
|
+
try {
|
|
173
|
+
return e.matches(t);
|
|
174
|
+
} catch {
|
|
175
|
+
return !1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function S(e, t) {
|
|
179
|
+
try {
|
|
180
|
+
return e.closest(t);
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
var C = (e) => e.replace(/\s+/g, " ").trim();
|
|
186
|
+
function pe(e) {
|
|
187
|
+
if (e.tagName !== "INPUT") return !1;
|
|
188
|
+
let t = e, n = (t.getAttribute("autocomplete") ?? "").toLowerCase(), r = `${t.name} ${t.id}`.toLowerCase();
|
|
189
|
+
return t.type === "password" || n.includes("cc-") || n.includes("password") || /\b(card|cc|cvc|cvv|iban)/.test(r);
|
|
190
|
+
}
|
|
191
|
+
function w(e) {
|
|
192
|
+
let t = e.getAttribute("role")?.trim().split(/\s+/)[0];
|
|
193
|
+
if (t) return t;
|
|
194
|
+
let n = e.tagName.toLowerCase();
|
|
195
|
+
switch (n) {
|
|
196
|
+
case "a": return e.hasAttribute("href") ? "link" : "text";
|
|
197
|
+
case "button":
|
|
198
|
+
case "summary": return "button";
|
|
199
|
+
case "input": return fe[e.type?.toLowerCase()] ?? "textbox";
|
|
200
|
+
case "textarea": return "textbox";
|
|
201
|
+
case "select": return "combobox";
|
|
202
|
+
case "img": return "image";
|
|
203
|
+
case "h1":
|
|
204
|
+
case "h2":
|
|
205
|
+
case "h3":
|
|
206
|
+
case "h4":
|
|
207
|
+
case "h5":
|
|
208
|
+
case "h6": return "heading";
|
|
209
|
+
default: return x(e, "[contenteditable]:not([contenteditable=false])") ? "textbox" : n;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function T(e, t = 120) {
|
|
213
|
+
if (x(e, le) || S(e, ue)) return "";
|
|
214
|
+
let n = "", r = (e) => {
|
|
215
|
+
if (n.length > t) return;
|
|
216
|
+
if (e.nodeType === 3) {
|
|
217
|
+
n += e.nodeValue ?? "";
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (e.nodeType !== 1) return;
|
|
221
|
+
let i = e, a = i.tagName;
|
|
222
|
+
if (a !== "SCRIPT" && a !== "STYLE" && a !== "TEMPLATE" && !x(i, le) && i.getAttribute("aria-hidden") !== "true") {
|
|
223
|
+
if (a === "IMG") n += ` ${i.getAttribute("alt") ?? ""} `;
|
|
224
|
+
else {
|
|
225
|
+
for (let e of i.childNodes) r(e);
|
|
226
|
+
/^(P|DIV|LI|BR|TD|TH|DT|DD)$/.test(a) && (n += " ");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
for (let t of e.childNodes) r(t);
|
|
231
|
+
return C(n);
|
|
232
|
+
}
|
|
233
|
+
function me(e) {
|
|
234
|
+
let t = e.getAttribute("aria-labelledby");
|
|
235
|
+
if (!t) return "";
|
|
236
|
+
let n = e.ownerDocument;
|
|
237
|
+
return C(t.split(/\s+/).map((e) => {
|
|
238
|
+
let t = n.getElementById(e);
|
|
239
|
+
return t ? T(t) : "";
|
|
240
|
+
}).join(" "));
|
|
241
|
+
}
|
|
242
|
+
function he(e) {
|
|
243
|
+
let t = e;
|
|
244
|
+
return C((t.labels ? [...t.labels] : []).map((e) => T(e)).join(" ")) || C(t.getAttribute("placeholder") ?? "") || C(t.getAttribute("title") ?? "") || C(t.getAttribute("name") ?? "");
|
|
245
|
+
}
|
|
246
|
+
function ge(e) {
|
|
247
|
+
if (S(e, ue)) return "";
|
|
248
|
+
let t = C(e.getAttribute("aria-label") ?? "");
|
|
249
|
+
if (t) return t;
|
|
250
|
+
let n = me(e);
|
|
251
|
+
if (n) return n;
|
|
252
|
+
let r = e.tagName;
|
|
253
|
+
if (r === "INPUT") {
|
|
254
|
+
let t = e.type?.toLowerCase();
|
|
255
|
+
return t === "submit" || t === "button" || t === "reset" ? C(e.getAttribute("value") ?? "") : t === "image" ? C(e.getAttribute("alt") ?? "") : he(e);
|
|
256
|
+
}
|
|
257
|
+
return r === "TEXTAREA" || r === "SELECT" ? he(e) : x(e, "[contenteditable]:not([contenteditable=false])") ? C(e.getAttribute("title") ?? "") : r === "IMG" ? C(e.getAttribute("alt") ?? "") : T(e) || C(e.getAttribute("title") ?? "");
|
|
258
|
+
}
|
|
259
|
+
function _e(e) {
|
|
260
|
+
let t = S(e, de);
|
|
261
|
+
if (!t) return d(w(e), 200);
|
|
262
|
+
let n = t;
|
|
263
|
+
if (pe(n)) return n.type === "password" ? "password field" : "card field";
|
|
264
|
+
let r = w(n), i = d(ge(n), 60).replace(/"/g, "'");
|
|
265
|
+
return d(i ? `${r} "${i}"` : r, 200);
|
|
266
|
+
}
|
|
267
|
+
function E(e = location.href) {
|
|
268
|
+
try {
|
|
269
|
+
let t = new URL(l(e));
|
|
270
|
+
return d(u(`${t.pathname}${t.search}`), 500);
|
|
271
|
+
} catch {
|
|
272
|
+
return "/";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function ve(e, t = {}) {
|
|
276
|
+
let n = t.doc ?? document, r = t.ignore ?? (() => !1), i = "", a = null, o = (t) => {
|
|
277
|
+
try {
|
|
278
|
+
e.push(t);
|
|
279
|
+
} catch {}
|
|
280
|
+
}, s = (e) => {
|
|
281
|
+
if (!e || typeof e.nodeType != "number") return null;
|
|
282
|
+
let t = e;
|
|
283
|
+
return t.nodeType === 1 ? t : t.parentElement;
|
|
284
|
+
}, c = (e) => {
|
|
285
|
+
try {
|
|
286
|
+
if (r(e.target)) return;
|
|
287
|
+
let t = s(e.target);
|
|
288
|
+
if (!t) return;
|
|
289
|
+
a = null, o({
|
|
290
|
+
kind: "click",
|
|
291
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
292
|
+
path: E(),
|
|
293
|
+
target: _e(t)
|
|
294
|
+
});
|
|
295
|
+
} catch {}
|
|
296
|
+
}, l = (e) => {
|
|
297
|
+
try {
|
|
298
|
+
if (r(e.target)) return;
|
|
299
|
+
let t = s(e.target);
|
|
300
|
+
if (!t) return;
|
|
301
|
+
let n = S(t, de) ?? t;
|
|
302
|
+
if (n.tagName === "INPUT" && /^(checkbox|radio)$/i.test(n.type) || n === a) return;
|
|
303
|
+
a = n, o({
|
|
304
|
+
kind: "input",
|
|
305
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
306
|
+
path: E(),
|
|
307
|
+
target: _e(n)
|
|
308
|
+
});
|
|
309
|
+
} catch {}
|
|
310
|
+
}, u = () => {
|
|
311
|
+
try {
|
|
312
|
+
let e = location.pathname + location.search;
|
|
313
|
+
if (e === i) return;
|
|
314
|
+
i = e, a = null, o({
|
|
315
|
+
kind: "navigation",
|
|
316
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
317
|
+
path: E()
|
|
318
|
+
});
|
|
319
|
+
} catch {}
|
|
320
|
+
};
|
|
321
|
+
return n.addEventListener("click", c, !0), n.addEventListener("input", l, !0), u(), {
|
|
322
|
+
navigated: u,
|
|
323
|
+
stop: () => {
|
|
324
|
+
n.removeEventListener("click", c, !0), n.removeEventListener("input", l, !0);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// src/capture/console.ts
|
|
329
|
+
var ye = [
|
|
330
|
+
"error",
|
|
331
|
+
"warn",
|
|
332
|
+
"log",
|
|
333
|
+
"info",
|
|
334
|
+
"debug"
|
|
335
|
+
], D = 2e3, O = 4e3;
|
|
336
|
+
function be(e, t = 0) {
|
|
337
|
+
if (typeof e == "string") return e;
|
|
338
|
+
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
339
|
+
if (e == null) return String(e);
|
|
340
|
+
if (typeof e == "function") return `[function ${e.name || ""}]`;
|
|
341
|
+
if (typeof e != "object") return String(e);
|
|
342
|
+
if (typeof Node < "u" && e instanceof Node) return `[${e.nodeName.toLowerCase()}]`;
|
|
343
|
+
if (t > 0) return Array.isArray(e) ? "[…]" : "{…}";
|
|
344
|
+
try {
|
|
345
|
+
let t = /* @__PURE__ */ new WeakSet(), n = JSON.stringify(e, (e, n) => {
|
|
346
|
+
if (n && typeof n == "object") {
|
|
347
|
+
if (t.has(n)) return "[circular]";
|
|
348
|
+
t.add(n);
|
|
349
|
+
}
|
|
350
|
+
return n;
|
|
351
|
+
});
|
|
352
|
+
return d(n ?? String(e), D);
|
|
353
|
+
} catch {
|
|
354
|
+
return Object.prototype.toString.call(e);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function xe(e) {
|
|
358
|
+
return d(e.map((e) => be(e)).join(" "), D);
|
|
359
|
+
}
|
|
360
|
+
function Se(e) {
|
|
361
|
+
let t = e.find((e) => e instanceof Error);
|
|
362
|
+
return t?.stack ? d(t.stack, O) : void 0;
|
|
363
|
+
}
|
|
364
|
+
function Ce() {
|
|
365
|
+
let e = (/* @__PURE__ */ Error()).stack;
|
|
366
|
+
if (!e) return;
|
|
367
|
+
let t = e.split("\n"), n = t[0].startsWith("Error") ? 3 : 2, r = t.slice(n).join("\n");
|
|
368
|
+
return r ? d(r, O) : void 0;
|
|
369
|
+
}
|
|
370
|
+
function we(e, t = window) {
|
|
371
|
+
let n = t.console, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = !1, o = (t) => {
|
|
372
|
+
try {
|
|
373
|
+
e.push(t);
|
|
374
|
+
} catch {}
|
|
375
|
+
};
|
|
376
|
+
for (let e of ye) {
|
|
377
|
+
let t = n?.[e];
|
|
378
|
+
if (typeof t != "function") continue;
|
|
379
|
+
let s = function(...n) {
|
|
380
|
+
if (!a) {
|
|
381
|
+
a = !0;
|
|
382
|
+
try {
|
|
383
|
+
o({
|
|
384
|
+
level: e,
|
|
385
|
+
message: xe(n),
|
|
386
|
+
stack: Se(n) ?? (e === "error" || e === "warn" ? Ce() : void 0),
|
|
387
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
388
|
+
});
|
|
389
|
+
} catch {} finally {
|
|
390
|
+
a = !1;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return t.apply(this, n);
|
|
394
|
+
};
|
|
395
|
+
s.__pinaxOriginal = t, r.set(e, t), i.set(e, s);
|
|
396
|
+
try {
|
|
397
|
+
n[e] = s;
|
|
398
|
+
} catch {}
|
|
399
|
+
}
|
|
400
|
+
let s = (e) => {
|
|
401
|
+
try {
|
|
402
|
+
if (!e.message && !e.error) return;
|
|
403
|
+
let t = e.error, n = e.filename ? ` (${e.filename}:${e.lineno}:${e.colno})` : "";
|
|
404
|
+
o({
|
|
405
|
+
level: "error",
|
|
406
|
+
message: d(`Uncaught ${t?.name ? `${t.name}: ${t.message}` : e.message}${n}`, D),
|
|
407
|
+
stack: t?.stack ? d(t.stack, O) : void 0,
|
|
408
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
409
|
+
});
|
|
410
|
+
} catch {}
|
|
411
|
+
}, c = (e) => {
|
|
412
|
+
try {
|
|
413
|
+
let t = e.reason;
|
|
414
|
+
o({
|
|
415
|
+
level: "error",
|
|
416
|
+
message: d(`Unhandled promise rejection: ${be(t)}`, D),
|
|
417
|
+
stack: t instanceof Error && t.stack ? d(t.stack, O) : void 0,
|
|
418
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
419
|
+
});
|
|
420
|
+
} catch {}
|
|
421
|
+
};
|
|
422
|
+
return t.addEventListener("error", s), t.addEventListener("unhandledrejection", c), () => {
|
|
423
|
+
t.removeEventListener("error", s), t.removeEventListener("unhandledrejection", c);
|
|
424
|
+
for (let [e, t] of r) try {
|
|
425
|
+
n[e] === i.get(e) && (n[e] = t);
|
|
426
|
+
} catch {}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
// src/capture/ua.ts
|
|
430
|
+
var Te = {
|
|
431
|
+
"10.0": "10/11",
|
|
432
|
+
"6.3": "8.1",
|
|
433
|
+
"6.2": "8",
|
|
434
|
+
"6.1": "7"
|
|
435
|
+
};
|
|
436
|
+
function k(e, t) {
|
|
437
|
+
return t.exec(e)?.[1];
|
|
438
|
+
}
|
|
439
|
+
function A(e) {
|
|
440
|
+
if (e) return e.replace(/_/g, ".").split(".").slice(0, 2).join(".");
|
|
441
|
+
}
|
|
442
|
+
function Ee(e, t = 0) {
|
|
443
|
+
let n = { deviceType: "desktop" };
|
|
444
|
+
for (let [t, r] of [
|
|
445
|
+
["Edge", /Edg(?:e|A|iOS)?\/([\d.]+)/],
|
|
446
|
+
["Opera", /(?:OPR|OPiOS)\/([\d.]+)/],
|
|
447
|
+
["Samsung Internet", /SamsungBrowser\/([\d.]+)/],
|
|
448
|
+
["Firefox", /(?:Firefox|FxiOS)\/([\d.]+)/],
|
|
449
|
+
["Chrome", /(?:Chrome|CriOS)\/([\d.]+)/],
|
|
450
|
+
["Safari", /Version\/([\d.]+).*Safari\//]
|
|
451
|
+
]) {
|
|
452
|
+
let i = k(e, r);
|
|
453
|
+
if (i) {
|
|
454
|
+
n.browser = t, n.browserVersion = A(i);
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
!n.browser && /AppleWebKit/.test(e) && /Mobile\//.test(e) && (n.browser = "Safari (in-app)");
|
|
459
|
+
let r = /iPad/.test(e) || /Macintosh/.test(e) && t > 1;
|
|
460
|
+
if (/iPhone|iPod/.test(e)) n.os = `iOS ${A(k(e, /OS ([\d_]+) like Mac/)) ?? ""}`.trim(), n.deviceType = "mobile", n.deviceModel = /iPod/.test(e) ? "iPod" : "iPhone";
|
|
461
|
+
else if (r) {
|
|
462
|
+
let t = A(k(e, /OS ([\d_]+) like Mac/));
|
|
463
|
+
n.os = t ? `iPadOS ${t}` : "iPadOS", n.deviceType = "tablet", n.deviceModel = "iPad";
|
|
464
|
+
} else if (/Android/.test(e)) {
|
|
465
|
+
n.os = `Android ${k(e, /Android ([\d.]+)/) ?? ""}`.trim(), n.deviceType = /Mobile/.test(e) ? "mobile" : "tablet";
|
|
466
|
+
let t = k(e, /Android [\d.]+;(?: [a-z]{2}[-_][a-z]{2};)? ([^;)]+?)(?: Build\/[^;)]*)?\)/i);
|
|
467
|
+
t && t !== "K" && !/^wv$/.test(t) && (n.deviceModel = t.trim());
|
|
468
|
+
} else if (/CrOS/.test(e)) n.os = "ChromeOS";
|
|
469
|
+
else if (/Windows NT/.test(e)) {
|
|
470
|
+
let t = k(e, /Windows NT ([\d.]+)/);
|
|
471
|
+
n.os = t && Te[t] ? `Windows ${Te[t]}` : "Windows";
|
|
472
|
+
} else /Mac OS X/.test(e) ? n.os = `macOS ${A(k(e, /Mac OS X ([\d_.]+)/)) ?? ""}`.trim() : /Linux/.test(e) && (n.os = "Linux");
|
|
473
|
+
return n.deviceType === "desktop" && /Mobi|Tablet|Kindle|Silk/.test(e) && (n.deviceType = /Tablet|Kindle|Silk/.test(e) ? "tablet" : "mobile"), n;
|
|
474
|
+
}
|
|
475
|
+
// src/capture/env.ts
|
|
476
|
+
var j = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
477
|
+
function De(e = /* @__PURE__ */ new Date()) {
|
|
478
|
+
let t = (e, t = 2) => String(Math.abs(e)).padStart(t, "0"), n = -e.getTimezoneOffset(), r = n >= 0 ? "+" : "-";
|
|
479
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(), 3)}${r}${t(Math.trunc(n / 60))}:${t(n % 60)}`;
|
|
480
|
+
}
|
|
481
|
+
function Oe(e = window) {
|
|
482
|
+
let t = e.navigator, n = t?.userAgent ?? "", r = Ee(n, t?.maxTouchPoints ?? 0), i = "UTC";
|
|
483
|
+
try {
|
|
484
|
+
i = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
485
|
+
} catch {}
|
|
486
|
+
let a = (e, t) => e ? d(e, t) : void 0;
|
|
487
|
+
return {
|
|
488
|
+
userAgent: d(n, 1e3),
|
|
489
|
+
browser: a(r.browser, 100),
|
|
490
|
+
browserVersion: a(r.browserVersion, 50),
|
|
491
|
+
os: a(r.os, 100),
|
|
492
|
+
deviceType: r.deviceType,
|
|
493
|
+
deviceModel: a(r.deviceModel, 100),
|
|
494
|
+
screen: {
|
|
495
|
+
w: j(e.screen?.width),
|
|
496
|
+
h: j(e.screen?.height)
|
|
497
|
+
},
|
|
498
|
+
viewport: {
|
|
499
|
+
w: j(e.innerWidth),
|
|
500
|
+
h: j(e.innerHeight)
|
|
501
|
+
},
|
|
502
|
+
pixelRatio: Math.min(10, Math.max(0, e.devicePixelRatio || 1)),
|
|
503
|
+
timeZone: d(i, 100),
|
|
504
|
+
language: a(t?.language, 35),
|
|
505
|
+
occurredAt: De()
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function ke(e, t) {
|
|
509
|
+
return e === 0 || e >= 400 || t > 2e3;
|
|
510
|
+
}
|
|
511
|
+
function Ae(e, t = window, n = {}) {
|
|
512
|
+
let r = n.now ?? (() => typeof performance < "u" ? performance.now() : Date.now()), i = t.location?.href, a = n.ignore ?? (() => !1), o = (t, n, o, s, c) => {
|
|
513
|
+
try {
|
|
514
|
+
let l = Math.max(0, Math.round(r() - s));
|
|
515
|
+
if (!ke(o, l)) return;
|
|
516
|
+
let u = f(n, i);
|
|
517
|
+
if (a(u)) return;
|
|
518
|
+
e.push({
|
|
519
|
+
method: d(t.toUpperCase(), 10),
|
|
520
|
+
url: d(u, 2e3),
|
|
521
|
+
status: Math.min(999, Math.max(0, o | 0)),
|
|
522
|
+
durationMs: Math.min(6e5, l),
|
|
523
|
+
at: c
|
|
524
|
+
});
|
|
525
|
+
} catch {}
|
|
526
|
+
}, s = [], c = t.fetch;
|
|
527
|
+
if (typeof c == "function") {
|
|
528
|
+
let e = (e, n) => {
|
|
529
|
+
let i = "GET", a = "", s = r(), l = (/* @__PURE__ */ new Date()).toISOString();
|
|
530
|
+
try {
|
|
531
|
+
typeof e == "string" ? a = e : e instanceof URL ? a = e.href : e && typeof e.url == "string" && (a = e.url, i = e.method || i), n?.method && (i = n.method);
|
|
532
|
+
} catch {}
|
|
533
|
+
let u = c.call(t, e, n);
|
|
534
|
+
try {
|
|
535
|
+
u.then((e) => o(i, a, e?.status ?? 0, s, l), () => o(i, a, 0, s, l));
|
|
536
|
+
} catch {}
|
|
537
|
+
return u;
|
|
538
|
+
};
|
|
539
|
+
try {
|
|
540
|
+
t.fetch = e, s.push(() => {
|
|
541
|
+
t.fetch === e && (t.fetch = c);
|
|
542
|
+
});
|
|
543
|
+
} catch {}
|
|
544
|
+
}
|
|
545
|
+
let l = t.XMLHttpRequest;
|
|
546
|
+
if (l?.prototype) {
|
|
547
|
+
let e = l.prototype, t = e.open, n = e.send, i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakSet(), u = function(e, n, ...r) {
|
|
548
|
+
try {
|
|
549
|
+
i.set(this, {
|
|
550
|
+
method: String(e),
|
|
551
|
+
url: String(n)
|
|
552
|
+
});
|
|
553
|
+
} catch {}
|
|
554
|
+
return t.call(this, e, n, ...r);
|
|
555
|
+
}, d = function(e) {
|
|
556
|
+
try {
|
|
557
|
+
let e = i.get(this);
|
|
558
|
+
e && (a.set(this, {
|
|
559
|
+
m: e,
|
|
560
|
+
start: r(),
|
|
561
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
562
|
+
aborted: !1
|
|
563
|
+
}), c.has(this) || (c.add(this), this.addEventListener("abort", () => {
|
|
564
|
+
let e = a.get(this);
|
|
565
|
+
e && (e.aborted = !0);
|
|
566
|
+
}), this.addEventListener("loadend", () => {
|
|
567
|
+
let e = a.get(this);
|
|
568
|
+
a.delete(this), e && !e.aborted && o(e.m.method, e.m.url, this.status, e.start, e.startedAt);
|
|
569
|
+
})));
|
|
570
|
+
} catch {}
|
|
571
|
+
return n.call(this, e);
|
|
572
|
+
};
|
|
573
|
+
e.open = u, e.send = d, s.push(() => {
|
|
574
|
+
e.open === u && (e.open = t), e.send === d && (e.send = n);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
return () => {
|
|
578
|
+
for (let e of s) try {
|
|
579
|
+
e();
|
|
580
|
+
} catch {}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
// src/capture/ring.ts
|
|
584
|
+
var M = class {
|
|
585
|
+
constructor(e) {
|
|
586
|
+
this.capacity = e, this.items = [], this.listeners = /* @__PURE__ */ new Set();
|
|
587
|
+
}
|
|
588
|
+
push(e) {
|
|
589
|
+
this.items.push(e), this.items.length > this.capacity && this.items.shift();
|
|
590
|
+
for (let t of this.listeners) try {
|
|
591
|
+
t(e);
|
|
592
|
+
} catch {}
|
|
593
|
+
}
|
|
594
|
+
subscribe(e) {
|
|
595
|
+
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
596
|
+
}
|
|
597
|
+
toArray() {
|
|
598
|
+
return this.items.slice();
|
|
599
|
+
}
|
|
600
|
+
clear() {
|
|
601
|
+
this.items = [];
|
|
602
|
+
}
|
|
603
|
+
get size() {
|
|
604
|
+
return this.items.length;
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
// src/editor-loader.ts
|
|
608
|
+
function je() {
|
|
609
|
+
return import("./chunks/editor-0Kr31Uly.mjs");
|
|
610
|
+
}
|
|
611
|
+
function Me() {
|
|
612
|
+
return import("./chunks/recorder-tu4yugLw.mjs");
|
|
613
|
+
}
|
|
614
|
+
function Ne() {
|
|
615
|
+
return import("./chunks/scan-CFQwrtAQ.mjs");
|
|
616
|
+
}
|
|
617
|
+
// src/capture/signature.ts
|
|
618
|
+
function Pe(e) {
|
|
619
|
+
return p(e).replace(/https?:\/\/\S+/g, "<url>").replace(/\b[0-9a-f]{8,}\b/gi, "<id>").replace(/\d+/g, "<n>").replace(/\s+/g, " ").trim().slice(0, 200);
|
|
620
|
+
}
|
|
621
|
+
function N(e, t) {
|
|
622
|
+
let n = (Array.isArray(e) ? e : []).filter((e) => e.level === "error");
|
|
623
|
+
if (n[0]?.message) return `console:${Pe(n[0].message)}`;
|
|
624
|
+
let r = (Array.isArray(t) ? t : []).find((e) => e.status === 0 || e.status >= 500);
|
|
625
|
+
if (r) {
|
|
626
|
+
let e = r.url;
|
|
627
|
+
try {
|
|
628
|
+
e = new URL(r.url).pathname;
|
|
629
|
+
} catch {}
|
|
630
|
+
return `network:${r.method.toUpperCase()} ${Pe(e)} ${r.status === 0 ? "failed" : "5xx"}`;
|
|
631
|
+
}
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
// src/fixcheck.ts
|
|
635
|
+
function P(e) {
|
|
636
|
+
return e.level === "error" ? N([e], []) : null;
|
|
637
|
+
}
|
|
638
|
+
function Fe(e) {
|
|
639
|
+
return N([], [e]);
|
|
640
|
+
}
|
|
641
|
+
function F(e) {
|
|
642
|
+
let t = e.path ?? (() => location.pathname), n = e.random ?? Math.random, r = e.now ?? Date.now, i = [], a = /* @__PURE__ */ new Set(), o = r(), s = null, c = (t) => {
|
|
643
|
+
if (t) {
|
|
644
|
+
for (let n of i) if (!(n.signature !== t || a.has(n.id))) {
|
|
645
|
+
a.add(n.id);
|
|
646
|
+
try {
|
|
647
|
+
e.report(n);
|
|
648
|
+
} catch {}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}, l = (e) => {
|
|
652
|
+
let t = Date.parse(e);
|
|
653
|
+
return Number.isNaN(t) || t >= o - 1;
|
|
654
|
+
}, u = (r) => {
|
|
655
|
+
let u = t();
|
|
656
|
+
if (s = u, o = r, a = /* @__PURE__ */ new Set(), i = e.checks.filter((t) => Ie(t.path, u) && e.sampleRate > 0 && n() < e.sampleRate), i.length) {
|
|
657
|
+
for (let t of e.console.toArray()) l(t.at) && c(P(t));
|
|
658
|
+
for (let t of e.network.toArray()) l(t.at) && c(Fe(t));
|
|
659
|
+
}
|
|
660
|
+
}, d = e.console.subscribe((e) => {
|
|
661
|
+
i.length && c(P(e));
|
|
662
|
+
}), f = e.network.subscribe((e) => {
|
|
663
|
+
i.length && c(Fe(e));
|
|
664
|
+
}), p = typeof performance < "u" && performance.timeOrigin ? performance.timeOrigin : r();
|
|
665
|
+
return u(e.since ?? Math.min(p, r())), {
|
|
666
|
+
navigated: () => {
|
|
667
|
+
t() !== s && u(r());
|
|
668
|
+
},
|
|
669
|
+
stop: () => {
|
|
670
|
+
d(), f(), i = [];
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
function Ie(e, t) {
|
|
675
|
+
return e === "*" || Le(e, t);
|
|
676
|
+
}
|
|
677
|
+
function Le(e, t) {
|
|
678
|
+
let n = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e;
|
|
679
|
+
return n(e) === n(t);
|
|
680
|
+
}
|
|
681
|
+
function Re(e) {
|
|
682
|
+
let t = e.path ?? (() => location.pathname), n = /* @__PURE__ */ new Set(), r = t(), i = e.known.flatMap((e) => e.signature ? [{
|
|
683
|
+
id: e.id,
|
|
684
|
+
path: "*",
|
|
685
|
+
signature: e.signature
|
|
686
|
+
}] : []), a = i.length ? F({
|
|
687
|
+
checks: i,
|
|
688
|
+
sampleRate: 1,
|
|
689
|
+
random: () => 0,
|
|
690
|
+
console: e.console,
|
|
691
|
+
network: e.network,
|
|
692
|
+
report: (e) => n.add(e.id),
|
|
693
|
+
path: t,
|
|
694
|
+
now: e.now
|
|
695
|
+
}) : null;
|
|
696
|
+
return {
|
|
697
|
+
matches: () => ze(e.known, t(), n),
|
|
698
|
+
navigated: () => {
|
|
699
|
+
t() !== r && (r = t(), n.clear()), a?.navigated();
|
|
700
|
+
},
|
|
701
|
+
stop: () => a?.stop()
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function ze(e, t, n = /* @__PURE__ */ new Set()) {
|
|
705
|
+
return e.filter((e) => n.has(e.id) || e.paths.some((e) => Le(e, t))).slice(0, 3);
|
|
706
|
+
}
|
|
707
|
+
// src/mount.ts
|
|
708
|
+
var I = "pinax-widget-root";
|
|
709
|
+
function Be(e = document) {
|
|
710
|
+
let t = e.getElementById(I);
|
|
711
|
+
if (t?.shadowRoot) return t.shadowRoot;
|
|
712
|
+
let n = e.createElement("div");
|
|
713
|
+
return n.id = I, n.className = "ph-no-capture fs-exclude", n.setAttribute("data-hj-suppress", ""), n.setAttribute("data-clarity-mask", "true"), n.setAttribute("data-private", ""), n.style.cssText = "all: initial; position: fixed; z-index: 2147483647;", e.body.appendChild(n), n.attachShadow({ mode: "open" });
|
|
714
|
+
}
|
|
715
|
+
function Ve(e = document) {
|
|
716
|
+
e.getElementById(I)?.remove();
|
|
717
|
+
}
|
|
718
|
+
// src/navigation.ts
|
|
719
|
+
function He(e, t = window) {
|
|
720
|
+
let n = !0, r = !1, i = () => {
|
|
721
|
+
if (!n || r) return;
|
|
722
|
+
r = !0;
|
|
723
|
+
let t = () => {
|
|
724
|
+
if (r = !1, n) try {
|
|
725
|
+
e();
|
|
726
|
+
} catch {}
|
|
727
|
+
};
|
|
728
|
+
try {
|
|
729
|
+
queueMicrotask(t);
|
|
730
|
+
} catch {
|
|
731
|
+
setTimeout(t, 0);
|
|
732
|
+
}
|
|
733
|
+
}, a = [], o = t.history;
|
|
734
|
+
for (let e of ["pushState", "replaceState"]) {
|
|
735
|
+
let t = o?.[e];
|
|
736
|
+
if (typeof t != "function") continue;
|
|
737
|
+
let n = function(...e) {
|
|
738
|
+
let n = t.apply(this, e);
|
|
739
|
+
return i(), n;
|
|
740
|
+
};
|
|
741
|
+
try {
|
|
742
|
+
o[e] = n, a.push(() => {
|
|
743
|
+
o[e] === n && (o[e] = t);
|
|
744
|
+
});
|
|
745
|
+
} catch {}
|
|
746
|
+
}
|
|
747
|
+
return t.addEventListener("popstate", i), a.push(() => t.removeEventListener("popstate", i)), () => {
|
|
748
|
+
n = !1;
|
|
749
|
+
for (let e of a) try {
|
|
750
|
+
e();
|
|
751
|
+
} catch {}
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
// src/paths.ts
|
|
755
|
+
var L = /* @__PURE__ */ new Map();
|
|
756
|
+
function Ue(e) {
|
|
757
|
+
let t = L.get(e);
|
|
758
|
+
if (!t) {
|
|
759
|
+
let n = R(e.trim()).split("*").map((e) => e.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
760
|
+
t = RegExp(`^${n}$`), L.size > 200 && L.clear(), L.set(e, t);
|
|
761
|
+
}
|
|
762
|
+
return t;
|
|
763
|
+
}
|
|
764
|
+
function R(e) {
|
|
765
|
+
return e.length > 1 ? e.replace(/\/+$/, "") || "/" : e;
|
|
766
|
+
}
|
|
767
|
+
function We(e) {
|
|
768
|
+
try {
|
|
769
|
+
return decodeURI(e);
|
|
770
|
+
} catch {
|
|
771
|
+
return e;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function Ge(e, t) {
|
|
775
|
+
if (typeof e != "string" || !e.trim()) return !1;
|
|
776
|
+
let n = Ue(e), r = R(t || "/"), i = [r, `${r === "/" ? "" : r}/`], a = We(r);
|
|
777
|
+
return a !== r && i.push(a, `${a}/`), i.some((e) => n.test(e));
|
|
778
|
+
}
|
|
779
|
+
function Ke(e, t) {
|
|
780
|
+
return e?.length ? e.some((e) => Ge(e, t)) : !1;
|
|
781
|
+
}
|
|
782
|
+
// src/queue.ts
|
|
783
|
+
var qe = 36e5, Je = 8, z = (e) => `pinax:queue:${e}`, B = /* @__PURE__ */ new Map(), Ye = (e) => Date.now() - e.queuedAt <= qe, Xe = (e) => {
|
|
784
|
+
let t = e;
|
|
785
|
+
return !!t && typeof t.queuedAt == "number" && typeof t.tries == "number" && typeof t.body?.page?.url == "string";
|
|
786
|
+
};
|
|
787
|
+
function V(e, t) {
|
|
788
|
+
let n;
|
|
789
|
+
try {
|
|
790
|
+
let r = e.getItem(z(t)), i = r ? JSON.parse(r) : [];
|
|
791
|
+
n = Array.isArray(i) ? i : [];
|
|
792
|
+
} catch {
|
|
793
|
+
return [];
|
|
794
|
+
}
|
|
795
|
+
let r = n.filter((e) => Xe(e) && Ye(e)), i = r.some((e) => "email" in e.body || "user" in e.body);
|
|
796
|
+
if (r.length === n.length && !i) return r;
|
|
797
|
+
for (let e of n) !r.includes(e) && e?.id && B.delete(e.id);
|
|
798
|
+
let a = r.map((e) => ({
|
|
799
|
+
...e,
|
|
800
|
+
body: Ze(e.body)
|
|
801
|
+
}));
|
|
802
|
+
return H(e, t, a), a;
|
|
803
|
+
}
|
|
804
|
+
function H(e, t, n) {
|
|
805
|
+
try {
|
|
806
|
+
return n.length ? e.setItem(z(t), JSON.stringify(n)) : e.removeItem(z(t)), !0;
|
|
807
|
+
} catch {
|
|
808
|
+
return !1;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function U() {
|
|
812
|
+
try {
|
|
813
|
+
return window.localStorage;
|
|
814
|
+
} catch {
|
|
815
|
+
return null;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
function Ze(e) {
|
|
819
|
+
let { email: t, user: r, console: i, screenshot: a, annotations: o, replay: s, ...c } = e;
|
|
820
|
+
return {
|
|
821
|
+
...c,
|
|
822
|
+
page: {
|
|
823
|
+
...c.page,
|
|
824
|
+
url: n(c.page.url)
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
var Qe = () => `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
|
|
829
|
+
function $e(e, t) {
|
|
830
|
+
let n = U();
|
|
831
|
+
if (!n) return !1;
|
|
832
|
+
let r = V(n, e), i = r.slice(0, Math.max(0, r.length - 4));
|
|
833
|
+
for (let e of i) e.id && B.delete(e.id);
|
|
834
|
+
let a = Qe(), o = H(n, e, [...r.slice(-4), {
|
|
835
|
+
id: a,
|
|
836
|
+
body: Ze(t),
|
|
837
|
+
queuedAt: Date.now(),
|
|
838
|
+
tries: 0
|
|
839
|
+
}]);
|
|
840
|
+
return o && (t.email || t.user) && B.set(a, {
|
|
841
|
+
...t.email && { email: t.email },
|
|
842
|
+
...t.user && { user: t.user }
|
|
843
|
+
}), o;
|
|
844
|
+
}
|
|
845
|
+
function et(e) {
|
|
846
|
+
let t = U();
|
|
847
|
+
return t ? V(t, e).length : 0;
|
|
848
|
+
}
|
|
849
|
+
var W = !1;
|
|
850
|
+
async function tt(e, t, n) {
|
|
851
|
+
let r = U();
|
|
852
|
+
if (r && !W && (typeof navigator > "u" || navigator.onLine !== !1)) {
|
|
853
|
+
W = !0;
|
|
854
|
+
try {
|
|
855
|
+
let i = V(r, n), a = [];
|
|
856
|
+
for (let r of i) {
|
|
857
|
+
let i = r.id ? B.get(r.id) : void 0, o = await y(e, t, n, {
|
|
858
|
+
...r.body,
|
|
859
|
+
...i
|
|
860
|
+
});
|
|
861
|
+
!o.ok && o.retry && r.tries + 1 < Je ? a.push({
|
|
862
|
+
...r,
|
|
863
|
+
tries: r.tries + 1
|
|
864
|
+
}) : r.id && B.delete(r.id);
|
|
865
|
+
}
|
|
866
|
+
let o = new Set(i.map((e) => e.id)), s = V(r, n).filter((e) => !o.has(e.id));
|
|
867
|
+
H(r, n, [...a, ...s]);
|
|
868
|
+
} finally {
|
|
869
|
+
W = !1;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
// src/segment.ts
|
|
874
|
+
var G = {
|
|
875
|
+
opened: "Pinax Widget Opened",
|
|
876
|
+
submitted: "Feedback Submitted"
|
|
877
|
+
};
|
|
878
|
+
function nt(e = window) {
|
|
879
|
+
try {
|
|
880
|
+
let t = e.analytics;
|
|
881
|
+
return !t || typeof t != "object" && typeof t != "function" ? null : typeof t.track == "function" ? t : null;
|
|
882
|
+
} catch {
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
function rt(e, t) {
|
|
887
|
+
return typeof e == "boolean" ? e : t === !0;
|
|
888
|
+
}
|
|
889
|
+
function it(e, t) {
|
|
890
|
+
try {
|
|
891
|
+
nt()?.track?.(e, t);
|
|
892
|
+
} catch {}
|
|
893
|
+
}
|
|
894
|
+
function at() {
|
|
895
|
+
it(G.opened, { source: "pinax" });
|
|
896
|
+
}
|
|
897
|
+
function ot(e) {
|
|
898
|
+
let t = {
|
|
899
|
+
source: "pinax",
|
|
900
|
+
type: e.type.toLowerCase()
|
|
901
|
+
};
|
|
902
|
+
typeof e.rating == "number" && (t.rating = e.rating), e.reportId && (t.reportId = e.reportId), e.queued && (t.queued = !0), it(G.submitted, t);
|
|
903
|
+
}
|
|
904
|
+
function st() {
|
|
905
|
+
try {
|
|
906
|
+
let e = nt()?.user?.()?.id?.();
|
|
907
|
+
return typeof e == "string" && e.trim() ? e.trim().slice(0, 200) : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
|
|
908
|
+
} catch {
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
// src/index.ts
|
|
913
|
+
var ct = 8e3, K = null, q, J, Y, lt, X = (e, t) => (lt ?? window.fetch).call(window, e, t);
|
|
914
|
+
function Z(e, t) {
|
|
915
|
+
try {
|
|
916
|
+
(console.warn.__pinaxOriginal ?? console.warn).call(console, `Pinax: ${e}`, t ?? "");
|
|
917
|
+
} catch {}
|
|
918
|
+
}
|
|
919
|
+
function Q(e) {
|
|
920
|
+
try {
|
|
921
|
+
e();
|
|
922
|
+
} catch (e) {
|
|
923
|
+
Z("capture could not start", e);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function ut(t) {
|
|
927
|
+
if (K) return;
|
|
928
|
+
if (!t?.key) throw Error("Pinax: init() needs a website key");
|
|
929
|
+
let n = m(t.apiUrl), i = h(t.cdnUrl, t.apiUrl);
|
|
930
|
+
lt = typeof window.fetch == "function" ? window.fetch : void 0;
|
|
931
|
+
let c = {
|
|
932
|
+
options: t,
|
|
933
|
+
api: n,
|
|
934
|
+
cdn: i,
|
|
935
|
+
root: Be(),
|
|
936
|
+
user: q,
|
|
937
|
+
console: new M(50),
|
|
938
|
+
network: new M(50),
|
|
939
|
+
breadcrumbs: new M(20),
|
|
940
|
+
replayStarting: !1,
|
|
941
|
+
replaySampled: !1,
|
|
942
|
+
consent: {
|
|
943
|
+
diagnostics: !1,
|
|
944
|
+
replay: !1,
|
|
945
|
+
...J
|
|
946
|
+
},
|
|
947
|
+
running: !1,
|
|
948
|
+
watchers: {},
|
|
949
|
+
counted: !1,
|
|
950
|
+
stopCapture: {},
|
|
951
|
+
onNavigate: [],
|
|
952
|
+
cleanups: [],
|
|
953
|
+
openWhenReady: !1,
|
|
954
|
+
alive: !0
|
|
955
|
+
};
|
|
956
|
+
K = c, q = void 0, J = void 0, Q(() => {
|
|
957
|
+
let e = dt(we(c.console));
|
|
958
|
+
c.stopCapture.console = e, c.cleanups.push(e);
|
|
959
|
+
}), Q(() => {
|
|
960
|
+
let e = dt(Ae(c.network, window, { ignore: (e) => e.startsWith(`${n}/v1/widget/`) || i !== null && (e.startsWith(g(i, t.key)) || e.startsWith(ae(n, t.key, i))) }));
|
|
961
|
+
c.stopCapture.network = e, c.cleanups.push(e);
|
|
962
|
+
});
|
|
963
|
+
let l = c.root.host;
|
|
964
|
+
Q(() => {
|
|
965
|
+
let e = ve(c.breadcrumbs, { ignore: (e) => e instanceof Node && l.contains(e) });
|
|
966
|
+
c.onNavigate.push(e.navigated), c.cleanups.push(e.stop);
|
|
967
|
+
}), c.onNavigate.push(() => {
|
|
968
|
+
c.watchers.fixChecks?.navigated(), c.watchers.sightings?.navigated();
|
|
969
|
+
}), c.cleanups.push(() => {
|
|
970
|
+
bt(c), wt(c);
|
|
971
|
+
}), Q(() => c.cleanups.push(He(() => {
|
|
972
|
+
for (let e of c.onNavigate) try {
|
|
973
|
+
e();
|
|
974
|
+
} catch {}
|
|
975
|
+
})));
|
|
976
|
+
let u = () => {
|
|
977
|
+
tt(X, n, t.key).catch(() => {});
|
|
978
|
+
};
|
|
979
|
+
window.addEventListener("online", u), c.cleanups.push(() => window.removeEventListener("online", u)), ee(X, n, t.key, i).then((i) => {
|
|
980
|
+
if (!c.alive) return;
|
|
981
|
+
if (!i) {
|
|
982
|
+
Z("this website key was not found");
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
let l = r(i.ai, i.samplingRate), d = o(i.settings);
|
|
986
|
+
c.config = {
|
|
987
|
+
...i,
|
|
988
|
+
settings: d,
|
|
989
|
+
branding: e(i.branding),
|
|
990
|
+
ai: l,
|
|
991
|
+
known: a(i.known, d.knownIssues)
|
|
992
|
+
}, ft(c), c.replaySampled = l.replay && Math.random() < l.replaySampleRate, te(X, n, t.key, location.href), et(t.key) && u();
|
|
993
|
+
let f = It(i.allowedDomains, location.hostname);
|
|
994
|
+
if (i.enabled && !f && Z(`${location.hostname} isn't one of this website's allowed domains, so the button is hidden. Add it under Websites in Pinax.`), c.running = i.enabled && f, ht(c), !c.running) return;
|
|
995
|
+
let p = xt(c), m = rt(t.segment, c.config.settings.segment), h = new s(c.root, c.config, {
|
|
996
|
+
takeScreenshot: async () => (await je()).takeScreenshot(c.root.host, { autoBlur: l.autoBlur }),
|
|
997
|
+
markUp: async (e) => (await je()).markUp(c.root, e),
|
|
998
|
+
submit: (e) => Ot(c, e, m),
|
|
999
|
+
user: () => c.user,
|
|
1000
|
+
opened: m ? at : void 0,
|
|
1001
|
+
followUp: l.followUp ? ({ type: e, message: r }) => ie(X, n, t.key, {
|
|
1002
|
+
type: e,
|
|
1003
|
+
message: r,
|
|
1004
|
+
pagePath: location.pathname
|
|
1005
|
+
}) : void 0,
|
|
1006
|
+
knownIssues: p,
|
|
1007
|
+
meToo: (e, r) => ce(X, n, t.key, e, r),
|
|
1008
|
+
attachments: () => Dt(c)
|
|
1009
|
+
});
|
|
1010
|
+
c.ui = h;
|
|
1011
|
+
let { hidePaths: g, hideButton: _ } = c.config.settings;
|
|
1012
|
+
if (g.length && !_) {
|
|
1013
|
+
let e = () => h.setPathHidden(Ke(g, location.pathname));
|
|
1014
|
+
e(), c.onNavigate.push(e);
|
|
1015
|
+
}
|
|
1016
|
+
c.openWhenReady && h.open();
|
|
1017
|
+
}).catch((e) => {
|
|
1018
|
+
c.alive && Z("could not load widget settings", e);
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
function dt(e) {
|
|
1022
|
+
let t = !1;
|
|
1023
|
+
return () => {
|
|
1024
|
+
t || (t = !0, e());
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function ft(e) {
|
|
1028
|
+
let t = e.config?.settings.capture;
|
|
1029
|
+
t && (t.console || (Q(() => e.stopCapture.console?.()), e.console.clear()), t.network || (Q(() => e.stopCapture.network?.()), e.network.clear()));
|
|
1030
|
+
}
|
|
1031
|
+
function pt(e) {
|
|
1032
|
+
let t = e.options.consent;
|
|
1033
|
+
return t === "wait" || t !== "none" && e.config?.settings.consent?.required === !0;
|
|
1034
|
+
}
|
|
1035
|
+
function mt(e) {
|
|
1036
|
+
return pt(e) || e.config?.settings.consent?.required === !0;
|
|
1037
|
+
}
|
|
1038
|
+
function $(e) {
|
|
1039
|
+
let t = pt(e);
|
|
1040
|
+
return {
|
|
1041
|
+
diagnostics: !t || e.consent.diagnostics,
|
|
1042
|
+
replay: !t || e.consent.replay
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function ht(e) {
|
|
1046
|
+
try {
|
|
1047
|
+
gt(e);
|
|
1048
|
+
} catch (e) {
|
|
1049
|
+
Z("could not apply consent", e);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function gt(e) {
|
|
1053
|
+
if (!e.alive || !e.config) return;
|
|
1054
|
+
let t = $(e);
|
|
1055
|
+
e.config.settings.consent?.required && t.diagnostics && !e.counted && (e.counted = !0, oe(X, e.api, e.options.key, e.cdn)), e.running && (t.diagnostics ? (vt(e), yt(e)) : bt(e), t.replay && e.replaySampled ? Ct(e) : wt(e)), e.ui?.refresh();
|
|
1056
|
+
}
|
|
1057
|
+
var _t = (e) => mt(e) && $(e).diagnostics ? !0 : void 0;
|
|
1058
|
+
function vt(e) {
|
|
1059
|
+
let t = e.config?.ai;
|
|
1060
|
+
!e.watchers.fixChecks && t?.fixChecks.length && (t.fixCheckSampleRate <= 0 || Q(() => {
|
|
1061
|
+
e.watchers.fixChecks = F({
|
|
1062
|
+
checks: t.fixChecks,
|
|
1063
|
+
sampleRate: t.fixCheckSampleRate,
|
|
1064
|
+
console: e.console,
|
|
1065
|
+
network: e.network,
|
|
1066
|
+
since: e.watchersSince,
|
|
1067
|
+
report: (t) => b(X, e.api, e.options.key, {
|
|
1068
|
+
checkId: t.id,
|
|
1069
|
+
signature: t.signature,
|
|
1070
|
+
consent: _t(e)
|
|
1071
|
+
})
|
|
1072
|
+
});
|
|
1073
|
+
}));
|
|
1074
|
+
}
|
|
1075
|
+
function yt(e) {
|
|
1076
|
+
let t = e.config?.ai;
|
|
1077
|
+
!e.watchers.sightings && t?.watches.length && (t.fixCheckSampleRate <= 0 || Q(() => {
|
|
1078
|
+
e.watchers.sightings = F({
|
|
1079
|
+
checks: t.watches.map((e) => ({
|
|
1080
|
+
...e,
|
|
1081
|
+
path: "*"
|
|
1082
|
+
})),
|
|
1083
|
+
sampleRate: t.fixCheckSampleRate,
|
|
1084
|
+
console: e.console,
|
|
1085
|
+
network: e.network,
|
|
1086
|
+
since: e.watchersSince,
|
|
1087
|
+
report: (t) => b(X, e.api, e.options.key, {
|
|
1088
|
+
checkId: t.id,
|
|
1089
|
+
signature: t.signature,
|
|
1090
|
+
basket: Y,
|
|
1091
|
+
consent: _t(e)
|
|
1092
|
+
}, "sighting")
|
|
1093
|
+
});
|
|
1094
|
+
}));
|
|
1095
|
+
}
|
|
1096
|
+
function bt(e) {
|
|
1097
|
+
let { fixChecks: t, sightings: n } = e.watchers;
|
|
1098
|
+
(t || n) && (e.watchers = {}, e.watchersSince = Date.now() + 2, Q(() => t?.stop()), Q(() => n?.stop()));
|
|
1099
|
+
}
|
|
1100
|
+
function xt(e) {
|
|
1101
|
+
let t = e.config?.known;
|
|
1102
|
+
if (!t?.length) return;
|
|
1103
|
+
let n;
|
|
1104
|
+
return Q(() => {
|
|
1105
|
+
let r = Re({
|
|
1106
|
+
known: t,
|
|
1107
|
+
console: e.console,
|
|
1108
|
+
network: e.network
|
|
1109
|
+
});
|
|
1110
|
+
e.onNavigate.push(r.navigated), e.cleanups.push(r.stop), n = r.matches;
|
|
1111
|
+
}), n;
|
|
1112
|
+
}
|
|
1113
|
+
function St(e) {
|
|
1114
|
+
let t = () => {
|
|
1115
|
+
let t = window.requestIdleCallback;
|
|
1116
|
+
typeof t == "function" ? t(e, { timeout: 3e3 }) : setTimeout(e, 200);
|
|
1117
|
+
};
|
|
1118
|
+
document.readyState === "complete" ? t() : window.addEventListener("load", t, { once: !0 });
|
|
1119
|
+
}
|
|
1120
|
+
function Ct(e) {
|
|
1121
|
+
if (e.recorder || e.replayStarting) return;
|
|
1122
|
+
e.replayStarting = !0;
|
|
1123
|
+
let t = () => e.alive && e.running && e.replaySampled && $(e).replay;
|
|
1124
|
+
St(() => {
|
|
1125
|
+
t() ? Me().then((n) => {
|
|
1126
|
+
e.replayStarting = !1, !e.recorder && t() && (e.recorder = n.startRecorder({
|
|
1127
|
+
exclude: `#${e.root.host.id}`,
|
|
1128
|
+
mask: e.config?.ai?.replayMask
|
|
1129
|
+
}), e.ui?.refresh());
|
|
1130
|
+
}).catch((t) => {
|
|
1131
|
+
e.replayStarting = !1, Z("session replay could not start", t);
|
|
1132
|
+
}) : e.replayStarting = !1;
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
function wt(e) {
|
|
1136
|
+
let t = e.recorder;
|
|
1137
|
+
e.recorder = void 0, t && Q(() => t.stop());
|
|
1138
|
+
}
|
|
1139
|
+
async function Tt(e) {
|
|
1140
|
+
if (!e.recorder) return null;
|
|
1141
|
+
let n;
|
|
1142
|
+
try {
|
|
1143
|
+
return await Promise.race([e.recorder.exportReplay(t.replayChars).catch(() => null), new Promise((e) => {
|
|
1144
|
+
n = setTimeout(() => e(null), 5e3);
|
|
1145
|
+
})]);
|
|
1146
|
+
} finally {
|
|
1147
|
+
clearTimeout(n);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
async function Et(e) {
|
|
1151
|
+
let t;
|
|
1152
|
+
try {
|
|
1153
|
+
return await Promise.race([Ne().then((t) => t.scanPage({ exclude: `#${e.root.host.id}` })).catch(() => null), new Promise((e) => {
|
|
1154
|
+
t = setTimeout(() => e(null), ct);
|
|
1155
|
+
})]);
|
|
1156
|
+
} finally {
|
|
1157
|
+
clearTimeout(t);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
function Dt(e) {
|
|
1161
|
+
let t = $(e), n = e.config?.settings.capture, r = n?.console !== !1, i = n?.network !== !1;
|
|
1162
|
+
return {
|
|
1163
|
+
logs: t.diagnostics && (r && e.console.size > 0 || i && e.network.size > 0 || e.breadcrumbs.size > 0),
|
|
1164
|
+
askLogs: !t.diagnostics && (r || i),
|
|
1165
|
+
replay: t.replay && !!e.recorder && typeof CompressionStream == "function"
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
async function Ot(e, t, r = !1) {
|
|
1169
|
+
let a = t.type === "ACCESSIBILITY" ? await Et(e) : void 0, o = $(e), s = (o.diagnostics || t.includeLogs === !0) && t.listed?.logs !== !1, l = o.replay && t.listed?.replay !== !1, u = r && o.diagnostics && !e.user?.id ? st() : null, d = u ? {
|
|
1170
|
+
...e.user,
|
|
1171
|
+
id: u
|
|
1172
|
+
} : e.user, f = e.config?.settings.capture, p = c({
|
|
1173
|
+
type: t.type,
|
|
1174
|
+
message: t.message,
|
|
1175
|
+
rating: t.rating,
|
|
1176
|
+
email: t.email,
|
|
1177
|
+
user: d,
|
|
1178
|
+
screenshot: t.shot?.dataUrl,
|
|
1179
|
+
annotations: t.shot?.annotations,
|
|
1180
|
+
followUp: t.followUp,
|
|
1181
|
+
fields: t.fields,
|
|
1182
|
+
barrier: t.barrier,
|
|
1183
|
+
a11yScan: a,
|
|
1184
|
+
hp: t.hp,
|
|
1185
|
+
elapsedMs: t.elapsedMs,
|
|
1186
|
+
consent: mt(e) ? o : void 0,
|
|
1187
|
+
includeLogs: t.includeLogs
|
|
1188
|
+
}, {
|
|
1189
|
+
page: {
|
|
1190
|
+
url: n(location.href),
|
|
1191
|
+
title: document.title || void 0
|
|
1192
|
+
},
|
|
1193
|
+
environment: Oe(),
|
|
1194
|
+
console: !s || f?.console === !1 ? [] : e.console.toArray(),
|
|
1195
|
+
network: !s || f?.network === !1 ? [] : e.network.toArray(),
|
|
1196
|
+
breadcrumbs: s ? e.breadcrumbs.toArray() : []
|
|
1197
|
+
});
|
|
1198
|
+
l && i(p, await Tt(e));
|
|
1199
|
+
let m = await y(X, e.api, e.options.key, p), h = (e, n) => {
|
|
1200
|
+
r && ot({
|
|
1201
|
+
type: t.type,
|
|
1202
|
+
rating: t.rating,
|
|
1203
|
+
reportId: n,
|
|
1204
|
+
queued: e
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1207
|
+
return m.ok ? (h(!1, m.id || void 0), { status: "sent" }) : m.retry && $e(e.options.key, p) ? (h(!0), { status: "queued" }) : {
|
|
1208
|
+
status: "error",
|
|
1209
|
+
message: m.message
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
function kt() {
|
|
1213
|
+
K ? K.ui ? K.ui.open() : K.config || (K.openWhenReady = !0) : Z("call init() before open()");
|
|
1214
|
+
}
|
|
1215
|
+
function At(e) {
|
|
1216
|
+
let t;
|
|
1217
|
+
if (typeof e == "boolean") t = {
|
|
1218
|
+
diagnostics: e,
|
|
1219
|
+
replay: e
|
|
1220
|
+
};
|
|
1221
|
+
else if (e && typeof e == "object") {
|
|
1222
|
+
t = {};
|
|
1223
|
+
for (let n of ["diagnostics", "replay"]) e[n] !== void 0 && (t[n] = e[n] === !0);
|
|
1224
|
+
} else {
|
|
1225
|
+
Z("consent() takes true, false or { diagnostics, replay }");
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
K ? (K.consent = {
|
|
1229
|
+
...K.consent,
|
|
1230
|
+
...t
|
|
1231
|
+
}, ht(K)) : J = {
|
|
1232
|
+
...J,
|
|
1233
|
+
...t
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
function jt(e) {
|
|
1237
|
+
let t = e ? { ...e } : void 0;
|
|
1238
|
+
K ? K.user = t : q = t;
|
|
1239
|
+
}
|
|
1240
|
+
function Mt(e) {
|
|
1241
|
+
Y = Nt(e);
|
|
1242
|
+
}
|
|
1243
|
+
function Nt(e) {
|
|
1244
|
+
if (!e || typeof e != "object") return;
|
|
1245
|
+
let { value: t, currency: n } = e, r = typeof n == "string" ? n.trim().toUpperCase() : "";
|
|
1246
|
+
if (!(typeof t != "number" || !Number.isFinite(t) || t <= 0 || t > 1e7 || !/^[A-Z]{3}$/.test(r))) return {
|
|
1247
|
+
value: Math.round(t * 100) / 100,
|
|
1248
|
+
currency: r
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
function Pt() {
|
|
1252
|
+
if (K) {
|
|
1253
|
+
K.alive = !1, K.ui?.destroy();
|
|
1254
|
+
for (let e of K.cleanups.reverse()) try {
|
|
1255
|
+
e();
|
|
1256
|
+
} catch {}
|
|
1257
|
+
}
|
|
1258
|
+
Ve(), K = null, q = void 0, J = void 0, Y = void 0;
|
|
1259
|
+
}
|
|
1260
|
+
function Ft() {
|
|
1261
|
+
return K;
|
|
1262
|
+
}
|
|
1263
|
+
function It(e, t) {
|
|
1264
|
+
if (!e) return !0;
|
|
1265
|
+
let n = t.toLowerCase();
|
|
1266
|
+
return e.some((e) => e.toLowerCase() === n);
|
|
1267
|
+
}
|
|
1268
|
+
export { Nt as cleanBasket, At as consent, Pt as destroy, Ft as getState, jt as identify, ut as init, kt as open, Mt as setBasket };
|
|
1269
|
+
|
|
1270
|
+
//# sourceMappingURL=pinax.mjs.map
|