@naturalcycles/internal-web-lib 1.7.0 → 1.7.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,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
1
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/is.util.js
|
|
2
2
|
var e = (e) => !!e;
|
|
3
3
|
function t(e) {
|
|
4
4
|
return typeof e == "object" && !!e && !Array.isArray(e) || !1;
|
|
@@ -7,7 +7,7 @@ function n(e) {
|
|
|
7
7
|
for (let t in e) if (Object.hasOwn(e, t)) return !1;
|
|
8
8
|
return !0;
|
|
9
9
|
}
|
|
10
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
10
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/abort.js
|
|
11
11
|
function r(e) {
|
|
12
12
|
return e ? i(e) : void 0;
|
|
13
13
|
}
|
|
@@ -36,7 +36,7 @@ function c(e) {
|
|
|
36
36
|
});
|
|
37
37
|
return t.signal;
|
|
38
38
|
}
|
|
39
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
39
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/log/commonLogger.js
|
|
40
40
|
function l(e, t) {
|
|
41
41
|
let n = (n, [r, i]) => e({
|
|
42
42
|
...t?.(),
|
|
@@ -64,8 +64,8 @@ var d = l(({ level: e, msg: t, err: n, ...r }) => {
|
|
|
64
64
|
let i = [];
|
|
65
65
|
t !== void 0 && i.push(t), n !== void 0 && i.push(n), Object.keys(r).length && i.push(r), console[e](...i);
|
|
66
66
|
}), f = (...e) => void 0, p = Object.entries;
|
|
67
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
68
|
-
function
|
|
67
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
|
|
68
|
+
function m(e, t, n = {}) {
|
|
69
69
|
if (n.mutate) {
|
|
70
70
|
for (let n of Object.keys(e)) t.includes(n) || delete e[n];
|
|
71
71
|
return e;
|
|
@@ -74,7 +74,7 @@ function ee(e, t, n = {}) {
|
|
|
74
74
|
for (let n of t) n in e && (r[n] = e[n]);
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function h(e, t, n = {}) {
|
|
78
78
|
if (n.mutate) {
|
|
79
79
|
for (let n of t) delete e[n];
|
|
80
80
|
return e;
|
|
@@ -83,16 +83,16 @@ function m(e, t, n = {}) {
|
|
|
83
83
|
for (let n of Object.keys(e)) t.includes(n) || (r[n] = e[n]);
|
|
84
84
|
return r;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
function h(e, t = {}) {
|
|
90
|
-
return _(e, (e, t) => t != null, t);
|
|
86
|
+
function ee(e, t = {}) {
|
|
87
|
+
return v(e, (e, t) => !!t, t);
|
|
91
88
|
}
|
|
92
89
|
function g(e, t = {}) {
|
|
93
|
-
return
|
|
90
|
+
return v(e, (e, t) => t != null, t);
|
|
91
|
+
}
|
|
92
|
+
function _(e, t = {}) {
|
|
93
|
+
return v(e, (e, t) => t !== void 0, t);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function v(e, t, n = {}) {
|
|
96
96
|
if (n.mutate) {
|
|
97
97
|
for (let [n, r] of p(e)) t(n, r, e) || delete e[n];
|
|
98
98
|
return e;
|
|
@@ -101,73 +101,73 @@ function _(e, t, n = {}) {
|
|
|
101
101
|
for (let [n, i] of p(e)) t(n, i, e) && (r[n] = i);
|
|
102
102
|
return r;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function y(e, t) {
|
|
105
105
|
let n = {};
|
|
106
106
|
for (let [r, i] of Object.entries(e)) n[t(r, i, e)] = i;
|
|
107
107
|
return n;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
for (let r of n) if (t(r)) for (let n of Object.keys(r)) n !== "__proto__" && n !== "constructor" && n !== "prototype" && (t(r[n]) ? (e[n] ||= {},
|
|
109
|
+
function b(e, ...n) {
|
|
110
|
+
for (let r of n) if (t(r)) for (let n of Object.keys(r)) n !== "__proto__" && n !== "constructor" && n !== "prototype" && (t(r[n]) ? (e[n] ||= {}, b(e[n], r[n])) : e[n] = r[n]);
|
|
111
111
|
return e;
|
|
112
112
|
}
|
|
113
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
114
|
-
function b() {
|
|
115
|
-
return !x();
|
|
116
|
-
}
|
|
113
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/env.js
|
|
117
114
|
function x() {
|
|
115
|
+
return !S();
|
|
116
|
+
}
|
|
117
|
+
function S() {
|
|
118
118
|
return typeof window < "u" && !!window?.document;
|
|
119
119
|
}
|
|
120
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
if (typeof e == "string" && e &&
|
|
120
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
|
|
121
|
+
var C = /^\s*[{["\-\d]/;
|
|
122
|
+
function w(e, t) {
|
|
123
|
+
if (typeof e == "string" && e && C.test(e)) try {
|
|
124
124
|
return JSON.parse(e, t);
|
|
125
125
|
} catch {}
|
|
126
126
|
return e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function te(e, t) {
|
|
129
129
|
try {
|
|
130
130
|
return JSON.parse(e, t);
|
|
131
131
|
} catch {
|
|
132
|
-
throw new
|
|
132
|
+
throw new ie({ text: e });
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
136
|
-
function
|
|
135
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
|
|
136
|
+
function T(e, t, n = "...") {
|
|
137
137
|
if (!e || e.length <= t) return e;
|
|
138
138
|
if (t <= n.length) return n;
|
|
139
139
|
let r = Math.round((t - n.length) / 2), i = e.length - Math.floor((t - n.length) / 2);
|
|
140
140
|
return e.slice(0, r) + n + e.slice(i);
|
|
141
141
|
}
|
|
142
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
143
|
-
function
|
|
142
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
|
|
143
|
+
function E(e, t = Error, n) {
|
|
144
144
|
let r;
|
|
145
|
-
return r = e instanceof t ? e :
|
|
145
|
+
return r = e instanceof t ? e : ne(D(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function D(e, t) {
|
|
148
148
|
let n;
|
|
149
|
-
return
|
|
149
|
+
return j(e) ? n = O(e) : (e = w(e), n = k(e) ? e.error : A(e) ? e : j(e) ? O(e) : {
|
|
150
150
|
name: "Error",
|
|
151
|
-
message:
|
|
151
|
+
message: I(e),
|
|
152
152
|
data: {}
|
|
153
153
|
}), Object.assign(n.data, t), n;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (!(e instanceof Error) &&
|
|
155
|
+
function O(e) {
|
|
156
|
+
if (!(e instanceof Error) && A(e)) return e;
|
|
157
157
|
let t = {
|
|
158
158
|
name: e.name,
|
|
159
159
|
message: e.message,
|
|
160
160
|
data: { ...e.data }
|
|
161
161
|
};
|
|
162
|
-
return e.stack && (t.stack = e.stack), e.cause && (t.cause =
|
|
162
|
+
return e.stack && (t.stack = e.stack), e.cause && (t.cause = D(e.cause)), t;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function ne(e, t = Error) {
|
|
165
165
|
if (e instanceof t) return e;
|
|
166
166
|
let { name: n, cause: r } = e, i = new t(e.message, e.data, {
|
|
167
167
|
name: n,
|
|
168
168
|
cause: r
|
|
169
169
|
});
|
|
170
|
-
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof
|
|
170
|
+
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof N || (Object.defineProperties(i, {
|
|
171
171
|
name: {
|
|
172
172
|
value: n,
|
|
173
173
|
configurable: !0,
|
|
@@ -191,31 +191,31 @@ function re(e, t = Error) {
|
|
|
191
191
|
writable: !0
|
|
192
192
|
})), i;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function k(e) {
|
|
195
195
|
try {
|
|
196
|
-
return
|
|
196
|
+
return A(e?.error);
|
|
197
197
|
} catch {
|
|
198
198
|
return !1;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function A(e) {
|
|
202
202
|
try {
|
|
203
203
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string" && typeof e.data == "object";
|
|
204
204
|
} catch {
|
|
205
205
|
return !1;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function j(e) {
|
|
209
209
|
try {
|
|
210
210
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string";
|
|
211
211
|
} catch {
|
|
212
212
|
return !1;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return t ?
|
|
215
|
+
function M(e, t) {
|
|
216
|
+
return t ? E(e, void 0, t) : e;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var N = class e extends Error {
|
|
219
219
|
data;
|
|
220
220
|
cause;
|
|
221
221
|
static of(t) {
|
|
@@ -226,7 +226,7 @@ var M = class e extends Error {
|
|
|
226
226
|
}
|
|
227
227
|
constructor(e, t = {}, n = {}) {
|
|
228
228
|
super(e);
|
|
229
|
-
let { name: r =
|
|
229
|
+
let { name: r = x() ? this.constructor.name : "AppError", cause: i } = n;
|
|
230
230
|
Object.defineProperties(this, {
|
|
231
231
|
name: {
|
|
232
232
|
value: r,
|
|
@@ -240,7 +240,7 @@ var M = class e extends Error {
|
|
|
240
240
|
enumerable: !1
|
|
241
241
|
}
|
|
242
242
|
}), i ? Object.defineProperty(this, "cause", {
|
|
243
|
-
value:
|
|
243
|
+
value: D(i),
|
|
244
244
|
writable: !0,
|
|
245
245
|
configurable: !0,
|
|
246
246
|
enumerable: !0
|
|
@@ -250,43 +250,43 @@ var M = class e extends Error {
|
|
|
250
250
|
writable: !0
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, P = class extends N {
|
|
254
254
|
constructor(e, t, n) {
|
|
255
255
|
t.response && Object.defineProperty(t, "response", { enumerable: !1 }), super(e, t, {
|
|
256
256
|
...n,
|
|
257
257
|
name: "HttpRequestError"
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
},
|
|
260
|
+
}, re = class extends N {
|
|
261
261
|
constructor(e, t) {
|
|
262
262
|
super(e, t, { name: "AssertionError" });
|
|
263
263
|
}
|
|
264
|
-
},
|
|
264
|
+
}, ie = class extends N {
|
|
265
265
|
constructor(e) {
|
|
266
|
-
let t = ["Failed to parse", e.text &&
|
|
266
|
+
let t = ["Failed to parse", e.text && T(e.text, 200)].filter(Boolean).join(": ");
|
|
267
267
|
super(t, e, { name: "JsonParseError" });
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, ae = class extends N {
|
|
270
270
|
constructor(e, t, n) {
|
|
271
271
|
super(e, t, {
|
|
272
272
|
...n,
|
|
273
273
|
name: "TimeoutError"
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
},
|
|
276
|
+
}, oe = class extends N {
|
|
277
277
|
constructor(e) {
|
|
278
278
|
super(e || "expected error was not thrown", {}, { name: "UnexpectedPassError" });
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
282
|
-
function
|
|
281
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
|
|
282
|
+
function F(e, t, n, r) {
|
|
283
283
|
try {
|
|
284
284
|
return JSON.stringify(e, t, n);
|
|
285
285
|
} catch {
|
|
286
|
-
return JSON.stringify(e,
|
|
286
|
+
return JSON.stringify(e, se(t, r), n);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function se(e, t) {
|
|
290
290
|
let n = [], r = [];
|
|
291
291
|
return t ??= (e, t) => n[0] === t ? "[Circular ~]" : "[Circular ~." + r.slice(0, n.indexOf(t)).join(".") + "]", function(i, a) {
|
|
292
292
|
if (n.length > 0) {
|
|
@@ -296,22 +296,22 @@ function ce(e, t) {
|
|
|
296
296
|
return e == null ? a : e.call(this, i, a);
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
300
|
-
var
|
|
301
|
-
function
|
|
299
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
|
|
300
|
+
var ce = typeof globalThis.AggregateError == "function", le = F;
|
|
301
|
+
function I(e, t = {}) {
|
|
302
302
|
if (e === void 0) return "undefined";
|
|
303
303
|
if (e === null) return "null";
|
|
304
304
|
if (typeof e == "function") return "function";
|
|
305
305
|
if (typeof e == "symbol") return e.toString();
|
|
306
306
|
let n;
|
|
307
|
-
if (e =
|
|
308
|
-
if (e instanceof Error ||
|
|
307
|
+
if (e = w(e), k(e)) return I(e.error, t);
|
|
308
|
+
if (e instanceof Error || j(e)) n = ue(e, t);
|
|
309
309
|
else if (typeof e == "string") n = e.trim() || "empty_string";
|
|
310
310
|
else if (typeof e == "number") n = String(e);
|
|
311
311
|
else {
|
|
312
312
|
e instanceof Map ? e = Object.fromEntries(e) : e instanceof Set && (e = Array.from(e));
|
|
313
313
|
try {
|
|
314
|
-
let { stringifyFn: r =
|
|
314
|
+
let { stringifyFn: r = le } = t;
|
|
315
315
|
n = r(e, void 0, 2);
|
|
316
316
|
} catch {
|
|
317
317
|
n = String(e);
|
|
@@ -319,38 +319,28 @@ function F(e, t = {}) {
|
|
|
319
319
|
}
|
|
320
320
|
if (n === void 0) return "undefined";
|
|
321
321
|
let { maxLen: r = 1e4 } = t;
|
|
322
|
-
return r && n.length > r ?
|
|
322
|
+
return r && n.length > r ? T(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function ue(e, t) {
|
|
325
325
|
let { includeErrorCause: n = !0 } = t, r = [e.name, e.message].filter(Boolean).join(": ");
|
|
326
|
-
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData &&
|
|
326
|
+
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && A(e) && Object.keys(e.data).length && (r += "\n" + I(e.data, t)), t.includeErrorStack && e.stack) {
|
|
327
327
|
let t = r.split("\n").length;
|
|
328
328
|
r = [r, ...e.stack.split("\n").slice(t)].join("\n");
|
|
329
329
|
}
|
|
330
|
-
return
|
|
330
|
+
return ce && e instanceof AggregateError && e.errors.length && (r = [
|
|
331
331
|
r,
|
|
332
332
|
`${e.errors.length} error(s):`,
|
|
333
|
-
...e.errors.map((e, n) => `${n + 1}. ${
|
|
334
|
-
].join("\n")), e.cause && n && (r = r + "\nCaused by: " +
|
|
333
|
+
...e.errors.map((e, n) => `${n + 1}. ${I(e, t)}`)
|
|
334
|
+
].join("\n")), e.cause && n && (r = r + "\nCaused by: " + I(e.cause, t)), r;
|
|
335
335
|
}
|
|
336
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
337
|
-
function
|
|
338
|
-
if (!(e instanceof t)) throw new
|
|
336
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/error/assert.js
|
|
337
|
+
function L(e, t = Error) {
|
|
338
|
+
if (!(e instanceof t)) throw new re(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function R(e, t) {
|
|
341
341
|
if (!(e instanceof t)) throw e;
|
|
342
342
|
}
|
|
343
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
344
|
-
async function R(e, t) {
|
|
345
|
-
t?.aborted || await new Promise((n) => {
|
|
346
|
-
let r = setTimeout(i, e);
|
|
347
|
-
function i() {
|
|
348
|
-
clearTimeout(r), t?.removeEventListener("abort", i), n();
|
|
349
|
-
}
|
|
350
|
-
t?.addEventListener("abort", i);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
|
|
343
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
|
|
354
344
|
function z(e, t = Date.now()) {
|
|
355
345
|
return B(t - e);
|
|
356
346
|
}
|
|
@@ -360,11 +350,11 @@ function B(e) {
|
|
|
360
350
|
let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
|
|
361
351
|
return r === 0 ? n === 0 ? `${t} sec` : `${n}m${t}s` : r < 24 ? `${r}h${n}m` : r < 48 ? `${Math.round(r + n / 60)}h` : `${Math.floor(r / 24)} days`;
|
|
362
352
|
}
|
|
363
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
353
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
|
|
364
354
|
function V(e, t, n) {
|
|
365
355
|
return e <= t ? t : e >= n ? n : e;
|
|
366
356
|
}
|
|
367
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
357
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/analytics/analytics.model.js
|
|
368
358
|
var H = "identify";
|
|
369
359
|
function U(e) {
|
|
370
360
|
return e.length <= 255 ? e : Array.from(e).slice(0, 255).join("");
|
|
@@ -381,8 +371,8 @@ var W = [
|
|
|
381
371
|
"utm_creative_format",
|
|
382
372
|
"utm_marketing_tactic"
|
|
383
373
|
];
|
|
384
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
385
|
-
function
|
|
374
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/array/array.util.js
|
|
375
|
+
function de(e, t) {
|
|
386
376
|
let n = {};
|
|
387
377
|
for (let r of e) {
|
|
388
378
|
let e = t(r);
|
|
@@ -390,19 +380,29 @@ function fe(e, t) {
|
|
|
390
380
|
}
|
|
391
381
|
return n;
|
|
392
382
|
}
|
|
393
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
383
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
|
|
384
|
+
async function fe(e, t) {
|
|
385
|
+
t?.aborted || await new Promise((n) => {
|
|
386
|
+
let r = setTimeout(i, e);
|
|
387
|
+
function i() {
|
|
388
|
+
clearTimeout(r), t?.removeEventListener("abort", i), n();
|
|
389
|
+
}
|
|
390
|
+
t?.addEventListener("abort", i);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
|
|
394
394
|
async function pe(e, t) {
|
|
395
395
|
let n = new AbortController(), { signal: r } = n;
|
|
396
396
|
if (!t.timeout) return await e(r);
|
|
397
397
|
let { timeout: i, name: a = e.name || "pTimeout function", onTimeout: o } = t, s = t.fakeError || /* @__PURE__ */ Error("TimeoutError");
|
|
398
398
|
return await new Promise(async (c, l) => {
|
|
399
399
|
let u = setTimeout(() => {
|
|
400
|
-
let e = new
|
|
400
|
+
let e = new ae(`"${a}" timed out after ${i} ms`, t.errorData);
|
|
401
401
|
if (e.stack = s.stack.replace("Error: TimeoutError", "TimeoutError: " + e.message), o) {
|
|
402
402
|
try {
|
|
403
403
|
c(o(e));
|
|
404
404
|
} catch (e) {
|
|
405
|
-
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(
|
|
405
|
+
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(M(e, t.errorData));
|
|
406
406
|
}
|
|
407
407
|
n.abort(e);
|
|
408
408
|
} else l(e), n.abort(e);
|
|
@@ -416,7 +416,7 @@ async function pe(e, t) {
|
|
|
416
416
|
}
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
419
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
|
|
420
420
|
function me(e, t) {
|
|
421
421
|
if (typeof e != "string") return null;
|
|
422
422
|
try {
|
|
@@ -425,7 +425,7 @@ function me(e, t) {
|
|
|
425
425
|
return null;
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
428
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.99.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
|
|
429
429
|
var he = [
|
|
430
430
|
"GET",
|
|
431
431
|
"POST",
|
|
@@ -435,7 +435,7 @@ var he = [
|
|
|
435
435
|
"HEAD"
|
|
436
436
|
], ge = class e {
|
|
437
437
|
static VERSION = 5;
|
|
438
|
-
static userAgent =
|
|
438
|
+
static userAgent = x() ? `fetcher/${this.VERSION}` : void 0;
|
|
439
439
|
constructor(e = {}) {
|
|
440
440
|
if (typeof globalThis.fetch != "function") throw TypeError("globalThis.fetch is not available");
|
|
441
441
|
this.cfg = this.normalizeCfg(e);
|
|
@@ -501,7 +501,7 @@ var he = [
|
|
|
501
501
|
headVoid;
|
|
502
502
|
async queryGraphQL(e) {
|
|
503
503
|
e = { ...e }, e.method ||= this.cfg.init.method;
|
|
504
|
-
let t =
|
|
504
|
+
let t = ee({
|
|
505
505
|
query: e.query,
|
|
506
506
|
variables: e.variables
|
|
507
507
|
});
|
|
@@ -513,7 +513,7 @@ var he = [
|
|
|
513
513
|
if (n.err) throw n.err;
|
|
514
514
|
if (n.body.errors) {
|
|
515
515
|
let e = n.body.errors[0];
|
|
516
|
-
throw new
|
|
516
|
+
throw new P(e.message, {
|
|
517
517
|
...t,
|
|
518
518
|
errors: n.body.errors,
|
|
519
519
|
response: n.fetchResponse,
|
|
@@ -556,12 +556,12 @@ var he = [
|
|
|
556
556
|
}
|
|
557
557
|
async expectError(e) {
|
|
558
558
|
let t = await this.doFetch(e);
|
|
559
|
-
if (!t.err) throw new
|
|
560
|
-
return
|
|
559
|
+
if (!t.err) throw new oe("Fetch was expected to error");
|
|
560
|
+
return L(t.err, P), t.err;
|
|
561
561
|
}
|
|
562
562
|
async tryFetch(e) {
|
|
563
563
|
let t = await this.doFetch(e);
|
|
564
|
-
return t.err ? (
|
|
564
|
+
return t.err ? (R(t.err, P), [t.err, null]) : [null, t.body];
|
|
565
565
|
}
|
|
566
566
|
async doFetch(t) {
|
|
567
567
|
let n = 0;
|
|
@@ -596,7 +596,7 @@ var he = [
|
|
|
596
596
|
try {
|
|
597
597
|
d.fetchResponse = await (i.overrideFetchFn || e.callNativeFetch)(i.fullUrl, i.init, i.fetchFn), d.ok = d.fetchResponse.ok, d.err = void 0;
|
|
598
598
|
} catch (e) {
|
|
599
|
-
d.err =
|
|
599
|
+
d.err = E(e), d.ok = !1, d.fetchResponse = void 0;
|
|
600
600
|
}
|
|
601
601
|
if (d.statusFamily = this.getStatusFamily(d), d.statusCode = d.fetchResponse?.status, d.fetchResponse?.ok) try {
|
|
602
602
|
await pe(async () => await this.onOkResponse(d), {
|
|
@@ -604,12 +604,12 @@ var he = [
|
|
|
604
604
|
name: "Fetcher.downloadBody"
|
|
605
605
|
});
|
|
606
606
|
} catch (e) {
|
|
607
|
-
d.err =
|
|
607
|
+
d.err = E(e), d.ok = !1, await this.onNotOkResponse(d);
|
|
608
608
|
}
|
|
609
609
|
else await this.onNotOkResponse(d);
|
|
610
610
|
}
|
|
611
611
|
if (d.err) {
|
|
612
|
-
|
|
612
|
+
M(d.err, i.errorData), i.onError?.(d.err);
|
|
613
613
|
for (let e of this.cfg.hooks.onError || []) await e(d.err);
|
|
614
614
|
}
|
|
615
615
|
for (let e of this.cfg.hooks.afterResponse || []) await e(d);
|
|
@@ -630,7 +630,7 @@ var he = [
|
|
|
630
630
|
if (n === "json") {
|
|
631
631
|
if (e.fetchResponse.body) {
|
|
632
632
|
let n = await e.fetchResponse.text();
|
|
633
|
-
n ? (e.body = n, e.body =
|
|
633
|
+
n ? (e.body = n, e.body = te(n, t.jsonReviver)) : e.body = {};
|
|
634
634
|
} else e.body = {};
|
|
635
635
|
} else if (n === "text") e.body = e.fetchResponse.body ? await e.fetchResponse.text() : "";
|
|
636
636
|
else if (n === "arrayBuffer") e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0);
|
|
@@ -655,15 +655,15 @@ var he = [
|
|
|
655
655
|
async onNotOkResponse(e) {
|
|
656
656
|
let t;
|
|
657
657
|
if (!e.body && e.fetchResponse) try {
|
|
658
|
-
e.body =
|
|
658
|
+
e.body = w(await e.fetchResponse.text());
|
|
659
659
|
} catch {}
|
|
660
|
-
t = e.err ?
|
|
660
|
+
t = e.err ? O(e.err) : e.body ? D(e.body) : {
|
|
661
661
|
name: "Error",
|
|
662
662
|
message: "Fetch failed",
|
|
663
663
|
data: {}
|
|
664
664
|
};
|
|
665
665
|
let n = e.fetchResponse?.status || 0;
|
|
666
|
-
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new
|
|
666
|
+
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new P([e.statusCode, e.signature].filter(Boolean).join(" "), g({
|
|
667
667
|
response: e.fetchResponse,
|
|
668
668
|
responseStatusCode: n,
|
|
669
669
|
requestUrl: e.req.fullUrl,
|
|
@@ -692,7 +692,7 @@ var he = [
|
|
|
692
692
|
}), t.retryStopped) return;
|
|
693
693
|
t.retryAttempt++;
|
|
694
694
|
let a = this.getRetryTimeout(e);
|
|
695
|
-
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = V(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${B(a)}`), await
|
|
695
|
+
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = V(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${B(a)}`), await fe(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0));
|
|
696
696
|
}
|
|
697
697
|
getRetryTimeout(e) {
|
|
698
698
|
let t = 0;
|
|
@@ -736,7 +736,7 @@ var he = [
|
|
|
736
736
|
return this.cfg.logWithSearchParams || (n = n.split("?")[0]), !this.cfg.logWithBaseUrl && t && n.startsWith(t) && (n = n.slice(t.length)), n;
|
|
737
737
|
}
|
|
738
738
|
normalizeCfg(t) {
|
|
739
|
-
let { debug: n = !1, logger: r = d } = t, i =
|
|
739
|
+
let { debug: n = !1, logger: r = d } = t, i = b({
|
|
740
740
|
baseUrl: "",
|
|
741
741
|
name: this.getFetcherName(t),
|
|
742
742
|
inputUrl: "",
|
|
@@ -753,12 +753,12 @@ var he = [
|
|
|
753
753
|
logRequestBody: n,
|
|
754
754
|
logResponse: n,
|
|
755
755
|
logResponseBody: n,
|
|
756
|
-
logWithBaseUrl:
|
|
756
|
+
logWithBaseUrl: x(),
|
|
757
757
|
logWithSearchParams: !0,
|
|
758
758
|
retry: { ...ye },
|
|
759
759
|
init: {
|
|
760
760
|
method: t.method || "GET",
|
|
761
|
-
headers:
|
|
761
|
+
headers: g({
|
|
762
762
|
"user-agent": e.userAgent,
|
|
763
763
|
...t.headers
|
|
764
764
|
}),
|
|
@@ -770,7 +770,7 @@ var he = [
|
|
|
770
770
|
hooks: {},
|
|
771
771
|
throwHttpErrors: !0,
|
|
772
772
|
errorData: {}
|
|
773
|
-
},
|
|
773
|
+
}, h(t, [
|
|
774
774
|
"method",
|
|
775
775
|
"credentials",
|
|
776
776
|
"headers",
|
|
@@ -779,7 +779,7 @@ var he = [
|
|
|
779
779
|
"name",
|
|
780
780
|
"keepalive"
|
|
781
781
|
]));
|
|
782
|
-
return i.init.headers =
|
|
782
|
+
return i.init.headers = y(i.init.headers, (e) => e.toLowerCase()), i.baseUrl.endsWith("/") && (r.warn(`Fetcher: baseUrl should not end with slash: ${i.baseUrl}`), i.baseUrl = i.baseUrl.slice(0, -1)), i;
|
|
783
783
|
}
|
|
784
784
|
getFetcherName(e) {
|
|
785
785
|
let { name: t } = e;
|
|
@@ -791,7 +791,7 @@ var he = [
|
|
|
791
791
|
}
|
|
792
792
|
normalizeOptions(t) {
|
|
793
793
|
let n = {
|
|
794
|
-
...
|
|
794
|
+
...m(this.cfg, [
|
|
795
795
|
"timeoutSeconds",
|
|
796
796
|
"retryPost",
|
|
797
797
|
"retry3xx",
|
|
@@ -810,7 +810,7 @@ var he = [
|
|
|
810
810
|
"overrideFetchFn"
|
|
811
811
|
]),
|
|
812
812
|
started: Date.now(),
|
|
813
|
-
...
|
|
813
|
+
...h(t, [
|
|
814
814
|
"method",
|
|
815
815
|
"headers",
|
|
816
816
|
"credentials"
|
|
@@ -819,9 +819,9 @@ var he = [
|
|
|
819
819
|
fullUrl: t.url || "",
|
|
820
820
|
retry: {
|
|
821
821
|
...this.cfg.retry,
|
|
822
|
-
...
|
|
822
|
+
..._(t.retry || {})
|
|
823
823
|
},
|
|
824
|
-
init:
|
|
824
|
+
init: b({
|
|
825
825
|
...this.cfg.init,
|
|
826
826
|
headers: {
|
|
827
827
|
...this.cfg.init.headers,
|
|
@@ -831,15 +831,15 @@ var he = [
|
|
|
831
831
|
credentials: t.credentials || this.cfg.init.credentials,
|
|
832
832
|
redirect: t.redirect || this.cfg.init.redirect || "follow",
|
|
833
833
|
keepalive: t.keepalive ?? this.cfg.init.keepalive
|
|
834
|
-
}, { headers:
|
|
834
|
+
}, { headers: y(t.headers || {}, (e) => e.toLowerCase()) })
|
|
835
835
|
};
|
|
836
|
-
|
|
836
|
+
g(n.init.headers, { mutate: !0 });
|
|
837
837
|
let r = t.baseUrl || this.cfg.baseUrl;
|
|
838
838
|
if (r) {
|
|
839
839
|
let { inputUrl: e } = n;
|
|
840
840
|
e.startsWith("/") && (this.cfg.logger.warn("Fetcher: url should not start with / when baseUrl is specified"), e = e.slice(1)), n.fullUrl = `${r}/${e}`;
|
|
841
841
|
}
|
|
842
|
-
let i =
|
|
842
|
+
let i = _({
|
|
843
843
|
...this.cfg.searchParams,
|
|
844
844
|
...t.searchParams
|
|
845
845
|
});
|
|
@@ -923,7 +923,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
923
923
|
logger: this.cfg.logger,
|
|
924
924
|
retryPost: !0,
|
|
925
925
|
timeoutSeconds: 10
|
|
926
|
-
}),
|
|
926
|
+
}), x() || (this.restoreOrphanedQueues(), globalThis.addEventListener("pagehide", this.handlePageHide), document.addEventListener("visibilitychange", this.handleVisibilityChange));
|
|
927
927
|
}
|
|
928
928
|
cfg;
|
|
929
929
|
firstTouchFetcher;
|
|
@@ -1002,13 +1002,13 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1002
1002
|
return this.cfg.debug && this.cfg.logger.log(`[analytics] ${r.name}`, { props: r.props }), this.queue.push(r), this.queue.length > this.cfg.maxQueueSize && (this.queue.shift(), this.cfg.logger.warn("[analytics] queue overflow, dropped the oldest event")), this.schedulePersistQueue(), this.queue.length >= this.cfg.maxBatchSize && !this.consecutiveFailures ? this.flush() : this.scheduleFlush(), r;
|
|
1003
1003
|
}
|
|
1004
1004
|
canTrack() {
|
|
1005
|
-
return !
|
|
1005
|
+
return !x() && this.cfg.isEnabled();
|
|
1006
1006
|
}
|
|
1007
1007
|
reset() {
|
|
1008
1008
|
this.clearPendingEvents(), this.identity.reset(), this.hasUpdatedAcquisitionProps = !1;
|
|
1009
1009
|
}
|
|
1010
1010
|
async flush() {
|
|
1011
|
-
if (!(
|
|
1011
|
+
if (!(x() || this.isFlushing)) {
|
|
1012
1012
|
this.isFlushing = !0, this.clearFlushTimer();
|
|
1013
1013
|
try {
|
|
1014
1014
|
for (; this.queue.length;) for (let e of this.prepareBatches()) {
|
|
@@ -1033,7 +1033,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
1035
|
destroy() {
|
|
1036
|
-
this.persistScheduledQueue(), this.clearFlushTimer(),
|
|
1036
|
+
this.persistScheduledQueue(), this.clearFlushTimer(), x() || (globalThis.removeEventListener("pagehide", this.handlePageHide), document.removeEventListener("visibilitychange", this.handleVisibilityChange));
|
|
1037
1037
|
}
|
|
1038
1038
|
ensureAcquisitionProps() {
|
|
1039
1039
|
this.hasUpdatedAcquisitionProps || (this.hasUpdatedAcquisitionProps = !0, this.identity.updateAcquisitionProps(), this.sendFirstTouch());
|
|
@@ -1050,11 +1050,11 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1050
1050
|
}, r = await this.firstTouchFetcher.doFetch({
|
|
1051
1051
|
url: e,
|
|
1052
1052
|
method: "POST",
|
|
1053
|
-
text:
|
|
1053
|
+
text: F(n),
|
|
1054
1054
|
responseType: "void"
|
|
1055
1055
|
});
|
|
1056
1056
|
if (r.err) try {
|
|
1057
|
-
this.cfg.onError(
|
|
1057
|
+
this.cfg.onError(M(r.err, { firstTouch: !0 }));
|
|
1058
1058
|
} catch (e) {
|
|
1059
1059
|
this.cfg.logger.warn("[analytics] onError hook threw", { err: e });
|
|
1060
1060
|
}
|
|
@@ -1088,7 +1088,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1088
1088
|
}
|
|
1089
1089
|
this.cfg.logger.error(`[analytics] batch rejected with ${t.status}, dropping ${e.events.length} event(s)`);
|
|
1090
1090
|
try {
|
|
1091
|
-
this.cfg.onError(new
|
|
1091
|
+
this.cfg.onError(new N("batch dropped on a non-retryable status", {
|
|
1092
1092
|
status: t.status,
|
|
1093
1093
|
eventCount: e.events.length
|
|
1094
1094
|
}));
|
|
@@ -1109,7 +1109,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1109
1109
|
prepareBatches() {
|
|
1110
1110
|
let e = [], t, n = this.identity.getDistinctId();
|
|
1111
1111
|
for (let r of this.queue) {
|
|
1112
|
-
let i = Y(
|
|
1112
|
+
let i = Y(F(r)), a = t?.events.length === this.cfg.maxBatchSize, o = +!!t?.events.length, s = !!t && t.bodyBytes + o + i > this.cfg.maxBatchBytes;
|
|
1113
1113
|
t && (a || s) && (e.push(this.finalizeBatch(t)), t = void 0), t ? (t.events.push(r), t.bodyBytes += o + i) : t = this.createPendingBatch(n, r, i);
|
|
1114
1114
|
}
|
|
1115
1115
|
return t && e.push(this.finalizeBatch(t)), e;
|
|
@@ -1137,7 +1137,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1137
1137
|
};
|
|
1138
1138
|
return {
|
|
1139
1139
|
events: e.events,
|
|
1140
|
-
body:
|
|
1140
|
+
body: F(t)
|
|
1141
1141
|
};
|
|
1142
1142
|
}
|
|
1143
1143
|
restoreOrphanedQueues() {
|
|
@@ -1159,7 +1159,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1159
1159
|
} catch {}
|
|
1160
1160
|
}
|
|
1161
1161
|
scheduleFlush() {
|
|
1162
|
-
if (this.flushTimer ||
|
|
1162
|
+
if (this.flushTimer || x()) return;
|
|
1163
1163
|
let e = this.cfg.flushInterval;
|
|
1164
1164
|
this.consecutiveFailures && (e = Math.min(this.cfg.flushInterval * 2 ** this.consecutiveFailures, this.cfg.maxRetryBackoff), e = Math.max(e, this.retryAfter)), this.flushTimer = setTimeout(() => {
|
|
1165
1165
|
this.flushTimer = void 0, this.flush();
|
|
@@ -1182,7 +1182,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1182
1182
|
if (this.cfg.persistQueue) {
|
|
1183
1183
|
this.isQueuePersistScheduled = !1;
|
|
1184
1184
|
try {
|
|
1185
|
-
this.queue.length ? localStorage.setItem(this.queueKey,
|
|
1185
|
+
this.queue.length ? localStorage.setItem(this.queueKey, F(this.queue)) : localStorage.removeItem(this.queueKey);
|
|
1186
1186
|
} catch {}
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
@@ -1214,7 +1214,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1214
1214
|
return this.loadEntry()[e];
|
|
1215
1215
|
}
|
|
1216
1216
|
getAcquisitionProps() {
|
|
1217
|
-
let e = this.loadEntry(), t =
|
|
1217
|
+
let e = this.loadEntry(), t = v(e, (e) => String(e).startsWith(Ee)), { firstTouch: n } = e;
|
|
1218
1218
|
return n && (t.initial_referrer = n.referrer), t;
|
|
1219
1219
|
}
|
|
1220
1220
|
getFirstTouchProps() {
|
|
@@ -1236,7 +1236,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1236
1236
|
});
|
|
1237
1237
|
}
|
|
1238
1238
|
updateAcquisitionProps() {
|
|
1239
|
-
if (
|
|
1239
|
+
if (x()) return;
|
|
1240
1240
|
let e = this.loadEntry(), t = new URL(globalThis.location.href);
|
|
1241
1241
|
Object.assign(e, J(t)), e.firstTouch ||= { referrer: ke() }, e.firstTouch.utms ||= Ae(t), this.saveEntry(e);
|
|
1242
1242
|
}
|
|
@@ -1277,7 +1277,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1277
1277
|
}));
|
|
1278
1278
|
} else localStorage.setItem(this.cfg.persistenceKey, n);
|
|
1279
1279
|
} catch (e) {
|
|
1280
|
-
this.reportError(
|
|
1280
|
+
this.reportError(M(e, { bytes: t }));
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
cookieLength(e) {
|
|
@@ -1301,11 +1301,11 @@ function ke() {
|
|
|
1301
1301
|
return U(document.referrer) || null;
|
|
1302
1302
|
}
|
|
1303
1303
|
function Ae(e) {
|
|
1304
|
-
let t =
|
|
1304
|
+
let t = de(W, (t) => {
|
|
1305
1305
|
let n = e.searchParams.get(t);
|
|
1306
1306
|
return [`initial_${t}`, n ? U(n) : null];
|
|
1307
1307
|
});
|
|
1308
|
-
if (!n(
|
|
1308
|
+
if (!n(g(t))) return t;
|
|
1309
1309
|
}
|
|
1310
1310
|
function je(e, t) {
|
|
1311
1311
|
return Object.fromEntries(t.flatMap((t) => {
|
|
@@ -1334,7 +1334,7 @@ function Q(e, t, n, r, i) {
|
|
|
1334
1334
|
let o = a.join("; ");
|
|
1335
1335
|
return document.cookie = o, o;
|
|
1336
1336
|
}
|
|
1337
|
-
var $ = class extends
|
|
1337
|
+
var $ = class extends N {
|
|
1338
1338
|
constructor(e, t) {
|
|
1339
1339
|
super(e, t, { name: "AnalyticsClientError" });
|
|
1340
1340
|
}
|