@cloudflare/vitest-pool-workers 0.12.3 → 0.12.5

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.
@@ -4,9 +4,9 @@ var __commonJS = (cb, mod) => function __require() {
4
4
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
5
  };
6
6
 
7
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/symbols.js
7
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/symbols.js
8
8
  var require_symbols = __commonJS({
9
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/symbols.js"(exports2, module2) {
9
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/symbols.js"(exports2, module2) {
10
10
  "use strict";
11
11
  module2.exports = {
12
12
  kClose: Symbol("close"),
@@ -70,6 +70,9 @@ var require_symbols = __commonJS({
70
70
  kListeners: Symbol("listeners"),
71
71
  kHTTPContext: Symbol("http context"),
72
72
  kMaxConcurrentStreams: Symbol("max concurrent streams"),
73
+ kEnableConnectProtocol: Symbol("http2session connect protocol"),
74
+ kRemoteSettings: Symbol("http2session remote settings"),
75
+ kHTTP2Stream: Symbol("http2session client stream"),
73
76
  kNoProxyAgent: Symbol("no proxy agent"),
74
77
  kHttpProxyAgent: Symbol("http proxy agent"),
75
78
  kHttpsProxyAgent: Symbol("https proxy agent")
@@ -77,17 +80,25 @@ var require_symbols = __commonJS({
77
80
  }
78
81
  });
79
82
 
80
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/errors.js
83
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/errors.js
81
84
  var require_errors = __commonJS({
82
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/errors.js"(exports2, module2) {
85
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/errors.js"(exports2, module2) {
83
86
  "use strict";
87
+ var kUndiciError = Symbol.for("undici.error.UND_ERR");
84
88
  var UndiciError = class extends Error {
85
89
  constructor(message, options) {
86
90
  super(message, options);
87
91
  this.name = "UndiciError";
88
92
  this.code = "UND_ERR";
89
93
  }
94
+ static [Symbol.hasInstance](instance) {
95
+ return instance && instance[kUndiciError] === true;
96
+ }
97
+ get [kUndiciError]() {
98
+ return true;
99
+ }
90
100
  };
101
+ var kConnectTimeoutError = Symbol.for("undici.error.UND_ERR_CONNECT_TIMEOUT");
91
102
  var ConnectTimeoutError = class extends UndiciError {
92
103
  constructor(message) {
93
104
  super(message);
@@ -95,7 +106,14 @@ var require_errors = __commonJS({
95
106
  this.message = message || "Connect Timeout Error";
96
107
  this.code = "UND_ERR_CONNECT_TIMEOUT";
97
108
  }
109
+ static [Symbol.hasInstance](instance) {
110
+ return instance && instance[kConnectTimeoutError] === true;
111
+ }
112
+ get [kConnectTimeoutError]() {
113
+ return true;
114
+ }
98
115
  };
116
+ var kHeadersTimeoutError = Symbol.for("undici.error.UND_ERR_HEADERS_TIMEOUT");
99
117
  var HeadersTimeoutError = class extends UndiciError {
100
118
  constructor(message) {
101
119
  super(message);
@@ -103,7 +121,14 @@ var require_errors = __commonJS({
103
121
  this.message = message || "Headers Timeout Error";
104
122
  this.code = "UND_ERR_HEADERS_TIMEOUT";
105
123
  }
124
+ static [Symbol.hasInstance](instance) {
125
+ return instance && instance[kHeadersTimeoutError] === true;
126
+ }
127
+ get [kHeadersTimeoutError]() {
128
+ return true;
129
+ }
106
130
  };
131
+ var kHeadersOverflowError = Symbol.for("undici.error.UND_ERR_HEADERS_OVERFLOW");
107
132
  var HeadersOverflowError = class extends UndiciError {
108
133
  constructor(message) {
109
134
  super(message);
@@ -111,7 +136,14 @@ var require_errors = __commonJS({
111
136
  this.message = message || "Headers Overflow Error";
112
137
  this.code = "UND_ERR_HEADERS_OVERFLOW";
113
138
  }
139
+ static [Symbol.hasInstance](instance) {
140
+ return instance && instance[kHeadersOverflowError] === true;
141
+ }
142
+ get [kHeadersOverflowError]() {
143
+ return true;
144
+ }
114
145
  };
146
+ var kBodyTimeoutError = Symbol.for("undici.error.UND_ERR_BODY_TIMEOUT");
115
147
  var BodyTimeoutError = class extends UndiciError {
116
148
  constructor(message) {
117
149
  super(message);
@@ -119,19 +151,14 @@ var require_errors = __commonJS({
119
151
  this.message = message || "Body Timeout Error";
120
152
  this.code = "UND_ERR_BODY_TIMEOUT";
121
153
  }
122
- };
123
- var ResponseStatusCodeError = class extends UndiciError {
124
- constructor(message, statusCode, headers, body) {
125
- super(message);
126
- this.name = "ResponseStatusCodeError";
127
- this.message = message || "Response Status Code Error";
128
- this.code = "UND_ERR_RESPONSE_STATUS_CODE";
129
- this.body = body;
130
- this.status = statusCode;
131
- this.statusCode = statusCode;
132
- this.headers = headers;
154
+ static [Symbol.hasInstance](instance) {
155
+ return instance && instance[kBodyTimeoutError] === true;
156
+ }
157
+ get [kBodyTimeoutError]() {
158
+ return true;
133
159
  }
134
160
  };
161
+ var kInvalidArgumentError = Symbol.for("undici.error.UND_ERR_INVALID_ARG");
135
162
  var InvalidArgumentError = class extends UndiciError {
136
163
  constructor(message) {
137
164
  super(message);
@@ -139,7 +166,14 @@ var require_errors = __commonJS({
139
166
  this.message = message || "Invalid Argument Error";
140
167
  this.code = "UND_ERR_INVALID_ARG";
141
168
  }
169
+ static [Symbol.hasInstance](instance) {
170
+ return instance && instance[kInvalidArgumentError] === true;
171
+ }
172
+ get [kInvalidArgumentError]() {
173
+ return true;
174
+ }
142
175
  };
176
+ var kInvalidReturnValueError = Symbol.for("undici.error.UND_ERR_INVALID_RETURN_VALUE");
143
177
  var InvalidReturnValueError = class extends UndiciError {
144
178
  constructor(message) {
145
179
  super(message);
@@ -147,14 +181,29 @@ var require_errors = __commonJS({
147
181
  this.message = message || "Invalid Return Value Error";
148
182
  this.code = "UND_ERR_INVALID_RETURN_VALUE";
149
183
  }
184
+ static [Symbol.hasInstance](instance) {
185
+ return instance && instance[kInvalidReturnValueError] === true;
186
+ }
187
+ get [kInvalidReturnValueError]() {
188
+ return true;
189
+ }
150
190
  };
191
+ var kAbortError = Symbol.for("undici.error.UND_ERR_ABORT");
151
192
  var AbortError = class extends UndiciError {
152
193
  constructor(message) {
153
194
  super(message);
154
195
  this.name = "AbortError";
155
196
  this.message = message || "The operation was aborted";
197
+ this.code = "UND_ERR_ABORT";
198
+ }
199
+ static [Symbol.hasInstance](instance) {
200
+ return instance && instance[kAbortError] === true;
201
+ }
202
+ get [kAbortError]() {
203
+ return true;
156
204
  }
157
205
  };
206
+ var kRequestAbortedError = Symbol.for("undici.error.UND_ERR_ABORTED");
158
207
  var RequestAbortedError = class extends AbortError {
159
208
  constructor(message) {
160
209
  super(message);
@@ -162,7 +211,14 @@ var require_errors = __commonJS({
162
211
  this.message = message || "Request aborted";
163
212
  this.code = "UND_ERR_ABORTED";
164
213
  }
214
+ static [Symbol.hasInstance](instance) {
215
+ return instance && instance[kRequestAbortedError] === true;
216
+ }
217
+ get [kRequestAbortedError]() {
218
+ return true;
219
+ }
165
220
  };
221
+ var kInformationalError = Symbol.for("undici.error.UND_ERR_INFO");
166
222
  var InformationalError = class extends UndiciError {
167
223
  constructor(message) {
168
224
  super(message);
@@ -170,7 +226,14 @@ var require_errors = __commonJS({
170
226
  this.message = message || "Request information";
171
227
  this.code = "UND_ERR_INFO";
172
228
  }
229
+ static [Symbol.hasInstance](instance) {
230
+ return instance && instance[kInformationalError] === true;
231
+ }
232
+ get [kInformationalError]() {
233
+ return true;
234
+ }
173
235
  };
236
+ var kRequestContentLengthMismatchError = Symbol.for("undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH");
174
237
  var RequestContentLengthMismatchError = class extends UndiciError {
175
238
  constructor(message) {
176
239
  super(message);
@@ -178,7 +241,14 @@ var require_errors = __commonJS({
178
241
  this.message = message || "Request body length does not match content-length header";
179
242
  this.code = "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH";
180
243
  }
244
+ static [Symbol.hasInstance](instance) {
245
+ return instance && instance[kRequestContentLengthMismatchError] === true;
246
+ }
247
+ get [kRequestContentLengthMismatchError]() {
248
+ return true;
249
+ }
181
250
  };
251
+ var kResponseContentLengthMismatchError = Symbol.for("undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH");
182
252
  var ResponseContentLengthMismatchError = class extends UndiciError {
183
253
  constructor(message) {
184
254
  super(message);
@@ -186,7 +256,14 @@ var require_errors = __commonJS({
186
256
  this.message = message || "Response body length does not match content-length header";
187
257
  this.code = "UND_ERR_RES_CONTENT_LENGTH_MISMATCH";
188
258
  }
259
+ static [Symbol.hasInstance](instance) {
260
+ return instance && instance[kResponseContentLengthMismatchError] === true;
261
+ }
262
+ get [kResponseContentLengthMismatchError]() {
263
+ return true;
264
+ }
189
265
  };
266
+ var kClientDestroyedError = Symbol.for("undici.error.UND_ERR_DESTROYED");
190
267
  var ClientDestroyedError = class extends UndiciError {
191
268
  constructor(message) {
192
269
  super(message);
@@ -194,7 +271,14 @@ var require_errors = __commonJS({
194
271
  this.message = message || "The client is destroyed";
195
272
  this.code = "UND_ERR_DESTROYED";
196
273
  }
274
+ static [Symbol.hasInstance](instance) {
275
+ return instance && instance[kClientDestroyedError] === true;
276
+ }
277
+ get [kClientDestroyedError]() {
278
+ return true;
279
+ }
197
280
  };
281
+ var kClientClosedError = Symbol.for("undici.error.UND_ERR_CLOSED");
198
282
  var ClientClosedError = class extends UndiciError {
199
283
  constructor(message) {
200
284
  super(message);
@@ -202,7 +286,14 @@ var require_errors = __commonJS({
202
286
  this.message = message || "The client is closed";
203
287
  this.code = "UND_ERR_CLOSED";
204
288
  }
289
+ static [Symbol.hasInstance](instance) {
290
+ return instance && instance[kClientClosedError] === true;
291
+ }
292
+ get [kClientClosedError]() {
293
+ return true;
294
+ }
205
295
  };
296
+ var kSocketError = Symbol.for("undici.error.UND_ERR_SOCKET");
206
297
  var SocketError = class extends UndiciError {
207
298
  constructor(message, socket) {
208
299
  super(message);
@@ -211,7 +302,14 @@ var require_errors = __commonJS({
211
302
  this.code = "UND_ERR_SOCKET";
212
303
  this.socket = socket;
213
304
  }
305
+ static [Symbol.hasInstance](instance) {
306
+ return instance && instance[kSocketError] === true;
307
+ }
308
+ get [kSocketError]() {
309
+ return true;
310
+ }
214
311
  };
312
+ var kNotSupportedError = Symbol.for("undici.error.UND_ERR_NOT_SUPPORTED");
215
313
  var NotSupportedError = class extends UndiciError {
216
314
  constructor(message) {
217
315
  super(message);
@@ -219,7 +317,14 @@ var require_errors = __commonJS({
219
317
  this.message = message || "Not supported error";
220
318
  this.code = "UND_ERR_NOT_SUPPORTED";
221
319
  }
320
+ static [Symbol.hasInstance](instance) {
321
+ return instance && instance[kNotSupportedError] === true;
322
+ }
323
+ get [kNotSupportedError]() {
324
+ return true;
325
+ }
222
326
  };
327
+ var kBalancedPoolMissingUpstreamError = Symbol.for("undici.error.UND_ERR_BPL_MISSING_UPSTREAM");
223
328
  var BalancedPoolMissingUpstreamError = class extends UndiciError {
224
329
  constructor(message) {
225
330
  super(message);
@@ -227,7 +332,14 @@ var require_errors = __commonJS({
227
332
  this.message = message || "No upstream has been added to the BalancedPool";
228
333
  this.code = "UND_ERR_BPL_MISSING_UPSTREAM";
229
334
  }
335
+ static [Symbol.hasInstance](instance) {
336
+ return instance && instance[kBalancedPoolMissingUpstreamError] === true;
337
+ }
338
+ get [kBalancedPoolMissingUpstreamError]() {
339
+ return true;
340
+ }
230
341
  };
342
+ var kHTTPParserError = Symbol.for("undici.error.UND_ERR_HTTP_PARSER");
231
343
  var HTTPParserError = class extends Error {
232
344
  constructor(message, code, data) {
233
345
  super(message);
@@ -235,7 +347,14 @@ var require_errors = __commonJS({
235
347
  this.code = code ? `HPE_${code}` : void 0;
236
348
  this.data = data ? data.toString() : void 0;
237
349
  }
350
+ static [Symbol.hasInstance](instance) {
351
+ return instance && instance[kHTTPParserError] === true;
352
+ }
353
+ get [kHTTPParserError]() {
354
+ return true;
355
+ }
238
356
  };
357
+ var kResponseExceededMaxSizeError = Symbol.for("undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE");
239
358
  var ResponseExceededMaxSizeError = class extends UndiciError {
240
359
  constructor(message) {
241
360
  super(message);
@@ -243,7 +362,14 @@ var require_errors = __commonJS({
243
362
  this.message = message || "Response content exceeded max size";
244
363
  this.code = "UND_ERR_RES_EXCEEDED_MAX_SIZE";
245
364
  }
365
+ static [Symbol.hasInstance](instance) {
366
+ return instance && instance[kResponseExceededMaxSizeError] === true;
367
+ }
368
+ get [kResponseExceededMaxSizeError]() {
369
+ return true;
370
+ }
246
371
  };
372
+ var kRequestRetryError = Symbol.for("undici.error.UND_ERR_REQ_RETRY");
247
373
  var RequestRetryError = class extends UndiciError {
248
374
  constructor(message, code, { headers, data }) {
249
375
  super(message);
@@ -254,7 +380,14 @@ var require_errors = __commonJS({
254
380
  this.data = data;
255
381
  this.headers = headers;
256
382
  }
383
+ static [Symbol.hasInstance](instance) {
384
+ return instance && instance[kRequestRetryError] === true;
385
+ }
386
+ get [kRequestRetryError]() {
387
+ return true;
388
+ }
257
389
  };
390
+ var kResponseError = Symbol.for("undici.error.UND_ERR_RESPONSE");
258
391
  var ResponseError = class extends UndiciError {
259
392
  constructor(message, code, { headers, body }) {
260
393
  super(message);
@@ -265,7 +398,14 @@ var require_errors = __commonJS({
265
398
  this.body = body;
266
399
  this.headers = headers;
267
400
  }
401
+ static [Symbol.hasInstance](instance) {
402
+ return instance && instance[kResponseError] === true;
403
+ }
404
+ get [kResponseError]() {
405
+ return true;
406
+ }
268
407
  };
408
+ var kSecureProxyConnectionError = Symbol.for("undici.error.UND_ERR_PRX_TLS");
269
409
  var SecureProxyConnectionError = class extends UndiciError {
270
410
  constructor(cause, message, options = {}) {
271
411
  super(message, { cause, ...options });
@@ -274,6 +414,27 @@ var require_errors = __commonJS({
274
414
  this.code = "UND_ERR_PRX_TLS";
275
415
  this.cause = cause;
276
416
  }
417
+ static [Symbol.hasInstance](instance) {
418
+ return instance && instance[kSecureProxyConnectionError] === true;
419
+ }
420
+ get [kSecureProxyConnectionError]() {
421
+ return true;
422
+ }
423
+ };
424
+ var kMaxOriginsReachedError = Symbol.for("undici.error.UND_ERR_MAX_ORIGINS_REACHED");
425
+ var MaxOriginsReachedError = class extends UndiciError {
426
+ constructor(message) {
427
+ super(message);
428
+ this.name = "MaxOriginsReachedError";
429
+ this.message = message || "Maximum allowed origins reached";
430
+ this.code = "UND_ERR_MAX_ORIGINS_REACHED";
431
+ }
432
+ static [Symbol.hasInstance](instance) {
433
+ return instance && instance[kMaxOriginsReachedError] === true;
434
+ }
435
+ get [kMaxOriginsReachedError]() {
436
+ return true;
437
+ }
277
438
  };
278
439
  module2.exports = {
279
440
  AbortError,
@@ -284,7 +445,6 @@ var require_errors = __commonJS({
284
445
  BodyTimeoutError,
285
446
  RequestContentLengthMismatchError,
286
447
  ConnectTimeoutError,
287
- ResponseStatusCodeError,
288
448
  InvalidArgumentError,
289
449
  InvalidReturnValueError,
290
450
  RequestAbortedError,
@@ -298,14 +458,15 @@ var require_errors = __commonJS({
298
458
  ResponseExceededMaxSizeError,
299
459
  RequestRetryError,
300
460
  ResponseError,
301
- SecureProxyConnectionError
461
+ SecureProxyConnectionError,
462
+ MaxOriginsReachedError
302
463
  };
303
464
  }
304
465
  });
305
466
 
306
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/handler/wrap-handler.js
467
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/wrap-handler.js
307
468
  var require_wrap_handler = __commonJS({
308
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/handler/wrap-handler.js"(exports2, module2) {
469
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/wrap-handler.js"(exports2, module2) {
309
470
  "use strict";
310
471
  var { InvalidArgumentError } = require_errors();
311
472
  module2.exports = class WrapHandler {
@@ -380,9 +541,9 @@ var require_wrap_handler = __commonJS({
380
541
  }
381
542
  });
382
543
 
383
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/dispatcher.js
544
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/dispatcher.js
384
545
  var require_dispatcher = __commonJS({
385
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/dispatcher.js"(exports2, module2) {
546
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/dispatcher.js"(exports2, module2) {
386
547
  "use strict";
387
548
  var EventEmitter = require("node:events");
388
549
  var WrapHandler = require_wrap_handler();
@@ -422,9 +583,9 @@ var require_dispatcher = __commonJS({
422
583
  }
423
584
  });
424
585
 
425
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/util/timers.js
586
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/util/timers.js
426
587
  var require_timers = __commonJS({
427
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/util/timers.js"(exports2, module2) {
588
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/util/timers.js"(exports2, module2) {
428
589
  "use strict";
429
590
  var fastNow = 0;
430
591
  var RESOLUTION_MS = 1e3;
@@ -651,9 +812,9 @@ var require_timers = __commonJS({
651
812
  }
652
813
  });
653
814
 
654
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/constants.js
815
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/constants.js
655
816
  var require_constants = __commonJS({
656
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/constants.js"(exports2, module2) {
817
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/constants.js"(exports2, module2) {
657
818
  "use strict";
658
819
  var wellknownHeaderNames = (
659
820
  /** @type {const} */
@@ -779,9 +940,9 @@ var require_constants = __commonJS({
779
940
  }
780
941
  });
781
942
 
782
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/tree.js
943
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/tree.js
783
944
  var require_tree = __commonJS({
784
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/tree.js"(exports2, module2) {
945
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/tree.js"(exports2, module2) {
785
946
  "use strict";
786
947
  var {
787
948
  wellknownHeaderNames,
@@ -921,9 +1082,9 @@ var require_tree = __commonJS({
921
1082
  }
922
1083
  });
923
1084
 
924
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/util.js
1085
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/util.js
925
1086
  var require_util = __commonJS({
926
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/core/util.js"(exports2, module2) {
1087
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/util.js"(exports2, module2) {
927
1088
  "use strict";
928
1089
  var assert = require("node:assert");
929
1090
  var { kDestroyed, kBodyUsed, kListeners, kBody } = require_symbols();
@@ -987,8 +1148,11 @@ var require_util = __commonJS({
987
1148
  return (sTag === "Blob" || sTag === "File") && ("stream" in object && typeof object.stream === "function" || "arrayBuffer" in object && typeof object.arrayBuffer === "function");
988
1149
  }
989
1150
  }
1151
+ function pathHasQueryOrFragment(url) {
1152
+ return url.includes("?") || url.includes("#");
1153
+ }
990
1154
  function serializePathWithQuery(url, queryParams) {
991
- if (url.includes("?") || url.includes("#")) {
1155
+ if (pathHasQueryOrFragment(url)) {
992
1156
  throw new Error('Query params cannot be passed when url already contains "?" or "#".');
993
1157
  }
994
1158
  const stringified = stringify(queryParams);
@@ -1244,30 +1408,28 @@ var require_util = __commonJS({
1244
1408
  let iterator;
1245
1409
  return new ReadableStream(
1246
1410
  {
1247
- async start() {
1411
+ start() {
1248
1412
  iterator = iterable[Symbol.asyncIterator]();
1249
1413
  },
1250
1414
  pull(controller) {
1251
- async function pull() {
1252
- const { done, value } = await iterator.next();
1415
+ return iterator.next().then(({ done, value }) => {
1253
1416
  if (done) {
1254
- queueMicrotask(() => {
1417
+ return queueMicrotask(() => {
1255
1418
  controller.close();
1256
1419
  controller.byobRequest?.respond(0);
1257
1420
  });
1258
1421
  } else {
1259
1422
  const buf = Buffer.isBuffer(value) ? value : Buffer.from(value);
1260
1423
  if (buf.byteLength) {
1261
- controller.enqueue(new Uint8Array(buf));
1424
+ return controller.enqueue(new Uint8Array(buf));
1262
1425
  } else {
1263
- return await pull();
1426
+ return this.pull(controller);
1264
1427
  }
1265
1428
  }
1266
- }
1267
- return pull();
1429
+ });
1268
1430
  },
1269
- async cancel() {
1270
- await iterator.return();
1431
+ cancel() {
1432
+ return iterator.return();
1271
1433
  },
1272
1434
  type: "bytes"
1273
1435
  }
@@ -1284,36 +1446,289 @@ var require_util = __commonJS({
1284
1446
  signal.once("abort", listener);
1285
1447
  return () => signal.removeListener("abort", listener);
1286
1448
  }
1449
+ var validTokenChars = new Uint8Array([
1450
+ 0,
1451
+ 0,
1452
+ 0,
1453
+ 0,
1454
+ 0,
1455
+ 0,
1456
+ 0,
1457
+ 0,
1458
+ 0,
1459
+ 0,
1460
+ 0,
1461
+ 0,
1462
+ 0,
1463
+ 0,
1464
+ 0,
1465
+ 0,
1466
+ // 0-15
1467
+ 0,
1468
+ 0,
1469
+ 0,
1470
+ 0,
1471
+ 0,
1472
+ 0,
1473
+ 0,
1474
+ 0,
1475
+ 0,
1476
+ 0,
1477
+ 0,
1478
+ 0,
1479
+ 0,
1480
+ 0,
1481
+ 0,
1482
+ 0,
1483
+ // 16-31
1484
+ 0,
1485
+ 1,
1486
+ 0,
1487
+ 1,
1488
+ 1,
1489
+ 1,
1490
+ 1,
1491
+ 1,
1492
+ 0,
1493
+ 0,
1494
+ 1,
1495
+ 1,
1496
+ 0,
1497
+ 1,
1498
+ 1,
1499
+ 0,
1500
+ // 32-47 (!"#$%&'()*+,-./)
1501
+ 1,
1502
+ 1,
1503
+ 1,
1504
+ 1,
1505
+ 1,
1506
+ 1,
1507
+ 1,
1508
+ 1,
1509
+ 1,
1510
+ 1,
1511
+ 0,
1512
+ 0,
1513
+ 0,
1514
+ 0,
1515
+ 0,
1516
+ 0,
1517
+ // 48-63 (0-9:;<=>?)
1518
+ 0,
1519
+ 1,
1520
+ 1,
1521
+ 1,
1522
+ 1,
1523
+ 1,
1524
+ 1,
1525
+ 1,
1526
+ 1,
1527
+ 1,
1528
+ 1,
1529
+ 1,
1530
+ 1,
1531
+ 1,
1532
+ 1,
1533
+ 1,
1534
+ // 64-79 (@A-O)
1535
+ 1,
1536
+ 1,
1537
+ 1,
1538
+ 1,
1539
+ 1,
1540
+ 1,
1541
+ 1,
1542
+ 1,
1543
+ 1,
1544
+ 1,
1545
+ 1,
1546
+ 0,
1547
+ 0,
1548
+ 0,
1549
+ 1,
1550
+ 1,
1551
+ // 80-95 (P-Z[\]^_)
1552
+ 1,
1553
+ 1,
1554
+ 1,
1555
+ 1,
1556
+ 1,
1557
+ 1,
1558
+ 1,
1559
+ 1,
1560
+ 1,
1561
+ 1,
1562
+ 1,
1563
+ 1,
1564
+ 1,
1565
+ 1,
1566
+ 1,
1567
+ 1,
1568
+ // 96-111 (`a-o)
1569
+ 1,
1570
+ 1,
1571
+ 1,
1572
+ 1,
1573
+ 1,
1574
+ 1,
1575
+ 1,
1576
+ 1,
1577
+ 1,
1578
+ 1,
1579
+ 1,
1580
+ 0,
1581
+ 1,
1582
+ 0,
1583
+ 1,
1584
+ 0,
1585
+ // 112-127 (p-z{|}~)
1586
+ 0,
1587
+ 0,
1588
+ 0,
1589
+ 0,
1590
+ 0,
1591
+ 0,
1592
+ 0,
1593
+ 0,
1594
+ 0,
1595
+ 0,
1596
+ 0,
1597
+ 0,
1598
+ 0,
1599
+ 0,
1600
+ 0,
1601
+ 0,
1602
+ // 128-143
1603
+ 0,
1604
+ 0,
1605
+ 0,
1606
+ 0,
1607
+ 0,
1608
+ 0,
1609
+ 0,
1610
+ 0,
1611
+ 0,
1612
+ 0,
1613
+ 0,
1614
+ 0,
1615
+ 0,
1616
+ 0,
1617
+ 0,
1618
+ 0,
1619
+ // 144-159
1620
+ 0,
1621
+ 0,
1622
+ 0,
1623
+ 0,
1624
+ 0,
1625
+ 0,
1626
+ 0,
1627
+ 0,
1628
+ 0,
1629
+ 0,
1630
+ 0,
1631
+ 0,
1632
+ 0,
1633
+ 0,
1634
+ 0,
1635
+ 0,
1636
+ // 160-175
1637
+ 0,
1638
+ 0,
1639
+ 0,
1640
+ 0,
1641
+ 0,
1642
+ 0,
1643
+ 0,
1644
+ 0,
1645
+ 0,
1646
+ 0,
1647
+ 0,
1648
+ 0,
1649
+ 0,
1650
+ 0,
1651
+ 0,
1652
+ 0,
1653
+ // 176-191
1654
+ 0,
1655
+ 0,
1656
+ 0,
1657
+ 0,
1658
+ 0,
1659
+ 0,
1660
+ 0,
1661
+ 0,
1662
+ 0,
1663
+ 0,
1664
+ 0,
1665
+ 0,
1666
+ 0,
1667
+ 0,
1668
+ 0,
1669
+ 0,
1670
+ // 192-207
1671
+ 0,
1672
+ 0,
1673
+ 0,
1674
+ 0,
1675
+ 0,
1676
+ 0,
1677
+ 0,
1678
+ 0,
1679
+ 0,
1680
+ 0,
1681
+ 0,
1682
+ 0,
1683
+ 0,
1684
+ 0,
1685
+ 0,
1686
+ 0,
1687
+ // 208-223
1688
+ 0,
1689
+ 0,
1690
+ 0,
1691
+ 0,
1692
+ 0,
1693
+ 0,
1694
+ 0,
1695
+ 0,
1696
+ 0,
1697
+ 0,
1698
+ 0,
1699
+ 0,
1700
+ 0,
1701
+ 0,
1702
+ 0,
1703
+ 0,
1704
+ // 224-239
1705
+ 0,
1706
+ 0,
1707
+ 0,
1708
+ 0,
1709
+ 0,
1710
+ 0,
1711
+ 0,
1712
+ 0,
1713
+ 0,
1714
+ 0,
1715
+ 0,
1716
+ 0,
1717
+ 0,
1718
+ 0,
1719
+ 0,
1720
+ 0
1721
+ // 240-255
1722
+ ]);
1287
1723
  function isTokenCharCode(c) {
1288
- switch (c) {
1289
- case 34:
1290
- case 40:
1291
- case 41:
1292
- case 44:
1293
- case 47:
1294
- case 58:
1295
- case 59:
1296
- case 60:
1297
- case 61:
1298
- case 62:
1299
- case 63:
1300
- case 64:
1301
- case 91:
1302
- case 92:
1303
- case 93:
1304
- case 123:
1305
- case 125:
1306
- return false;
1307
- default:
1308
- return c >= 33 && c <= 126;
1309
- }
1724
+ return validTokenChars[c] === 1;
1310
1725
  }
1726
+ var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
1311
1727
  function isValidHTTPToken(characters) {
1312
- if (characters.length === 0) {
1313
- return false;
1314
- }
1315
- for (let i = 0; i < characters.length; ++i) {
1316
- if (!isTokenCharCode(characters.charCodeAt(i))) {
1728
+ if (characters.length >= 12) return tokenRegExp.test(characters);
1729
+ if (characters.length === 0) return false;
1730
+ for (let i = 0; i < characters.length; i++) {
1731
+ if (validTokenChars[characters.charCodeAt(i)] !== 1) {
1317
1732
  return false;
1318
1733
  }
1319
1734
  }
@@ -1400,6 +1815,19 @@ var require_util = __commonJS({
1400
1815
  message += ` timeout: ${opts.timeout}ms)`;
1401
1816
  destroy(socket, new ConnectTimeoutError(message));
1402
1817
  }
1818
+ function getProtocolFromUrlString(urlString) {
1819
+ if (urlString[0] === "h" && urlString[1] === "t" && urlString[2] === "t" && urlString[3] === "p") {
1820
+ switch (urlString[4]) {
1821
+ case ":":
1822
+ return "http:";
1823
+ case "s":
1824
+ if (urlString[5] === ":") {
1825
+ return "https:";
1826
+ }
1827
+ }
1828
+ }
1829
+ return urlString.slice(0, urlString.indexOf(":") + 1);
1830
+ }
1403
1831
  var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
1404
1832
  kEnumerableProperty.enumerable = true;
1405
1833
  var normalizedMethodRecordsBase = {
@@ -1451,6 +1879,7 @@ var require_util = __commonJS({
1451
1879
  assertRequestHandler,
1452
1880
  getSocketInfo,
1453
1881
  isFormDataLike,
1882
+ pathHasQueryOrFragment,
1454
1883
  serializePathWithQuery,
1455
1884
  addAbortListener,
1456
1885
  isValidHTTPToken,
@@ -1465,14 +1894,15 @@ var require_util = __commonJS({
1465
1894
  nodeMinor,
1466
1895
  safeHTTPMethods: Object.freeze(["GET", "HEAD", "OPTIONS", "TRACE"]),
1467
1896
  wrapRequestBody,
1468
- setupConnectTimeout
1897
+ setupConnectTimeout,
1898
+ getProtocolFromUrlString
1469
1899
  };
1470
1900
  }
1471
1901
  });
1472
1902
 
1473
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/handler/unwrap-handler.js
1903
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/unwrap-handler.js
1474
1904
  var require_unwrap_handler = __commonJS({
1475
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/handler/unwrap-handler.js"(exports2, module2) {
1905
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/unwrap-handler.js"(exports2, module2) {
1476
1906
  "use strict";
1477
1907
  var { parseHeaders } = require_util();
1478
1908
  var { InvalidArgumentError } = require_errors();
@@ -1550,9 +1980,9 @@ var require_unwrap_handler = __commonJS({
1550
1980
  }
1551
1981
  });
1552
1982
 
1553
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/dispatcher-base.js
1983
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/dispatcher-base.js
1554
1984
  var require_dispatcher_base = __commonJS({
1555
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/dispatcher-base.js"(exports2, module2) {
1985
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/dispatcher-base.js"(exports2, module2) {
1556
1986
  "use strict";
1557
1987
  var Dispatcher = require_dispatcher();
1558
1988
  var UnwrapHandler = require_unwrap_handler();
@@ -1565,16 +1995,19 @@ var require_dispatcher_base = __commonJS({
1565
1995
  var kOnDestroyed = Symbol("onDestroyed");
1566
1996
  var kOnClosed = Symbol("onClosed");
1567
1997
  var DispatcherBase = class extends Dispatcher {
1568
- constructor() {
1569
- super();
1570
- this[kDestroyed] = false;
1571
- this[kOnDestroyed] = null;
1572
- this[kClosed] = false;
1573
- this[kOnClosed] = [];
1574
- }
1998
+ /** @type {boolean} */
1999
+ [kDestroyed] = false;
2000
+ /** @type {Array<Function|null} */
2001
+ [kOnDestroyed] = null;
2002
+ /** @type {boolean} */
2003
+ [kClosed] = false;
2004
+ /** @type {Array<Function>|null} */
2005
+ [kOnClosed] = null;
2006
+ /** @returns {boolean} */
1575
2007
  get destroyed() {
1576
2008
  return this[kDestroyed];
1577
2009
  }
2010
+ /** @returns {boolean} */
1578
2011
  get closed() {
1579
2012
  return this[kClosed];
1580
2013
  }
@@ -1590,7 +2023,8 @@ var require_dispatcher_base = __commonJS({
1590
2023
  throw new InvalidArgumentError("invalid callback");
1591
2024
  }
1592
2025
  if (this[kDestroyed]) {
1593
- queueMicrotask(() => callback(new ClientDestroyedError(), null));
2026
+ const err = new ClientDestroyedError();
2027
+ queueMicrotask(() => callback(err, null));
1594
2028
  return;
1595
2029
  }
1596
2030
  if (this[kClosed]) {
@@ -1602,6 +2036,7 @@ var require_dispatcher_base = __commonJS({
1602
2036
  return;
1603
2037
  }
1604
2038
  this[kClosed] = true;
2039
+ this[kOnClosed] ??= [];
1605
2040
  this[kOnClosed].push(callback);
1606
2041
  const onClosed = () => {
1607
2042
  const callbacks = this[kOnClosed];
@@ -1610,9 +2045,7 @@ var require_dispatcher_base = __commonJS({
1610
2045
  callbacks[i](null, null);
1611
2046
  }
1612
2047
  };
1613
- this[kClose]().then(() => this.destroy()).then(() => {
1614
- queueMicrotask(onClosed);
1615
- });
2048
+ this[kClose]().then(() => this.destroy()).then(() => queueMicrotask(onClosed));
1616
2049
  }
1617
2050
  destroy(err, callback) {
1618
2051
  if (typeof err === "function") {
@@ -1622,10 +2055,7 @@ var require_dispatcher_base = __commonJS({
1622
2055
  if (callback === void 0) {
1623
2056
  return new Promise((resolve, reject) => {
1624
2057
  this.destroy(err, (err2, data) => {
1625
- return err2 ? (
1626
- /* istanbul ignore next: should never error */
1627
- reject(err2)
1628
- ) : resolve(data);
2058
+ return err2 ? reject(err2) : resolve(data);
1629
2059
  });
1630
2060
  });
1631
2061
  }
@@ -1644,7 +2074,7 @@ var require_dispatcher_base = __commonJS({
1644
2074
  err = new ClientDestroyedError();
1645
2075
  }
1646
2076
  this[kDestroyed] = true;
1647
- this[kOnDestroyed] = this[kOnDestroyed] || [];
2077
+ this[kOnDestroyed] ??= [];
1648
2078
  this[kOnDestroyed].push(callback);
1649
2079
  const onDestroyed = () => {
1650
2080
  const callbacks = this[kOnDestroyed];
@@ -1653,9 +2083,7 @@ var require_dispatcher_base = __commonJS({
1653
2083
  callbacks[i](null, null);
1654
2084
  }
1655
2085
  };
1656
- this[kDestroy](err).then(() => {
1657
- queueMicrotask(onDestroyed);
1658
- });
2086
+ this[kDestroy](err).then(() => queueMicrotask(onDestroyed));
1659
2087
  }
1660
2088
  dispatch(opts, handler) {
1661
2089
  if (!handler || typeof handler !== "object") {
@@ -1738,11 +2166,11 @@ var require_client = __commonJS({
1738
2166
  }
1739
2167
  });
1740
2168
 
1741
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/agent.js
2169
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/agent.js
1742
2170
  var require_agent = __commonJS({
1743
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/dispatcher/agent.js"(exports2, module2) {
2171
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/agent.js"(exports2, module2) {
1744
2172
  "use strict";
1745
- var { InvalidArgumentError } = require_errors();
2173
+ var { InvalidArgumentError, MaxOriginsReachedError } = require_errors();
1746
2174
  var { kClients: kClients2, kRunning, kClose, kDestroy, kDispatch, kUrl } = require_symbols();
1747
2175
  var DispatcherBase = require_dispatcher_base();
1748
2176
  var Pool = require_pool();
@@ -1754,43 +2182,36 @@ var require_agent = __commonJS({
1754
2182
  var kOnDrain = Symbol("onDrain");
1755
2183
  var kFactory = Symbol("factory");
1756
2184
  var kOptions = Symbol("options");
2185
+ var kOrigins = Symbol("origins");
1757
2186
  function defaultFactory(origin, opts) {
1758
2187
  return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
1759
2188
  }
1760
2189
  var Agent = class extends DispatcherBase {
1761
- constructor({ factory = defaultFactory, connect, ...options } = {}) {
2190
+ constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
1762
2191
  if (typeof factory !== "function") {
1763
2192
  throw new InvalidArgumentError("factory must be a function.");
1764
2193
  }
1765
2194
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") {
1766
2195
  throw new InvalidArgumentError("connect must be a function or an object");
1767
2196
  }
2197
+ if (typeof maxOrigins !== "number" || Number.isNaN(maxOrigins) || maxOrigins <= 0) {
2198
+ throw new InvalidArgumentError("maxOrigins must be a number greater than 0");
2199
+ }
1768
2200
  super();
1769
2201
  if (connect && typeof connect !== "function") {
1770
2202
  connect = { ...connect };
1771
2203
  }
1772
- this[kOptions] = { ...util.deepClone(options), connect };
2204
+ this[kOptions] = { ...util.deepClone(options), maxOrigins, connect };
1773
2205
  this[kFactory] = factory;
1774
2206
  this[kClients2] = /* @__PURE__ */ new Map();
2207
+ this[kOrigins] = /* @__PURE__ */ new Set();
1775
2208
  this[kOnDrain] = (origin, targets) => {
1776
2209
  this.emit("drain", origin, [this, ...targets]);
1777
2210
  };
1778
2211
  this[kOnConnect] = (origin, targets) => {
1779
- const result = this[kClients2].get(origin);
1780
- if (result) {
1781
- result.count += 1;
1782
- }
1783
2212
  this.emit("connect", origin, [this, ...targets]);
1784
2213
  };
1785
2214
  this[kOnDisconnect] = (origin, targets, err) => {
1786
- const result = this[kClients2].get(origin);
1787
- if (result) {
1788
- result.count -= 1;
1789
- if (result.count <= 0) {
1790
- this[kClients2].delete(origin);
1791
- result.dispatcher.destroy();
1792
- }
1793
- }
1794
2215
  this.emit("disconnect", origin, [this, ...targets], err);
1795
2216
  };
1796
2217
  this[kOnConnectionError] = (origin, targets, err) => {
@@ -1811,29 +2232,56 @@ var require_agent = __commonJS({
1811
2232
  } else {
1812
2233
  throw new InvalidArgumentError("opts.origin must be a non-empty string or URL.");
1813
2234
  }
2235
+ if (this[kOrigins].size >= this[kOptions].maxOrigins && !this[kOrigins].has(key)) {
2236
+ throw new MaxOriginsReachedError();
2237
+ }
1814
2238
  const result = this[kClients2].get(key);
1815
2239
  let dispatcher = result && result.dispatcher;
1816
2240
  if (!dispatcher) {
1817
- dispatcher = this[kFactory](opts.origin, this[kOptions]).on("drain", this[kOnDrain]).on("connect", this[kOnConnect]).on("disconnect", this[kOnDisconnect]).on("connectionError", this[kOnConnectionError]);
2241
+ const closeClientIfUnused = (connected) => {
2242
+ const result2 = this[kClients2].get(key);
2243
+ if (result2) {
2244
+ if (connected) result2.count -= 1;
2245
+ if (result2.count <= 0) {
2246
+ this[kClients2].delete(key);
2247
+ result2.dispatcher.close();
2248
+ }
2249
+ this[kOrigins].delete(key);
2250
+ }
2251
+ };
2252
+ dispatcher = this[kFactory](opts.origin, this[kOptions]).on("drain", this[kOnDrain]).on("connect", (origin, targets) => {
2253
+ const result2 = this[kClients2].get(key);
2254
+ if (result2) {
2255
+ result2.count += 1;
2256
+ }
2257
+ this[kOnConnect](origin, targets);
2258
+ }).on("disconnect", (origin, targets, err) => {
2259
+ closeClientIfUnused(true);
2260
+ this[kOnDisconnect](origin, targets, err);
2261
+ }).on("connectionError", (origin, targets, err) => {
2262
+ closeClientIfUnused(false);
2263
+ this[kOnConnectionError](origin, targets, err);
2264
+ });
1818
2265
  this[kClients2].set(key, { count: 0, dispatcher });
2266
+ this[kOrigins].add(key);
1819
2267
  }
1820
2268
  return dispatcher.dispatch(opts, handler);
1821
2269
  }
1822
- async [kClose]() {
2270
+ [kClose]() {
1823
2271
  const closePromises = [];
1824
2272
  for (const { dispatcher } of this[kClients2].values()) {
1825
2273
  closePromises.push(dispatcher.close());
1826
2274
  }
1827
2275
  this[kClients2].clear();
1828
- await Promise.all(closePromises);
2276
+ return Promise.all(closePromises);
1829
2277
  }
1830
- async [kDestroy](err) {
2278
+ [kDestroy](err) {
1831
2279
  const destroyPromises = [];
1832
2280
  for (const { dispatcher } of this[kClients2].values()) {
1833
2281
  destroyPromises.push(dispatcher.destroy(err));
1834
2282
  }
1835
2283
  this[kClients2].clear();
1836
- await Promise.all(destroyPromises);
2284
+ return Promise.all(destroyPromises);
1837
2285
  }
1838
2286
  get stats() {
1839
2287
  const allClientStats = {};
@@ -1849,9 +2297,9 @@ var require_agent = __commonJS({
1849
2297
  }
1850
2298
  });
1851
2299
 
1852
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-symbols.js
2300
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-symbols.js
1853
2301
  var require_mock_symbols = __commonJS({
1854
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-symbols.js"(exports2, module2) {
2302
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-symbols.js"(exports2, module2) {
1855
2303
  "use strict";
1856
2304
  module2.exports = {
1857
2305
  kAgent: Symbol("agent"),
@@ -1885,11 +2333,12 @@ var require_mock_symbols = __commonJS({
1885
2333
  }
1886
2334
  });
1887
2335
 
1888
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-errors.js
2336
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-errors.js
1889
2337
  var require_mock_errors = __commonJS({
1890
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-errors.js"(exports2, module2) {
2338
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-errors.js"(exports2, module2) {
1891
2339
  "use strict";
1892
2340
  var { UndiciError } = require_errors();
2341
+ var kMockNotMatchedError = Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED");
1893
2342
  var MockNotMatchedError = class extends UndiciError {
1894
2343
  constructor(message) {
1895
2344
  super(message);
@@ -1897,6 +2346,12 @@ var require_mock_errors = __commonJS({
1897
2346
  this.message = message || "The request does not match any registered mock dispatches";
1898
2347
  this.code = "UND_MOCK_ERR_MOCK_NOT_MATCHED";
1899
2348
  }
2349
+ static [Symbol.hasInstance](instance) {
2350
+ return instance && instance[kMockNotMatchedError] === true;
2351
+ }
2352
+ get [kMockNotMatchedError]() {
2353
+ return true;
2354
+ }
1900
2355
  };
1901
2356
  module2.exports = {
1902
2357
  MockNotMatchedError
@@ -1904,9 +2359,9 @@ var require_mock_errors = __commonJS({
1904
2359
  }
1905
2360
  });
1906
2361
 
1907
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-utils.js
2362
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-utils.js
1908
2363
  var require_mock_utils = __commonJS({
1909
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-utils.js"(exports2, module2) {
2364
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-utils.js"(exports2, module2) {
1910
2365
  "use strict";
1911
2366
  var { MockNotMatchedError } = require_mock_errors();
1912
2367
  var {
@@ -2160,8 +2615,7 @@ var require_mock_utils = __commonJS({
2160
2615
  const optsHeaders = Array.isArray(opts.headers) ? buildHeadersFromArray(opts.headers) : opts.headers;
2161
2616
  const body = typeof _data === "function" ? _data({ ...opts, headers: optsHeaders }) : _data;
2162
2617
  if (isPromise(body)) {
2163
- body.then((newData) => handleReply(mockDispatches, newData));
2164
- return;
2618
+ return body.then((newData) => handleReply(mockDispatches, newData));
2165
2619
  }
2166
2620
  const responseData = getResponseData(body);
2167
2621
  const responseHeaders = generateKeyValues(headers);
@@ -2185,7 +2639,7 @@ var require_mock_utils = __commonJS({
2185
2639
  try {
2186
2640
  mockDispatch.call(this, opts, handler);
2187
2641
  } catch (error) {
2188
- if (error instanceof MockNotMatchedError) {
2642
+ if (error.code === "UND_MOCK_ERR_MOCK_NOT_MATCHED") {
2189
2643
  const netConnect = agent[kGetNetConnect]();
2190
2644
  if (netConnect === false) {
2191
2645
  throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`);
@@ -2214,16 +2668,17 @@ var require_mock_utils = __commonJS({
2214
2668
  return false;
2215
2669
  }
2216
2670
  function buildAndValidateMockOptions(opts) {
2217
- if (opts) {
2218
- const { agent, ...mockOptions } = opts;
2219
- if ("enableCallHistory" in mockOptions && typeof mockOptions.enableCallHistory !== "boolean") {
2220
- throw new InvalidArgumentError("options.enableCallHistory must to be a boolean");
2221
- }
2222
- if ("acceptNonStandardSearchParameters" in mockOptions && typeof mockOptions.acceptNonStandardSearchParameters !== "boolean") {
2223
- throw new InvalidArgumentError("options.acceptNonStandardSearchParameters must to be a boolean");
2224
- }
2225
- return mockOptions;
2671
+ const { agent, ...mockOptions } = opts;
2672
+ if ("enableCallHistory" in mockOptions && typeof mockOptions.enableCallHistory !== "boolean") {
2673
+ throw new InvalidArgumentError("options.enableCallHistory must to be a boolean");
2674
+ }
2675
+ if ("acceptNonStandardSearchParameters" in mockOptions && typeof mockOptions.acceptNonStandardSearchParameters !== "boolean") {
2676
+ throw new InvalidArgumentError("options.acceptNonStandardSearchParameters must to be a boolean");
2677
+ }
2678
+ if ("ignoreTrailingSlash" in mockOptions && typeof mockOptions.ignoreTrailingSlash !== "boolean") {
2679
+ throw new InvalidArgumentError("options.ignoreTrailingSlash must to be a boolean");
2226
2680
  }
2681
+ return mockOptions;
2227
2682
  }
2228
2683
  module2.exports = {
2229
2684
  getResponseData,
@@ -2246,9 +2701,9 @@ var require_mock_utils = __commonJS({
2246
2701
  }
2247
2702
  });
2248
2703
 
2249
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-interceptor.js
2704
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-interceptor.js
2250
2705
  var require_mock_interceptor = __commonJS({
2251
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-interceptor.js"(exports2, module2) {
2706
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-interceptor.js"(exports2, module2) {
2252
2707
  "use strict";
2253
2708
  var { getResponseData, buildKey, addMockDispatch } = require_mock_utils();
2254
2709
  var {
@@ -2410,9 +2865,9 @@ var require_mock_interceptor = __commonJS({
2410
2865
  }
2411
2866
  });
2412
2867
 
2413
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-client.js
2868
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-client.js
2414
2869
  var require_mock_client = __commonJS({
2415
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-client.js"(exports2, module2) {
2870
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-client.js"(exports2, module2) {
2416
2871
  "use strict";
2417
2872
  var { promisify } = require("node:util");
2418
2873
  var Client = require_client();
@@ -2471,9 +2926,9 @@ var require_mock_client = __commonJS({
2471
2926
  }
2472
2927
  });
2473
2928
 
2474
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-pool.js
2929
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-pool.js
2475
2930
  var require_mock_pool = __commonJS({
2476
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-pool.js"(exports2, module2) {
2931
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-pool.js"(exports2, module2) {
2477
2932
  "use strict";
2478
2933
  var { promisify } = require("node:util");
2479
2934
  var Pool = require_pool();
@@ -2569,9 +3024,9 @@ var require_pending_interceptor_formatter = __commonJS({
2569
3024
  }
2570
3025
  });
2571
3026
 
2572
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-call-history.js
3027
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-call-history.js
2573
3028
  var require_mock_call_history = __commonJS({
2574
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-call-history.js"(exports2, module2) {
3029
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-call-history.js"(exports2, module2) {
2575
3030
  "use strict";
2576
3031
  var { kMockCallHistoryAddLog } = require_mock_symbols();
2577
3032
  var { InvalidArgumentError } = require_errors();
@@ -2769,9 +3224,9 @@ var require_mock_call_history = __commonJS({
2769
3224
  }
2770
3225
  });
2771
3226
 
2772
- // ../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-agent.js
3227
+ // ../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-agent.js
2773
3228
  var require_mock_agent = __commonJS({
2774
- "../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/mock-agent.js"(exports2, module2) {
3229
+ "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/mock/mock-agent.js"(exports2, module2) {
2775
3230
  "use strict";
2776
3231
  var { kClients: kClients2 } = require_symbols();
2777
3232
  var Agent = require_agent();
@@ -2801,14 +3256,14 @@ var require_mock_agent = __commonJS({
2801
3256
  var PendingInterceptorsFormatter = require_pending_interceptor_formatter();
2802
3257
  var { MockCallHistory } = require_mock_call_history();
2803
3258
  var MockAgent2 = class extends Dispatcher {
2804
- constructor(opts) {
3259
+ constructor(opts = {}) {
2805
3260
  super(opts);
2806
3261
  const mockOptions = buildAndValidateMockOptions(opts);
2807
3262
  this[kNetConnect] = true;
2808
3263
  this[kIsMockActive2] = true;
2809
- this[kMockAgentIsCallHistoryEnabled] = mockOptions?.enableCallHistory ?? false;
2810
- this[kMockAgentAcceptsNonStandardSearchParameters] = mockOptions?.acceptNonStandardSearchParameters ?? false;
2811
- this[kIgnoreTrailingSlash] = mockOptions?.ignoreTrailingSlash ?? false;
3264
+ this[kMockAgentIsCallHistoryEnabled] = mockOptions.enableCallHistory ?? false;
3265
+ this[kMockAgentAcceptsNonStandardSearchParameters] = mockOptions.acceptNonStandardSearchParameters ?? false;
3266
+ this[kIgnoreTrailingSlash] = mockOptions.ignoreTrailingSlash ?? false;
2812
3267
  if (opts?.agent && typeof opts.agent.dispatch !== "function") {
2813
3268
  throw new InvalidArgumentError("Argument opts.agent must implement Agent");
2814
3269
  }