@purepageio/fetch-engines 0.2.7 → 0.2.9

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/dist/index.cjs CHANGED
@@ -5,12 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function __require() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
8
  var __export = (target, all) => {
15
9
  for (var name in all)
16
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -33,1565 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
27
  ));
34
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
29
 
36
- // node_modules/.pnpm/tsup@8.4.0_postcss@8.5.3_typescript@5.8.2/node_modules/tsup/assets/cjs_shims.js
37
- var init_cjs_shims = __esm({
38
- "node_modules/.pnpm/tsup@8.4.0_postcss@8.5.3_typescript@5.8.2/node_modules/tsup/assets/cjs_shims.js"() {
39
- "use strict";
40
- }
41
- });
42
-
43
- // ../node_modules/ms/index.js
44
- var require_ms = __commonJS({
45
- "../node_modules/ms/index.js"(exports2, module2) {
46
- "use strict";
47
- init_cjs_shims();
48
- var s = 1e3;
49
- var m = s * 60;
50
- var h = m * 60;
51
- var d = h * 24;
52
- var w = d * 7;
53
- var y = d * 365.25;
54
- module2.exports = function(val, options) {
55
- options = options || {};
56
- var type = typeof val;
57
- if (type === "string" && val.length > 0) {
58
- return parse2(val);
59
- } else if (type === "number" && isFinite(val)) {
60
- return options.long ? fmtLong(val) : fmtShort(val);
61
- }
62
- throw new Error(
63
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
64
- );
65
- };
66
- function parse2(str) {
67
- str = String(str);
68
- if (str.length > 100) {
69
- return;
70
- }
71
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
72
- str
73
- );
74
- if (!match) {
75
- return;
76
- }
77
- var n = parseFloat(match[1]);
78
- var type = (match[2] || "ms").toLowerCase();
79
- switch (type) {
80
- case "years":
81
- case "year":
82
- case "yrs":
83
- case "yr":
84
- case "y":
85
- return n * y;
86
- case "weeks":
87
- case "week":
88
- case "w":
89
- return n * w;
90
- case "days":
91
- case "day":
92
- case "d":
93
- return n * d;
94
- case "hours":
95
- case "hour":
96
- case "hrs":
97
- case "hr":
98
- case "h":
99
- return n * h;
100
- case "minutes":
101
- case "minute":
102
- case "mins":
103
- case "min":
104
- case "m":
105
- return n * m;
106
- case "seconds":
107
- case "second":
108
- case "secs":
109
- case "sec":
110
- case "s":
111
- return n * s;
112
- case "milliseconds":
113
- case "millisecond":
114
- case "msecs":
115
- case "msec":
116
- case "ms":
117
- return n;
118
- default:
119
- return void 0;
120
- }
121
- }
122
- function fmtShort(ms) {
123
- var msAbs = Math.abs(ms);
124
- if (msAbs >= d) {
125
- return Math.round(ms / d) + "d";
126
- }
127
- if (msAbs >= h) {
128
- return Math.round(ms / h) + "h";
129
- }
130
- if (msAbs >= m) {
131
- return Math.round(ms / m) + "m";
132
- }
133
- if (msAbs >= s) {
134
- return Math.round(ms / s) + "s";
135
- }
136
- return ms + "ms";
137
- }
138
- function fmtLong(ms) {
139
- var msAbs = Math.abs(ms);
140
- if (msAbs >= d) {
141
- return plural(ms, msAbs, d, "day");
142
- }
143
- if (msAbs >= h) {
144
- return plural(ms, msAbs, h, "hour");
145
- }
146
- if (msAbs >= m) {
147
- return plural(ms, msAbs, m, "minute");
148
- }
149
- if (msAbs >= s) {
150
- return plural(ms, msAbs, s, "second");
151
- }
152
- return ms + " ms";
153
- }
154
- function plural(ms, msAbs, n, name) {
155
- var isPlural = msAbs >= n * 1.5;
156
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
157
- }
158
- }
159
- });
160
-
161
- // ../node_modules/debug/src/common.js
162
- var require_common = __commonJS({
163
- "../node_modules/debug/src/common.js"(exports2, module2) {
164
- "use strict";
165
- init_cjs_shims();
166
- function setup(env) {
167
- createDebug.debug = createDebug;
168
- createDebug.default = createDebug;
169
- createDebug.coerce = coerce;
170
- createDebug.disable = disable;
171
- createDebug.enable = enable;
172
- createDebug.enabled = enabled;
173
- createDebug.humanize = require_ms();
174
- createDebug.destroy = destroy;
175
- Object.keys(env).forEach((key) => {
176
- createDebug[key] = env[key];
177
- });
178
- createDebug.names = [];
179
- createDebug.skips = [];
180
- createDebug.formatters = {};
181
- function selectColor(namespace) {
182
- let hash = 0;
183
- for (let i = 0; i < namespace.length; i++) {
184
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
185
- hash |= 0;
186
- }
187
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
188
- }
189
- createDebug.selectColor = selectColor;
190
- function createDebug(namespace) {
191
- let prevTime;
192
- let enableOverride = null;
193
- let namespacesCache;
194
- let enabledCache;
195
- function debug2(...args) {
196
- if (!debug2.enabled) {
197
- return;
198
- }
199
- const self = debug2;
200
- const curr = Number(/* @__PURE__ */ new Date());
201
- const ms = curr - (prevTime || curr);
202
- self.diff = ms;
203
- self.prev = prevTime;
204
- self.curr = curr;
205
- prevTime = curr;
206
- args[0] = createDebug.coerce(args[0]);
207
- if (typeof args[0] !== "string") {
208
- args.unshift("%O");
209
- }
210
- let index = 0;
211
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
212
- if (match === "%%") {
213
- return "%";
214
- }
215
- index++;
216
- const formatter = createDebug.formatters[format];
217
- if (typeof formatter === "function") {
218
- const val = args[index];
219
- match = formatter.call(self, val);
220
- args.splice(index, 1);
221
- index--;
222
- }
223
- return match;
224
- });
225
- createDebug.formatArgs.call(self, args);
226
- const logFn = self.log || createDebug.log;
227
- logFn.apply(self, args);
228
- }
229
- debug2.namespace = namespace;
230
- debug2.useColors = createDebug.useColors();
231
- debug2.color = createDebug.selectColor(namespace);
232
- debug2.extend = extend;
233
- debug2.destroy = createDebug.destroy;
234
- Object.defineProperty(debug2, "enabled", {
235
- enumerable: true,
236
- configurable: false,
237
- get: () => {
238
- if (enableOverride !== null) {
239
- return enableOverride;
240
- }
241
- if (namespacesCache !== createDebug.namespaces) {
242
- namespacesCache = createDebug.namespaces;
243
- enabledCache = createDebug.enabled(namespace);
244
- }
245
- return enabledCache;
246
- },
247
- set: (v) => {
248
- enableOverride = v;
249
- }
250
- });
251
- if (typeof createDebug.init === "function") {
252
- createDebug.init(debug2);
253
- }
254
- return debug2;
255
- }
256
- function extend(namespace, delimiter) {
257
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
258
- newDebug.log = this.log;
259
- return newDebug;
260
- }
261
- function enable(namespaces) {
262
- createDebug.save(namespaces);
263
- createDebug.namespaces = namespaces;
264
- createDebug.names = [];
265
- createDebug.skips = [];
266
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
267
- for (const ns of split) {
268
- if (ns[0] === "-") {
269
- createDebug.skips.push(ns.slice(1));
270
- } else {
271
- createDebug.names.push(ns);
272
- }
273
- }
274
- }
275
- function matchesTemplate(search, template) {
276
- let searchIndex = 0;
277
- let templateIndex = 0;
278
- let starIndex = -1;
279
- let matchIndex = 0;
280
- while (searchIndex < search.length) {
281
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
282
- if (template[templateIndex] === "*") {
283
- starIndex = templateIndex;
284
- matchIndex = searchIndex;
285
- templateIndex++;
286
- } else {
287
- searchIndex++;
288
- templateIndex++;
289
- }
290
- } else if (starIndex !== -1) {
291
- templateIndex = starIndex + 1;
292
- matchIndex++;
293
- searchIndex = matchIndex;
294
- } else {
295
- return false;
296
- }
297
- }
298
- while (templateIndex < template.length && template[templateIndex] === "*") {
299
- templateIndex++;
300
- }
301
- return templateIndex === template.length;
302
- }
303
- function disable() {
304
- const namespaces = [
305
- ...createDebug.names,
306
- ...createDebug.skips.map((namespace) => "-" + namespace)
307
- ].join(",");
308
- createDebug.enable("");
309
- return namespaces;
310
- }
311
- function enabled(name) {
312
- for (const skip of createDebug.skips) {
313
- if (matchesTemplate(name, skip)) {
314
- return false;
315
- }
316
- }
317
- for (const ns of createDebug.names) {
318
- if (matchesTemplate(name, ns)) {
319
- return true;
320
- }
321
- }
322
- return false;
323
- }
324
- function coerce(val) {
325
- if (val instanceof Error) {
326
- return val.stack || val.message;
327
- }
328
- return val;
329
- }
330
- function destroy() {
331
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
332
- }
333
- createDebug.enable(createDebug.load());
334
- return createDebug;
335
- }
336
- module2.exports = setup;
337
- }
338
- });
339
-
340
- // ../node_modules/debug/src/browser.js
341
- var require_browser = __commonJS({
342
- "../node_modules/debug/src/browser.js"(exports2, module2) {
343
- "use strict";
344
- init_cjs_shims();
345
- exports2.formatArgs = formatArgs;
346
- exports2.save = save;
347
- exports2.load = load;
348
- exports2.useColors = useColors;
349
- exports2.storage = localstorage();
350
- exports2.destroy = /* @__PURE__ */ (() => {
351
- let warned = false;
352
- return () => {
353
- if (!warned) {
354
- warned = true;
355
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
356
- }
357
- };
358
- })();
359
- exports2.colors = [
360
- "#0000CC",
361
- "#0000FF",
362
- "#0033CC",
363
- "#0033FF",
364
- "#0066CC",
365
- "#0066FF",
366
- "#0099CC",
367
- "#0099FF",
368
- "#00CC00",
369
- "#00CC33",
370
- "#00CC66",
371
- "#00CC99",
372
- "#00CCCC",
373
- "#00CCFF",
374
- "#3300CC",
375
- "#3300FF",
376
- "#3333CC",
377
- "#3333FF",
378
- "#3366CC",
379
- "#3366FF",
380
- "#3399CC",
381
- "#3399FF",
382
- "#33CC00",
383
- "#33CC33",
384
- "#33CC66",
385
- "#33CC99",
386
- "#33CCCC",
387
- "#33CCFF",
388
- "#6600CC",
389
- "#6600FF",
390
- "#6633CC",
391
- "#6633FF",
392
- "#66CC00",
393
- "#66CC33",
394
- "#9900CC",
395
- "#9900FF",
396
- "#9933CC",
397
- "#9933FF",
398
- "#99CC00",
399
- "#99CC33",
400
- "#CC0000",
401
- "#CC0033",
402
- "#CC0066",
403
- "#CC0099",
404
- "#CC00CC",
405
- "#CC00FF",
406
- "#CC3300",
407
- "#CC3333",
408
- "#CC3366",
409
- "#CC3399",
410
- "#CC33CC",
411
- "#CC33FF",
412
- "#CC6600",
413
- "#CC6633",
414
- "#CC9900",
415
- "#CC9933",
416
- "#CCCC00",
417
- "#CCCC33",
418
- "#FF0000",
419
- "#FF0033",
420
- "#FF0066",
421
- "#FF0099",
422
- "#FF00CC",
423
- "#FF00FF",
424
- "#FF3300",
425
- "#FF3333",
426
- "#FF3366",
427
- "#FF3399",
428
- "#FF33CC",
429
- "#FF33FF",
430
- "#FF6600",
431
- "#FF6633",
432
- "#FF9900",
433
- "#FF9933",
434
- "#FFCC00",
435
- "#FFCC33"
436
- ];
437
- function useColors() {
438
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
439
- return true;
440
- }
441
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
442
- return false;
443
- }
444
- let m;
445
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
446
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
447
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
448
- typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
449
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
450
- }
451
- function formatArgs(args) {
452
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
453
- if (!this.useColors) {
454
- return;
455
- }
456
- const c = "color: " + this.color;
457
- args.splice(1, 0, c, "color: inherit");
458
- let index = 0;
459
- let lastC = 0;
460
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
461
- if (match === "%%") {
462
- return;
463
- }
464
- index++;
465
- if (match === "%c") {
466
- lastC = index;
467
- }
468
- });
469
- args.splice(lastC, 0, c);
470
- }
471
- exports2.log = console.debug || console.log || (() => {
472
- });
473
- function save(namespaces) {
474
- try {
475
- if (namespaces) {
476
- exports2.storage.setItem("debug", namespaces);
477
- } else {
478
- exports2.storage.removeItem("debug");
479
- }
480
- } catch (error) {
481
- }
482
- }
483
- function load() {
484
- let r;
485
- try {
486
- r = exports2.storage.getItem("debug");
487
- } catch (error) {
488
- }
489
- if (!r && typeof process !== "undefined" && "env" in process) {
490
- r = process.env.DEBUG;
491
- }
492
- return r;
493
- }
494
- function localstorage() {
495
- try {
496
- return localStorage;
497
- } catch (error) {
498
- }
499
- }
500
- module2.exports = require_common()(exports2);
501
- var { formatters } = module2.exports;
502
- formatters.j = function(v) {
503
- try {
504
- return JSON.stringify(v);
505
- } catch (error) {
506
- return "[UnexpectedJSONParseError]: " + error.message;
507
- }
508
- };
509
- }
510
- });
511
-
512
- // ../node_modules/debug/src/node.js
513
- var require_node = __commonJS({
514
- "../node_modules/debug/src/node.js"(exports2, module2) {
515
- "use strict";
516
- init_cjs_shims();
517
- var tty = require("tty");
518
- var util = require("util");
519
- exports2.init = init;
520
- exports2.log = log;
521
- exports2.formatArgs = formatArgs;
522
- exports2.save = save;
523
- exports2.load = load;
524
- exports2.useColors = useColors;
525
- exports2.destroy = util.deprecate(
526
- () => {
527
- },
528
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
529
- );
530
- exports2.colors = [6, 2, 3, 4, 5, 1];
531
- try {
532
- const supportsColor = require("supports-color");
533
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
534
- exports2.colors = [
535
- 20,
536
- 21,
537
- 26,
538
- 27,
539
- 32,
540
- 33,
541
- 38,
542
- 39,
543
- 40,
544
- 41,
545
- 42,
546
- 43,
547
- 44,
548
- 45,
549
- 56,
550
- 57,
551
- 62,
552
- 63,
553
- 68,
554
- 69,
555
- 74,
556
- 75,
557
- 76,
558
- 77,
559
- 78,
560
- 79,
561
- 80,
562
- 81,
563
- 92,
564
- 93,
565
- 98,
566
- 99,
567
- 112,
568
- 113,
569
- 128,
570
- 129,
571
- 134,
572
- 135,
573
- 148,
574
- 149,
575
- 160,
576
- 161,
577
- 162,
578
- 163,
579
- 164,
580
- 165,
581
- 166,
582
- 167,
583
- 168,
584
- 169,
585
- 170,
586
- 171,
587
- 172,
588
- 173,
589
- 178,
590
- 179,
591
- 184,
592
- 185,
593
- 196,
594
- 197,
595
- 198,
596
- 199,
597
- 200,
598
- 201,
599
- 202,
600
- 203,
601
- 204,
602
- 205,
603
- 206,
604
- 207,
605
- 208,
606
- 209,
607
- 214,
608
- 215,
609
- 220,
610
- 221
611
- ];
612
- }
613
- } catch (error) {
614
- }
615
- exports2.inspectOpts = Object.keys(process.env).filter((key) => {
616
- return /^debug_/i.test(key);
617
- }).reduce((obj, key) => {
618
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
619
- return k.toUpperCase();
620
- });
621
- let val = process.env[key];
622
- if (/^(yes|on|true|enabled)$/i.test(val)) {
623
- val = true;
624
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
625
- val = false;
626
- } else if (val === "null") {
627
- val = null;
628
- } else {
629
- val = Number(val);
630
- }
631
- obj[prop] = val;
632
- return obj;
633
- }, {});
634
- function useColors() {
635
- return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
636
- }
637
- function formatArgs(args) {
638
- const { namespace: name, useColors: useColors2 } = this;
639
- if (useColors2) {
640
- const c = this.color;
641
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
642
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
643
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
644
- args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
645
- } else {
646
- args[0] = getDate() + name + " " + args[0];
647
- }
648
- }
649
- function getDate() {
650
- if (exports2.inspectOpts.hideDate) {
651
- return "";
652
- }
653
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
654
- }
655
- function log(...args) {
656
- return process.stderr.write(util.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
657
- }
658
- function save(namespaces) {
659
- if (namespaces) {
660
- process.env.DEBUG = namespaces;
661
- } else {
662
- delete process.env.DEBUG;
663
- }
664
- }
665
- function load() {
666
- return process.env.DEBUG;
667
- }
668
- function init(debug2) {
669
- debug2.inspectOpts = {};
670
- const keys = Object.keys(exports2.inspectOpts);
671
- for (let i = 0; i < keys.length; i++) {
672
- debug2.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
673
- }
674
- }
675
- module2.exports = require_common()(exports2);
676
- var { formatters } = module2.exports;
677
- formatters.o = function(v) {
678
- this.inspectOpts.colors = this.useColors;
679
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
680
- };
681
- formatters.O = function(v) {
682
- this.inspectOpts.colors = this.useColors;
683
- return util.inspect(v, this.inspectOpts);
684
- };
685
- }
686
- });
687
-
688
- // ../node_modules/debug/src/index.js
689
- var require_src = __commonJS({
690
- "../node_modules/debug/src/index.js"(exports2, module2) {
691
- "use strict";
692
- init_cjs_shims();
693
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
694
- module2.exports = require_browser();
695
- } else {
696
- module2.exports = require_node();
697
- }
698
- }
699
- });
700
-
701
- // ../node_modules/arr-union/index.js
702
- var require_arr_union = __commonJS({
703
- "../node_modules/arr-union/index.js"(exports2, module2) {
704
- "use strict";
705
- init_cjs_shims();
706
- module2.exports = function union(init) {
707
- if (!Array.isArray(init)) {
708
- throw new TypeError("arr-union expects the first argument to be an array.");
709
- }
710
- var len = arguments.length;
711
- var i = 0;
712
- while (++i < len) {
713
- var arg = arguments[i];
714
- if (!arg) continue;
715
- if (!Array.isArray(arg)) {
716
- arg = [arg];
717
- }
718
- for (var j = 0; j < arg.length; j++) {
719
- var ele = arg[j];
720
- if (init.indexOf(ele) >= 0) {
721
- continue;
722
- }
723
- init.push(ele);
724
- }
725
- }
726
- return init;
727
- };
728
- }
729
- });
730
-
731
- // ../node_modules/lazy-cache/index.js
732
- var require_lazy_cache = __commonJS({
733
- "../node_modules/lazy-cache/index.js"(exports2, module2) {
734
- "use strict";
735
- init_cjs_shims();
736
- function lazyCache(fn) {
737
- var cache = {};
738
- var proxy = function(mod, name) {
739
- name = name || camelcase(mod);
740
- if (process.env.UNLAZY === "true" || process.env.UNLAZY === true || process.env.TRAVIS) {
741
- cache[name] = fn(mod);
742
- }
743
- Object.defineProperty(proxy, name, {
744
- enumerable: true,
745
- configurable: true,
746
- get: getter
747
- });
748
- function getter() {
749
- if (cache.hasOwnProperty(name)) {
750
- return cache[name];
751
- }
752
- return cache[name] = fn(mod);
753
- }
754
- return getter;
755
- };
756
- return proxy;
757
- }
758
- function camelcase(str) {
759
- if (str.length === 1) {
760
- return str.toLowerCase();
761
- }
762
- str = str.replace(/^[\W_]+|[\W_]+$/g, "").toLowerCase();
763
- return str.replace(/[\W_]+(\w|$)/g, function(_, ch) {
764
- return ch.toUpperCase();
765
- });
766
- }
767
- module2.exports = lazyCache;
768
- }
769
- });
770
-
771
- // ../node_modules/for-in/index.js
772
- var require_for_in = __commonJS({
773
- "../node_modules/for-in/index.js"(exports2, module2) {
774
- "use strict";
775
- init_cjs_shims();
776
- module2.exports = function forIn(obj, fn, thisArg) {
777
- for (var key in obj) {
778
- if (fn.call(thisArg, obj[key], key, obj) === false) {
779
- break;
780
- }
781
- }
782
- };
783
- }
784
- });
785
-
786
- // ../node_modules/for-own/index.js
787
- var require_for_own = __commonJS({
788
- "../node_modules/for-own/index.js"(exports2, module2) {
789
- "use strict";
790
- init_cjs_shims();
791
- var forIn = require_for_in();
792
- var hasOwn = Object.prototype.hasOwnProperty;
793
- module2.exports = function forOwn(obj, fn, thisArg) {
794
- forIn(obj, function(val, key) {
795
- if (hasOwn.call(obj, key)) {
796
- return fn.call(thisArg, obj[key], key, obj);
797
- }
798
- });
799
- };
800
- }
801
- });
802
-
803
- // ../node_modules/clone-deep/utils.js
804
- var require_utils = __commonJS({
805
- "../node_modules/clone-deep/utils.js"(exports2, module2) {
806
- "use strict";
807
- init_cjs_shims();
808
- var utils = require_lazy_cache()(require);
809
- var fn = require;
810
- require = utils;
811
- require("is-plain-object", "isObject");
812
- require("shallow-clone", "clone");
813
- require("kind-of", "typeOf");
814
- require_for_own();
815
- require = fn;
816
- module2.exports = utils;
817
- }
818
- });
819
-
820
- // ../node_modules/clone-deep/index.js
821
- var require_clone_deep = __commonJS({
822
- "../node_modules/clone-deep/index.js"(exports2, module2) {
823
- "use strict";
824
- init_cjs_shims();
825
- var utils = require_utils();
826
- function cloneDeep(val, instanceClone) {
827
- switch (utils.typeOf(val)) {
828
- case "object":
829
- return cloneObjectDeep(val, instanceClone);
830
- case "array":
831
- return cloneArrayDeep(val, instanceClone);
832
- default:
833
- return utils.clone(val);
834
- }
835
- }
836
- function cloneObjectDeep(obj, instanceClone) {
837
- if (utils.isObject(obj)) {
838
- var res = {};
839
- utils.forOwn(obj, function(obj2, key) {
840
- this[key] = cloneDeep(obj2, instanceClone);
841
- }, res);
842
- return res;
843
- } else if (instanceClone) {
844
- return instanceClone(obj);
845
- } else {
846
- return obj;
847
- }
848
- }
849
- function cloneArrayDeep(arr, instanceClone) {
850
- var len = arr.length, res = [];
851
- var i = -1;
852
- while (++i < len) {
853
- res[i] = cloneDeep(arr[i], instanceClone);
854
- }
855
- return res;
856
- }
857
- module2.exports = cloneDeep;
858
- }
859
- });
860
-
861
- // ../node_modules/is-buffer/index.js
862
- var require_is_buffer = __commonJS({
863
- "../node_modules/is-buffer/index.js"(exports2, module2) {
864
- "use strict";
865
- init_cjs_shims();
866
- module2.exports = function(obj) {
867
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
868
- };
869
- function isBuffer(obj) {
870
- return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
871
- }
872
- function isSlowBuffer(obj) {
873
- return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0));
874
- }
875
- }
876
- });
877
-
878
- // ../node_modules/kind-of/index.js
879
- var require_kind_of = __commonJS({
880
- "../node_modules/kind-of/index.js"(exports2, module2) {
881
- "use strict";
882
- init_cjs_shims();
883
- var isBuffer = require_is_buffer();
884
- var toString = Object.prototype.toString;
885
- module2.exports = function kindOf(val) {
886
- if (typeof val === "undefined") {
887
- return "undefined";
888
- }
889
- if (val === null) {
890
- return "null";
891
- }
892
- if (val === true || val === false || val instanceof Boolean) {
893
- return "boolean";
894
- }
895
- if (typeof val === "string" || val instanceof String) {
896
- return "string";
897
- }
898
- if (typeof val === "number" || val instanceof Number) {
899
- return "number";
900
- }
901
- if (typeof val === "function" || val instanceof Function) {
902
- return "function";
903
- }
904
- if (typeof Array.isArray !== "undefined" && Array.isArray(val)) {
905
- return "array";
906
- }
907
- if (val instanceof RegExp) {
908
- return "regexp";
909
- }
910
- if (val instanceof Date) {
911
- return "date";
912
- }
913
- var type = toString.call(val);
914
- if (type === "[object RegExp]") {
915
- return "regexp";
916
- }
917
- if (type === "[object Date]") {
918
- return "date";
919
- }
920
- if (type === "[object Arguments]") {
921
- return "arguments";
922
- }
923
- if (type === "[object Error]") {
924
- return "error";
925
- }
926
- if (isBuffer(val)) {
927
- return "buffer";
928
- }
929
- if (type === "[object Set]") {
930
- return "set";
931
- }
932
- if (type === "[object WeakSet]") {
933
- return "weakset";
934
- }
935
- if (type === "[object Map]") {
936
- return "map";
937
- }
938
- if (type === "[object WeakMap]") {
939
- return "weakmap";
940
- }
941
- if (type === "[object Symbol]") {
942
- return "symbol";
943
- }
944
- if (type === "[object Int8Array]") {
945
- return "int8array";
946
- }
947
- if (type === "[object Uint8Array]") {
948
- return "uint8array";
949
- }
950
- if (type === "[object Uint8ClampedArray]") {
951
- return "uint8clampedarray";
952
- }
953
- if (type === "[object Int16Array]") {
954
- return "int16array";
955
- }
956
- if (type === "[object Uint16Array]") {
957
- return "uint16array";
958
- }
959
- if (type === "[object Int32Array]") {
960
- return "int32array";
961
- }
962
- if (type === "[object Uint32Array]") {
963
- return "uint32array";
964
- }
965
- if (type === "[object Float32Array]") {
966
- return "float32array";
967
- }
968
- if (type === "[object Float64Array]") {
969
- return "float64array";
970
- }
971
- return "object";
972
- };
973
- }
974
- });
975
-
976
- // ../node_modules/merge-deep/index.js
977
- var require_merge_deep = __commonJS({
978
- "../node_modules/merge-deep/index.js"(exports2, module2) {
979
- "use strict";
980
- init_cjs_shims();
981
- var union = require_arr_union();
982
- var clone = require_clone_deep();
983
- var typeOf = require_kind_of();
984
- module2.exports = function mergeDeep(orig, objects) {
985
- if (!isObject(orig) && !Array.isArray(orig)) {
986
- orig = {};
987
- }
988
- var target = clone(orig);
989
- var len = arguments.length;
990
- var idx = 0;
991
- while (++idx < len) {
992
- var val = arguments[idx];
993
- if (isObject(val) || Array.isArray(val)) {
994
- merge2(target, val);
995
- }
996
- }
997
- return target;
998
- };
999
- function merge2(target, obj) {
1000
- for (var key in obj) {
1001
- if (!isValidKey(key) || !hasOwn(obj, key)) {
1002
- continue;
1003
- }
1004
- var oldVal = obj[key];
1005
- var newVal = target[key];
1006
- if (isObject(newVal) && isObject(oldVal)) {
1007
- target[key] = merge2(newVal, oldVal);
1008
- } else if (Array.isArray(newVal)) {
1009
- target[key] = union([], newVal, oldVal);
1010
- } else {
1011
- target[key] = clone(oldVal);
1012
- }
1013
- }
1014
- return target;
1015
- }
1016
- function hasOwn(obj, key) {
1017
- return Object.prototype.hasOwnProperty.call(obj, key);
1018
- }
1019
- function isObject(val) {
1020
- return typeOf(val) === "object" || typeOf(val) === "function";
1021
- }
1022
- function isValidKey(key) {
1023
- return key !== "__proto__" && key !== "constructor" && key !== "prototype";
1024
- }
1025
- }
1026
- });
1027
-
1028
- // ../node_modules/puppeteer-extra-plugin/dist/index.esm.js
1029
- var index_esm_exports = {};
1030
- __export(index_esm_exports, {
1031
- PuppeteerExtraPlugin: () => PuppeteerExtraPlugin
1032
- });
1033
- var import_debug, merge, PuppeteerExtraPlugin;
1034
- var init_index_esm = __esm({
1035
- "../node_modules/puppeteer-extra-plugin/dist/index.esm.js"() {
1036
- "use strict";
1037
- init_cjs_shims();
1038
- import_debug = __toESM(require_src());
1039
- merge = require_merge_deep();
1040
- PuppeteerExtraPlugin = class {
1041
- constructor(opts) {
1042
- this._debugBase = (0, import_debug.default)(`puppeteer-extra-plugin:base:${this.name}`);
1043
- this._childClassMembers = [];
1044
- this._opts = merge(this.defaults, opts || {});
1045
- this._debugBase("Initialized.");
1046
- }
1047
- /**
1048
- * Plugin name (required).
1049
- *
1050
- * Convention:
1051
- * - Package: `puppeteer-extra-plugin-anonymize-ua`
1052
- * - Name: `anonymize-ua`
1053
- *
1054
- * @example
1055
- * get name () { return 'anonymize-ua' }
1056
- */
1057
- get name() {
1058
- throw new Error('Plugin must override "name"');
1059
- }
1060
- /**
1061
- * Plugin defaults (optional).
1062
- *
1063
- * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation).
1064
- *
1065
- * The result of merging defaults with user supplied options can be accessed through `this.opts`.
1066
- *
1067
- * @see [[opts]]
1068
- *
1069
- * @example
1070
- * get defaults () {
1071
- * return {
1072
- * stripHeadless: true,
1073
- * makeWindows: true,
1074
- * customFn: null
1075
- * }
1076
- * }
1077
- *
1078
- * // Users can overwrite plugin defaults during instantiation:
1079
- * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))
1080
- */
1081
- get defaults() {
1082
- return {};
1083
- }
1084
- /**
1085
- * Plugin requirements (optional).
1086
- *
1087
- * Signal certain plugin requirements to the base class and the user.
1088
- *
1089
- * Currently supported:
1090
- * - `launch`
1091
- * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`),
1092
- * will output a warning to the user.
1093
- * - `headful`
1094
- * - If the plugin doesn't work in `headless: true` mode,
1095
- * will output a warning to the user.
1096
- * - `dataFromPlugins`
1097
- * - In case the plugin requires data from other plugins.
1098
- * will enable usage of `this.getDataFromPlugins()`.
1099
- * - `runLast`
1100
- * - In case the plugin prefers to run after the others.
1101
- * Useful when the plugin needs data from others.
1102
- *
1103
- * @example
1104
- * get requirements () {
1105
- * return new Set(['runLast', 'dataFromPlugins'])
1106
- * }
1107
- */
1108
- get requirements() {
1109
- return /* @__PURE__ */ new Set([]);
1110
- }
1111
- /**
1112
- * Plugin dependencies (optional).
1113
- *
1114
- * Missing plugins will be required() by puppeteer-extra.
1115
- *
1116
- * @example
1117
- * get dependencies () {
1118
- * return new Set(['user-preferences'])
1119
- * }
1120
- * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.
1121
- */
1122
- get dependencies() {
1123
- return /* @__PURE__ */ new Set([]);
1124
- }
1125
- /**
1126
- * Plugin data (optional).
1127
- *
1128
- * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,
1129
- * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`).
1130
- *
1131
- * Convention: `[ {name: 'Any name', value: 'Any value'} ]`
1132
- *
1133
- * @see [[getDataFromPlugins]]
1134
- *
1135
- * @example
1136
- * // plugin1.js
1137
- * get data () {
1138
- * return [
1139
- * {
1140
- * name: 'userPreferences',
1141
- * value: { foo: 'bar' }
1142
- * },
1143
- * {
1144
- * name: 'userPreferences',
1145
- * value: { hello: 'world' }
1146
- * }
1147
- * ]
1148
- *
1149
- * // plugin2.js
1150
- * get requirements () { return new Set(['dataFromPlugins']) }
1151
- *
1152
- * async beforeLaunch () {
1153
- * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value)
1154
- * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ]
1155
- * }
1156
- */
1157
- get data() {
1158
- return [];
1159
- }
1160
- /**
1161
- * Access the plugin options (usually the `defaults` merged with user defined options)
1162
- *
1163
- * To skip the auto-merging of defaults with user supplied opts don't define a `defaults`
1164
- * property and set the `this._opts` Object in your plugin constructor directly.
1165
- *
1166
- * @see [[defaults]]
1167
- *
1168
- * @example
1169
- * get defaults () { return { foo: "bar" } }
1170
- *
1171
- * async onPageCreated (page) {
1172
- * this.debug(this.opts.foo) // => bar
1173
- * }
1174
- */
1175
- get opts() {
1176
- return this._opts;
1177
- }
1178
- /**
1179
- * Convenience debug logger based on the [debug] module.
1180
- * Will automatically namespace the logging output to the plugin package name.
1181
- * [debug]: https://www.npmjs.com/package/debug
1182
- *
1183
- * ```bash
1184
- * # toggle output using environment variables
1185
- * DEBUG=puppeteer-extra-plugin:<plugin_name> node foo.js
1186
- * # to debug all the things:
1187
- * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js
1188
- * ```
1189
- *
1190
- * @example
1191
- * this.debug('hello world')
1192
- * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'
1193
- */
1194
- get debug() {
1195
- return (0, import_debug.default)(`puppeteer-extra-plugin:${this.name}`);
1196
- }
1197
- /**
1198
- * Before a new browser instance is created/launched.
1199
- *
1200
- * Can be used to modify the puppeteer launch options by modifying or returning them.
1201
- *
1202
- * Plugins using this method will be called in sequence to each
1203
- * be able to update the launch options.
1204
- *
1205
- * @example
1206
- * async beforeLaunch (options) {
1207
- * if (this.opts.flashPluginPath) {
1208
- * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`)
1209
- * }
1210
- * }
1211
- *
1212
- * @param options - Puppeteer launch options
1213
- */
1214
- async beforeLaunch(options) {
1215
- }
1216
- /**
1217
- * After the browser has launched.
1218
- *
1219
- * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
1220
- * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created.
1221
- * In order to make the plugins as stateless as possible don't store a reference to the browser instance
1222
- * in the plugin but rather consider alternatives.
1223
- *
1224
- * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`.
1225
- *
1226
- * Alternatively you could expose a class method that takes a browser instance as a parameter to work with:
1227
- *
1228
- * ```es6
1229
- * const fancyPlugin = require('puppeteer-extra-plugin-fancy')()
1230
- * puppeteer.use(fancyPlugin)
1231
- * const browser = await puppeteer.launch()
1232
- * await fancyPlugin.killBrowser(browser)
1233
- * ```
1234
- *
1235
- * @param browser - The `puppeteer` browser instance.
1236
- * @param opts.options - Puppeteer launch options used.
1237
- *
1238
- * @example
1239
- * async afterLaunch (browser, opts) {
1240
- * this.debug('browser has been launched', opts.options)
1241
- * }
1242
- */
1243
- async afterLaunch(browser, opts = { options: {} }) {
1244
- }
1245
- /**
1246
- * Before connecting to an existing browser instance.
1247
- *
1248
- * Can be used to modify the puppeteer connect options by modifying or returning them.
1249
- *
1250
- * Plugins using this method will be called in sequence to each
1251
- * be able to update the launch options.
1252
- *
1253
- * @param {Object} options - Puppeteer connect options
1254
- * @return {Object=}
1255
- */
1256
- async beforeConnect(options) {
1257
- }
1258
- /**
1259
- * After connecting to an existing browser instance.
1260
- *
1261
- * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
1262
- *
1263
- * @param browser - The `puppeteer` browser instance.
1264
- * @param {Object} opts
1265
- * @param {Object} opts.options - Puppeteer connect options used.
1266
- *
1267
- */
1268
- async afterConnect(browser, opts = {}) {
1269
- }
1270
- /**
1271
- * Called when a browser instance is available.
1272
- *
1273
- * This applies to both `puppeteer.launch()` and `puppeteer.connect()`.
1274
- *
1275
- * Convenience method created for plugins that need access to a browser instance
1276
- * and don't mind if it has been created through `launch` or `connect`.
1277
- *
1278
- * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
1279
- *
1280
- * @param browser - The `puppeteer` browser instance.
1281
- */
1282
- async onBrowser(browser, opts) {
1283
- }
1284
- /**
1285
- * Called when a target is created, for example when a new page is opened by window.open or browser.newPage.
1286
- *
1287
- * > Note: This includes target creations in incognito browser contexts.
1288
- *
1289
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
1290
- *
1291
- * @param {Puppeteer.Target} target
1292
- */
1293
- async onTargetCreated(target) {
1294
- }
1295
- /**
1296
- * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience.
1297
- *
1298
- * > Note: This includes page creations in incognito browser contexts.
1299
- *
1300
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
1301
- *
1302
- * @param {Puppeteer.Target} target
1303
- *
1304
- * @example
1305
- * async onPageCreated (page) {
1306
- * let ua = await page.browser().userAgent()
1307
- * if (this.opts.stripHeadless) {
1308
- * ua = ua.replace('HeadlessChrome/', 'Chrome/')
1309
- * }
1310
- * this.debug('new ua', ua)
1311
- * await page.setUserAgent(ua)
1312
- * }
1313
- */
1314
- async onPageCreated(page) {
1315
- }
1316
- /**
1317
- * Called when the url of a target changes.
1318
- *
1319
- * > Note: This includes target changes in incognito browser contexts.
1320
- *
1321
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
1322
- *
1323
- * @param {Puppeteer.Target} target
1324
- */
1325
- async onTargetChanged(target) {
1326
- }
1327
- /**
1328
- * Called when a target is destroyed, for example when a page is closed.
1329
- *
1330
- * > Note: This includes target destructions in incognito browser contexts.
1331
- *
1332
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
1333
- *
1334
- * @param {Puppeteer.Target} target
1335
- */
1336
- async onTargetDestroyed(target) {
1337
- }
1338
- /**
1339
- * Called when Puppeteer gets disconnected from the Chromium instance.
1340
- *
1341
- * This might happen because of one of the following:
1342
- * - Chromium is closed or crashed
1343
- * - The `browser.disconnect` method was called
1344
- */
1345
- async onDisconnected() {
1346
- }
1347
- /**
1348
- * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved
1349
- * and should be used instead of `onClose`.
1350
- *
1351
- * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios.
1352
- * In order for plugins to clean up properly (e.g. deleting temporary files)
1353
- * the `onClose` method had been introduced.
1354
- *
1355
- * > Note: Might be called multiple times on exit.
1356
- *
1357
- * > Note: This only includes browser instances created through `.launch()`.
1358
- */
1359
- async onClose() {
1360
- }
1361
- /**
1362
- * After the plugin has been registered in `puppeteer-extra`.
1363
- *
1364
- * Normally right after `puppeteer.use(plugin)` is called
1365
- */
1366
- async onPluginRegistered() {
1367
- }
1368
- /**
1369
- * Helper method to retrieve `data` objects from other plugins.
1370
- *
1371
- * A plugin needs to state the `dataFromPlugins` requirement
1372
- * in order to use this method. Will be mapped to `puppeteer.getPluginData`.
1373
- *
1374
- * @param name - Filter data by `name` property
1375
- *
1376
- * @see [data]
1377
- * @see [requirements]
1378
- */
1379
- getDataFromPlugins(name) {
1380
- return [];
1381
- }
1382
- /**
1383
- * Will match plugin dependencies against all currently registered plugins.
1384
- * Is being called by `puppeteer-extra` and used to require missing dependencies.
1385
- *
1386
- * @param {Array<Object>} plugins
1387
- * @return {Set} - list of missing plugin names
1388
- *
1389
- * @private
1390
- */
1391
- _getMissingDependencies(plugins) {
1392
- const pluginNames = new Set(plugins.map((p) => p.name));
1393
- const missing = new Set(Array.from(this.dependencies.values()).filter((x) => !pluginNames.has(x)));
1394
- return missing;
1395
- }
1396
- /**
1397
- * Conditionally bind browser/process events to class members.
1398
- * The idea is to reduce event binding boilerplate in plugins.
1399
- *
1400
- * For efficiency we make sure the plugin is using the respective event
1401
- * by checking the child class members before registering the listener.
1402
- *
1403
- * @param {<Puppeteer.Browser>} browser
1404
- * @param {Object} opts - Options
1405
- * @param {string} opts.context - Puppeteer context (launch/connect)
1406
- * @param {Object} [opts.options] - Puppeteer launch or connect options
1407
- * @param {Array<string>} [opts.defaultArgs] - The default flags that Chromium will be launched with
1408
- *
1409
- * @private
1410
- */
1411
- async _bindBrowserEvents(browser, opts = {}) {
1412
- if (this._hasChildClassMember("onTargetCreated") || this._hasChildClassMember("onPageCreated")) {
1413
- browser.on("targetcreated", this._onTargetCreated.bind(this));
1414
- }
1415
- if (this._hasChildClassMember("onTargetChanged") && this.onTargetChanged) {
1416
- browser.on("targetchanged", this.onTargetChanged.bind(this));
1417
- }
1418
- if (this._hasChildClassMember("onTargetDestroyed") && this.onTargetDestroyed) {
1419
- browser.on("targetdestroyed", this.onTargetDestroyed.bind(this));
1420
- }
1421
- if (this._hasChildClassMember("onDisconnected") && this.onDisconnected) {
1422
- browser.on("disconnected", this.onDisconnected.bind(this));
1423
- }
1424
- if (opts.context === "launch" && this._hasChildClassMember("onClose")) {
1425
- if (this.onClose) {
1426
- process.on("exit", this.onClose.bind(this));
1427
- browser.on("disconnected", this.onClose.bind(this));
1428
- if (opts.options.handleSIGINT !== false) {
1429
- process.on("SIGINT", this.onClose.bind(this));
1430
- }
1431
- if (opts.options.handleSIGTERM !== false) {
1432
- process.on("SIGTERM", this.onClose.bind(this));
1433
- }
1434
- if (opts.options.handleSIGHUP !== false) {
1435
- process.on("SIGHUP", this.onClose.bind(this));
1436
- }
1437
- }
1438
- }
1439
- if (opts.context === "launch" && this.afterLaunch) {
1440
- await this.afterLaunch(browser, opts);
1441
- }
1442
- if (opts.context === "connect" && this.afterConnect) {
1443
- await this.afterConnect(browser, opts);
1444
- }
1445
- if (this.onBrowser)
1446
- await this.onBrowser(browser, opts);
1447
- }
1448
- /**
1449
- * @private
1450
- */
1451
- async _onTargetCreated(target) {
1452
- if (this.onTargetCreated)
1453
- await this.onTargetCreated(target);
1454
- if (target.type() === "page") {
1455
- try {
1456
- const page = await target.page();
1457
- if (!page) {
1458
- return;
1459
- }
1460
- const validPage = "isClosed" in page && !page.isClosed();
1461
- if (this.onPageCreated && validPage) {
1462
- await this.onPageCreated(page);
1463
- }
1464
- } catch (err) {
1465
- console.error(err);
1466
- }
1467
- }
1468
- }
1469
- /**
1470
- * @private
1471
- */
1472
- _register(prototype) {
1473
- this._registerChildClassMembers(prototype);
1474
- if (this.onPluginRegistered)
1475
- this.onPluginRegistered();
1476
- }
1477
- /**
1478
- * @private
1479
- */
1480
- _registerChildClassMembers(prototype) {
1481
- this._childClassMembers = Object.getOwnPropertyNames(prototype);
1482
- }
1483
- /**
1484
- * @private
1485
- */
1486
- _hasChildClassMember(name) {
1487
- return !!this._childClassMembers.includes(name);
1488
- }
1489
- /**
1490
- * @private
1491
- */
1492
- get _isPuppeteerExtraPlugin() {
1493
- return true;
1494
- }
1495
- };
1496
- }
1497
- });
1498
-
1499
- // ../node_modules/puppeteer-extra-plugin-stealth/index.js
1500
- var require_puppeteer_extra_plugin_stealth = __commonJS({
1501
- "../node_modules/puppeteer-extra-plugin-stealth/index.js"(exports2, module2) {
1502
- "use strict";
1503
- init_cjs_shims();
1504
- var { PuppeteerExtraPlugin: PuppeteerExtraPlugin2 } = (init_index_esm(), __toCommonJS(index_esm_exports));
1505
- var StealthPlugin = class extends PuppeteerExtraPlugin2 {
1506
- constructor(opts = {}) {
1507
- super(opts);
1508
- }
1509
- get name() {
1510
- return "stealth";
1511
- }
1512
- get defaults() {
1513
- const availableEvasions = /* @__PURE__ */ new Set([
1514
- "chrome.app",
1515
- "chrome.csi",
1516
- "chrome.loadTimes",
1517
- "chrome.runtime",
1518
- "defaultArgs",
1519
- "iframe.contentWindow",
1520
- "media.codecs",
1521
- "navigator.hardwareConcurrency",
1522
- "navigator.languages",
1523
- "navigator.permissions",
1524
- "navigator.plugins",
1525
- "navigator.webdriver",
1526
- "sourceurl",
1527
- "user-agent-override",
1528
- "webgl.vendor",
1529
- "window.outerdimensions"
1530
- ]);
1531
- return {
1532
- availableEvasions,
1533
- // Enable all available evasions by default
1534
- enabledEvasions: /* @__PURE__ */ new Set([...availableEvasions])
1535
- };
1536
- }
1537
- /**
1538
- * Requires evasion techniques dynamically based on configuration.
1539
- *
1540
- * @private
1541
- */
1542
- get dependencies() {
1543
- return new Set(
1544
- [...this.opts.enabledEvasions].map((e) => `${this.name}/evasions/${e}`)
1545
- );
1546
- }
1547
- /**
1548
- * Get all available evasions.
1549
- *
1550
- * Please look into the [evasions directory](./evasions/) for an up to date list.
1551
- *
1552
- * @type {Set<string>} - A Set of all available evasions.
1553
- *
1554
- * @example
1555
- * const pluginStealth = require('puppeteer-extra-plugin-stealth')()
1556
- * console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' }
1557
- * puppeteer.use(pluginStealth)
1558
- */
1559
- get availableEvasions() {
1560
- return this.defaults.availableEvasions;
1561
- }
1562
- /**
1563
- * Get all enabled evasions.
1564
- *
1565
- * Enabled evasions can be configured either through `opts` or by modifying this property.
1566
- *
1567
- * @type {Set<string>} - A Set of all enabled evasions.
1568
- *
1569
- * @example
1570
- * // Remove specific evasion from enabled ones dynamically
1571
- * const pluginStealth = require('puppeteer-extra-plugin-stealth')()
1572
- * pluginStealth.enabledEvasions.delete('console.debug')
1573
- * puppeteer.use(pluginStealth)
1574
- */
1575
- get enabledEvasions() {
1576
- return this.opts.enabledEvasions;
1577
- }
1578
- /**
1579
- * @private
1580
- */
1581
- set enabledEvasions(evasions) {
1582
- this.opts.enabledEvasions = evasions;
1583
- }
1584
- async onBrowser(browser) {
1585
- if (browser && browser.setMaxListeners) {
1586
- browser.setMaxListeners(30);
1587
- }
1588
- }
1589
- };
1590
- var defaultExport = (opts) => new StealthPlugin(opts);
1591
- module2.exports = defaultExport;
1592
- }
1593
- });
1594
-
1595
30
  // src/index.ts
