@naturalcycles/internal-web-lib 1.7.0 → 1.7.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/bundle/analyticsClient.js +252 -259
- package/bundle/analyticsClient.js.map +1 -1
- package/bundle/conversionClient.js +199 -206
- package/bundle/conversionClient.js.map +1 -1
- package/bundle/cookieMonster.js +1 -1
- package/bundle/cookieMonster.js.map +1 -1
- package/dist/conversion/conversionClient.js +0 -1
- package/dist/ncuikit/dist/styles/_palette.js +1 -1
- package/package.json +4 -3
|
@@ -7,7 +7,7 @@ function e(e = 21) {
|
|
|
7
7
|
function t() {
|
|
8
8
|
return e();
|
|
9
9
|
}
|
|
10
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
10
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/is.util.js
|
|
11
11
|
var n = (e) => !!e;
|
|
12
12
|
function r(e) {
|
|
13
13
|
return typeof e == "object" && !!e && !Array.isArray(e) || !1;
|
|
@@ -22,27 +22,18 @@ function i(e) {
|
|
|
22
22
|
}
|
|
23
23
|
return !1;
|
|
24
24
|
}
|
|
25
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
25
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/abort.js
|
|
26
26
|
function a(e) {
|
|
27
|
-
return e ?
|
|
27
|
+
return e ? AbortSignal.timeout(e) : void 0;
|
|
28
28
|
}
|
|
29
29
|
function o(e) {
|
|
30
|
-
|
|
30
|
+
let t = e.filter(n);
|
|
31
|
+
return t.length ? s(t) : void 0;
|
|
31
32
|
}
|
|
32
33
|
function s(e) {
|
|
33
|
-
|
|
34
|
-
return setTimeout(() => {
|
|
35
|
-
t.abort(new DOMException("The operation was aborted due to timeout", "TimeoutError"));
|
|
36
|
-
}, e), t.signal;
|
|
34
|
+
return e.length === 1 ? e[0] : typeof AbortSignal.any == "function" ? AbortSignal.any(e) : c(e);
|
|
37
35
|
}
|
|
38
36
|
function c(e) {
|
|
39
|
-
let t = e.filter(n);
|
|
40
|
-
return t.length ? l(t) : void 0;
|
|
41
|
-
}
|
|
42
|
-
function l(e) {
|
|
43
|
-
return e.length === 1 ? e[0] : typeof AbortSignal.any == "function" ? AbortSignal.any(e) : u(e);
|
|
44
|
-
}
|
|
45
|
-
function u(e) {
|
|
46
37
|
let t = new AbortController();
|
|
47
38
|
for (let n of e) if (n.aborted) return t.abort(n.reason), t.signal;
|
|
48
39
|
for (let n of e) n.addEventListener("abort", () => t.abort(n.reason), {
|
|
@@ -51,8 +42,21 @@ function u(e) {
|
|
|
51
42
|
});
|
|
52
43
|
return t.signal;
|
|
53
44
|
}
|
|
54
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
55
|
-
function
|
|
45
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
|
|
46
|
+
function l(e, t = d()) {
|
|
47
|
+
return u(t - e);
|
|
48
|
+
}
|
|
49
|
+
function u(e) {
|
|
50
|
+
if (e < 1e3) return `${Math.round(e)} ms`;
|
|
51
|
+
if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
|
|
52
|
+
let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
|
|
53
|
+
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`;
|
|
54
|
+
}
|
|
55
|
+
function d() {
|
|
56
|
+
return Date.now();
|
|
57
|
+
}
|
|
58
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/log/commonLogger.js
|
|
59
|
+
function f(e, t) {
|
|
56
60
|
let n = (n, [r, i]) => e({
|
|
57
61
|
...t?.(),
|
|
58
62
|
...ee(r, i),
|
|
@@ -63,7 +67,7 @@ function d(e, t) {
|
|
|
63
67
|
log: (...e) => n("log", e),
|
|
64
68
|
warn: (...e) => n("warn", e),
|
|
65
69
|
error: (...e) => n("error", e),
|
|
66
|
-
child: (n) =>
|
|
70
|
+
child: (n) => f(e, () => ({
|
|
67
71
|
...t?.(),
|
|
68
72
|
...n
|
|
69
73
|
}))
|
|
@@ -75,11 +79,11 @@ function ee(e, t) {
|
|
|
75
79
|
msg: e
|
|
76
80
|
} : e instanceof Error ? { err: e } : e;
|
|
77
81
|
}
|
|
78
|
-
var
|
|
82
|
+
var p = f(({ level: e, msg: t, err: n, ...r }) => {
|
|
79
83
|
let i = [];
|
|
80
84
|
t !== void 0 && i.push(t), n !== void 0 && i.push(n), Object.keys(r).length && i.push(r), console[e](...i);
|
|
81
|
-
}),
|
|
82
|
-
logger =
|
|
85
|
+
}), m = /* @__PURE__ */ new class {
|
|
86
|
+
logger = p;
|
|
83
87
|
pendingOps = /* @__PURE__ */ new Set();
|
|
84
88
|
onErrorHooks = [];
|
|
85
89
|
runInBackground(e) {
|
|
@@ -92,14 +96,14 @@ var f = d(({ level: e, msg: t, err: n, ...r }) => {
|
|
|
92
96
|
async allDone(e) {
|
|
93
97
|
let { size: t } = this.pendingOps;
|
|
94
98
|
if (!t) return;
|
|
95
|
-
let { logger: n } = this, r =
|
|
99
|
+
let { logger: n } = this, r = d();
|
|
96
100
|
if (e) {
|
|
97
101
|
if (await Promise.race([Promise.allSettled(this.pendingOps), new Promise((t) => setTimeout(t, e, "timeout"))]) === "timeout") {
|
|
98
102
|
n.warn(`AsyncManager.allDone timed out after ${e} ms with ${this.pendingOps.size} pending op(s)`);
|
|
99
103
|
return;
|
|
100
104
|
}
|
|
101
105
|
} else await Promise.allSettled(this.pendingOps);
|
|
102
|
-
n.log(`AsyncManager.allDone for ${t} op(s) in ${
|
|
106
|
+
n.log(`AsyncManager.allDone for ${t} op(s) in ${d() - r} ms`);
|
|
103
107
|
}
|
|
104
108
|
reset() {
|
|
105
109
|
this.pendingOps.clear(), this.onErrorHooks = [];
|
|
@@ -110,9 +114,9 @@ var f = d(({ level: e, msg: t, err: n, ...r }) => {
|
|
|
110
114
|
err: e
|
|
111
115
|
});
|
|
112
116
|
}
|
|
113
|
-
}(),
|
|
114
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
115
|
-
function
|
|
117
|
+
}(), h = /* @__PURE__ */ m.runInBackground.bind(m), te = (...e) => void 0, g = Object.entries;
|
|
118
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
|
|
119
|
+
function ne(e, t, n = {}) {
|
|
116
120
|
if (n.mutate) {
|
|
117
121
|
for (let n of Object.keys(e)) t.includes(n) || delete e[n];
|
|
118
122
|
return e;
|
|
@@ -130,7 +134,7 @@ function _(e, t, n = {}) {
|
|
|
130
134
|
for (let n of Object.keys(e)) t.includes(n) || (r[n] = e[n]);
|
|
131
135
|
return r;
|
|
132
136
|
}
|
|
133
|
-
function
|
|
137
|
+
function re(e, t = {}) {
|
|
134
138
|
return b(e, (e, t) => !!t, t);
|
|
135
139
|
}
|
|
136
140
|
function v(e, t = {}) {
|
|
@@ -141,11 +145,11 @@ function y(e, t = {}) {
|
|
|
141
145
|
}
|
|
142
146
|
function b(e, t, n = {}) {
|
|
143
147
|
if (n.mutate) {
|
|
144
|
-
for (let [n, r] of
|
|
148
|
+
for (let [n, r] of g(e)) t(n, r, e) || delete e[n];
|
|
145
149
|
return e;
|
|
146
150
|
}
|
|
147
151
|
let r = {};
|
|
148
|
-
for (let [n, i] of
|
|
152
|
+
for (let [n, i] of g(e)) t(n, i, e) && (r[n] = i);
|
|
149
153
|
return r;
|
|
150
154
|
}
|
|
151
155
|
function x(e, t) {
|
|
@@ -153,23 +157,27 @@ function x(e, t) {
|
|
|
153
157
|
for (let [r, i] of Object.entries(e)) n[t(r, i, e)] = i;
|
|
154
158
|
return n;
|
|
155
159
|
}
|
|
156
|
-
function
|
|
160
|
+
function S(e, t = {}) {
|
|
157
161
|
return b(e, (e, t) => !i(t), t);
|
|
158
162
|
}
|
|
159
|
-
function
|
|
160
|
-
for (let n of t) if (r(n)) for (let t of Object.keys(n)) t !== "__proto__" && t !== "constructor" && t !== "prototype" && (r(n[t]) ? (e[t] ||= {},
|
|
163
|
+
function C(e, ...t) {
|
|
164
|
+
for (let n of t) if (r(n)) for (let t of Object.keys(n)) t !== "__proto__" && t !== "constructor" && t !== "prototype" && (r(n[t]) ? (e[t] ||= {}, C(e[t], n[t])) : e[t] = n[t]);
|
|
161
165
|
return e;
|
|
162
166
|
}
|
|
163
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
164
|
-
function
|
|
167
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/env.js
|
|
168
|
+
function w() {
|
|
165
169
|
return !ie();
|
|
166
170
|
}
|
|
167
171
|
function ie() {
|
|
168
172
|
return typeof window < "u" && !!window?.document;
|
|
169
173
|
}
|
|
170
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
174
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
|
|
175
|
+
function T(e, t, n) {
|
|
176
|
+
return e <= t ? t : e >= n ? n : e;
|
|
177
|
+
}
|
|
178
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
|
|
171
179
|
var ae = /^\s*[{["\-\d]/;
|
|
172
|
-
function
|
|
180
|
+
function E(e, t) {
|
|
173
181
|
if (typeof e == "string" && e && ae.test(e)) try {
|
|
174
182
|
return JSON.parse(e, t);
|
|
175
183
|
} catch {}
|
|
@@ -179,41 +187,41 @@ function oe(e, t) {
|
|
|
179
187
|
try {
|
|
180
188
|
return JSON.parse(e, t);
|
|
181
189
|
} catch {
|
|
182
|
-
throw new
|
|
190
|
+
throw new z({ text: e });
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
186
|
-
function
|
|
193
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
|
|
194
|
+
function D(e, t, n = "...") {
|
|
187
195
|
if (!e || e.length <= t) return e;
|
|
188
196
|
if (t <= n.length) return n;
|
|
189
197
|
let r = Math.round((t - n.length) / 2), i = e.length - Math.floor((t - n.length) / 2);
|
|
190
198
|
return e.slice(0, r) + n + e.slice(i);
|
|
191
199
|
}
|
|
192
|
-
function
|
|
200
|
+
function O(e, t) {
|
|
193
201
|
let n = e.indexOf(t);
|
|
194
202
|
return e.slice(0, n === -1 ? void 0 : n);
|
|
195
203
|
}
|
|
196
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
197
|
-
function
|
|
204
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
|
|
205
|
+
function k(e, t = Error, n) {
|
|
198
206
|
let r;
|
|
199
|
-
return r = e instanceof t ? e : se(
|
|
207
|
+
return r = e instanceof t ? e : se(A(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
|
|
200
208
|
}
|
|
201
|
-
function
|
|
209
|
+
function A(e, t) {
|
|
202
210
|
let n;
|
|
203
|
-
return
|
|
211
|
+
return P(e) ? n = j(e) : (e = E(e), n = M(e) ? e.error : N(e) ? e : P(e) ? j(e) : {
|
|
204
212
|
name: "Error",
|
|
205
|
-
message:
|
|
213
|
+
message: G(e),
|
|
206
214
|
data: {}
|
|
207
215
|
}), Object.assign(n.data, t), n;
|
|
208
216
|
}
|
|
209
|
-
function
|
|
210
|
-
if (!(e instanceof Error) &&
|
|
217
|
+
function j(e) {
|
|
218
|
+
if (!(e instanceof Error) && N(e)) return e;
|
|
211
219
|
let t = {
|
|
212
220
|
name: e.name,
|
|
213
221
|
message: e.message,
|
|
214
222
|
data: { ...e.data }
|
|
215
223
|
};
|
|
216
|
-
return e.stack && (t.stack = e.stack), e.cause && (t.cause =
|
|
224
|
+
return e.stack && (t.stack = e.stack), e.cause && (t.cause = A(e.cause)), t;
|
|
217
225
|
}
|
|
218
226
|
function se(e, t = Error) {
|
|
219
227
|
if (e instanceof t) return e;
|
|
@@ -221,7 +229,7 @@ function se(e, t = Error) {
|
|
|
221
229
|
name: n,
|
|
222
230
|
cause: r
|
|
223
231
|
});
|
|
224
|
-
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof
|
|
232
|
+
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof I || (Object.defineProperties(i, {
|
|
225
233
|
name: {
|
|
226
234
|
value: n,
|
|
227
235
|
configurable: !0,
|
|
@@ -245,31 +253,31 @@ function se(e, t = Error) {
|
|
|
245
253
|
writable: !0
|
|
246
254
|
})), i;
|
|
247
255
|
}
|
|
248
|
-
function
|
|
256
|
+
function M(e) {
|
|
249
257
|
try {
|
|
250
|
-
return
|
|
258
|
+
return N(e?.error);
|
|
251
259
|
} catch {
|
|
252
260
|
return !1;
|
|
253
261
|
}
|
|
254
262
|
}
|
|
255
|
-
function
|
|
263
|
+
function N(e) {
|
|
256
264
|
try {
|
|
257
265
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string" && typeof e.data == "object";
|
|
258
266
|
} catch {
|
|
259
267
|
return !1;
|
|
260
268
|
}
|
|
261
269
|
}
|
|
262
|
-
function
|
|
270
|
+
function P(e) {
|
|
263
271
|
try {
|
|
264
272
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string";
|
|
265
273
|
} catch {
|
|
266
274
|
return !1;
|
|
267
275
|
}
|
|
268
276
|
}
|
|
269
|
-
function
|
|
270
|
-
return t ?
|
|
277
|
+
function F(e, t) {
|
|
278
|
+
return t ? k(e, void 0, t) : e;
|
|
271
279
|
}
|
|
272
|
-
var
|
|
280
|
+
var I = class e extends Error {
|
|
273
281
|
data;
|
|
274
282
|
cause;
|
|
275
283
|
static of(t) {
|
|
@@ -280,7 +288,7 @@ var P = class e extends Error {
|
|
|
280
288
|
}
|
|
281
289
|
constructor(e, t = {}, n = {}) {
|
|
282
290
|
super(e);
|
|
283
|
-
let { name: r =
|
|
291
|
+
let { name: r = w() ? this.constructor.name : "AppError", cause: i } = n;
|
|
284
292
|
Object.defineProperties(this, {
|
|
285
293
|
name: {
|
|
286
294
|
value: r,
|
|
@@ -294,7 +302,7 @@ var P = class e extends Error {
|
|
|
294
302
|
enumerable: !1
|
|
295
303
|
}
|
|
296
304
|
}), i ? Object.defineProperty(this, "cause", {
|
|
297
|
-
value:
|
|
305
|
+
value: A(i),
|
|
298
306
|
writable: !0,
|
|
299
307
|
configurable: !0,
|
|
300
308
|
enumerable: !0
|
|
@@ -304,43 +312,43 @@ var P = class e extends Error {
|
|
|
304
312
|
writable: !0
|
|
305
313
|
});
|
|
306
314
|
}
|
|
307
|
-
},
|
|
315
|
+
}, L = class extends I {
|
|
308
316
|
constructor(e, t, n) {
|
|
309
317
|
t.response && Object.defineProperty(t, "response", { enumerable: !1 }), super(e, t, {
|
|
310
318
|
...n,
|
|
311
319
|
name: "HttpRequestError"
|
|
312
320
|
});
|
|
313
321
|
}
|
|
314
|
-
},
|
|
322
|
+
}, R = class extends I {
|
|
315
323
|
constructor(e, t) {
|
|
316
324
|
super(e, t, { name: "AssertionError" });
|
|
317
325
|
}
|
|
318
|
-
},
|
|
326
|
+
}, z = class extends I {
|
|
319
327
|
constructor(e) {
|
|
320
|
-
let t = ["Failed to parse", e.text &&
|
|
328
|
+
let t = ["Failed to parse", e.text && D(e.text, 200)].filter(Boolean).join(": ");
|
|
321
329
|
super(t, e, { name: "JsonParseError" });
|
|
322
330
|
}
|
|
323
|
-
},
|
|
331
|
+
}, B = class extends I {
|
|
324
332
|
constructor(e, t, n) {
|
|
325
333
|
super(e, t, {
|
|
326
334
|
...n,
|
|
327
335
|
name: "TimeoutError"
|
|
328
336
|
});
|
|
329
337
|
}
|
|
330
|
-
},
|
|
338
|
+
}, V = class extends I {
|
|
331
339
|
constructor(e) {
|
|
332
340
|
super(e || "expected error was not thrown", {}, { name: "UnexpectedPassError" });
|
|
333
341
|
}
|
|
334
342
|
};
|
|
335
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
336
|
-
function
|
|
343
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
|
|
344
|
+
function H(e, t, n, r) {
|
|
337
345
|
try {
|
|
338
346
|
return JSON.stringify(e, t, n);
|
|
339
347
|
} catch {
|
|
340
|
-
return JSON.stringify(e,
|
|
348
|
+
return JSON.stringify(e, U(t, r), n);
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
|
-
function
|
|
351
|
+
function U(e, t) {
|
|
344
352
|
let n = [], r = [];
|
|
345
353
|
return t ??= (e, t) => n[0] === t ? "[Circular ~]" : "[Circular ~." + r.slice(0, n.indexOf(t)).join(".") + "]", function(i, a) {
|
|
346
354
|
if (n.length > 0) {
|
|
@@ -350,22 +358,22 @@ function z(e, t) {
|
|
|
350
358
|
return e == null ? a : e.call(this, i, a);
|
|
351
359
|
};
|
|
352
360
|
}
|
|
353
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
354
|
-
var
|
|
355
|
-
function
|
|
361
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
|
|
362
|
+
var W = H;
|
|
363
|
+
function G(e, t = {}) {
|
|
356
364
|
if (e === void 0) return "undefined";
|
|
357
365
|
if (e === null) return "null";
|
|
358
366
|
if (typeof e == "function") return "function";
|
|
359
367
|
if (typeof e == "symbol") return e.toString();
|
|
360
368
|
let n;
|
|
361
|
-
if (e =
|
|
362
|
-
if (e instanceof Error ||
|
|
369
|
+
if (e = E(e), M(e)) return G(e.error, t);
|
|
370
|
+
if (e instanceof Error || P(e)) n = K(e, t);
|
|
363
371
|
else if (typeof e == "string") n = e.trim() || "empty_string";
|
|
364
372
|
else if (typeof e == "number") n = String(e);
|
|
365
373
|
else {
|
|
366
374
|
e instanceof Map ? e = Object.fromEntries(e) : e instanceof Set && (e = Array.from(e));
|
|
367
375
|
try {
|
|
368
|
-
let { stringifyFn: r =
|
|
376
|
+
let { stringifyFn: r = W } = t;
|
|
369
377
|
n = r(e, void 0, 2);
|
|
370
378
|
} catch {
|
|
371
379
|
n = String(e);
|
|
@@ -373,28 +381,31 @@ function H(e, t = {}) {
|
|
|
373
381
|
}
|
|
374
382
|
if (n === void 0) return "undefined";
|
|
375
383
|
let { maxLen: r = 1e4 } = t;
|
|
376
|
-
return r && n.length > r ?
|
|
384
|
+
return r && n.length > r ? D(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
|
|
377
385
|
}
|
|
378
|
-
function
|
|
386
|
+
function K(e, t) {
|
|
379
387
|
let { includeErrorCause: n = !0 } = t, r = [e.name, e.message].filter(Boolean).join(": ");
|
|
380
|
-
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData &&
|
|
388
|
+
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && N(e) && Object.keys(e.data).length && (r += "\n" + G(e.data, t)), t.includeErrorStack && e.stack) {
|
|
381
389
|
let t = r.split("\n").length;
|
|
382
390
|
r = [r, ...e.stack.split("\n").slice(t)].join("\n");
|
|
383
391
|
}
|
|
384
|
-
return
|
|
392
|
+
return e instanceof AggregateError && e.errors.length && (r = [
|
|
385
393
|
r,
|
|
386
394
|
`${e.errors.length} error(s):`,
|
|
387
|
-
...e.errors.map((e, n) => `${n + 1}. ${
|
|
388
|
-
].join("\n")), e.cause && n && (r = r + "\nCaused by: " +
|
|
395
|
+
...e.errors.map((e, n) => `${n + 1}. ${G(e, t)}`)
|
|
396
|
+
].join("\n")), e.cause && n && (r = r + "\nCaused by: " + G(e.cause, t)), r;
|
|
397
|
+
}
|
|
398
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/error/assert.js
|
|
399
|
+
function ce(e, t, n) {
|
|
400
|
+
if (!e) throw new R(t || "condition failed", { ...n });
|
|
389
401
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
if (!(e instanceof t)) throw new ce(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
|
|
402
|
+
function le(e, t = Error) {
|
|
403
|
+
if (!(e instanceof t)) throw new R(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
|
|
393
404
|
}
|
|
394
405
|
function ue(e, t) {
|
|
395
406
|
if (!(e instanceof t)) throw e;
|
|
396
407
|
}
|
|
397
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
408
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
|
|
398
409
|
async function de(e, t) {
|
|
399
410
|
t?.aborted || await new Promise((n) => {
|
|
400
411
|
let r = setTimeout(i, e);
|
|
@@ -404,33 +415,19 @@ async function de(e, t) {
|
|
|
404
415
|
t?.addEventListener("abort", i);
|
|
405
416
|
});
|
|
406
417
|
}
|
|
407
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
408
|
-
function
|
|
409
|
-
return K(t - e);
|
|
410
|
-
}
|
|
411
|
-
function K(e) {
|
|
412
|
-
if (e < 1e3) return `${Math.round(e)} ms`;
|
|
413
|
-
if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
|
|
414
|
-
let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
|
|
415
|
-
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`;
|
|
416
|
-
}
|
|
417
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
|
|
418
|
-
function fe(e, t, n) {
|
|
419
|
-
return e <= t ? t : e >= n ? n : e;
|
|
420
|
-
}
|
|
421
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
|
|
422
|
-
async function pe(e, t) {
|
|
418
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
|
|
419
|
+
async function fe(e, t) {
|
|
423
420
|
let n = new AbortController(), { signal: r } = n;
|
|
424
421
|
if (!t.timeout) return await e(r);
|
|
425
422
|
let { timeout: i, name: a = e.name || "pTimeout function", onTimeout: o } = t, s = t.fakeError || /* @__PURE__ */ Error("TimeoutError");
|
|
426
423
|
return await new Promise(async (c, l) => {
|
|
427
424
|
let u = setTimeout(() => {
|
|
428
|
-
let e = new
|
|
425
|
+
let e = new B(`"${a}" timed out after ${i} ms`, t.errorData);
|
|
429
426
|
if (e.stack = s.stack.replace("Error: TimeoutError", "TimeoutError: " + e.message), o) {
|
|
430
427
|
try {
|
|
431
428
|
c(o(e));
|
|
432
429
|
} catch (e) {
|
|
433
|
-
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(
|
|
430
|
+
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(F(e, t.errorData));
|
|
434
431
|
}
|
|
435
432
|
n.abort(e);
|
|
436
433
|
} else l(e), n.abort(e);
|
|
@@ -444,8 +441,8 @@ async function pe(e, t) {
|
|
|
444
441
|
}
|
|
445
442
|
});
|
|
446
443
|
}
|
|
447
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
448
|
-
function
|
|
444
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
|
|
445
|
+
function pe(e, t) {
|
|
449
446
|
if (typeof e != "string") return null;
|
|
450
447
|
try {
|
|
451
448
|
return new URL(e, t || void 0);
|
|
@@ -453,21 +450,21 @@ function me(e, t) {
|
|
|
453
450
|
return null;
|
|
454
451
|
}
|
|
455
452
|
}
|
|
456
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
457
|
-
var
|
|
453
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
|
|
454
|
+
var me = [
|
|
458
455
|
"GET",
|
|
459
456
|
"POST",
|
|
460
457
|
"PUT",
|
|
461
458
|
"PATCH",
|
|
462
459
|
"DELETE",
|
|
463
|
-
"HEAD"
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
static
|
|
460
|
+
"HEAD",
|
|
461
|
+
"QUERY"
|
|
462
|
+
], q = 5, he = class e {
|
|
463
|
+
static VERSION = q;
|
|
464
|
+
static userAgent = /* @__PURE__ */ w() ? `fetcher/${q}` : void 0;
|
|
467
465
|
constructor(e = {}) {
|
|
468
|
-
if (typeof globalThis.fetch != "function") throw TypeError("globalThis.fetch is not available");
|
|
469
466
|
this.cfg = this.normalizeCfg(e);
|
|
470
|
-
for (let e of
|
|
467
|
+
for (let e of me) {
|
|
471
468
|
let t = e.toLowerCase();
|
|
472
469
|
this[`${t}Void`] = async (t, n) => await this.fetch({
|
|
473
470
|
url: t,
|
|
@@ -516,20 +513,23 @@ var he = [
|
|
|
516
513
|
put;
|
|
517
514
|
patch;
|
|
518
515
|
delete;
|
|
516
|
+
query;
|
|
519
517
|
getText;
|
|
520
518
|
postText;
|
|
521
519
|
putText;
|
|
522
520
|
patchText;
|
|
523
521
|
deleteText;
|
|
522
|
+
queryText;
|
|
524
523
|
getVoid;
|
|
525
524
|
postVoid;
|
|
526
525
|
putVoid;
|
|
527
526
|
patchVoid;
|
|
528
527
|
deleteVoid;
|
|
529
528
|
headVoid;
|
|
529
|
+
queryVoid;
|
|
530
530
|
async queryGraphQL(e) {
|
|
531
531
|
e = { ...e }, e.method ||= this.cfg.init.method;
|
|
532
|
-
let t =
|
|
532
|
+
let t = re({
|
|
533
533
|
query: e.query,
|
|
534
534
|
variables: e.variables
|
|
535
535
|
});
|
|
@@ -541,7 +541,7 @@ var he = [
|
|
|
541
541
|
if (n.err) throw n.err;
|
|
542
542
|
if (n.body.errors) {
|
|
543
543
|
let e = n.body.errors[0];
|
|
544
|
-
throw new
|
|
544
|
+
throw new L(e.message, {
|
|
545
545
|
...t,
|
|
546
546
|
errors: n.body.errors,
|
|
547
547
|
response: n.fetchResponse,
|
|
@@ -552,7 +552,7 @@ var he = [
|
|
|
552
552
|
requestSignature: n.signature,
|
|
553
553
|
requestName: n.req.requestName,
|
|
554
554
|
fetcherName: this.cfg.name,
|
|
555
|
-
requestDuration:
|
|
555
|
+
requestDuration: d() - n.req.started
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
let { data: r } = n.body;
|
|
@@ -584,12 +584,12 @@ var he = [
|
|
|
584
584
|
}
|
|
585
585
|
async expectError(e) {
|
|
586
586
|
let t = await this.doFetch(e);
|
|
587
|
-
if (!t.err) throw new
|
|
588
|
-
return
|
|
587
|
+
if (!t.err) throw new V("Fetch was expected to error");
|
|
588
|
+
return le(t.err, L), t.err;
|
|
589
589
|
}
|
|
590
590
|
async tryFetch(e) {
|
|
591
591
|
let t = await this.doFetch(e);
|
|
592
|
-
return t.err ? (ue(t.err,
|
|
592
|
+
return t.err ? (ue(t.err, L), [t.err, null]) : [null, t.body];
|
|
593
593
|
}
|
|
594
594
|
async doFetch(t) {
|
|
595
595
|
let n = 0;
|
|
@@ -601,9 +601,9 @@ var he = [
|
|
|
601
601
|
}
|
|
602
602
|
n = this.initGeneration;
|
|
603
603
|
}
|
|
604
|
-
let r = this.normalizeOptions(t), { logger: i } = this.cfg, { init: { method:
|
|
604
|
+
let r = this.normalizeOptions(t), { logger: i } = this.cfg, { init: { method: s } } = r, c = r.timeoutSeconds ? r.timeoutSeconds * 1e3 : void 0;
|
|
605
605
|
for (let e of this.cfg.hooks.beforeRequest || []) await e(r);
|
|
606
|
-
let l = r.fullUrl.includes("://") ? new URL(r.fullUrl) : void 0, u = [
|
|
606
|
+
let l = r.fullUrl.includes("://") ? new URL(r.fullUrl) : void 0, u = [s, l ? this.getShortUrl(l) : r.fullUrl].join(" "), f = {
|
|
607
607
|
req: r,
|
|
608
608
|
retryStatus: {
|
|
609
609
|
retryAttempt: 0,
|
|
@@ -612,9 +612,9 @@ var he = [
|
|
|
612
612
|
},
|
|
613
613
|
signature: u
|
|
614
614
|
};
|
|
615
|
-
for (; !
|
|
616
|
-
if (r.started =
|
|
617
|
-
let { retryAttempt: e } =
|
|
615
|
+
for (; !f.retryStatus.retryStopped;) {
|
|
616
|
+
if (r.started = d(), f.body = void 0, r.init.signal = o([a(c), t.signal]), r.logRequest) {
|
|
617
|
+
let { retryAttempt: e } = f.retryStatus;
|
|
618
618
|
i.log([
|
|
619
619
|
" >>",
|
|
620
620
|
u,
|
|
@@ -622,33 +622,33 @@ var he = [
|
|
|
622
622
|
].filter(Boolean).join(" ")), r.logRequestBody && r.init.body && i.log({ body: r.init.body });
|
|
623
623
|
}
|
|
624
624
|
try {
|
|
625
|
-
|
|
625
|
+
f.fetchResponse = await (r.overrideFetchFn || e.callNativeFetch)(r.fullUrl, r.init, r.fetchFn), f.ok = f.fetchResponse.ok, f.err = void 0;
|
|
626
626
|
} catch (e) {
|
|
627
|
-
|
|
627
|
+
f.err = k(e), f.ok = !1, f.fetchResponse = void 0;
|
|
628
628
|
}
|
|
629
|
-
if (
|
|
630
|
-
await
|
|
631
|
-
timeout:
|
|
629
|
+
if (f.statusFamily = this.getStatusFamily(f), f.statusCode = f.fetchResponse?.status, f.fetchResponse?.ok) try {
|
|
630
|
+
await fe(async () => await this.onOkResponse(f), {
|
|
631
|
+
timeout: c ?? 0,
|
|
632
632
|
name: "Fetcher.downloadBody"
|
|
633
633
|
});
|
|
634
634
|
} catch (e) {
|
|
635
|
-
|
|
635
|
+
f.err = k(e), f.ok = !1, await this.onNotOkResponse(f);
|
|
636
636
|
}
|
|
637
|
-
else await this.onNotOkResponse(
|
|
637
|
+
else await this.onNotOkResponse(f);
|
|
638
638
|
}
|
|
639
|
-
if (
|
|
640
|
-
|
|
641
|
-
for (let e of this.cfg.hooks.onError || []) await e(
|
|
639
|
+
if (f.err) {
|
|
640
|
+
F(f.err, r.errorData), r.onError?.(f.err);
|
|
641
|
+
for (let e of this.cfg.hooks.onError || []) await e(f.err);
|
|
642
642
|
}
|
|
643
|
-
for (let e of this.cfg.hooks.afterResponse || []) await e(
|
|
644
|
-
return
|
|
643
|
+
for (let e of this.cfg.hooks.afterResponse || []) await e(f);
|
|
644
|
+
return f.err && await this.detectStaleInit(t, f, n) ? await this.doFetch({
|
|
645
645
|
...t,
|
|
646
|
-
[
|
|
647
|
-
}) :
|
|
646
|
+
[J]: !0
|
|
647
|
+
}) : f;
|
|
648
648
|
}
|
|
649
649
|
async detectStaleInit(e, t, n) {
|
|
650
650
|
let { shouldReinit: r, init: i } = this.cfg.hooks;
|
|
651
|
-
return !r || !i || e[
|
|
651
|
+
return !r || !i || e[J] || !await r(t) ? !1 : (n === this.initGeneration && this.resetInit(), !0);
|
|
652
652
|
}
|
|
653
653
|
async runInitHooks() {
|
|
654
654
|
for (let e of this.cfg.hooks.init || []) await e(this.cfg);
|
|
@@ -660,12 +660,7 @@ var he = [
|
|
|
660
660
|
let n = await e.fetchResponse.text();
|
|
661
661
|
n ? (e.body = n, e.body = oe(n, t.jsonReviver)) : e.body = {};
|
|
662
662
|
} else e.body = {};
|
|
663
|
-
} else
|
|
664
|
-
else if (n === "arrayBuffer") e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0);
|
|
665
|
-
else if (n === "bytes") e.body = e.fetchResponse.body ? new Uint8Array(await e.fetchResponse.arrayBuffer()) : /* @__PURE__ */ new Uint8Array();
|
|
666
|
-
else if (n === "blob") e.body = e.fetchResponse.body ? await e.fetchResponse.blob() : new Blob();
|
|
667
|
-
else if (n === "void") await e.fetchResponse.body?.cancel();
|
|
668
|
-
else if (n === "readableStream" && (e.body = e.fetchResponse.body, e.body === null)) throw Error("fetchResponse.body is null");
|
|
663
|
+
} else n === "text" ? e.body = e.fetchResponse.body ? await e.fetchResponse.text() : "" : n === "arrayBuffer" ? e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0) : n === "bytes" ? e.body = e.fetchResponse.body ? new Uint8Array(await e.fetchResponse.arrayBuffer()) : /* @__PURE__ */ new Uint8Array() : n === "blob" ? e.body = e.fetchResponse.body ? await e.fetchResponse.blob() : new Blob() : n === "void" ? await e.fetchResponse.body?.cancel() : n === "readableStream" && (e.body = e.fetchResponse.body, ce(e.body !== null, "fetchResponse.body is null"));
|
|
669
664
|
if (e.retryStatus.retryStopped = !0, t.logResponse) {
|
|
670
665
|
let { retryAttempt: n } = e.retryStatus, { logger: r } = this.cfg;
|
|
671
666
|
r.log([
|
|
@@ -673,7 +668,7 @@ var he = [
|
|
|
673
668
|
e.fetchResponse.status,
|
|
674
669
|
e.signature,
|
|
675
670
|
n && `try#${n + 1}/${t.retry.count + 1}`,
|
|
676
|
-
|
|
671
|
+
l(e.req.started)
|
|
677
672
|
].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log({ body: e.body });
|
|
678
673
|
}
|
|
679
674
|
}
|
|
@@ -683,15 +678,15 @@ var he = [
|
|
|
683
678
|
async onNotOkResponse(e) {
|
|
684
679
|
let t;
|
|
685
680
|
if (!e.body && e.fetchResponse) try {
|
|
686
|
-
e.body =
|
|
681
|
+
e.body = E(await e.fetchResponse.text());
|
|
687
682
|
} catch {}
|
|
688
|
-
t = e.err ?
|
|
683
|
+
t = e.err ? j(e.err) : e.body ? A(e.body) : {
|
|
689
684
|
name: "Error",
|
|
690
685
|
message: "Fetch failed",
|
|
691
686
|
data: {}
|
|
692
687
|
};
|
|
693
688
|
let n = e.fetchResponse?.status || 0;
|
|
694
|
-
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new
|
|
689
|
+
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new L([e.statusCode, e.signature].filter(Boolean).join(" "), v({
|
|
695
690
|
response: e.fetchResponse,
|
|
696
691
|
responseStatusCode: n,
|
|
697
692
|
requestUrl: e.req.fullUrl,
|
|
@@ -700,7 +695,7 @@ var he = [
|
|
|
700
695
|
requestSignature: e.signature,
|
|
701
696
|
requestName: e.req.requestName,
|
|
702
697
|
fetcherName: this.cfg.name,
|
|
703
|
-
requestDuration:
|
|
698
|
+
requestDuration: d() - e.req.started
|
|
704
699
|
}), { cause: t }), await this.processRetry(e);
|
|
705
700
|
}
|
|
706
701
|
async processRetry(e) {
|
|
@@ -714,13 +709,13 @@ var he = [
|
|
|
714
709
|
e.fetchResponse?.status || 0,
|
|
715
710
|
e.signature,
|
|
716
711
|
n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
|
|
717
|
-
|
|
712
|
+
l(e.req.started)
|
|
718
713
|
].filter(Boolean).join(" "),
|
|
719
714
|
err: e.err.cause || e.err
|
|
720
715
|
}), t.retryStopped) return;
|
|
721
716
|
t.retryAttempt++;
|
|
722
717
|
let a = this.getRetryTimeout(e);
|
|
723
|
-
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout =
|
|
718
|
+
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = T(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${u(a)}`), await de(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0));
|
|
724
719
|
}
|
|
725
720
|
getRetryTimeout(e) {
|
|
726
721
|
let t = 0;
|
|
@@ -728,10 +723,10 @@ var he = [
|
|
|
728
723
|
let n = e.fetchResponse.headers.get("retry-after") ?? e.fetchResponse.headers.get("x-ratelimit-reset");
|
|
729
724
|
if (n) {
|
|
730
725
|
let e = Number(n);
|
|
731
|
-
if (e) t = e > 10 ** 9 ? e * 1e3 -
|
|
726
|
+
if (e) t = e > 10 ** 9 ? e * 1e3 - d() : e * 1e3;
|
|
732
727
|
else {
|
|
733
728
|
let e = new Date(n);
|
|
734
|
-
Number.isNaN(e.getTime()) || (t = e.getTime() -
|
|
729
|
+
Number.isNaN(e.getTime()) || (t = e.getTime() - d());
|
|
735
730
|
}
|
|
736
731
|
this.cfg.logger.log(`retry-after: ${n}`), t || this.cfg.logger.warn("retry-after could not be parsed");
|
|
737
732
|
}
|
|
@@ -764,7 +759,7 @@ var he = [
|
|
|
764
759
|
return this.cfg.logWithSearchParams || (n = n.split("?")[0]), !this.cfg.logWithBaseUrl && t && n.startsWith(t) && (n = n.slice(t.length)), n;
|
|
765
760
|
}
|
|
766
761
|
normalizeCfg(t) {
|
|
767
|
-
let { debug: n = !1, logger: r =
|
|
762
|
+
let { debug: n = !1, logger: r = p } = t, i = C({
|
|
768
763
|
baseUrl: "",
|
|
769
764
|
name: this.getFetcherName(t),
|
|
770
765
|
inputUrl: "",
|
|
@@ -781,9 +776,9 @@ var he = [
|
|
|
781
776
|
logRequestBody: n,
|
|
782
777
|
logResponse: n,
|
|
783
778
|
logResponseBody: n,
|
|
784
|
-
logWithBaseUrl:
|
|
779
|
+
logWithBaseUrl: w(),
|
|
785
780
|
logWithSearchParams: !0,
|
|
786
|
-
retry: { ...
|
|
781
|
+
retry: { ...ve },
|
|
787
782
|
init: {
|
|
788
783
|
method: t.method || "GET",
|
|
789
784
|
headers: v({
|
|
@@ -812,14 +807,14 @@ var he = [
|
|
|
812
807
|
getFetcherName(e) {
|
|
813
808
|
let { name: t } = e;
|
|
814
809
|
if (!t && e.baseUrl) {
|
|
815
|
-
let n =
|
|
810
|
+
let n = pe(e.baseUrl);
|
|
816
811
|
n && (t = n.hostname);
|
|
817
812
|
}
|
|
818
813
|
return t;
|
|
819
814
|
}
|
|
820
815
|
normalizeOptions(t) {
|
|
821
816
|
let n = {
|
|
822
|
-
...
|
|
817
|
+
...ne(this.cfg, [
|
|
823
818
|
"timeoutSeconds",
|
|
824
819
|
"retryPost",
|
|
825
820
|
"retry3xx",
|
|
@@ -837,7 +832,7 @@ var he = [
|
|
|
837
832
|
"fetchFn",
|
|
838
833
|
"overrideFetchFn"
|
|
839
834
|
]),
|
|
840
|
-
started:
|
|
835
|
+
started: d(),
|
|
841
836
|
..._(t, [
|
|
842
837
|
"method",
|
|
843
838
|
"headers",
|
|
@@ -849,7 +844,7 @@ var he = [
|
|
|
849
844
|
...this.cfg.retry,
|
|
850
845
|
...y(t.retry || {})
|
|
851
846
|
},
|
|
852
|
-
init:
|
|
847
|
+
init: C({
|
|
853
848
|
...this.cfg.init,
|
|
854
849
|
headers: {
|
|
855
850
|
...this.cfg.init.headers,
|
|
@@ -875,13 +870,13 @@ var he = [
|
|
|
875
870
|
let e = new URLSearchParams(i).toString();
|
|
876
871
|
n.fullUrl += (n.fullUrl.includes("?") ? "&" : "?") + e;
|
|
877
872
|
}
|
|
878
|
-
return t.json === void 0 ? t.text === void 0 ? t.form ? t.form instanceof URLSearchParams || t.form instanceof FormData ? n.init.body = t.form : (n.init.body = new URLSearchParams(t.form), n.init.headers["content-type"] ||= "application/x-www-form-urlencoded") : t.body !== void 0 && (n.init.body = t.body) : (n.init.body = t.text, n.init.headers["content-type"] ||= "text/plain") : (n.init.body = JSON.stringify(t.json), n.init.headers["content-type"] ||= "application/json"), n.init.headers.accept ||=
|
|
873
|
+
return t.json === void 0 ? t.text === void 0 ? t.form ? t.form instanceof URLSearchParams || t.form instanceof FormData ? n.init.body = t.form : (n.init.body = new URLSearchParams(t.form), n.init.headers["content-type"] ||= "application/x-www-form-urlencoded") : t.body !== void 0 && (n.init.body = t.body) : (n.init.body = t.text, n.init.headers["content-type"] ||= "text/plain") : (n.init.body = JSON.stringify(t.json), n.init.headers["content-type"] ||= "application/json"), n.init.headers.accept ||= _e[n.responseType], n;
|
|
879
874
|
}
|
|
880
875
|
};
|
|
881
|
-
function
|
|
882
|
-
return
|
|
876
|
+
function ge(e = {}) {
|
|
877
|
+
return he.create(e);
|
|
883
878
|
}
|
|
884
|
-
var
|
|
879
|
+
var J = Symbol("reinitAttempted"), _e = {
|
|
885
880
|
text: "text/plain",
|
|
886
881
|
json: "application/json",
|
|
887
882
|
void: "*/*",
|
|
@@ -889,84 +884,83 @@ var q = Symbol("reinitAttempted"), ve = {
|
|
|
889
884
|
arrayBuffer: "application/octet-stream",
|
|
890
885
|
bytes: "application/octet-stream",
|
|
891
886
|
blob: "application/octet-stream"
|
|
892
|
-
},
|
|
887
|
+
}, ve = {
|
|
893
888
|
count: 2,
|
|
894
889
|
timeout: 1e3,
|
|
895
890
|
timeoutMax: 3e4,
|
|
896
891
|
timeoutMultiplier: 2,
|
|
897
892
|
maxRetryAfter: 6e5
|
|
898
|
-
},
|
|
893
|
+
}, ye = {
|
|
899
894
|
"https://www.naturalcycles.com/": [
|
|
900
895
|
{
|
|
901
896
|
pathIncludes: "shop",
|
|
902
|
-
conversionScrubber: (e) =>
|
|
897
|
+
conversionScrubber: (e) => Y(e, "/shop")
|
|
903
898
|
},
|
|
904
899
|
{
|
|
905
900
|
pathIncludes: "research-library",
|
|
906
|
-
conversionScrubber: (e) =>
|
|
901
|
+
conversionScrubber: (e) => Y(e, "/research-library")
|
|
907
902
|
},
|
|
908
903
|
{ pathIncludes: "plan-pregnancy" },
|
|
909
904
|
{ pathIncludes: "postpartum" },
|
|
910
905
|
{
|
|
911
906
|
pathIncludes: "cyclematters/period-calculator",
|
|
912
|
-
conversionScrubber: (e) =>
|
|
907
|
+
conversionScrubber: (e) => O(e, "/period-calculator")
|
|
913
908
|
},
|
|
914
909
|
{
|
|
915
910
|
pathIncludes: "cyclematters/search",
|
|
916
|
-
conversionScrubber: (e) =>
|
|
911
|
+
conversionScrubber: (e) => Y(e, "/cyclematters/search")
|
|
917
912
|
},
|
|
918
913
|
{
|
|
919
914
|
pathIncludes: "cyclematters/perimenopause-quiz",
|
|
920
|
-
conversionScrubber: (e) =>
|
|
915
|
+
conversionScrubber: (e) => O(e, "/perimenopause-quiz")
|
|
921
916
|
}
|
|
922
917
|
],
|
|
923
918
|
"https://www.naturalcycles.me/": [],
|
|
924
919
|
"https://signup.naturalcycles.com/": [{ pathIncludes: "account" }, {
|
|
925
920
|
pathIncludes: "onboarding",
|
|
926
|
-
conversionScrubber: (e) =>
|
|
921
|
+
conversionScrubber: (e) => Y(e, "/onboarding")
|
|
927
922
|
}],
|
|
928
923
|
"https://se.naturalcycles.com/": [],
|
|
929
924
|
"https://br.naturalcycles.com/": [],
|
|
930
925
|
"https://uk.naturalcycles.com/": []
|
|
931
926
|
};
|
|
932
|
-
function
|
|
927
|
+
function Y(e, t) {
|
|
933
928
|
let n = e.indexOf(t);
|
|
934
929
|
return n === -1 ? null : e.slice(0, n + t.length);
|
|
935
930
|
}
|
|
936
|
-
var
|
|
931
|
+
var be = {
|
|
937
932
|
"http://localhost:8000": "https://www.naturalcycles.com/",
|
|
938
933
|
"http://localhost:8001": "https://www.naturalcycles.me/",
|
|
939
934
|
"http://localhost:4200": "https://signup.naturalcycles.com/"
|
|
940
|
-
},
|
|
935
|
+
}, xe = [
|
|
941
936
|
"https://www.naturalcycles.com/",
|
|
942
937
|
"https://www.naturalcycles.me/",
|
|
943
938
|
"https://signup.naturalcycles.com/",
|
|
944
939
|
"https://se.naturalcycles.com/",
|
|
945
940
|
"https://br.naturalcycles.com/",
|
|
946
941
|
"https://uk.naturalcycles.com/"
|
|
947
|
-
],
|
|
942
|
+
], X;
|
|
948
943
|
(function(e) {
|
|
949
|
-
e.flow = "flow", e.code = "code", e.refId = "refId", e.referral = "referral", e.ignoreConfirmation = "ignoreConfirmation", e.ic = "ic", e.measuringDevice = "measuringDevice", e.irclickid = "irclickid", e.fg = "fg", e.sfg = "sfg", e.sq = "sq", e.cbo = "cbo", e.ip = "ip", e.ipv = "ipv", e.appleAuth = "appleAuth", e.googleAuth = "googleAuth", e.od = "od", e.pl = "pl", e.ScCid = "ScCid", e.fbclid = "fbclid", e.ttclid = "ttclid", e.
|
|
950
|
-
})(
|
|
951
|
-
var
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
Y.epik
|
|
944
|
+
e.flow = "flow", e.code = "code", e.refId = "refId", e.referral = "referral", e.ignoreConfirmation = "ignoreConfirmation", e.ic = "ic", e.measuringDevice = "measuringDevice", e.irclickid = "irclickid", e.fg = "fg", e.sfg = "sfg", e.sq = "sq", e.cbo = "cbo", e.ip = "ip", e.ipv = "ipv", e.appleAuth = "appleAuth", e.googleAuth = "googleAuth", e.od = "od", e.pl = "pl", e.ScCid = "ScCid", e.fbclid = "fbclid", e.ttclid = "ttclid", e.epik = "epik", e.adid = "adid", e.wcf = "wcf", e.we = "we", e.werr = "werr", e.wdpm = "wdpm", e.wsc = "wsc", e.ral = "ral", e.dpm = "dpm";
|
|
945
|
+
})(X ||= {});
|
|
946
|
+
var Se = [
|
|
947
|
+
X.ScCid,
|
|
948
|
+
X.irclickid,
|
|
949
|
+
X.fbclid,
|
|
950
|
+
X.ttclid,
|
|
951
|
+
X.epik
|
|
958
952
|
];
|
|
959
|
-
|
|
960
|
-
var
|
|
953
|
+
X.flow, X.code, X.ignoreConfirmation, X.ic, X.fg, X.sfg, X.sq, X.cbo, X.ip, X.ipv, X.od, X.pl, X.wcf, X.we, X.wdpm, X.wsc, X.ral, X.dpm;
|
|
954
|
+
var Ce;
|
|
961
955
|
(function(e) {
|
|
962
|
-
e[e.OURA = 1] = "OURA", e[e.APPLE_WATCH = 2] = "APPLE_WATCH", e[e.META_LANDING_PAGE = 3] = "META_LANDING_PAGE", e[e.PAYMENT_REDIRECT_FROM_APP = 4] = "PAYMENT_REDIRECT_FROM_APP", e[e.B1 = 5] = "B1", e[e.EMAIL_VERIFICATION_REDIRECT = 6] = "EMAIL_VERIFICATION_REDIRECT", e[e.WHOOP = 7] = "WHOOP";
|
|
963
|
-
})(
|
|
956
|
+
e[e.OURA = 1] = "OURA", e[e.APPLE_WATCH = 2] = "APPLE_WATCH", e[e.META_LANDING_PAGE = 3] = "META_LANDING_PAGE", e[e.PAYMENT_REDIRECT_FROM_APP = 4] = "PAYMENT_REDIRECT_FROM_APP", e[e.B1 = 5] = "B1", e[e.EMAIL_VERIFICATION_REDIRECT = 6] = "EMAIL_VERIFICATION_REDIRECT", e[e.WHOOP = 7] = "WHOOP", e[e.B2 = 8] = "B2", e[e.R1 = 9] = "R1";
|
|
957
|
+
})(Ce ||= {});
|
|
964
958
|
var Z = new class {
|
|
965
959
|
scrubPathname(e, t) {
|
|
966
|
-
let n =
|
|
960
|
+
let n = xe.find((t) => t === `${e}/`) || be[e];
|
|
967
961
|
if (!n) return null;
|
|
968
962
|
let r = t;
|
|
969
|
-
for (let e of
|
|
963
|
+
for (let e of ye[n]) if (r.includes(e.pathIncludes) && (r = e.conversionScrubber?.(r) ?? null, r === null)) return null;
|
|
970
964
|
return r;
|
|
971
965
|
}
|
|
972
966
|
}(), Q = new class {
|
|
@@ -1019,7 +1013,7 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1019
1013
|
...e,
|
|
1020
1014
|
enabled: e.enabled ?? !0,
|
|
1021
1015
|
onError: e.onError ?? te
|
|
1022
|
-
}, this.fetcher =
|
|
1016
|
+
}, this.fetcher = ge({ baseUrl: e.url });
|
|
1023
1017
|
}
|
|
1024
1018
|
cfg;
|
|
1025
1019
|
fetcher;
|
|
@@ -1031,7 +1025,7 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1031
1025
|
pageView(e, t = {}) {
|
|
1032
1026
|
if (!this.cfg.enabled || !this.hasMarketingConsent(e)) return;
|
|
1033
1027
|
let n = Z.scrubPathname(globalThis.location.origin, e.pathname);
|
|
1034
|
-
n !== null &&
|
|
1028
|
+
n !== null && h(this.send("p", {
|
|
1035
1029
|
...e,
|
|
1036
1030
|
pathname: n
|
|
1037
1031
|
}, t));
|
|
@@ -1039,7 +1033,7 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1039
1033
|
purchase(e, t = {}) {
|
|
1040
1034
|
if (!this.cfg.enabled || !this.hasMarketingConsent(e)) return;
|
|
1041
1035
|
let n = Z.scrubPathname(globalThis.location.origin, e.pathname);
|
|
1042
|
-
n !== null &&
|
|
1036
|
+
n !== null && h(this.send("purchase", {
|
|
1043
1037
|
...e,
|
|
1044
1038
|
pathname: n
|
|
1045
1039
|
}, t));
|
|
@@ -1062,19 +1056,18 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1062
1056
|
});
|
|
1063
1057
|
r.err && this.cfg.onError(r.err);
|
|
1064
1058
|
} catch (e) {
|
|
1065
|
-
this.cfg.onError(
|
|
1059
|
+
this.cfg.onError(k(e));
|
|
1066
1060
|
}
|
|
1067
1061
|
}
|
|
1068
1062
|
getHeaders(e) {
|
|
1069
1063
|
let t = String(this.cfg.clientId);
|
|
1070
|
-
return e.marketingConsent ? this.tryOrReport(() => (this.cfg.enabled && this.storeClickIds(),
|
|
1064
|
+
return e.marketingConsent ? this.tryOrReport(() => (this.cfg.enabled && this.storeClickIds(), S({
|
|
1071
1065
|
clientId: t,
|
|
1072
|
-
fbc: Q.getCookie("_fbc") || $(Q.getCookie(
|
|
1066
|
+
fbc: Q.getCookie("_fbc") || $(Q.getCookie(X.fbclid)),
|
|
1073
1067
|
fbp: Q.getCookie("_fbp"),
|
|
1074
|
-
scCid: Q.getCookie(
|
|
1075
|
-
ttclid: Q.getCookie(
|
|
1076
|
-
|
|
1077
|
-
epik: Q.getCookie("_epik") || Q.getCookie(Y.epik),
|
|
1068
|
+
scCid: Q.getCookie(X.ScCid),
|
|
1069
|
+
ttclid: Q.getCookie(X.ttclid),
|
|
1070
|
+
epik: Q.getCookie("_epik") || Q.getCookie(X.epik),
|
|
1078
1071
|
uuid_c1: Q.getCookie("_scid") || Q.getCookie("uuid_c1")
|
|
1079
1072
|
})), { clientId: t }) : { clientId: t };
|
|
1080
1073
|
}
|
|
@@ -1087,7 +1080,7 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1087
1080
|
try {
|
|
1088
1081
|
return e();
|
|
1089
1082
|
} catch (e) {
|
|
1090
|
-
return this.cfg.onError(
|
|
1083
|
+
return this.cfg.onError(k(e)), t;
|
|
1091
1084
|
}
|
|
1092
1085
|
}
|
|
1093
1086
|
captureClickIds() {
|
|
@@ -1095,16 +1088,16 @@ var Te = 30, Ee = 200, De = 20, Oe = class {
|
|
|
1095
1088
|
if (e === this.lastCapturedHref) return;
|
|
1096
1089
|
this.lastCapturedHref = e;
|
|
1097
1090
|
let n = new URLSearchParams(t);
|
|
1098
|
-
for (let e of
|
|
1091
|
+
for (let e of Se) {
|
|
1099
1092
|
let t = n.get(e) || n.get(e.toLowerCase());
|
|
1100
1093
|
if (!t) continue;
|
|
1101
|
-
let r = e ===
|
|
1094
|
+
let r = e === X.fbclid ? this.toFbc(t) : t.slice(0, Ee);
|
|
1102
1095
|
r && (this.pendingClickIds[e] = r);
|
|
1103
1096
|
}
|
|
1104
1097
|
}
|
|
1105
1098
|
toFbc(e) {
|
|
1106
1099
|
let t = we(e);
|
|
1107
|
-
if (!(!t || t.length < De) && !(this.pendingClickIds[
|
|
1100
|
+
if (!(!t || t.length < De) && !(this.pendingClickIds[X.fbclid] || Q.getCookie(X.fbclid))?.endsWith(`.${t}`)) return $(t);
|
|
1108
1101
|
}
|
|
1109
1102
|
};
|
|
1110
1103
|
export { Oe as ConversionClient, t as generateConversionEventId };
|