1596
31
  var index_exports = {};
1597
32
  __export(index_exports, {
@@ -1600,13 +35,8 @@ __export(index_exports, {
1600
35
  PlaywrightEngine: () => PlaywrightEngine
1601
36
  });
1602
37
  module.exports = __toCommonJS(index_exports);
1603
- init_cjs_shims();
1604
-
1605
- // src/FetchEngine.ts
1606
- init_cjs_shims();
1607
38
 
1608
39
  // src/utils/markdown-converter.ts
1609
- init_cjs_shims();
1610
40
  var import_turndown = __toESM(require("turndown"), 1);
1611
41
  var import_turndown_plugin_gfm = require("turndown-plugin-gfm");
1612
42
  var import_node_html_parser = require("node-html-parser");
@@ -2236,7 +666,6 @@ ${p2}`);
2236
666
  };
2237
667
 
2238
668
  // src/errors.ts
2239
- init_cjs_shims();
2240
669
  var FetchError = class _FetchError extends Error {
2241
670
  /** A specific error code (e.g., ERR_NAVIGATION_TIMEOUT, ERR_HTTP_ERROR). */
2242
671
  code;
@@ -2361,11 +790,7 @@ var FetchEngine = class _FetchEngine {
2361
790
  }
2362
791
  };
2363
792
 
2364
- // src/PlaywrightEngine.ts
2365
- init_cjs_shims();
2366
-
2367
793
  // src/browser/PlaywrightBrowserPool.ts
2368
- init_cjs_shims();
2369
794
  var import_playwright = require("playwright");
2370
795
  var import_user_agents = __toESM(require("user-agents"), 1);
2371
796
  var import_uuid = require("uuid");
@@ -2376,7 +801,7 @@ var StealthPluginInstance;
2376
801
  async function loadDependencies() {
2377
802
  if (!chromiumWithExtras) {
2378
803
  chromiumWithExtras = (0, import_playwright_extra.addExtra)(import_playwright.chromium);
2379
- const StealthPluginModule = await Promise.resolve().then(() => __toESM(require_puppeteer_extra_plugin_stealth(), 1));
804
+ const StealthPluginModule = await import("puppeteer-extra-plugin-stealth");
2380
805
  const stealthPluginFactory = typeof StealthPluginModule.default === "function" ? StealthPluginModule.default : StealthPluginModule;
2381
806
  if (typeof stealthPluginFactory !== "function") {
2382
807
  throw new Error("puppeteer-extra-plugin-stealth export is not a function or module structure is unexpected.");
@@ -3175,7 +1600,6 @@ var PlaywrightEngine = class _PlaywrightEngine {
3175
1600
  };
3176
1601
 
3177
1602
  // src/HybridEngine.ts
3178
- init_cjs_shims();
3179
1603
  var HybridEngine = class {
3180
1604
  fetchEngine;
3181
1605
  playwrightEngine;
@@ -3230,45 +1654,4 @@ var HybridEngine = class {
3230
1654
  HybridEngine,
3231
1655
  PlaywrightEngine
3232
1656
  });
3233
- /*! Bundled license information:
3234
-
3235
- for-in/index.js:
3236
- (*!
3237
- * for-in <https://github.com/jonschlinkert/for-in>
3238
- *
3239
- * Copyright (c) 2014-2017, Jon Schlinkert.
3240
- * Released under the MIT License.
3241
- *)
3242
-
3243
- for-own/index.js:
3244
- (*!
3245
- * for-own <https://github.com/jonschlinkert/for-own>
3246
- *
3247
- * Copyright (c) 2014-2017, Jon Schlinkert.
3248
- * Released under the MIT License.
3249
- *)
3250
-
3251
- is-buffer/index.js:
3252
- (*!
3253
- * Determine if an object is a Buffer
3254
- *
3255
- * @author Feross Aboukhadijeh <https://feross.org>
3256
- * @license MIT
3257
- *)
3258
-
3259
- merge-deep/index.js:
3260
- (*!
3261
- * merge-deep <https://github.com/jonschlinkert/merge-deep>
3262
- *
3263
- * Copyright (c) 2014-2015, Jon Schlinkert.
3264
- * Licensed under the MIT License.
3265
- *)
3266
-
3267
- puppeteer-extra-plugin/dist/index.esm.js:
3268
- (*!
3269
- * puppeteer-extra-plugin v3.2.2 by berstend
3270
- * https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin
3271
- * @license MIT
3272
- *)
3273
- */
3274
1657
  //# sourceMappingURL=index.cjs.map