@rspack/dev-server 2.0.2 → 2.0.3

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.
Files changed (43) hide show
  1. package/client/clients/WebSocketClient.d.ts +17 -0
  2. package/client/clients/WebSocketClient.js +32 -0
  3. package/client/index.d.ts +17 -0
  4. package/client/index.js +356 -0
  5. package/client/modules/logger/Logger.d.ts +39 -0
  6. package/client/modules/logger/Logger.js +121 -0
  7. package/client/modules/logger/createConsoleLogger.d.ts +12 -0
  8. package/client/modules/logger/createConsoleLogger.js +119 -0
  9. package/client/modules/logger/index.d.ts +26 -0
  10. package/client/modules/logger/index.js +32 -0
  11. package/client/modules/types.d.ts +45 -0
  12. package/client/modules/types.js +17 -0
  13. package/client/overlay.d.ts +47 -0
  14. package/client/overlay.js +454 -0
  15. package/client/progress.d.ts +11 -0
  16. package/client/progress.js +197 -0
  17. package/client/socket.d.ts +15 -0
  18. package/client/socket.js +34 -0
  19. package/client/type.d.ts +15 -0
  20. package/client/type.js +1 -0
  21. package/client/utils/ansiHTML.d.ts +30 -0
  22. package/client/utils/ansiHTML.js +195 -0
  23. package/client/utils/log.d.ts +13 -0
  24. package/client/utils/log.js +11 -0
  25. package/client/utils/sendMessage.d.ts +11 -0
  26. package/client/utils/sendMessage.js +8 -0
  27. package/dist/0~chokidar.js +1477 -0
  28. package/dist/0~chokidar.js.LICENSE.txt +1 -0
  29. package/dist/0~connect-history-api-fallback.js +76 -0
  30. package/dist/0~connect-next.js +1245 -0
  31. package/dist/0~connect-next.js.LICENSE.txt +57 -0
  32. package/dist/0~debug.js +621 -0
  33. package/dist/0~http-proxy-middleware.js +3817 -0
  34. package/dist/0~http-proxy-middleware.js.LICENSE.txt +34 -0
  35. package/dist/0~launch-editor.js +601 -0
  36. package/dist/0~open.js +555 -0
  37. package/dist/0~p-retry.js +161 -0
  38. package/dist/0~serve-static.js +1595 -0
  39. package/dist/0~serve-static.js.LICENSE.txt +108 -0
  40. package/dist/465.js +5192 -0
  41. package/dist/index.d.ts +1008 -0
  42. package/dist/index.js +1 -0
  43. package/package.json +1 -1
@@ -0,0 +1,3817 @@
1
+ /*! LICENSE: 0~http-proxy-middleware.js.LICENSE.txt */
2
+ import node_http from "node:http";
3
+ import node_https from "node:https";
4
+ import node_http2 from "node:http2";
5
+ import { EventEmitter } from "node:events";
6
+ import "node:net";
7
+ import "node:stream";
8
+ import { URL as external_node_url_URL } from "node:url";
9
+ import { URL as external_url_URL } from "url";
10
+ import "node:zlib";
11
+ import "node:querystring";
12
+ import { __webpack_require__ } from "./465.js";
13
+ import "./0~debug.js";
14
+ import "./465.js";
15
+ __webpack_require__.add({
16
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
17
+ const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
18
+ const compile = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js");
19
+ const expand = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js");
20
+ const parse = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js");
21
+ const braces = (input, options = {})=>{
22
+ let output = [];
23
+ if (Array.isArray(input)) for (const pattern of input){
24
+ const result = braces.create(pattern, options);
25
+ if (Array.isArray(result)) output.push(...result);
26
+ else output.push(result);
27
+ }
28
+ else output = [].concat(braces.create(input, options));
29
+ if (options && true === options.expand && true === options.nodupes) output = [
30
+ ...new Set(output)
31
+ ];
32
+ return output;
33
+ };
34
+ braces.parse = (input, options = {})=>parse(input, options);
35
+ braces.stringify = (input, options = {})=>{
36
+ if ('string' == typeof input) return stringify(braces.parse(input, options), options);
37
+ return stringify(input, options);
38
+ };
39
+ braces.compile = (input, options = {})=>{
40
+ if ('string' == typeof input) input = braces.parse(input, options);
41
+ return compile(input, options);
42
+ };
43
+ braces.expand = (input, options = {})=>{
44
+ if ('string' == typeof input) input = braces.parse(input, options);
45
+ let result = expand(input, options);
46
+ if (true === options.noempty) result = result.filter(Boolean);
47
+ if (true === options.nodupes) result = [
48
+ ...new Set(result)
49
+ ];
50
+ return result;
51
+ };
52
+ braces.create = (input, options = {})=>{
53
+ if ('' === input || input.length < 3) return [
54
+ input
55
+ ];
56
+ return true !== options.expand ? braces.compile(input, options) : braces.expand(input, options);
57
+ };
58
+ module.exports = braces;
59
+ },
60
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js" (module, __unused_rspack_exports, __webpack_require__) {
61
+ const fill = __webpack_require__("./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js");
62
+ const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
63
+ const compile = (ast, options = {})=>{
64
+ const walk = (node, parent = {})=>{
65
+ const invalidBlock = utils.isInvalidBrace(parent);
66
+ const invalidNode = true === node.invalid && true === options.escapeInvalid;
67
+ const invalid = true === invalidBlock || true === invalidNode;
68
+ const prefix = true === options.escapeInvalid ? '\\' : '';
69
+ let output = '';
70
+ if (true === node.isOpen) return prefix + node.value;
71
+ if (true === node.isClose) {
72
+ console.log('node.isClose', prefix, node.value);
73
+ return prefix + node.value;
74
+ }
75
+ if ('open' === node.type) return invalid ? prefix + node.value : '(';
76
+ if ('close' === node.type) return invalid ? prefix + node.value : ')';
77
+ if ('comma' === node.type) return 'comma' === node.prev.type ? '' : invalid ? node.value : '|';
78
+ if (node.value) return node.value;
79
+ if (node.nodes && node.ranges > 0) {
80
+ const args = utils.reduce(node.nodes);
81
+ const range = fill(...args, {
82
+ ...options,
83
+ wrap: false,
84
+ toRegex: true,
85
+ strictZeros: true
86
+ });
87
+ if (0 !== range.length) return args.length > 1 && range.length > 1 ? `(${range})` : range;
88
+ }
89
+ if (node.nodes) for (const child of node.nodes)output += walk(child, node);
90
+ return output;
91
+ };
92
+ return walk(ast);
93
+ };
94
+ module.exports = compile;
95
+ },
96
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js" (module) {
97
+ module.exports = {
98
+ MAX_LENGTH: 10000,
99
+ CHAR_0: '0',
100
+ CHAR_9: '9',
101
+ CHAR_UPPERCASE_A: 'A',
102
+ CHAR_LOWERCASE_A: 'a',
103
+ CHAR_UPPERCASE_Z: 'Z',
104
+ CHAR_LOWERCASE_Z: 'z',
105
+ CHAR_LEFT_PARENTHESES: '(',
106
+ CHAR_RIGHT_PARENTHESES: ')',
107
+ CHAR_ASTERISK: '*',
108
+ CHAR_AMPERSAND: '&',
109
+ CHAR_AT: '@',
110
+ CHAR_BACKSLASH: '\\',
111
+ CHAR_BACKTICK: '`',
112
+ CHAR_CARRIAGE_RETURN: '\r',
113
+ CHAR_CIRCUMFLEX_ACCENT: '^',
114
+ CHAR_COLON: ':',
115
+ CHAR_COMMA: ',',
116
+ CHAR_DOLLAR: '$',
117
+ CHAR_DOT: '.',
118
+ CHAR_DOUBLE_QUOTE: '"',
119
+ CHAR_EQUAL: '=',
120
+ CHAR_EXCLAMATION_MARK: '!',
121
+ CHAR_FORM_FEED: '\f',
122
+ CHAR_FORWARD_SLASH: '/',
123
+ CHAR_HASH: '#',
124
+ CHAR_HYPHEN_MINUS: '-',
125
+ CHAR_LEFT_ANGLE_BRACKET: '<',
126
+ CHAR_LEFT_CURLY_BRACE: '{',
127
+ CHAR_LEFT_SQUARE_BRACKET: '[',
128
+ CHAR_LINE_FEED: '\n',
129
+ CHAR_NO_BREAK_SPACE: '\u00A0',
130
+ CHAR_PERCENT: '%',
131
+ CHAR_PLUS: '+',
132
+ CHAR_QUESTION_MARK: '?',
133
+ CHAR_RIGHT_ANGLE_BRACKET: '>',
134
+ CHAR_RIGHT_CURLY_BRACE: '}',
135
+ CHAR_RIGHT_SQUARE_BRACKET: ']',
136
+ CHAR_SEMICOLON: ';',
137
+ CHAR_SINGLE_QUOTE: '\'',
138
+ CHAR_SPACE: ' ',
139
+ CHAR_TAB: '\t',
140
+ CHAR_UNDERSCORE: '_',
141
+ CHAR_VERTICAL_LINE: '|',
142
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF'
143
+ };
144
+ },
145
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js" (module, __unused_rspack_exports, __webpack_require__) {
146
+ const fill = __webpack_require__("./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js");
147
+ const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
148
+ const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
149
+ const append = (queue = '', stash = '', enclose = false)=>{
150
+ const result = [];
151
+ queue = [].concat(queue);
152
+ stash = [].concat(stash);
153
+ if (!stash.length) return queue;
154
+ if (!queue.length) return enclose ? utils.flatten(stash).map((ele)=>`{${ele}}`) : stash;
155
+ for (const item of queue)if (Array.isArray(item)) for (const value of item)result.push(append(value, stash, enclose));
156
+ else for (let ele of stash){
157
+ if (true === enclose && 'string' == typeof ele) ele = `{${ele}}`;
158
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
159
+ }
160
+ return utils.flatten(result);
161
+ };
162
+ const expand = (ast, options = {})=>{
163
+ const rangeLimit = void 0 === options.rangeLimit ? 1000 : options.rangeLimit;
164
+ const walk = (node, parent = {})=>{
165
+ node.queue = [];
166
+ let p = parent;
167
+ let q = parent.queue;
168
+ while('brace' !== p.type && 'root' !== p.type && p.parent){
169
+ p = p.parent;
170
+ q = p.queue;
171
+ }
172
+ if (node.invalid || node.dollar) return void q.push(append(q.pop(), stringify(node, options)));
173
+ if ('brace' === node.type && true !== node.invalid && 2 === node.nodes.length) return void q.push(append(q.pop(), [
174
+ '{}'
175
+ ]));
176
+ if (node.nodes && node.ranges > 0) {
177
+ const args = utils.reduce(node.nodes);
178
+ if (utils.exceedsLimit(...args, options.step, rangeLimit)) throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
179
+ let range = fill(...args, options);
180
+ if (0 === range.length) range = stringify(node, options);
181
+ q.push(append(q.pop(), range));
182
+ node.nodes = [];
183
+ return;
184
+ }
185
+ const enclose = utils.encloseBrace(node);
186
+ let queue = node.queue;
187
+ let block = node;
188
+ while('brace' !== block.type && 'root' !== block.type && block.parent){
189
+ block = block.parent;
190
+ queue = block.queue;
191
+ }
192
+ for(let i = 0; i < node.nodes.length; i++){
193
+ const child = node.nodes[i];
194
+ if ('comma' === child.type && 'brace' === node.type) {
195
+ if (1 === i) queue.push('');
196
+ queue.push('');
197
+ continue;
198
+ }
199
+ if ('close' === child.type) {
200
+ q.push(append(q.pop(), queue, enclose));
201
+ continue;
202
+ }
203
+ if (child.value && 'open' !== child.type) {
204
+ queue.push(append(queue.pop(), child.value));
205
+ continue;
206
+ }
207
+ if (child.nodes) walk(child, node);
208
+ }
209
+ return queue;
210
+ };
211
+ return utils.flatten(walk(ast));
212
+ };
213
+ module.exports = expand;
214
+ },
215
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
216
+ const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
217
+ const { MAX_LENGTH, CHAR_BACKSLASH, CHAR_BACKTICK, CHAR_COMMA, CHAR_DOT, CHAR_LEFT_PARENTHESES, CHAR_RIGHT_PARENTHESES, CHAR_LEFT_CURLY_BRACE, CHAR_RIGHT_CURLY_BRACE, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_DOUBLE_QUOTE, CHAR_SINGLE_QUOTE, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js");
218
+ const parse = (input, options = {})=>{
219
+ if ('string' != typeof input) throw new TypeError('Expected a string');
220
+ const opts = options || {};
221
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
222
+ if (input.length > max) throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
223
+ const ast = {
224
+ type: 'root',
225
+ input,
226
+ nodes: []
227
+ };
228
+ const stack = [
229
+ ast
230
+ ];
231
+ let block = ast;
232
+ let prev = ast;
233
+ let brackets = 0;
234
+ const length = input.length;
235
+ let index = 0;
236
+ let depth = 0;
237
+ let value;
238
+ const advance = ()=>input[index++];
239
+ const push = (node)=>{
240
+ if ('text' === node.type && 'dot' === prev.type) prev.type = 'text';
241
+ if (prev && 'text' === prev.type && 'text' === node.type) {
242
+ prev.value += node.value;
243
+ return;
244
+ }
245
+ block.nodes.push(node);
246
+ node.parent = block;
247
+ node.prev = prev;
248
+ prev = node;
249
+ return node;
250
+ };
251
+ push({
252
+ type: 'bos'
253
+ });
254
+ while(index < length){
255
+ block = stack[stack.length - 1];
256
+ value = advance();
257
+ if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) continue;
258
+ if (value === CHAR_BACKSLASH) {
259
+ push({
260
+ type: 'text',
261
+ value: (options.keepEscaping ? value : '') + advance()
262
+ });
263
+ continue;
264
+ }
265
+ if (value === CHAR_RIGHT_SQUARE_BRACKET) {
266
+ push({
267
+ type: 'text',
268
+ value: '\\' + value
269
+ });
270
+ continue;
271
+ }
272
+ if (value === CHAR_LEFT_SQUARE_BRACKET) {
273
+ brackets++;
274
+ let next;
275
+ while(index < length && (next = advance())){
276
+ value += next;
277
+ if (next === CHAR_LEFT_SQUARE_BRACKET) {
278
+ brackets++;
279
+ continue;
280
+ }
281
+ if (next === CHAR_BACKSLASH) {
282
+ value += advance();
283
+ continue;
284
+ }
285
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
286
+ brackets--;
287
+ if (0 === brackets) break;
288
+ }
289
+ }
290
+ push({
291
+ type: 'text',
292
+ value
293
+ });
294
+ continue;
295
+ }
296
+ if (value === CHAR_LEFT_PARENTHESES) {
297
+ block = push({
298
+ type: 'paren',
299
+ nodes: []
300
+ });
301
+ stack.push(block);
302
+ push({
303
+ type: 'text',
304
+ value
305
+ });
306
+ continue;
307
+ }
308
+ if (value === CHAR_RIGHT_PARENTHESES) {
309
+ if ('paren' !== block.type) {
310
+ push({
311
+ type: 'text',
312
+ value
313
+ });
314
+ continue;
315
+ }
316
+ block = stack.pop();
317
+ push({
318
+ type: 'text',
319
+ value
320
+ });
321
+ block = stack[stack.length - 1];
322
+ continue;
323
+ }
324
+ if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
325
+ const open = value;
326
+ let next;
327
+ if (true !== options.keepQuotes) value = '';
328
+ while(index < length && (next = advance())){
329
+ if (next === CHAR_BACKSLASH) {
330
+ value += next + advance();
331
+ continue;
332
+ }
333
+ if (next === open) {
334
+ if (true === options.keepQuotes) value += next;
335
+ break;
336
+ }
337
+ value += next;
338
+ }
339
+ push({
340
+ type: 'text',
341
+ value
342
+ });
343
+ continue;
344
+ }
345
+ if (value === CHAR_LEFT_CURLY_BRACE) {
346
+ depth++;
347
+ const dollar = prev.value && '$' === prev.value.slice(-1) || true === block.dollar;
348
+ const brace = {
349
+ type: 'brace',
350
+ open: true,
351
+ close: false,
352
+ dollar,
353
+ depth,
354
+ commas: 0,
355
+ ranges: 0,
356
+ nodes: []
357
+ };
358
+ block = push(brace);
359
+ stack.push(block);
360
+ push({
361
+ type: 'open',
362
+ value
363
+ });
364
+ continue;
365
+ }
366
+ if (value === CHAR_RIGHT_CURLY_BRACE) {
367
+ if ('brace' !== block.type) {
368
+ push({
369
+ type: 'text',
370
+ value
371
+ });
372
+ continue;
373
+ }
374
+ const type = 'close';
375
+ block = stack.pop();
376
+ block.close = true;
377
+ push({
378
+ type,
379
+ value
380
+ });
381
+ depth--;
382
+ block = stack[stack.length - 1];
383
+ continue;
384
+ }
385
+ if (value === CHAR_COMMA && depth > 0) {
386
+ if (block.ranges > 0) {
387
+ block.ranges = 0;
388
+ const open = block.nodes.shift();
389
+ block.nodes = [
390
+ open,
391
+ {
392
+ type: 'text',
393
+ value: stringify(block)
394
+ }
395
+ ];
396
+ }
397
+ push({
398
+ type: 'comma',
399
+ value
400
+ });
401
+ block.commas++;
402
+ continue;
403
+ }
404
+ if (value === CHAR_DOT && depth > 0 && 0 === block.commas) {
405
+ const siblings = block.nodes;
406
+ if (0 === depth || 0 === siblings.length) {
407
+ push({
408
+ type: 'text',
409
+ value
410
+ });
411
+ continue;
412
+ }
413
+ if ('dot' === prev.type) {
414
+ block.range = [];
415
+ prev.value += value;
416
+ prev.type = 'range';
417
+ if (3 !== block.nodes.length && 5 !== block.nodes.length) {
418
+ block.invalid = true;
419
+ block.ranges = 0;
420
+ prev.type = 'text';
421
+ continue;
422
+ }
423
+ block.ranges++;
424
+ block.args = [];
425
+ continue;
426
+ }
427
+ if ('range' === prev.type) {
428
+ siblings.pop();
429
+ const before = siblings[siblings.length - 1];
430
+ before.value += prev.value + value;
431
+ prev = before;
432
+ block.ranges--;
433
+ continue;
434
+ }
435
+ push({
436
+ type: 'dot',
437
+ value
438
+ });
439
+ continue;
440
+ }
441
+ push({
442
+ type: 'text',
443
+ value
444
+ });
445
+ }
446
+ do {
447
+ block = stack.pop();
448
+ if ('root' !== block.type) {
449
+ block.nodes.forEach((node)=>{
450
+ if (!node.nodes) {
451
+ if ('open' === node.type) node.isOpen = true;
452
+ if ('close' === node.type) node.isClose = true;
453
+ if (!node.nodes) node.type = 'text';
454
+ node.invalid = true;
455
+ }
456
+ });
457
+ const parent = stack[stack.length - 1];
458
+ const index = parent.nodes.indexOf(block);
459
+ parent.nodes.splice(index, 1, ...block.nodes);
460
+ }
461
+ }while (stack.length > 0);
462
+ push({
463
+ type: 'eos'
464
+ });
465
+ return ast;
466
+ };
467
+ module.exports = parse;
468
+ },
469
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js" (module, __unused_rspack_exports, __webpack_require__) {
470
+ const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
471
+ module.exports = (ast, options = {})=>{
472
+ const stringify = (node, parent = {})=>{
473
+ const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
474
+ const invalidNode = true === node.invalid && true === options.escapeInvalid;
475
+ let output = '';
476
+ if (node.value) {
477
+ if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) return '\\' + node.value;
478
+ return node.value;
479
+ }
480
+ if (node.value) return node.value;
481
+ if (node.nodes) for (const child of node.nodes)output += stringify(child);
482
+ return output;
483
+ };
484
+ return stringify(ast);
485
+ };
486
+ },
487
+ "./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js" (__unused_rspack_module, exports) {
488
+ exports.isInteger = (num)=>{
489
+ if ('number' == typeof num) return Number.isInteger(num);
490
+ if ('string' == typeof num && '' !== num.trim()) return Number.isInteger(Number(num));
491
+ return false;
492
+ };
493
+ exports.find = (node, type)=>node.nodes.find((node)=>node.type === type);
494
+ exports.exceedsLimit = (min, max, step = 1, limit)=>{
495
+ if (false === limit) return false;
496
+ if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
497
+ return (Number(max) - Number(min)) / Number(step) >= limit;
498
+ };
499
+ exports.escapeNode = (block, n = 0, type)=>{
500
+ const node = block.nodes[n];
501
+ if (!node) return;
502
+ if (type && node.type === type || 'open' === node.type || 'close' === node.type) {
503
+ if (true !== node.escaped) {
504
+ node.value = '\\' + node.value;
505
+ node.escaped = true;
506
+ }
507
+ }
508
+ };
509
+ exports.encloseBrace = (node)=>{
510
+ if ('brace' !== node.type) return false;
511
+ if (node.commas >> 0 + node.ranges === 0) {
512
+ node.invalid = true;
513
+ return true;
514
+ }
515
+ return false;
516
+ };
517
+ exports.isInvalidBrace = (block)=>{
518
+ if ('brace' !== block.type) return false;
519
+ if (true === block.invalid || block.dollar) return true;
520
+ if (block.commas >> 0 + block.ranges === 0) {
521
+ block.invalid = true;
522
+ return true;
523
+ }
524
+ if (true !== block.open || true !== block.close) {
525
+ block.invalid = true;
526
+ return true;
527
+ }
528
+ return false;
529
+ };
530
+ exports.isOpenOrClose = (node)=>{
531
+ if ('open' === node.type || 'close' === node.type) return true;
532
+ return true === node.open || true === node.close;
533
+ };
534
+ exports.reduce = (nodes)=>nodes.reduce((acc, node)=>{
535
+ if ('text' === node.type) acc.push(node.value);
536
+ if ('range' === node.type) node.type = 'text';
537
+ return acc;
538
+ }, []);
539
+ exports.flatten = (...args)=>{
540
+ const result = [];
541
+ const flat = (arr)=>{
542
+ for(let i = 0; i < arr.length; i++){
543
+ const ele = arr[i];
544
+ if (Array.isArray(ele)) {
545
+ flat(ele);
546
+ continue;
547
+ }
548
+ if (void 0 !== ele) result.push(ele);
549
+ }
550
+ return result;
551
+ };
552
+ flat(args);
553
+ return result;
554
+ };
555
+ },
556
+ "./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
557
+ /*!
558
+ * fill-range <https://github.com/jonschlinkert/fill-range>
559
+ *
560
+ * Copyright (c) 2014-present, Jon Schlinkert.
561
+ * Licensed under the MIT License.
562
+ */ const util = __webpack_require__("util");
563
+ const toRegexRange = __webpack_require__("./node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js");
564
+ const isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
565
+ const transform = (toNumber)=>(value)=>true === toNumber ? Number(value) : String(value);
566
+ const isValidValue = (value)=>'number' == typeof value || 'string' == typeof value && '' !== value;
567
+ const isNumber = (num)=>Number.isInteger(+num);
568
+ const zeros = (input)=>{
569
+ let value = `${input}`;
570
+ let index = -1;
571
+ if ('-' === value[0]) value = value.slice(1);
572
+ if ('0' === value) return false;
573
+ while('0' === value[++index]);
574
+ return index > 0;
575
+ };
576
+ const stringify = (start, end, options)=>{
577
+ if ('string' == typeof start || 'string' == typeof end) return true;
578
+ return true === options.stringify;
579
+ };
580
+ const pad = (input, maxLength, toNumber)=>{
581
+ if (maxLength > 0) {
582
+ let dash = '-' === input[0] ? '-' : '';
583
+ if (dash) input = input.slice(1);
584
+ input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0');
585
+ }
586
+ if (false === toNumber) return String(input);
587
+ return input;
588
+ };
589
+ const toMaxLen = (input, maxLength)=>{
590
+ let negative = '-' === input[0] ? '-' : '';
591
+ if (negative) {
592
+ input = input.slice(1);
593
+ maxLength--;
594
+ }
595
+ while(input.length < maxLength)input = '0' + input;
596
+ return negative ? '-' + input : input;
597
+ };
598
+ const toSequence = (parts, options, maxLen)=>{
599
+ parts.negatives.sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
600
+ parts.positives.sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
601
+ let prefix = options.capture ? '' : '?:';
602
+ let positives = '';
603
+ let negatives = '';
604
+ let result;
605
+ if (parts.positives.length) positives = parts.positives.map((v)=>toMaxLen(String(v), maxLen)).join('|');
606
+ if (parts.negatives.length) negatives = `-(${prefix}${parts.negatives.map((v)=>toMaxLen(String(v), maxLen)).join('|')})`;
607
+ result = positives && negatives ? `${positives}|${negatives}` : positives || negatives;
608
+ if (options.wrap) return `(${prefix}${result})`;
609
+ return result;
610
+ };
611
+ const toRange = (a, b, isNumbers, options)=>{
612
+ if (isNumbers) return toRegexRange(a, b, {
613
+ wrap: false,
614
+ ...options
615
+ });
616
+ let start = String.fromCharCode(a);
617
+ if (a === b) return start;
618
+ let stop = String.fromCharCode(b);
619
+ return `[${start}-${stop}]`;
620
+ };
621
+ const toRegex = (start, end, options)=>{
622
+ if (Array.isArray(start)) {
623
+ let wrap = true === options.wrap;
624
+ let prefix = options.capture ? '' : '?:';
625
+ return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
626
+ }
627
+ return toRegexRange(start, end, options);
628
+ };
629
+ const rangeError = (...args)=>new RangeError('Invalid range arguments: ' + util.inspect(...args));
630
+ const invalidRange = (start, end, options)=>{
631
+ if (true === options.strictRanges) throw rangeError([
632
+ start,
633
+ end
634
+ ]);
635
+ return [];
636
+ };
637
+ const invalidStep = (step, options)=>{
638
+ if (true === options.strictRanges) throw new TypeError(`Expected step "${step}" to be a number`);
639
+ return [];
640
+ };
641
+ const fillNumbers = (start, end, step = 1, options = {})=>{
642
+ let a = Number(start);
643
+ let b = Number(end);
644
+ if (!Number.isInteger(a) || !Number.isInteger(b)) {
645
+ if (true === options.strictRanges) throw rangeError([
646
+ start,
647
+ end
648
+ ]);
649
+ return [];
650
+ }
651
+ if (0 === a) a = 0;
652
+ if (0 === b) b = 0;
653
+ let descending = a > b;
654
+ let startString = String(start);
655
+ let endString = String(end);
656
+ let stepString = String(step);
657
+ step = Math.max(Math.abs(step), 1);
658
+ let padded = zeros(startString) || zeros(endString) || zeros(stepString);
659
+ let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
660
+ let toNumber = false === padded && false === stringify(start, end, options);
661
+ let format = options.transform || transform(toNumber);
662
+ if (options.toRegex && 1 === step) return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
663
+ let parts = {
664
+ negatives: [],
665
+ positives: []
666
+ };
667
+ let push = (num)=>parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
668
+ let range = [];
669
+ let index = 0;
670
+ while(descending ? a >= b : a <= b){
671
+ if (true === options.toRegex && step > 1) push(a);
672
+ else range.push(pad(format(a, index), maxLen, toNumber));
673
+ a = descending ? a - step : a + step;
674
+ index++;
675
+ }
676
+ if (true === options.toRegex) return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, {
677
+ wrap: false,
678
+ ...options
679
+ });
680
+ return range;
681
+ };
682
+ const fillLetters = (start, end, step = 1, options = {})=>{
683
+ if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) return invalidRange(start, end, options);
684
+ let format = options.transform || ((val)=>String.fromCharCode(val));
685
+ let a = `${start}`.charCodeAt(0);
686
+ let b = `${end}`.charCodeAt(0);
687
+ let descending = a > b;
688
+ let min = Math.min(a, b);
689
+ let max = Math.max(a, b);
690
+ if (options.toRegex && 1 === step) return toRange(min, max, false, options);
691
+ let range = [];
692
+ let index = 0;
693
+ while(descending ? a >= b : a <= b){
694
+ range.push(format(a, index));
695
+ a = descending ? a - step : a + step;
696
+ index++;
697
+ }
698
+ if (true === options.toRegex) return toRegex(range, null, {
699
+ wrap: false,
700
+ options
701
+ });
702
+ return range;
703
+ };
704
+ const fill = (start, end, step, options = {})=>{
705
+ if (null == end && isValidValue(start)) return [
706
+ start
707
+ ];
708
+ if (!isValidValue(start) || !isValidValue(end)) return invalidRange(start, end, options);
709
+ if ('function' == typeof step) return fill(start, end, 1, {
710
+ transform: step
711
+ });
712
+ if (isObject(step)) return fill(start, end, 0, step);
713
+ let opts = {
714
+ ...options
715
+ };
716
+ if (true === opts.capture) opts.wrap = true;
717
+ step = step || opts.step || 1;
718
+ if (!isNumber(step)) {
719
+ if (null != step && !isObject(step)) return invalidStep(step, opts);
720
+ return fill(start, end, 1, step);
721
+ }
722
+ if (isNumber(start) && isNumber(end)) return fillNumbers(start, end, step, opts);
723
+ return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
724
+ };
725
+ module.exports = fill;
726
+ },
727
+ "./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js" (module) {
728
+ /*!
729
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
730
+ *
731
+ * Copyright (c) 2014-2016, Jon Schlinkert.
732
+ * Licensed under the MIT License.
733
+ */ module.exports = function(str) {
734
+ if ('string' != typeof str || '' === str) return false;
735
+ var match;
736
+ while(match = /(\\).|([@?!+*]\(.*\))/g.exec(str)){
737
+ if (match[2]) return true;
738
+ str = str.slice(match.index + match[0].length);
739
+ }
740
+ return false;
741
+ };
742
+ },
743
+ "./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js" (module, __unused_rspack_exports, __webpack_require__) {
744
+ /*!
745
+ * is-glob <https://github.com/jonschlinkert/is-glob>
746
+ *
747
+ * Copyright (c) 2014-2017, Jon Schlinkert.
748
+ * Released under the MIT License.
749
+ */ var isExtglob = __webpack_require__("./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js");
750
+ var chars = {
751
+ '{': '}',
752
+ '(': ')',
753
+ '[': ']'
754
+ };
755
+ var strictCheck = function(str) {
756
+ if ('!' === str[0]) return true;
757
+ var index = 0;
758
+ var pipeIndex = -2;
759
+ var closeSquareIndex = -2;
760
+ var closeCurlyIndex = -2;
761
+ var closeParenIndex = -2;
762
+ var backSlashIndex = -2;
763
+ while(index < str.length){
764
+ if ('*' === str[index]) return true;
765
+ if ('?' === str[index + 1] && /[\].+)]/.test(str[index])) return true;
766
+ if (-1 !== closeSquareIndex && '[' === str[index] && ']' !== str[index + 1]) {
767
+ if (closeSquareIndex < index) closeSquareIndex = str.indexOf(']', index);
768
+ if (closeSquareIndex > index) {
769
+ if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
770
+ backSlashIndex = str.indexOf('\\', index);
771
+ if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
772
+ }
773
+ }
774
+ if (-1 !== closeCurlyIndex && '{' === str[index] && '}' !== str[index + 1]) {
775
+ closeCurlyIndex = str.indexOf('}', index);
776
+ if (closeCurlyIndex > index) {
777
+ backSlashIndex = str.indexOf('\\', index);
778
+ if (-1 === backSlashIndex || backSlashIndex > closeCurlyIndex) return true;
779
+ }
780
+ }
781
+ if (-1 !== closeParenIndex && '(' === str[index] && '?' === str[index + 1] && /[:!=]/.test(str[index + 2]) && ')' !== str[index + 3]) {
782
+ closeParenIndex = str.indexOf(')', index);
783
+ if (closeParenIndex > index) {
784
+ backSlashIndex = str.indexOf('\\', index);
785
+ if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
786
+ }
787
+ }
788
+ if (-1 !== pipeIndex && '(' === str[index] && '|' !== str[index + 1]) {
789
+ if (pipeIndex < index) pipeIndex = str.indexOf('|', index);
790
+ if (-1 !== pipeIndex && ')' !== str[pipeIndex + 1]) {
791
+ closeParenIndex = str.indexOf(')', pipeIndex);
792
+ if (closeParenIndex > pipeIndex) {
793
+ backSlashIndex = str.indexOf('\\', pipeIndex);
794
+ if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
795
+ }
796
+ }
797
+ }
798
+ if ('\\' === str[index]) {
799
+ var open = str[index + 1];
800
+ index += 2;
801
+ var close = chars[open];
802
+ if (close) {
803
+ var n = str.indexOf(close, index);
804
+ if (-1 !== n) index = n + 1;
805
+ }
806
+ if ('!' === str[index]) return true;
807
+ } else index++;
808
+ }
809
+ return false;
810
+ };
811
+ var relaxedCheck = function(str) {
812
+ if ('!' === str[0]) return true;
813
+ var index = 0;
814
+ while(index < str.length){
815
+ if (/[*?{}()[\]]/.test(str[index])) return true;
816
+ if ('\\' === str[index]) {
817
+ var open = str[index + 1];
818
+ index += 2;
819
+ var close = chars[open];
820
+ if (close) {
821
+ var n = str.indexOf(close, index);
822
+ if (-1 !== n) index = n + 1;
823
+ }
824
+ if ('!' === str[index]) return true;
825
+ } else index++;
826
+ }
827
+ return false;
828
+ };
829
+ module.exports = function(str, options) {
830
+ if ('string' != typeof str || '' === str) return false;
831
+ if (isExtglob(str)) return true;
832
+ var check = strictCheck;
833
+ if (options && false === options.strict) check = relaxedCheck;
834
+ return check(str);
835
+ };
836
+ },
837
+ "./node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js" (module) {
838
+ /*!
839
+ * is-number <https://github.com/jonschlinkert/is-number>
840
+ *
841
+ * Copyright (c) 2014-present, Jon Schlinkert.
842
+ * Released under the MIT License.
843
+ */ module.exports = function(num) {
844
+ if ('number' == typeof num) return num - num === 0;
845
+ if ('string' == typeof num && '' !== num.trim()) return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
846
+ return false;
847
+ };
848
+ },
849
+ "./node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
850
+ const util = __webpack_require__("util");
851
+ const braces = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js");
852
+ const picomatch = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js");
853
+ const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js");
854
+ const isEmptyString = (v)=>'' === v || './' === v;
855
+ const hasBraces = (v)=>{
856
+ const index = v.indexOf('{');
857
+ return index > -1 && v.indexOf('}', index) > -1;
858
+ };
859
+ const micromatch = (list, patterns, options)=>{
860
+ patterns = [].concat(patterns);
861
+ list = [].concat(list);
862
+ let omit = new Set();
863
+ let keep = new Set();
864
+ let items = new Set();
865
+ let negatives = 0;
866
+ let onResult = (state)=>{
867
+ items.add(state.output);
868
+ if (options && options.onResult) options.onResult(state);
869
+ };
870
+ for(let i = 0; i < patterns.length; i++){
871
+ let isMatch = picomatch(String(patterns[i]), {
872
+ ...options,
873
+ onResult
874
+ }, true);
875
+ let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
876
+ if (negated) negatives++;
877
+ for (let item of list){
878
+ let matched = isMatch(item, true);
879
+ let match = negated ? !matched.isMatch : matched.isMatch;
880
+ if (match) if (negated) omit.add(matched.output);
881
+ else {
882
+ omit.delete(matched.output);
883
+ keep.add(matched.output);
884
+ }
885
+ }
886
+ }
887
+ let result = negatives === patterns.length ? [
888
+ ...items
889
+ ] : [
890
+ ...keep
891
+ ];
892
+ let matches = result.filter((item)=>!omit.has(item));
893
+ if (options && 0 === matches.length) {
894
+ if (true === options.failglob) throw new Error(`No matches found for "${patterns.join(', ')}"`);
895
+ if (true === options.nonull || true === options.nullglob) return options.unescape ? patterns.map((p)=>p.replace(/\\/g, '')) : patterns;
896
+ }
897
+ return matches;
898
+ };
899
+ micromatch.match = micromatch;
900
+ micromatch.matcher = (pattern, options)=>picomatch(pattern, options);
901
+ micromatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
902
+ micromatch.any = micromatch.isMatch;
903
+ micromatch.not = (list, patterns, options = {})=>{
904
+ patterns = [].concat(patterns).map(String);
905
+ let result = new Set();
906
+ let items = [];
907
+ let onResult = (state)=>{
908
+ if (options.onResult) options.onResult(state);
909
+ items.push(state.output);
910
+ };
911
+ let matches = new Set(micromatch(list, patterns, {
912
+ ...options,
913
+ onResult
914
+ }));
915
+ for (let item of items)if (!matches.has(item)) result.add(item);
916
+ return [
917
+ ...result
918
+ ];
919
+ };
920
+ micromatch.contains = (str, pattern, options)=>{
921
+ if ('string' != typeof str) throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
922
+ if (Array.isArray(pattern)) return pattern.some((p)=>micromatch.contains(str, p, options));
923
+ if ('string' == typeof pattern) {
924
+ if (isEmptyString(str) || isEmptyString(pattern)) return false;
925
+ if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) return true;
926
+ }
927
+ return micromatch.isMatch(str, pattern, {
928
+ ...options,
929
+ contains: true
930
+ });
931
+ };
932
+ micromatch.matchKeys = (obj, patterns, options)=>{
933
+ if (!utils.isObject(obj)) throw new TypeError('Expected the first argument to be an object');
934
+ let keys = micromatch(Object.keys(obj), patterns, options);
935
+ let res = {};
936
+ for (let key of keys)res[key] = obj[key];
937
+ return res;
938
+ };
939
+ micromatch.some = (list, patterns, options)=>{
940
+ let items = [].concat(list);
941
+ for (let pattern of [].concat(patterns)){
942
+ let isMatch = picomatch(String(pattern), options);
943
+ if (items.some((item)=>isMatch(item))) return true;
944
+ }
945
+ return false;
946
+ };
947
+ micromatch.every = (list, patterns, options)=>{
948
+ let items = [].concat(list);
949
+ for (let pattern of [].concat(patterns)){
950
+ let isMatch = picomatch(String(pattern), options);
951
+ if (!items.every((item)=>isMatch(item))) return false;
952
+ }
953
+ return true;
954
+ };
955
+ micromatch.all = (str, patterns, options)=>{
956
+ if ('string' != typeof str) throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
957
+ return [].concat(patterns).every((p)=>picomatch(p, options)(str));
958
+ };
959
+ micromatch.capture = (glob, input, options)=>{
960
+ let posix = utils.isWindows(options);
961
+ let regex = picomatch.makeRe(String(glob), {
962
+ ...options,
963
+ capture: true
964
+ });
965
+ let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
966
+ if (match) return match.slice(1).map((v)=>void 0 === v ? '' : v);
967
+ };
968
+ micromatch.makeRe = (...args)=>picomatch.makeRe(...args);
969
+ micromatch.scan = (...args)=>picomatch.scan(...args);
970
+ micromatch.parse = (patterns, options)=>{
971
+ let res = [];
972
+ for (let pattern of [].concat(patterns || []))for (let str of braces(String(pattern), options))res.push(picomatch.parse(str, options));
973
+ return res;
974
+ };
975
+ micromatch.braces = (pattern, options)=>{
976
+ if ('string' != typeof pattern) throw new TypeError('Expected a string');
977
+ if (options && true === options.nobrace || !hasBraces(pattern)) return [
978
+ pattern
979
+ ];
980
+ return braces(pattern, options);
981
+ };
982
+ micromatch.braceExpand = (pattern, options)=>{
983
+ if ('string' != typeof pattern) throw new TypeError('Expected a string');
984
+ return micromatch.braces(pattern, {
985
+ ...options,
986
+ expand: true
987
+ });
988
+ };
989
+ micromatch.hasBraces = hasBraces;
990
+ module.exports = micromatch;
991
+ },
992
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
993
+ module.exports = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js");
994
+ },
995
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js" (module, __unused_rspack_exports, __webpack_require__) {
996
+ const path = __webpack_require__("path");
997
+ const WIN_SLASH = '\\\\/';
998
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
999
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
1000
+ const DOT_LITERAL = '\\.';
1001
+ const PLUS_LITERAL = '\\+';
1002
+ const QMARK_LITERAL = '\\?';
1003
+ const SLASH_LITERAL = '\\/';
1004
+ const ONE_CHAR = '(?=.)';
1005
+ const QMARK = '[^/]';
1006
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
1007
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
1008
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
1009
+ const NO_DOT = `(?!${DOT_LITERAL})`;
1010
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
1011
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
1012
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1013
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1014
+ const STAR = `${QMARK}*?`;
1015
+ const POSIX_CHARS = {
1016
+ DOT_LITERAL,
1017
+ PLUS_LITERAL,
1018
+ QMARK_LITERAL,
1019
+ SLASH_LITERAL,
1020
+ ONE_CHAR,
1021
+ QMARK,
1022
+ END_ANCHOR,
1023
+ DOTS_SLASH,
1024
+ NO_DOT,
1025
+ NO_DOTS,
1026
+ NO_DOT_SLASH,
1027
+ NO_DOTS_SLASH,
1028
+ QMARK_NO_DOT,
1029
+ STAR,
1030
+ START_ANCHOR
1031
+ };
1032
+ const WINDOWS_CHARS = {
1033
+ ...POSIX_CHARS,
1034
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
1035
+ QMARK: WIN_NO_SLASH,
1036
+ STAR: `${WIN_NO_SLASH}*?`,
1037
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
1038
+ NO_DOT: `(?!${DOT_LITERAL})`,
1039
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1040
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
1041
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1042
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
1043
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1044
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
1045
+ };
1046
+ const POSIX_REGEX_SOURCE = {
1047
+ __proto__: null,
1048
+ alnum: 'a-zA-Z0-9',
1049
+ alpha: 'a-zA-Z',
1050
+ ascii: '\\x00-\\x7F',
1051
+ blank: ' \\t',
1052
+ cntrl: '\\x00-\\x1F\\x7F',
1053
+ digit: '0-9',
1054
+ graph: '\\x21-\\x7E',
1055
+ lower: 'a-z',
1056
+ print: '\\x20-\\x7E ',
1057
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
1058
+ space: ' \\t\\r\\n\\v\\f',
1059
+ upper: 'A-Z',
1060
+ word: 'A-Za-z0-9_',
1061
+ xdigit: 'A-Fa-f0-9'
1062
+ };
1063
+ module.exports = {
1064
+ DEFAULT_MAX_EXTGLOB_RECURSION,
1065
+ MAX_LENGTH: 65536,
1066
+ POSIX_REGEX_SOURCE,
1067
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1068
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
1069
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
1070
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
1071
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
1072
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1073
+ REPLACEMENTS: {
1074
+ __proto__: null,
1075
+ '***': '*',
1076
+ '**/**': '**',
1077
+ '**/**/**': '**'
1078
+ },
1079
+ CHAR_0: 48,
1080
+ CHAR_9: 57,
1081
+ CHAR_UPPERCASE_A: 65,
1082
+ CHAR_LOWERCASE_A: 97,
1083
+ CHAR_UPPERCASE_Z: 90,
1084
+ CHAR_LOWERCASE_Z: 122,
1085
+ CHAR_LEFT_PARENTHESES: 40,
1086
+ CHAR_RIGHT_PARENTHESES: 41,
1087
+ CHAR_ASTERISK: 42,
1088
+ CHAR_AMPERSAND: 38,
1089
+ CHAR_AT: 64,
1090
+ CHAR_BACKWARD_SLASH: 92,
1091
+ CHAR_CARRIAGE_RETURN: 13,
1092
+ CHAR_CIRCUMFLEX_ACCENT: 94,
1093
+ CHAR_COLON: 58,
1094
+ CHAR_COMMA: 44,
1095
+ CHAR_DOT: 46,
1096
+ CHAR_DOUBLE_QUOTE: 34,
1097
+ CHAR_EQUAL: 61,
1098
+ CHAR_EXCLAMATION_MARK: 33,
1099
+ CHAR_FORM_FEED: 12,
1100
+ CHAR_FORWARD_SLASH: 47,
1101
+ CHAR_GRAVE_ACCENT: 96,
1102
+ CHAR_HASH: 35,
1103
+ CHAR_HYPHEN_MINUS: 45,
1104
+ CHAR_LEFT_ANGLE_BRACKET: 60,
1105
+ CHAR_LEFT_CURLY_BRACE: 123,
1106
+ CHAR_LEFT_SQUARE_BRACKET: 91,
1107
+ CHAR_LINE_FEED: 10,
1108
+ CHAR_NO_BREAK_SPACE: 160,
1109
+ CHAR_PERCENT: 37,
1110
+ CHAR_PLUS: 43,
1111
+ CHAR_QUESTION_MARK: 63,
1112
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
1113
+ CHAR_RIGHT_CURLY_BRACE: 125,
1114
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
1115
+ CHAR_SEMICOLON: 59,
1116
+ CHAR_SINGLE_QUOTE: 39,
1117
+ CHAR_SPACE: 32,
1118
+ CHAR_TAB: 9,
1119
+ CHAR_UNDERSCORE: 95,
1120
+ CHAR_VERTICAL_LINE: 124,
1121
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1122
+ SEP: path.sep,
1123
+ extglobChars (chars) {
1124
+ return {
1125
+ '!': {
1126
+ type: 'negate',
1127
+ open: '(?:(?!(?:',
1128
+ close: `))${chars.STAR})`
1129
+ },
1130
+ '?': {
1131
+ type: 'qmark',
1132
+ open: '(?:',
1133
+ close: ')?'
1134
+ },
1135
+ '+': {
1136
+ type: 'plus',
1137
+ open: '(?:',
1138
+ close: ')+'
1139
+ },
1140
+ '*': {
1141
+ type: 'star',
1142
+ open: '(?:',
1143
+ close: ')*'
1144
+ },
1145
+ '@': {
1146
+ type: 'at',
1147
+ open: '(?:',
1148
+ close: ')'
1149
+ }
1150
+ };
1151
+ },
1152
+ globChars (win32) {
1153
+ return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
1154
+ }
1155
+ };
1156
+ },
1157
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
1158
+ const constants = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");
1159
+ const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js");
1160
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
1161
+ const expandRange = (args, options)=>{
1162
+ if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
1163
+ args.sort();
1164
+ const value = `[${args.join('-')}]`;
1165
+ try {
1166
+ new RegExp(value);
1167
+ } catch (ex) {
1168
+ return args.map((v)=>utils.escapeRegex(v)).join('..');
1169
+ }
1170
+ return value;
1171
+ };
1172
+ const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1173
+ const splitTopLevel = (input)=>{
1174
+ const parts = [];
1175
+ let bracket = 0;
1176
+ let paren = 0;
1177
+ let quote = 0;
1178
+ let value = '';
1179
+ let escaped = false;
1180
+ for (const ch of input){
1181
+ if (true === escaped) {
1182
+ value += ch;
1183
+ escaped = false;
1184
+ continue;
1185
+ }
1186
+ if ('\\' === ch) {
1187
+ value += ch;
1188
+ escaped = true;
1189
+ continue;
1190
+ }
1191
+ if ('"' === ch) {
1192
+ quote = 1 === quote ? 0 : 1;
1193
+ value += ch;
1194
+ continue;
1195
+ }
1196
+ if (0 === quote) {
1197
+ if ('[' === ch) bracket++;
1198
+ else if (']' === ch && bracket > 0) bracket--;
1199
+ else if (0 === bracket) {
1200
+ if ('(' === ch) paren++;
1201
+ else if (')' === ch && paren > 0) paren--;
1202
+ else if ('|' === ch && 0 === paren) {
1203
+ parts.push(value);
1204
+ value = '';
1205
+ continue;
1206
+ }
1207
+ }
1208
+ }
1209
+ value += ch;
1210
+ }
1211
+ parts.push(value);
1212
+ return parts;
1213
+ };
1214
+ const isPlainBranch = (branch)=>{
1215
+ let escaped = false;
1216
+ for (const ch of branch){
1217
+ if (true === escaped) {
1218
+ escaped = false;
1219
+ continue;
1220
+ }
1221
+ if ('\\' === ch) {
1222
+ escaped = true;
1223
+ continue;
1224
+ }
1225
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
1226
+ }
1227
+ return true;
1228
+ };
1229
+ const normalizeSimpleBranch = (branch)=>{
1230
+ let value = branch.trim();
1231
+ let changed = true;
1232
+ while(true === changed){
1233
+ changed = false;
1234
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
1235
+ value = value.slice(2, -1);
1236
+ changed = true;
1237
+ }
1238
+ }
1239
+ if (!isPlainBranch(value)) return;
1240
+ return value.replace(/\\(.)/g, '$1');
1241
+ };
1242
+ const hasRepeatedCharPrefixOverlap = (branches)=>{
1243
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
1244
+ for(let i = 0; i < values.length; i++)for(let j = i + 1; j < values.length; j++){
1245
+ const a = values[i];
1246
+ const b = values[j];
1247
+ const char = a[0];
1248
+ if (char && a === char.repeat(a.length) && b === char.repeat(b.length)) {
1249
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
1250
+ }
1251
+ }
1252
+ return false;
1253
+ };
1254
+ const parseRepeatedExtglob = (pattern, requireEnd = true)=>{
1255
+ if ('+' !== pattern[0] && '*' !== pattern[0] || '(' !== pattern[1]) return;
1256
+ let bracket = 0;
1257
+ let paren = 0;
1258
+ let quote = 0;
1259
+ let escaped = false;
1260
+ for(let i = 1; i < pattern.length; i++){
1261
+ const ch = pattern[i];
1262
+ if (true === escaped) {
1263
+ escaped = false;
1264
+ continue;
1265
+ }
1266
+ if ('\\' === ch) {
1267
+ escaped = true;
1268
+ continue;
1269
+ }
1270
+ if ('"' === ch) {
1271
+ quote = 1 === quote ? 0 : 1;
1272
+ continue;
1273
+ }
1274
+ if (1 !== quote) {
1275
+ if ('[' === ch) {
1276
+ bracket++;
1277
+ continue;
1278
+ }
1279
+ if (']' === ch && bracket > 0) {
1280
+ bracket--;
1281
+ continue;
1282
+ }
1283
+ if (!(bracket > 0)) {
1284
+ if ('(' === ch) {
1285
+ paren++;
1286
+ continue;
1287
+ }
1288
+ if (')' === ch) {
1289
+ paren--;
1290
+ if (0 === paren) {
1291
+ if (true === requireEnd && i !== pattern.length - 1) return;
1292
+ return {
1293
+ type: pattern[0],
1294
+ body: pattern.slice(2, i),
1295
+ end: i
1296
+ };
1297
+ }
1298
+ }
1299
+ }
1300
+ }
1301
+ }
1302
+ };
1303
+ const getStarExtglobSequenceOutput = (pattern)=>{
1304
+ let index = 0;
1305
+ const chars = [];
1306
+ while(index < pattern.length){
1307
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
1308
+ if (!match || '*' !== match.type) return;
1309
+ const branches = splitTopLevel(match.body).map((branch)=>branch.trim());
1310
+ if (1 !== branches.length) return;
1311
+ const branch = normalizeSimpleBranch(branches[0]);
1312
+ if (!branch || 1 !== branch.length) return;
1313
+ chars.push(branch);
1314
+ index += match.end + 1;
1315
+ }
1316
+ if (chars.length < 1) return;
1317
+ const source = 1 === chars.length ? utils.escapeRegex(chars[0]) : `[${chars.map((ch)=>utils.escapeRegex(ch)).join('')}]`;
1318
+ return `${source}*`;
1319
+ };
1320
+ const repeatedExtglobRecursion = (pattern)=>{
1321
+ let depth = 0;
1322
+ let value = pattern.trim();
1323
+ let match = parseRepeatedExtglob(value);
1324
+ while(match){
1325
+ depth++;
1326
+ value = match.body.trim();
1327
+ match = parseRepeatedExtglob(value);
1328
+ }
1329
+ return depth;
1330
+ };
1331
+ const analyzeRepeatedExtglob = (body, options)=>{
1332
+ if (false === options.maxExtglobRecursion) return {
1333
+ risky: false
1334
+ };
1335
+ const max = 'number' == typeof options.maxExtglobRecursion ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
1336
+ const branches = splitTopLevel(body).map((branch)=>branch.trim());
1337
+ if (branches.length > 1) {
1338
+ if (branches.some((branch)=>'' === branch) || branches.some((branch)=>/^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return {
1339
+ risky: true
1340
+ };
1341
+ }
1342
+ for (const branch of branches){
1343
+ const safeOutput = getStarExtglobSequenceOutput(branch);
1344
+ if (safeOutput) return {
1345
+ risky: true,
1346
+ safeOutput
1347
+ };
1348
+ if (repeatedExtglobRecursion(branch) > max) return {
1349
+ risky: true
1350
+ };
1351
+ }
1352
+ return {
1353
+ risky: false
1354
+ };
1355
+ };
1356
+ const parse = (input, options)=>{
1357
+ if ('string' != typeof input) throw new TypeError('Expected a string');
1358
+ input = REPLACEMENTS[input] || input;
1359
+ const opts = {
1360
+ ...options
1361
+ };
1362
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1363
+ let len = input.length;
1364
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1365
+ const bos = {
1366
+ type: 'bos',
1367
+ value: '',
1368
+ output: opts.prepend || ''
1369
+ };
1370
+ const tokens = [
1371
+ bos
1372
+ ];
1373
+ const capture = opts.capture ? '' : '?:';
1374
+ const win32 = utils.isWindows(options);
1375
+ const PLATFORM_CHARS = constants.globChars(win32);
1376
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
1377
+ const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
1378
+ const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1379
+ const nodot = opts.dot ? '' : NO_DOT;
1380
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
1381
+ let star = true === opts.bash ? globstar(opts) : STAR;
1382
+ if (opts.capture) star = `(${star})`;
1383
+ if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
1384
+ const state = {
1385
+ input,
1386
+ index: -1,
1387
+ start: 0,
1388
+ dot: true === opts.dot,
1389
+ consumed: '',
1390
+ output: '',
1391
+ prefix: '',
1392
+ backtrack: false,
1393
+ negated: false,
1394
+ brackets: 0,
1395
+ braces: 0,
1396
+ parens: 0,
1397
+ quotes: 0,
1398
+ globstar: false,
1399
+ tokens
1400
+ };
1401
+ input = utils.removePrefix(input, state);
1402
+ len = input.length;
1403
+ const extglobs = [];
1404
+ const braces = [];
1405
+ const stack = [];
1406
+ let prev = bos;
1407
+ let value;
1408
+ const eos = ()=>state.index === len - 1;
1409
+ const peek = state.peek = (n = 1)=>input[state.index + n];
1410
+ const advance = state.advance = ()=>input[++state.index] || '';
1411
+ const remaining = ()=>input.slice(state.index + 1);
1412
+ const consume = (value = '', num = 0)=>{
1413
+ state.consumed += value;
1414
+ state.index += num;
1415
+ };
1416
+ const append = (token)=>{
1417
+ state.output += null != token.output ? token.output : token.value;
1418
+ consume(token.value);
1419
+ };
1420
+ const negate = ()=>{
1421
+ let count = 1;
1422
+ while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
1423
+ advance();
1424
+ state.start++;
1425
+ count++;
1426
+ }
1427
+ if (count % 2 === 0) return false;
1428
+ state.negated = true;
1429
+ state.start++;
1430
+ return true;
1431
+ };
1432
+ const increment = (type)=>{
1433
+ state[type]++;
1434
+ stack.push(type);
1435
+ };
1436
+ const decrement = (type)=>{
1437
+ state[type]--;
1438
+ stack.pop();
1439
+ };
1440
+ const push = (tok)=>{
1441
+ if ('globstar' === prev.type) {
1442
+ const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
1443
+ const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
1444
+ if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
1445
+ state.output = state.output.slice(0, -prev.output.length);
1446
+ prev.type = 'star';
1447
+ prev.value = '*';
1448
+ prev.output = star;
1449
+ state.output += prev.output;
1450
+ }
1451
+ }
1452
+ if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
1453
+ if (tok.value || tok.output) append(tok);
1454
+ if (prev && 'text' === prev.type && 'text' === tok.type) {
1455
+ prev.value += tok.value;
1456
+ prev.output = (prev.output || '') + tok.value;
1457
+ return;
1458
+ }
1459
+ tok.prev = prev;
1460
+ tokens.push(tok);
1461
+ prev = tok;
1462
+ };
1463
+ const extglobOpen = (type, value)=>{
1464
+ const token = {
1465
+ ...EXTGLOB_CHARS[value],
1466
+ conditions: 1,
1467
+ inner: ''
1468
+ };
1469
+ token.prev = prev;
1470
+ token.parens = state.parens;
1471
+ token.output = state.output;
1472
+ token.startIndex = state.index;
1473
+ token.tokensIndex = tokens.length;
1474
+ const output = (opts.capture ? '(' : '') + token.open;
1475
+ increment('parens');
1476
+ push({
1477
+ type,
1478
+ value,
1479
+ output: state.output ? '' : ONE_CHAR
1480
+ });
1481
+ push({
1482
+ type: 'paren',
1483
+ extglob: true,
1484
+ value: advance(),
1485
+ output
1486
+ });
1487
+ extglobs.push(token);
1488
+ };
1489
+ const extglobClose = (token)=>{
1490
+ const literal = input.slice(token.startIndex, state.index + 1);
1491
+ const body = input.slice(token.startIndex + 2, state.index);
1492
+ const analysis = analyzeRepeatedExtglob(body, opts);
1493
+ if (('plus' === token.type || 'star' === token.type) && analysis.risky) {
1494
+ const safeOutput = analysis.safeOutput ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
1495
+ const open = tokens[token.tokensIndex];
1496
+ open.type = 'text';
1497
+ open.value = literal;
1498
+ open.output = safeOutput || utils.escapeRegex(literal);
1499
+ for(let i = token.tokensIndex + 1; i < tokens.length; i++){
1500
+ tokens[i].value = '';
1501
+ tokens[i].output = '';
1502
+ delete tokens[i].suffix;
1503
+ }
1504
+ state.output = token.output + open.output;
1505
+ state.backtrack = true;
1506
+ push({
1507
+ type: 'paren',
1508
+ extglob: true,
1509
+ value,
1510
+ output: ''
1511
+ });
1512
+ decrement('parens');
1513
+ return;
1514
+ }
1515
+ let output = token.close + (opts.capture ? ')' : '');
1516
+ let rest;
1517
+ if ('negate' === token.type) {
1518
+ let extglobStar = star;
1519
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
1520
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
1521
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
1522
+ const expression = parse(rest, {
1523
+ ...options,
1524
+ fastpaths: false
1525
+ }).output;
1526
+ output = token.close = `)${expression})${extglobStar})`;
1527
+ }
1528
+ if ('bos' === token.prev.type) state.negatedExtglob = true;
1529
+ }
1530
+ push({
1531
+ type: 'paren',
1532
+ extglob: true,
1533
+ value,
1534
+ output
1535
+ });
1536
+ decrement('parens');
1537
+ };
1538
+ if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1539
+ let backslashes = false;
1540
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
1541
+ if ('\\' === first) {
1542
+ backslashes = true;
1543
+ return m;
1544
+ }
1545
+ if ('?' === first) {
1546
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
1547
+ if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
1548
+ return QMARK.repeat(chars.length);
1549
+ }
1550
+ if ('.' === first) return DOT_LITERAL.repeat(chars.length);
1551
+ if ('*' === first) {
1552
+ if (esc) return esc + first + (rest ? star : '');
1553
+ return star;
1554
+ }
1555
+ return esc ? m : `\\${m}`;
1556
+ });
1557
+ if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
1558
+ if (output === input && true === opts.contains) {
1559
+ state.output = input;
1560
+ return state;
1561
+ }
1562
+ state.output = utils.wrapOutput(output, state, options);
1563
+ return state;
1564
+ }
1565
+ while(!eos()){
1566
+ value = advance();
1567
+ if ('\u0000' === value) continue;
1568
+ if ('\\' === value) {
1569
+ const next = peek();
1570
+ if ('/' === next && true !== opts.bash) continue;
1571
+ if ('.' === next || ';' === next) continue;
1572
+ if (!next) {
1573
+ value += '\\';
1574
+ push({
1575
+ type: 'text',
1576
+ value
1577
+ });
1578
+ continue;
1579
+ }
1580
+ const match = /^\\+/.exec(remaining());
1581
+ let slashes = 0;
1582
+ if (match && match[0].length > 2) {
1583
+ slashes = match[0].length;
1584
+ state.index += slashes;
1585
+ if (slashes % 2 !== 0) value += '\\';
1586
+ }
1587
+ if (true === opts.unescape) value = advance();
1588
+ else value += advance();
1589
+ if (0 === state.brackets) {
1590
+ push({
1591
+ type: 'text',
1592
+ value
1593
+ });
1594
+ continue;
1595
+ }
1596
+ }
1597
+ if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
1598
+ if (false !== opts.posix && ':' === value) {
1599
+ const inner = prev.value.slice(1);
1600
+ if (inner.includes('[')) {
1601
+ prev.posix = true;
1602
+ if (inner.includes(':')) {
1603
+ const idx = prev.value.lastIndexOf('[');
1604
+ const pre = prev.value.slice(0, idx);
1605
+ const rest = prev.value.slice(idx + 2);
1606
+ const posix = POSIX_REGEX_SOURCE[rest];
1607
+ if (posix) {
1608
+ prev.value = pre + posix;
1609
+ state.backtrack = true;
1610
+ advance();
1611
+ if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
1612
+ continue;
1613
+ }
1614
+ }
1615
+ }
1616
+ }
1617
+ if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
1618
+ if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
1619
+ if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
1620
+ prev.value += value;
1621
+ append({
1622
+ value
1623
+ });
1624
+ continue;
1625
+ }
1626
+ if (1 === state.quotes && '"' !== value) {
1627
+ value = utils.escapeRegex(value);
1628
+ prev.value += value;
1629
+ append({
1630
+ value
1631
+ });
1632
+ continue;
1633
+ }
1634
+ if ('"' === value) {
1635
+ state.quotes = 1 === state.quotes ? 0 : 1;
1636
+ if (true === opts.keepQuotes) push({
1637
+ type: 'text',
1638
+ value
1639
+ });
1640
+ continue;
1641
+ }
1642
+ if ('(' === value) {
1643
+ increment('parens');
1644
+ push({
1645
+ type: 'paren',
1646
+ value
1647
+ });
1648
+ continue;
1649
+ }
1650
+ if (')' === value) {
1651
+ if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
1652
+ const extglob = extglobs[extglobs.length - 1];
1653
+ if (extglob && state.parens === extglob.parens + 1) {
1654
+ extglobClose(extglobs.pop());
1655
+ continue;
1656
+ }
1657
+ push({
1658
+ type: 'paren',
1659
+ value,
1660
+ output: state.parens ? ')' : '\\)'
1661
+ });
1662
+ decrement('parens');
1663
+ continue;
1664
+ }
1665
+ if ('[' === value) {
1666
+ if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
1667
+ else {
1668
+ if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
1669
+ value = `\\${value}`;
1670
+ }
1671
+ push({
1672
+ type: 'bracket',
1673
+ value
1674
+ });
1675
+ continue;
1676
+ }
1677
+ if (']' === value) {
1678
+ if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
1679
+ push({
1680
+ type: 'text',
1681
+ value,
1682
+ output: `\\${value}`
1683
+ });
1684
+ continue;
1685
+ }
1686
+ if (0 === state.brackets) {
1687
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
1688
+ push({
1689
+ type: 'text',
1690
+ value,
1691
+ output: `\\${value}`
1692
+ });
1693
+ continue;
1694
+ }
1695
+ decrement('brackets');
1696
+ const prevValue = prev.value.slice(1);
1697
+ if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
1698
+ prev.value += value;
1699
+ append({
1700
+ value
1701
+ });
1702
+ if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
1703
+ const escaped = utils.escapeRegex(prev.value);
1704
+ state.output = state.output.slice(0, -prev.value.length);
1705
+ if (true === opts.literalBrackets) {
1706
+ state.output += escaped;
1707
+ prev.value = escaped;
1708
+ continue;
1709
+ }
1710
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1711
+ state.output += prev.value;
1712
+ continue;
1713
+ }
1714
+ if ('{' === value && true !== opts.nobrace) {
1715
+ increment('braces');
1716
+ const open = {
1717
+ type: 'brace',
1718
+ value,
1719
+ output: '(',
1720
+ outputIndex: state.output.length,
1721
+ tokensIndex: state.tokens.length
1722
+ };
1723
+ braces.push(open);
1724
+ push(open);
1725
+ continue;
1726
+ }
1727
+ if ('}' === value) {
1728
+ const brace = braces[braces.length - 1];
1729
+ if (true === opts.nobrace || !brace) {
1730
+ push({
1731
+ type: 'text',
1732
+ value,
1733
+ output: value
1734
+ });
1735
+ continue;
1736
+ }
1737
+ let output = ')';
1738
+ if (true === brace.dots) {
1739
+ const arr = tokens.slice();
1740
+ const range = [];
1741
+ for(let i = arr.length - 1; i >= 0; i--){
1742
+ tokens.pop();
1743
+ if ('brace' === arr[i].type) break;
1744
+ if ('dots' !== arr[i].type) range.unshift(arr[i].value);
1745
+ }
1746
+ output = expandRange(range, opts);
1747
+ state.backtrack = true;
1748
+ }
1749
+ if (true !== brace.comma && true !== brace.dots) {
1750
+ const out = state.output.slice(0, brace.outputIndex);
1751
+ const toks = state.tokens.slice(brace.tokensIndex);
1752
+ brace.value = brace.output = '\\{';
1753
+ value = output = '\\}';
1754
+ state.output = out;
1755
+ for (const t of toks)state.output += t.output || t.value;
1756
+ }
1757
+ push({
1758
+ type: 'brace',
1759
+ value,
1760
+ output
1761
+ });
1762
+ decrement('braces');
1763
+ braces.pop();
1764
+ continue;
1765
+ }
1766
+ if ('|' === value) {
1767
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1768
+ push({
1769
+ type: 'text',
1770
+ value
1771
+ });
1772
+ continue;
1773
+ }
1774
+ if (',' === value) {
1775
+ let output = value;
1776
+ const brace = braces[braces.length - 1];
1777
+ if (brace && 'braces' === stack[stack.length - 1]) {
1778
+ brace.comma = true;
1779
+ output = '|';
1780
+ }
1781
+ push({
1782
+ type: 'comma',
1783
+ value,
1784
+ output
1785
+ });
1786
+ continue;
1787
+ }
1788
+ if ('/' === value) {
1789
+ if ('dot' === prev.type && state.index === state.start + 1) {
1790
+ state.start = state.index + 1;
1791
+ state.consumed = '';
1792
+ state.output = '';
1793
+ tokens.pop();
1794
+ prev = bos;
1795
+ continue;
1796
+ }
1797
+ push({
1798
+ type: 'slash',
1799
+ value,
1800
+ output: SLASH_LITERAL
1801
+ });
1802
+ continue;
1803
+ }
1804
+ if ('.' === value) {
1805
+ if (state.braces > 0 && 'dot' === prev.type) {
1806
+ if ('.' === prev.value) prev.output = DOT_LITERAL;
1807
+ const brace = braces[braces.length - 1];
1808
+ prev.type = 'dots';
1809
+ prev.output += value;
1810
+ prev.value += value;
1811
+ brace.dots = true;
1812
+ continue;
1813
+ }
1814
+ if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
1815
+ push({
1816
+ type: 'text',
1817
+ value,
1818
+ output: DOT_LITERAL
1819
+ });
1820
+ continue;
1821
+ }
1822
+ push({
1823
+ type: 'dot',
1824
+ value,
1825
+ output: DOT_LITERAL
1826
+ });
1827
+ continue;
1828
+ }
1829
+ if ('?' === value) {
1830
+ const isGroup = prev && '(' === prev.value;
1831
+ if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
1832
+ extglobOpen('qmark', value);
1833
+ continue;
1834
+ }
1835
+ if (prev && 'paren' === prev.type) {
1836
+ const next = peek();
1837
+ let output = value;
1838
+ if ('<' === next && !utils.supportsLookbehinds()) throw new Error('Node.js v10 or higher is required for regex lookbehinds');
1839
+ if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1840
+ push({
1841
+ type: 'text',
1842
+ value,
1843
+ output
1844
+ });
1845
+ continue;
1846
+ }
1847
+ if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
1848
+ push({
1849
+ type: 'qmark',
1850
+ value,
1851
+ output: QMARK_NO_DOT
1852
+ });
1853
+ continue;
1854
+ }
1855
+ push({
1856
+ type: 'qmark',
1857
+ value,
1858
+ output: QMARK
1859
+ });
1860
+ continue;
1861
+ }
1862
+ if ('!' === value) {
1863
+ if (true !== opts.noextglob && '(' === peek()) {
1864
+ if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
1865
+ extglobOpen('negate', value);
1866
+ continue;
1867
+ }
1868
+ }
1869
+ if (true !== opts.nonegate && 0 === state.index) {
1870
+ negate();
1871
+ continue;
1872
+ }
1873
+ }
1874
+ if ('+' === value) {
1875
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
1876
+ extglobOpen('plus', value);
1877
+ continue;
1878
+ }
1879
+ if (prev && '(' === prev.value || false === opts.regex) {
1880
+ push({
1881
+ type: 'plus',
1882
+ value,
1883
+ output: PLUS_LITERAL
1884
+ });
1885
+ continue;
1886
+ }
1887
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
1888
+ push({
1889
+ type: 'plus',
1890
+ value
1891
+ });
1892
+ continue;
1893
+ }
1894
+ push({
1895
+ type: 'plus',
1896
+ value: PLUS_LITERAL
1897
+ });
1898
+ continue;
1899
+ }
1900
+ if ('@' === value) {
1901
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
1902
+ push({
1903
+ type: 'at',
1904
+ extglob: true,
1905
+ value,
1906
+ output: ''
1907
+ });
1908
+ continue;
1909
+ }
1910
+ push({
1911
+ type: 'text',
1912
+ value
1913
+ });
1914
+ continue;
1915
+ }
1916
+ if ('*' !== value) {
1917
+ if ('$' === value || '^' === value) value = `\\${value}`;
1918
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1919
+ if (match) {
1920
+ value += match[0];
1921
+ state.index += match[0].length;
1922
+ }
1923
+ push({
1924
+ type: 'text',
1925
+ value
1926
+ });
1927
+ continue;
1928
+ }
1929
+ if (prev && ('globstar' === prev.type || true === prev.star)) {
1930
+ prev.type = 'star';
1931
+ prev.star = true;
1932
+ prev.value += value;
1933
+ prev.output = star;
1934
+ state.backtrack = true;
1935
+ state.globstar = true;
1936
+ consume(value);
1937
+ continue;
1938
+ }
1939
+ let rest = remaining();
1940
+ if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
1941
+ extglobOpen('star', value);
1942
+ continue;
1943
+ }
1944
+ if ('star' === prev.type) {
1945
+ if (true === opts.noglobstar) {
1946
+ consume(value);
1947
+ continue;
1948
+ }
1949
+ const prior = prev.prev;
1950
+ const before = prior.prev;
1951
+ const isStart = 'slash' === prior.type || 'bos' === prior.type;
1952
+ const afterStar = before && ('star' === before.type || 'globstar' === before.type);
1953
+ if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
1954
+ push({
1955
+ type: 'star',
1956
+ value,
1957
+ output: ''
1958
+ });
1959
+ continue;
1960
+ }
1961
+ const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
1962
+ const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
1963
+ if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
1964
+ push({
1965
+ type: 'star',
1966
+ value,
1967
+ output: ''
1968
+ });
1969
+ continue;
1970
+ }
1971
+ while('/**' === rest.slice(0, 3)){
1972
+ const after = input[state.index + 4];
1973
+ if (after && '/' !== after) break;
1974
+ rest = rest.slice(3);
1975
+ consume('/**', 3);
1976
+ }
1977
+ if ('bos' === prior.type && eos()) {
1978
+ prev.type = 'globstar';
1979
+ prev.value += value;
1980
+ prev.output = globstar(opts);
1981
+ state.output = prev.output;
1982
+ state.globstar = true;
1983
+ consume(value);
1984
+ continue;
1985
+ }
1986
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
1987
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1988
+ prior.output = `(?:${prior.output}`;
1989
+ prev.type = 'globstar';
1990
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
1991
+ prev.value += value;
1992
+ state.globstar = true;
1993
+ state.output += prior.output + prev.output;
1994
+ consume(value);
1995
+ continue;
1996
+ }
1997
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
1998
+ const end = void 0 !== rest[1] ? '|$' : '';
1999
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
2000
+ prior.output = `(?:${prior.output}`;
2001
+ prev.type = 'globstar';
2002
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
2003
+ prev.value += value;
2004
+ state.output += prior.output + prev.output;
2005
+ state.globstar = true;
2006
+ consume(value + advance());
2007
+ push({
2008
+ type: 'slash',
2009
+ value: '/',
2010
+ output: ''
2011
+ });
2012
+ continue;
2013
+ }
2014
+ if ('bos' === prior.type && '/' === rest[0]) {
2015
+ prev.type = 'globstar';
2016
+ prev.value += value;
2017
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
2018
+ state.output = prev.output;
2019
+ state.globstar = true;
2020
+ consume(value + advance());
2021
+ push({
2022
+ type: 'slash',
2023
+ value: '/',
2024
+ output: ''
2025
+ });
2026
+ continue;
2027
+ }
2028
+ state.output = state.output.slice(0, -prev.output.length);
2029
+ prev.type = 'globstar';
2030
+ prev.output = globstar(opts);
2031
+ prev.value += value;
2032
+ state.output += prev.output;
2033
+ state.globstar = true;
2034
+ consume(value);
2035
+ continue;
2036
+ }
2037
+ const token = {
2038
+ type: 'star',
2039
+ value,
2040
+ output: star
2041
+ };
2042
+ if (true === opts.bash) {
2043
+ token.output = '.*?';
2044
+ if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
2045
+ push(token);
2046
+ continue;
2047
+ }
2048
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
2049
+ token.output = value;
2050
+ push(token);
2051
+ continue;
2052
+ }
2053
+ if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
2054
+ if ('dot' === prev.type) {
2055
+ state.output += NO_DOT_SLASH;
2056
+ prev.output += NO_DOT_SLASH;
2057
+ } else if (true === opts.dot) {
2058
+ state.output += NO_DOTS_SLASH;
2059
+ prev.output += NO_DOTS_SLASH;
2060
+ } else {
2061
+ state.output += nodot;
2062
+ prev.output += nodot;
2063
+ }
2064
+ if ('*' !== peek()) {
2065
+ state.output += ONE_CHAR;
2066
+ prev.output += ONE_CHAR;
2067
+ }
2068
+ }
2069
+ push(token);
2070
+ }
2071
+ while(state.brackets > 0){
2072
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
2073
+ state.output = utils.escapeLast(state.output, '[');
2074
+ decrement('brackets');
2075
+ }
2076
+ while(state.parens > 0){
2077
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
2078
+ state.output = utils.escapeLast(state.output, '(');
2079
+ decrement('parens');
2080
+ }
2081
+ while(state.braces > 0){
2082
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
2083
+ state.output = utils.escapeLast(state.output, '{');
2084
+ decrement('braces');
2085
+ }
2086
+ if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
2087
+ type: 'maybe_slash',
2088
+ value: '',
2089
+ output: `${SLASH_LITERAL}?`
2090
+ });
2091
+ if (true === state.backtrack) {
2092
+ state.output = '';
2093
+ for (const token of state.tokens){
2094
+ state.output += null != token.output ? token.output : token.value;
2095
+ if (token.suffix) state.output += token.suffix;
2096
+ }
2097
+ }
2098
+ return state;
2099
+ };
2100
+ parse.fastpaths = (input, options)=>{
2101
+ const opts = {
2102
+ ...options
2103
+ };
2104
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2105
+ const len = input.length;
2106
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2107
+ input = REPLACEMENTS[input] || input;
2108
+ const win32 = utils.isWindows(options);
2109
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(win32);
2110
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
2111
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
2112
+ const capture = opts.capture ? '' : '?:';
2113
+ const state = {
2114
+ negated: false,
2115
+ prefix: ''
2116
+ };
2117
+ let star = true === opts.bash ? '.*?' : STAR;
2118
+ if (opts.capture) star = `(${star})`;
2119
+ const globstar = (opts)=>{
2120
+ if (true === opts.noglobstar) return star;
2121
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2122
+ };
2123
+ const create = (str)=>{
2124
+ switch(str){
2125
+ case '*':
2126
+ return `${nodot}${ONE_CHAR}${star}`;
2127
+ case '.*':
2128
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
2129
+ case '*.*':
2130
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2131
+ case '*/*':
2132
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
2133
+ case '**':
2134
+ return nodot + globstar(opts);
2135
+ case '**/*':
2136
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
2137
+ case '**/*.*':
2138
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2139
+ case '**/.*':
2140
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
2141
+ default:
2142
+ {
2143
+ const match = /^(.*?)\.(\w+)$/.exec(str);
2144
+ if (!match) return;
2145
+ const source = create(match[1]);
2146
+ if (!source) return;
2147
+ return source + DOT_LITERAL + match[2];
2148
+ }
2149
+ }
2150
+ };
2151
+ const output = utils.removePrefix(input, state);
2152
+ let source = create(output);
2153
+ if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
2154
+ return source;
2155
+ };
2156
+ module.exports = parse;
2157
+ },
2158
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
2159
+ const path = __webpack_require__("path");
2160
+ const scan = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js");
2161
+ const parse = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js");
2162
+ const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js");
2163
+ const constants = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");
2164
+ const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
2165
+ const picomatch = (glob, options, returnState = false)=>{
2166
+ if (Array.isArray(glob)) {
2167
+ const fns = glob.map((input)=>picomatch(input, options, returnState));
2168
+ const arrayMatcher = (str)=>{
2169
+ for (const isMatch of fns){
2170
+ const state = isMatch(str);
2171
+ if (state) return state;
2172
+ }
2173
+ return false;
2174
+ };
2175
+ return arrayMatcher;
2176
+ }
2177
+ const isState = isObject(glob) && glob.tokens && glob.input;
2178
+ if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
2179
+ const opts = options || {};
2180
+ const posix = utils.isWindows(options);
2181
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
2182
+ const state = regex.state;
2183
+ delete regex.state;
2184
+ let isIgnored = ()=>false;
2185
+ if (opts.ignore) {
2186
+ const ignoreOpts = {
2187
+ ...options,
2188
+ ignore: null,
2189
+ onMatch: null,
2190
+ onResult: null
2191
+ };
2192
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
2193
+ }
2194
+ const matcher = (input, returnObject = false)=>{
2195
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
2196
+ glob,
2197
+ posix
2198
+ });
2199
+ const result = {
2200
+ glob,
2201
+ state,
2202
+ regex,
2203
+ posix,
2204
+ input,
2205
+ output,
2206
+ match,
2207
+ isMatch
2208
+ };
2209
+ if ('function' == typeof opts.onResult) opts.onResult(result);
2210
+ if (false === isMatch) {
2211
+ result.isMatch = false;
2212
+ return returnObject ? result : false;
2213
+ }
2214
+ if (isIgnored(input)) {
2215
+ if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
2216
+ result.isMatch = false;
2217
+ return returnObject ? result : false;
2218
+ }
2219
+ if ('function' == typeof opts.onMatch) opts.onMatch(result);
2220
+ return returnObject ? result : true;
2221
+ };
2222
+ if (returnState) matcher.state = state;
2223
+ return matcher;
2224
+ };
2225
+ picomatch.test = (input, regex, options, { glob, posix } = {})=>{
2226
+ if ('string' != typeof input) throw new TypeError('Expected input to be a string');
2227
+ if ('' === input) return {
2228
+ isMatch: false,
2229
+ output: ''
2230
+ };
2231
+ const opts = options || {};
2232
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
2233
+ let match = input === glob;
2234
+ let output = match && format ? format(input) : input;
2235
+ if (false === match) {
2236
+ output = format ? format(input) : input;
2237
+ match = output === glob;
2238
+ }
2239
+ if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
2240
+ return {
2241
+ isMatch: Boolean(match),
2242
+ match,
2243
+ output
2244
+ };
2245
+ };
2246
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options))=>{
2247
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
2248
+ return regex.test(path.basename(input));
2249
+ };
2250
+ picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
2251
+ picomatch.parse = (pattern, options)=>{
2252
+ if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
2253
+ return parse(pattern, {
2254
+ ...options,
2255
+ fastpaths: false
2256
+ });
2257
+ };
2258
+ picomatch.scan = (input, options)=>scan(input, options);
2259
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
2260
+ if (true === returnOutput) return state.output;
2261
+ const opts = options || {};
2262
+ const prepend = opts.contains ? '' : '^';
2263
+ const append = opts.contains ? '' : '$';
2264
+ let source = `${prepend}(?:${state.output})${append}`;
2265
+ if (state && true === state.negated) source = `^(?!${source}).*$`;
2266
+ const regex = picomatch.toRegex(source, options);
2267
+ if (true === returnState) regex.state = state;
2268
+ return regex;
2269
+ };
2270
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
2271
+ if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
2272
+ let parsed = {
2273
+ negated: false,
2274
+ fastpaths: true
2275
+ };
2276
+ if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
2277
+ if (!parsed.output) parsed = parse(input, options);
2278
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
2279
+ };
2280
+ picomatch.toRegex = (source, options)=>{
2281
+ try {
2282
+ const opts = options || {};
2283
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
2284
+ } catch (err) {
2285
+ if (options && true === options.debug) throw err;
2286
+ return /$^/;
2287
+ }
2288
+ };
2289
+ picomatch.constants = constants;
2290
+ module.exports = picomatch;
2291
+ },
2292
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
2293
+ const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js");
2294
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");
2295
+ const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
2296
+ const depth = (token)=>{
2297
+ if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
2298
+ };
2299
+ const scan = (input, options)=>{
2300
+ const opts = options || {};
2301
+ const length = input.length - 1;
2302
+ const scanToEnd = true === opts.parts || true === opts.scanToEnd;
2303
+ const slashes = [];
2304
+ const tokens = [];
2305
+ const parts = [];
2306
+ let str = input;
2307
+ let index = -1;
2308
+ let start = 0;
2309
+ let lastIndex = 0;
2310
+ let isBrace = false;
2311
+ let isBracket = false;
2312
+ let isGlob = false;
2313
+ let isExtglob = false;
2314
+ let isGlobstar = false;
2315
+ let braceEscaped = false;
2316
+ let backslashes = false;
2317
+ let negated = false;
2318
+ let negatedExtglob = false;
2319
+ let finished = false;
2320
+ let braces = 0;
2321
+ let prev;
2322
+ let code;
2323
+ let token = {
2324
+ value: '',
2325
+ depth: 0,
2326
+ isGlob: false
2327
+ };
2328
+ const eos = ()=>index >= length;
2329
+ const peek = ()=>str.charCodeAt(index + 1);
2330
+ const advance = ()=>{
2331
+ prev = code;
2332
+ return str.charCodeAt(++index);
2333
+ };
2334
+ while(index < length){
2335
+ code = advance();
2336
+ let next;
2337
+ if (code === CHAR_BACKWARD_SLASH) {
2338
+ backslashes = token.backslashes = true;
2339
+ code = advance();
2340
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
2341
+ continue;
2342
+ }
2343
+ if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
2344
+ braces++;
2345
+ while(true !== eos() && (code = advance())){
2346
+ if (code === CHAR_BACKWARD_SLASH) {
2347
+ backslashes = token.backslashes = true;
2348
+ advance();
2349
+ continue;
2350
+ }
2351
+ if (code === CHAR_LEFT_CURLY_BRACE) {
2352
+ braces++;
2353
+ continue;
2354
+ }
2355
+ if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
2356
+ isBrace = token.isBrace = true;
2357
+ isGlob = token.isGlob = true;
2358
+ finished = true;
2359
+ if (true === scanToEnd) continue;
2360
+ break;
2361
+ }
2362
+ if (true !== braceEscaped && code === CHAR_COMMA) {
2363
+ isBrace = token.isBrace = true;
2364
+ isGlob = token.isGlob = true;
2365
+ finished = true;
2366
+ if (true === scanToEnd) continue;
2367
+ break;
2368
+ }
2369
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
2370
+ braces--;
2371
+ if (0 === braces) {
2372
+ braceEscaped = false;
2373
+ isBrace = token.isBrace = true;
2374
+ finished = true;
2375
+ break;
2376
+ }
2377
+ }
2378
+ }
2379
+ if (true === scanToEnd) continue;
2380
+ break;
2381
+ }
2382
+ if (code === CHAR_FORWARD_SLASH) {
2383
+ slashes.push(index);
2384
+ tokens.push(token);
2385
+ token = {
2386
+ value: '',
2387
+ depth: 0,
2388
+ isGlob: false
2389
+ };
2390
+ if (true === finished) continue;
2391
+ if (prev === CHAR_DOT && index === start + 1) {
2392
+ start += 2;
2393
+ continue;
2394
+ }
2395
+ lastIndex = index + 1;
2396
+ continue;
2397
+ }
2398
+ if (true !== opts.noext) {
2399
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
2400
+ if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
2401
+ isGlob = token.isGlob = true;
2402
+ isExtglob = token.isExtglob = true;
2403
+ finished = true;
2404
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
2405
+ if (true === scanToEnd) {
2406
+ while(true !== eos() && (code = advance())){
2407
+ if (code === CHAR_BACKWARD_SLASH) {
2408
+ backslashes = token.backslashes = true;
2409
+ code = advance();
2410
+ continue;
2411
+ }
2412
+ if (code === CHAR_RIGHT_PARENTHESES) {
2413
+ isGlob = token.isGlob = true;
2414
+ finished = true;
2415
+ break;
2416
+ }
2417
+ }
2418
+ continue;
2419
+ }
2420
+ break;
2421
+ }
2422
+ }
2423
+ if (code === CHAR_ASTERISK) {
2424
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
2425
+ isGlob = token.isGlob = true;
2426
+ finished = true;
2427
+ if (true === scanToEnd) continue;
2428
+ break;
2429
+ }
2430
+ if (code === CHAR_QUESTION_MARK) {
2431
+ isGlob = token.isGlob = true;
2432
+ finished = true;
2433
+ if (true === scanToEnd) continue;
2434
+ break;
2435
+ }
2436
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
2437
+ while(true !== eos() && (next = advance())){
2438
+ if (next === CHAR_BACKWARD_SLASH) {
2439
+ backslashes = token.backslashes = true;
2440
+ advance();
2441
+ continue;
2442
+ }
2443
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
2444
+ isBracket = token.isBracket = true;
2445
+ isGlob = token.isGlob = true;
2446
+ finished = true;
2447
+ break;
2448
+ }
2449
+ }
2450
+ if (true === scanToEnd) continue;
2451
+ break;
2452
+ }
2453
+ if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
2454
+ negated = token.negated = true;
2455
+ start++;
2456
+ continue;
2457
+ }
2458
+ if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
2459
+ isGlob = token.isGlob = true;
2460
+ if (true === scanToEnd) {
2461
+ while(true !== eos() && (code = advance())){
2462
+ if (code === CHAR_LEFT_PARENTHESES) {
2463
+ backslashes = token.backslashes = true;
2464
+ code = advance();
2465
+ continue;
2466
+ }
2467
+ if (code === CHAR_RIGHT_PARENTHESES) {
2468
+ finished = true;
2469
+ break;
2470
+ }
2471
+ }
2472
+ continue;
2473
+ }
2474
+ break;
2475
+ }
2476
+ if (true === isGlob) {
2477
+ finished = true;
2478
+ if (true === scanToEnd) continue;
2479
+ break;
2480
+ }
2481
+ }
2482
+ if (true === opts.noext) {
2483
+ isExtglob = false;
2484
+ isGlob = false;
2485
+ }
2486
+ let base = str;
2487
+ let prefix = '';
2488
+ let glob = '';
2489
+ if (start > 0) {
2490
+ prefix = str.slice(0, start);
2491
+ str = str.slice(start);
2492
+ lastIndex -= start;
2493
+ }
2494
+ if (base && true === isGlob && lastIndex > 0) {
2495
+ base = str.slice(0, lastIndex);
2496
+ glob = str.slice(lastIndex);
2497
+ } else if (true === isGlob) {
2498
+ base = '';
2499
+ glob = str;
2500
+ } else base = str;
2501
+ if (base && '' !== base && '/' !== base && base !== str) {
2502
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
2503
+ }
2504
+ if (true === opts.unescape) {
2505
+ if (glob) glob = utils.removeBackslashes(glob);
2506
+ if (base && true === backslashes) base = utils.removeBackslashes(base);
2507
+ }
2508
+ const state = {
2509
+ prefix,
2510
+ input,
2511
+ start,
2512
+ base,
2513
+ glob,
2514
+ isBrace,
2515
+ isBracket,
2516
+ isGlob,
2517
+ isExtglob,
2518
+ isGlobstar,
2519
+ negated,
2520
+ negatedExtglob
2521
+ };
2522
+ if (true === opts.tokens) {
2523
+ state.maxDepth = 0;
2524
+ if (!isPathSeparator(code)) tokens.push(token);
2525
+ state.tokens = tokens;
2526
+ }
2527
+ if (true === opts.parts || true === opts.tokens) {
2528
+ let prevIndex;
2529
+ for(let idx = 0; idx < slashes.length; idx++){
2530
+ const n = prevIndex ? prevIndex + 1 : start;
2531
+ const i = slashes[idx];
2532
+ const value = input.slice(n, i);
2533
+ if (opts.tokens) {
2534
+ if (0 === idx && 0 !== start) {
2535
+ tokens[idx].isPrefix = true;
2536
+ tokens[idx].value = prefix;
2537
+ } else tokens[idx].value = value;
2538
+ depth(tokens[idx]);
2539
+ state.maxDepth += tokens[idx].depth;
2540
+ }
2541
+ if (0 !== idx || '' !== value) parts.push(value);
2542
+ prevIndex = i;
2543
+ }
2544
+ if (prevIndex && prevIndex + 1 < input.length) {
2545
+ const value = input.slice(prevIndex + 1);
2546
+ parts.push(value);
2547
+ if (opts.tokens) {
2548
+ tokens[tokens.length - 1].value = value;
2549
+ depth(tokens[tokens.length - 1]);
2550
+ state.maxDepth += tokens[tokens.length - 1].depth;
2551
+ }
2552
+ }
2553
+ state.slashes = slashes;
2554
+ state.parts = parts;
2555
+ }
2556
+ return state;
2557
+ };
2558
+ module.exports = scan;
2559
+ },
2560
+ "./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
2561
+ const path = __webpack_require__("path");
2562
+ const win32 = 'win32' === process.platform;
2563
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");
2564
+ exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
2565
+ exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
2566
+ exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
2567
+ exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
2568
+ exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
2569
+ exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
2570
+ exports.supportsLookbehinds = ()=>{
2571
+ const segs = process.version.slice(1).split('.').map(Number);
2572
+ if (3 === segs.length && segs[0] >= 9 || 8 === segs[0] && segs[1] >= 10) return true;
2573
+ return false;
2574
+ };
2575
+ exports.isWindows = (options)=>{
2576
+ if (options && 'boolean' == typeof options.windows) return options.windows;
2577
+ return true === win32 || '\\' === path.sep;
2578
+ };
2579
+ exports.escapeLast = (input, char, lastIdx)=>{
2580
+ const idx = input.lastIndexOf(char, lastIdx);
2581
+ if (-1 === idx) return input;
2582
+ if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
2583
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
2584
+ };
2585
+ exports.removePrefix = (input, state = {})=>{
2586
+ let output = input;
2587
+ if (output.startsWith('./')) {
2588
+ output = output.slice(2);
2589
+ state.prefix = './';
2590
+ }
2591
+ return output;
2592
+ };
2593
+ exports.wrapOutput = (input, state = {}, options = {})=>{
2594
+ const prepend = options.contains ? '' : '^';
2595
+ const append = options.contains ? '' : '$';
2596
+ let output = `${prepend}(?:${input})${append}`;
2597
+ if (true === state.negated) output = `(?:^(?!${output}).*$)`;
2598
+ return output;
2599
+ };
2600
+ },
2601
+ "./node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
2602
+ /*!
2603
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
2604
+ *
2605
+ * Copyright (c) 2015-present, Jon Schlinkert.
2606
+ * Released under the MIT License.
2607
+ */ const isNumber = __webpack_require__("./node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js");
2608
+ const toRegexRange = (min, max, options)=>{
2609
+ if (false === isNumber(min)) throw new TypeError('toRegexRange: expected the first argument to be a number');
2610
+ if (void 0 === max || min === max) return String(min);
2611
+ if (false === isNumber(max)) throw new TypeError('toRegexRange: expected the second argument to be a number.');
2612
+ let opts = {
2613
+ relaxZeros: true,
2614
+ ...options
2615
+ };
2616
+ if ('boolean' == typeof opts.strictZeros) opts.relaxZeros = false === opts.strictZeros;
2617
+ let relax = String(opts.relaxZeros);
2618
+ let shorthand = String(opts.shorthand);
2619
+ let capture = String(opts.capture);
2620
+ let wrap = String(opts.wrap);
2621
+ let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
2622
+ if (toRegexRange.cache.hasOwnProperty(cacheKey)) return toRegexRange.cache[cacheKey].result;
2623
+ let a = Math.min(min, max);
2624
+ let b = Math.max(min, max);
2625
+ if (1 === Math.abs(a - b)) {
2626
+ let result = min + '|' + max;
2627
+ if (opts.capture) return `(${result})`;
2628
+ if (false === opts.wrap) return result;
2629
+ return `(?:${result})`;
2630
+ }
2631
+ let isPadded = hasPadding(min) || hasPadding(max);
2632
+ let state = {
2633
+ min,
2634
+ max,
2635
+ a,
2636
+ b
2637
+ };
2638
+ let positives = [];
2639
+ let negatives = [];
2640
+ if (isPadded) {
2641
+ state.isPadded = isPadded;
2642
+ state.maxLen = String(state.max).length;
2643
+ }
2644
+ if (a < 0) {
2645
+ let newMin = b < 0 ? Math.abs(b) : 1;
2646
+ negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
2647
+ a = state.a = 0;
2648
+ }
2649
+ if (b >= 0) positives = splitToPatterns(a, b, state, opts);
2650
+ state.negatives = negatives;
2651
+ state.positives = positives;
2652
+ state.result = collatePatterns(negatives, positives, opts);
2653
+ if (true === opts.capture) state.result = `(${state.result})`;
2654
+ else if (false !== opts.wrap && positives.length + negatives.length > 1) state.result = `(?:${state.result})`;
2655
+ toRegexRange.cache[cacheKey] = state;
2656
+ return state.result;
2657
+ };
2658
+ function collatePatterns(neg, pos, options) {
2659
+ let onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
2660
+ let onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
2661
+ let intersected = filterPatterns(neg, pos, '-?', true, options) || [];
2662
+ let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
2663
+ return subpatterns.join('|');
2664
+ }
2665
+ function splitToRanges(min, max) {
2666
+ let nines = 1;
2667
+ let zeros = 1;
2668
+ let stop = countNines(min, nines);
2669
+ let stops = new Set([
2670
+ max
2671
+ ]);
2672
+ while(min <= stop && stop <= max){
2673
+ stops.add(stop);
2674
+ nines += 1;
2675
+ stop = countNines(min, nines);
2676
+ }
2677
+ stop = countZeros(max + 1, zeros) - 1;
2678
+ while(min < stop && stop <= max){
2679
+ stops.add(stop);
2680
+ zeros += 1;
2681
+ stop = countZeros(max + 1, zeros) - 1;
2682
+ }
2683
+ stops = [
2684
+ ...stops
2685
+ ];
2686
+ stops.sort(compare);
2687
+ return stops;
2688
+ }
2689
+ function rangeToPattern(start, stop, options) {
2690
+ if (start === stop) return {
2691
+ pattern: start,
2692
+ count: [],
2693
+ digits: 0
2694
+ };
2695
+ let zipped = zip(start, stop);
2696
+ let digits = zipped.length;
2697
+ let pattern = '';
2698
+ let count = 0;
2699
+ for(let i = 0; i < digits; i++){
2700
+ let [startDigit, stopDigit] = zipped[i];
2701
+ if (startDigit === stopDigit) pattern += startDigit;
2702
+ else if ('0' !== startDigit || '9' !== stopDigit) pattern += toCharacterClass(startDigit, stopDigit, options);
2703
+ else count++;
2704
+ }
2705
+ if (count) pattern += true === options.shorthand ? '\\d' : '[0-9]';
2706
+ return {
2707
+ pattern,
2708
+ count: [
2709
+ count
2710
+ ],
2711
+ digits
2712
+ };
2713
+ }
2714
+ function splitToPatterns(min, max, tok, options) {
2715
+ let ranges = splitToRanges(min, max);
2716
+ let tokens = [];
2717
+ let start = min;
2718
+ let prev;
2719
+ for(let i = 0; i < ranges.length; i++){
2720
+ let max = ranges[i];
2721
+ let obj = rangeToPattern(String(start), String(max), options);
2722
+ let zeros = '';
2723
+ if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
2724
+ if (prev.count.length > 1) prev.count.pop();
2725
+ prev.count.push(obj.count[0]);
2726
+ prev.string = prev.pattern + toQuantifier(prev.count);
2727
+ start = max + 1;
2728
+ continue;
2729
+ }
2730
+ if (tok.isPadded) zeros = padZeros(max, tok, options);
2731
+ obj.string = zeros + obj.pattern + toQuantifier(obj.count);
2732
+ tokens.push(obj);
2733
+ start = max + 1;
2734
+ prev = obj;
2735
+ }
2736
+ return tokens;
2737
+ }
2738
+ function filterPatterns(arr, comparison, prefix, intersection, options) {
2739
+ let result = [];
2740
+ for (let ele of arr){
2741
+ let { string } = ele;
2742
+ if (!intersection && !contains(comparison, 'string', string)) result.push(prefix + string);
2743
+ if (intersection && contains(comparison, 'string', string)) result.push(prefix + string);
2744
+ }
2745
+ return result;
2746
+ }
2747
+ function zip(a, b) {
2748
+ let arr = [];
2749
+ for(let i = 0; i < a.length; i++)arr.push([
2750
+ a[i],
2751
+ b[i]
2752
+ ]);
2753
+ return arr;
2754
+ }
2755
+ function compare(a, b) {
2756
+ return a > b ? 1 : b > a ? -1 : 0;
2757
+ }
2758
+ function contains(arr, key, val) {
2759
+ return arr.some((ele)=>ele[key] === val);
2760
+ }
2761
+ function countNines(min, len) {
2762
+ return Number(String(min).slice(0, -len) + '9'.repeat(len));
2763
+ }
2764
+ function countZeros(integer, zeros) {
2765
+ return integer - integer % Math.pow(10, zeros);
2766
+ }
2767
+ function toQuantifier(digits) {
2768
+ let [start = 0, stop = ''] = digits;
2769
+ if (stop || start > 1) return `{${start + (stop ? ',' + stop : '')}}`;
2770
+ return '';
2771
+ }
2772
+ function toCharacterClass(a, b, options) {
2773
+ return `[${a}${b - a === 1 ? '' : '-'}${b}]`;
2774
+ }
2775
+ function hasPadding(str) {
2776
+ return /^-?(0+)\d/.test(str);
2777
+ }
2778
+ function padZeros(value, tok, options) {
2779
+ if (!tok.isPadded) return value;
2780
+ let diff = Math.abs(tok.maxLen - String(value).length);
2781
+ let relax = false !== options.relaxZeros;
2782
+ switch(diff){
2783
+ case 0:
2784
+ return '';
2785
+ case 1:
2786
+ return relax ? '0?' : '0';
2787
+ case 2:
2788
+ return relax ? '0{0,2}' : '00';
2789
+ default:
2790
+ return relax ? `0{0,${diff}}` : `0{${diff}}`;
2791
+ }
2792
+ }
2793
+ toRegexRange.cache = {};
2794
+ toRegexRange.clearCache = ()=>toRegexRange.cache = {};
2795
+ module.exports = toRegexRange;
2796
+ }
2797
+ });
2798
+ const upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i;
2799
+ const defaultAgents = {
2800
+ http: new node_http.Agent({
2801
+ keepAlive: true,
2802
+ maxSockets: 256,
2803
+ maxFreeSockets: 64
2804
+ }),
2805
+ https: new node_https.Agent({
2806
+ keepAlive: true,
2807
+ maxSockets: 256,
2808
+ maxFreeSockets: 64
2809
+ })
2810
+ };
2811
+ const isSSL = /^https|wss/;
2812
+ const HTTP2_HEADER_BLACKLIST = [
2813
+ ":method",
2814
+ ":path",
2815
+ ":scheme",
2816
+ ":authority"
2817
+ ];
2818
+ function setupOutgoing(outgoing, options, req, forward) {
2819
+ outgoing.port = options[forward || "target"].port || (isSSL.test(options[forward || "target"].protocol ?? "http") ? 443 : 80);
2820
+ for (const e of [
2821
+ "host",
2822
+ "hostname",
2823
+ "socketPath",
2824
+ "pfx",
2825
+ "key",
2826
+ "passphrase",
2827
+ "cert",
2828
+ "ca",
2829
+ "ciphers",
2830
+ "secureProtocol"
2831
+ ]){
2832
+ const value = options[forward || "target"][e];
2833
+ if (void 0 !== value) outgoing[e] = value;
2834
+ }
2835
+ outgoing.method = options.method || req.method;
2836
+ outgoing.headers = {
2837
+ ...req.headers
2838
+ };
2839
+ if (req.headers?.[":authority"]) outgoing.headers.host = req.headers[":authority"];
2840
+ if (options.headers) for (const key of Object.keys(options.headers))outgoing.headers[key] = options.headers[key];
2841
+ if (req.httpVersionMajor > 1) for (const header of HTTP2_HEADER_BLACKLIST)delete outgoing.headers[header];
2842
+ if (options.auth) outgoing.auth = options.auth;
2843
+ if (options.ca) outgoing.ca = options.ca;
2844
+ if (isSSL.test(options[forward || "target"].protocol ?? "http")) outgoing.rejectUnauthorized = void 0 === options.secure ? true : options.secure;
2845
+ if (void 0 !== options.agent) outgoing.agent = options.agent || false;
2846
+ else if (req.httpVersionMajor > 1 || upgradeHeader.test(req.headers.connection || "")) outgoing.agent = false;
2847
+ else {
2848
+ const targetProto = options[forward || "target"].protocol ?? "http";
2849
+ outgoing.agent = isSSL.test(targetProto) ? defaultAgents.https : defaultAgents.http;
2850
+ }
2851
+ outgoing.localAddress = options.localAddress;
2852
+ if (!outgoing.agent) {
2853
+ outgoing.headers = outgoing.headers || {};
2854
+ if ("string" != typeof outgoing.headers.connection || !upgradeHeader.test(outgoing.headers.connection)) outgoing.headers.connection = "close";
2855
+ }
2856
+ const target = options[forward || "target"];
2857
+ const targetPath = target && false !== options.prependPath ? target.pathname || "" : "";
2858
+ const targetSearch = target instanceof URL && false !== options.prependPath ? target.search || "" : "";
2859
+ const reqUrl = req.url || "";
2860
+ const qIdx = reqUrl.indexOf("?");
2861
+ const reqPath = -1 === qIdx ? reqUrl : reqUrl.slice(0, qIdx);
2862
+ const reqSearch = -1 === qIdx ? "" : reqUrl.slice(qIdx);
2863
+ const normalizedPath = reqPath ? "/" === reqPath[0] ? reqPath : "/" + reqPath : "/";
2864
+ let outgoingPath = options.toProxy ? "/" + reqUrl : normalizedPath + reqSearch;
2865
+ outgoingPath = options.ignorePath ? "" : outgoingPath;
2866
+ let fullPath = joinURL(targetPath, outgoingPath);
2867
+ if (targetSearch) fullPath = fullPath.includes("?") ? fullPath.replace("?", targetSearch + "&") : fullPath + targetSearch;
2868
+ outgoing.path = fullPath;
2869
+ if (options.changeOrigin) outgoing.headers.host = requiresPort(outgoing.port, options[forward || "target"].protocol) && !hasPort(outgoing.host) ? outgoing.host + ":" + outgoing.port : outgoing.host ?? void 0;
2870
+ return outgoing;
2871
+ }
2872
+ function joinURL(base, path) {
2873
+ if (!base || "/" === base) return path || "/";
2874
+ if (!path || "/" === path) return base || "/";
2875
+ const baseHasTrailing = "/" === base[base.length - 1];
2876
+ const pathHasLeading = "/" === path[0];
2877
+ if (baseHasTrailing && pathHasLeading) return base + path.slice(1);
2878
+ if (!baseHasTrailing && !pathHasLeading) return base + "/" + path;
2879
+ return base + path;
2880
+ }
2881
+ function setupSocket(socket) {
2882
+ socket.setTimeout(0);
2883
+ socket.setNoDelay(true);
2884
+ socket.setKeepAlive(true, 0);
2885
+ return socket;
2886
+ }
2887
+ function getPort(req) {
2888
+ const hostHeader = req.headers[":authority"] || req.headers.host;
2889
+ const res = hostHeader ? hostHeader.match(/:(\d+)/) : "";
2890
+ if (res) return res[1];
2891
+ return hasEncryptedConnection(req) ? "443" : "80";
2892
+ }
2893
+ function hasEncryptedConnection(req) {
2894
+ const socket = req.socket;
2895
+ return !!socket && "encrypted" in socket && socket.encrypted;
2896
+ }
2897
+ function rewriteCookieProperty(header, config, property) {
2898
+ if (Array.isArray(header)) return header.map(function(headerElement) {
2899
+ return rewriteCookieProperty(headerElement, config, property);
2900
+ });
2901
+ return header.replace(new RegExp(String.raw`(;\s*` + property + "=)([^;]+)", "i"), function(match, prefix, previousValue) {
2902
+ let newValue;
2903
+ if (previousValue in config) newValue = config[previousValue];
2904
+ else {
2905
+ if (!("*" in config)) return match;
2906
+ newValue = config["*"];
2907
+ }
2908
+ return newValue ? prefix + newValue : "";
2909
+ });
2910
+ }
2911
+ function hasPort(host) {
2912
+ return host ? !!~host.indexOf(":") : false;
2913
+ }
2914
+ function requiresPort(_port, _protocol) {
2915
+ const protocol = _protocol?.split(":")[0];
2916
+ const port = +_port;
2917
+ if (!port) return false;
2918
+ switch(protocol){
2919
+ case "http":
2920
+ case "ws":
2921
+ return 80 !== port;
2922
+ case "https":
2923
+ case "wss":
2924
+ return 443 !== port;
2925
+ case "ftp":
2926
+ return 21 !== port;
2927
+ case "gopher":
2928
+ return 70 !== port;
2929
+ case "file":
2930
+ return false;
2931
+ }
2932
+ return 0 !== port;
2933
+ }
2934
+ function defineProxyMiddleware(m) {
2935
+ return m;
2936
+ }
2937
+ function defineProxyOutgoingMiddleware(m) {
2938
+ return m;
2939
+ }
2940
+ const redirectRegex = /^201|30([12378])$/;
2941
+ const webOutgoingMiddleware = [
2942
+ defineProxyOutgoingMiddleware((req, res, proxyRes)=>{
2943
+ if ("1.0" === req.httpVersion || req.httpVersionMajor >= 2 || 204 === proxyRes.statusCode || 304 === proxyRes.statusCode) delete proxyRes.headers["transfer-encoding"];
2944
+ }),
2945
+ defineProxyOutgoingMiddleware((req, res, proxyRes)=>{
2946
+ if ("1.0" === req.httpVersion) proxyRes.headers.connection = req.headers.connection || "close";
2947
+ else if (req.httpVersionMajor < 2 && !proxyRes.headers.connection) proxyRes.headers.connection = req.headers.connection || "keep-alive";
2948
+ else if (req.httpVersionMajor >= 2) delete proxyRes.headers.connection;
2949
+ }),
2950
+ defineProxyOutgoingMiddleware((req, res, proxyRes, options)=>{
2951
+ if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite) && proxyRes.headers.location && redirectRegex.test(String(proxyRes.statusCode))) {
2952
+ const target = _toURL(options.target);
2953
+ const u = new URL(proxyRes.headers.location, target);
2954
+ if (target.host !== u.host) return;
2955
+ if (options.hostRewrite) u.host = options.hostRewrite;
2956
+ else if (options.autoRewrite) {
2957
+ if (req.headers[":authority"]) u.host = req.headers[":authority"];
2958
+ else if (req.headers.host) u.host = req.headers.host;
2959
+ }
2960
+ if (options.protocolRewrite) u.protocol = options.protocolRewrite;
2961
+ proxyRes.headers.location = u.toString();
2962
+ }
2963
+ }),
2964
+ defineProxyOutgoingMiddleware((req, res, proxyRes, options)=>{
2965
+ const rewriteCookieDomainConfig = "string" == typeof options.cookieDomainRewrite ? {
2966
+ "*": options.cookieDomainRewrite
2967
+ } : options.cookieDomainRewrite;
2968
+ const rewriteCookiePathConfig = "string" == typeof options.cookiePathRewrite ? {
2969
+ "*": options.cookiePathRewrite
2970
+ } : options.cookiePathRewrite;
2971
+ const preserveHeaderKeyCase = options.preserveHeaderKeyCase;
2972
+ let rawHeaderKeyMap;
2973
+ const setHeader = function(key, header) {
2974
+ if (void 0 === header || !String(key).trim()) return;
2975
+ if (rewriteCookieDomainConfig && "set-cookie" === key.toLowerCase()) header = rewriteCookieProperty(header, rewriteCookieDomainConfig, "domain");
2976
+ if (rewriteCookiePathConfig && "set-cookie" === key.toLowerCase()) header = rewriteCookieProperty(header, rewriteCookiePathConfig, "path");
2977
+ try {
2978
+ res.setHeader(String(key).trim(), header);
2979
+ } catch {}
2980
+ };
2981
+ if (preserveHeaderKeyCase && void 0 !== proxyRes.rawHeaders) {
2982
+ rawHeaderKeyMap = {};
2983
+ for(let i = 0; i < proxyRes.rawHeaders.length; i += 2){
2984
+ const key = proxyRes.rawHeaders[i];
2985
+ rawHeaderKeyMap[key.toLowerCase()] = key;
2986
+ }
2987
+ }
2988
+ for (let key of Object.keys(proxyRes.headers)){
2989
+ const header = proxyRes.headers[key];
2990
+ if (preserveHeaderKeyCase && rawHeaderKeyMap) key = rawHeaderKeyMap[key] || key;
2991
+ setHeader(key, header);
2992
+ }
2993
+ }),
2994
+ defineProxyOutgoingMiddleware((req, res, proxyRes)=>{
2995
+ res.statusCode = proxyRes.statusCode;
2996
+ if (proxyRes.statusMessage && req.httpVersionMajor < 2) res.statusMessage = proxyRes.statusMessage;
2997
+ })
2998
+ ];
2999
+ function _toURL(target) {
3000
+ if (target instanceof URL) return target;
3001
+ if ("string" == typeof target) return new URL(target);
3002
+ const protocol = target.protocol || "http:";
3003
+ const host = target.host || target.hostname || "localhost";
3004
+ const port = target.port;
3005
+ return new URL(`${protocol}//${host}${port ? ":" + port : ""}`);
3006
+ }
3007
+ const nativeAgents = {
3008
+ http: node_http,
3009
+ https: node_https
3010
+ };
3011
+ const redirectStatuses = new Set([
3012
+ 301,
3013
+ 302,
3014
+ 303,
3015
+ 307,
3016
+ 308
3017
+ ]);
3018
+ const webIncomingMiddleware = [
3019
+ defineProxyMiddleware((req)=>{
3020
+ if (("DELETE" === req.method || "OPTIONS" === req.method) && !req.headers["content-length"]) {
3021
+ req.headers["content-length"] = "0";
3022
+ delete req.headers["transfer-encoding"];
3023
+ }
3024
+ }),
3025
+ defineProxyMiddleware((req, res, options)=>{
3026
+ if (options.timeout) req.socket.setTimeout(options.timeout, ()=>{
3027
+ req.socket.destroy();
3028
+ });
3029
+ }),
3030
+ defineProxyMiddleware((req, res, options)=>{
3031
+ if (!options.xfwd) return;
3032
+ const encrypted = req.isSpdy || hasEncryptedConnection(req);
3033
+ const values = {
3034
+ for: req.connection.remoteAddress || req.socket.remoteAddress,
3035
+ port: getPort(req),
3036
+ proto: encrypted ? "https" : "http"
3037
+ };
3038
+ for (const header of [
3039
+ "for",
3040
+ "port",
3041
+ "proto"
3042
+ ]){
3043
+ const key = "x-forwarded-" + header;
3044
+ if (!req.headers[key] && void 0 !== values[header]) req.headers[key] = values[header];
3045
+ }
3046
+ req.headers["x-forwarded-host"] = req.headers["x-forwarded-host"] || req.headers[":authority"] || req.headers.host || "";
3047
+ }),
3048
+ defineProxyMiddleware((req, res, options, server, head, callback)=>{
3049
+ server.emit("start", req, res, options.target || options.forward);
3050
+ const http = nativeAgents.http;
3051
+ const https = nativeAgents.https;
3052
+ const maxRedirects = "number" == typeof options.followRedirects ? options.followRedirects : options.followRedirects ? 5 : 0;
3053
+ if (options.forward) {
3054
+ const forwardReq = (isSSL.test(options.forward.protocol || "http") ? https : http).request(setupOutgoing(options.ssl || {}, options, req, "forward"));
3055
+ const forwardError = createErrorHandler(forwardReq, options.forward);
3056
+ req.on("error", forwardError);
3057
+ forwardReq.on("error", forwardError);
3058
+ (options.buffer || req).pipe(forwardReq);
3059
+ if (!options.target) return void res.end();
3060
+ }
3061
+ const proxyReq = (isSSL.test(options.target.protocol || "http") ? https : http).request(setupOutgoing(options.ssl || {}, options, req));
3062
+ proxyReq.on("socket", (_socket)=>{
3063
+ if (server && !proxyReq.getHeader("expect")) server.emit("proxyReq", proxyReq, req, res, options);
3064
+ });
3065
+ if (options.proxyTimeout) proxyReq.setTimeout(options.proxyTimeout, function() {
3066
+ proxyReq.destroy();
3067
+ });
3068
+ res.on("close", function() {
3069
+ if (!res.writableFinished) proxyReq.destroy();
3070
+ });
3071
+ const proxyError = createErrorHandler(proxyReq, options.target);
3072
+ req.on("error", proxyError);
3073
+ proxyReq.on("error", proxyError);
3074
+ function createErrorHandler(proxyReq, url) {
3075
+ return function(err) {
3076
+ if (!req.socket?.writable && "ECONNRESET" === err.code) {
3077
+ server.emit("econnreset", err, req, res, url);
3078
+ return proxyReq.destroy();
3079
+ }
3080
+ if (callback) callback(err, req, res, url);
3081
+ else server.emit("error", err, req, res, url);
3082
+ };
3083
+ }
3084
+ let bodyBuffer;
3085
+ if (maxRedirects > 0) {
3086
+ const chunks = [];
3087
+ const source = options.buffer || req;
3088
+ source.on("data", (chunk)=>{
3089
+ chunks.push("string" == typeof chunk ? Buffer.from(chunk) : chunk);
3090
+ proxyReq.write(chunk);
3091
+ });
3092
+ source.on("end", ()=>{
3093
+ bodyBuffer = Buffer.concat(chunks);
3094
+ proxyReq.end();
3095
+ });
3096
+ source.on("error", (err)=>{
3097
+ proxyReq.destroy(err);
3098
+ });
3099
+ } else proxyReq.on("socket", (socket)=>{
3100
+ if (socket.pending) socket.on("connect", ()=>(options.buffer || req).pipe(proxyReq));
3101
+ else (options.buffer || req).pipe(proxyReq);
3102
+ });
3103
+ function handleResponse(proxyRes, redirectCount, currentUrl) {
3104
+ const statusCode = proxyRes.statusCode;
3105
+ if (maxRedirects > 0 && redirectStatuses.has(statusCode) && redirectCount < maxRedirects && proxyRes.headers.location) {
3106
+ proxyRes.resume();
3107
+ const location = new URL(proxyRes.headers.location, currentUrl);
3108
+ const preserveMethod = 307 === statusCode || 308 === statusCode;
3109
+ const redirectMethod = preserveMethod ? req.method || "GET" : "GET";
3110
+ const isHTTPS = isSSL.test(location.protocol);
3111
+ const agent = isHTTPS ? https : http;
3112
+ const redirectHeaders = {
3113
+ ...req.headers
3114
+ };
3115
+ if (options.headers) Object.assign(redirectHeaders, options.headers);
3116
+ redirectHeaders.host = location.host;
3117
+ if (location.host !== currentUrl.host) {
3118
+ delete redirectHeaders.authorization;
3119
+ delete redirectHeaders.cookie;
3120
+ }
3121
+ if (!preserveMethod) {
3122
+ delete redirectHeaders["content-length"];
3123
+ delete redirectHeaders["content-type"];
3124
+ delete redirectHeaders["transfer-encoding"];
3125
+ }
3126
+ const redirectOpts = {
3127
+ hostname: location.hostname,
3128
+ port: location.port || (isHTTPS ? 443 : 80),
3129
+ path: location.pathname + location.search,
3130
+ method: redirectMethod,
3131
+ headers: redirectHeaders,
3132
+ agent: options.agent || false
3133
+ };
3134
+ if (isHTTPS) redirectOpts.rejectUnauthorized = void 0 === options.secure ? true : options.secure;
3135
+ const redirectReq = agent.request(redirectOpts);
3136
+ if (server && !redirectReq.getHeader("expect")) server.emit("proxyReq", redirectReq, req, res, options);
3137
+ if (options.proxyTimeout) redirectReq.setTimeout(options.proxyTimeout, ()=>{
3138
+ redirectReq.destroy();
3139
+ });
3140
+ const redirectError = createErrorHandler(redirectReq, location);
3141
+ redirectReq.on("error", redirectError);
3142
+ redirectReq.on("response", (nextRes)=>{
3143
+ handleResponse(nextRes, redirectCount + 1, location);
3144
+ });
3145
+ if (preserveMethod && bodyBuffer && bodyBuffer.length > 0) redirectReq.end(bodyBuffer);
3146
+ else redirectReq.end();
3147
+ return;
3148
+ }
3149
+ if (server) server.emit("proxyRes", proxyRes, req, res);
3150
+ if (!res.headersSent && !options.selfHandleResponse) {
3151
+ for (const pass of webOutgoingMiddleware)if (pass(req, res, proxyRes, options)) break;
3152
+ }
3153
+ if (res.finished) {
3154
+ if (server) server.emit("end", req, res, proxyRes);
3155
+ } else {
3156
+ res.on("close", function() {
3157
+ proxyRes.destroy();
3158
+ });
3159
+ proxyRes.on("close", function() {
3160
+ if (!proxyRes.complete && !res.destroyed) res.destroy();
3161
+ });
3162
+ proxyRes.on("error", function(err) {
3163
+ if (!res.destroyed) res.destroy(err);
3164
+ if (server.listenerCount("error") > 0) server.emit("error", err, req, res, currentUrl);
3165
+ });
3166
+ proxyRes.on("end", function() {
3167
+ if (server) server.emit("end", req, res, proxyRes);
3168
+ });
3169
+ if (!options.selfHandleResponse) proxyRes.pipe(res);
3170
+ }
3171
+ }
3172
+ proxyReq.on("response", function(proxyRes) {
3173
+ handleResponse(proxyRes, 0, options.target);
3174
+ });
3175
+ })
3176
+ ];
3177
+ const websocketIncomingMiddleware = [
3178
+ defineProxyMiddleware((req, socket)=>{
3179
+ if ("GET" !== req.method || !req.headers.upgrade) {
3180
+ socket.destroy();
3181
+ return true;
3182
+ }
3183
+ if ("websocket" !== req.headers.upgrade.toLowerCase()) {
3184
+ socket.destroy();
3185
+ return true;
3186
+ }
3187
+ }),
3188
+ defineProxyMiddleware((req, socket, options)=>{
3189
+ if (!options.xfwd) return;
3190
+ const values = {
3191
+ for: req.connection.remoteAddress || req.socket.remoteAddress,
3192
+ port: getPort(req),
3193
+ proto: hasEncryptedConnection(req) ? "wss" : "ws"
3194
+ };
3195
+ for (const header of [
3196
+ "for",
3197
+ "port",
3198
+ "proto"
3199
+ ]){
3200
+ const key = "x-forwarded-" + header;
3201
+ if (!req.headers[key] && void 0 !== values[header]) req.headers[key] = values[header];
3202
+ }
3203
+ }),
3204
+ defineProxyMiddleware((req, socket, options, server, head, callback)=>{
3205
+ const createHttpHeader = function(line, headers) {
3206
+ return Object.keys(headers).reduce(function(head, key) {
3207
+ const value = headers[key];
3208
+ if (!Array.isArray(value)) {
3209
+ head.push(key + ": " + value);
3210
+ return head;
3211
+ }
3212
+ for (const element of value)head.push(key + ": " + element);
3213
+ return head;
3214
+ }, [
3215
+ line
3216
+ ]).join("\r\n") + "\r\n\r\n";
3217
+ };
3218
+ setupSocket(socket);
3219
+ if (head && head.length > 0) socket.unshift(head);
3220
+ socket.on("error", onSocketError);
3221
+ const proxyReq = (isSSL.test(options.target.protocol || "http") ? node_https : node_http).request(setupOutgoing(options.ssl || {}, options, req));
3222
+ if (server) server.emit("proxyReqWs", proxyReq, req, socket, options, head);
3223
+ proxyReq.on("error", onOutgoingError);
3224
+ proxyReq.on("response", function(res) {
3225
+ if (!res.upgrade) if (!socket.destroyed && socket.writable) {
3226
+ socket.write(createHttpHeader("HTTP/" + res.httpVersion + " " + res.statusCode + " " + res.statusMessage, res.headers));
3227
+ res.on("error", onOutgoingError);
3228
+ res.pipe(socket);
3229
+ } else res.resume();
3230
+ });
3231
+ proxyReq.on("upgrade", function(proxyRes, proxySocket, proxyHead) {
3232
+ proxySocket.on("error", onOutgoingError);
3233
+ proxySocket.on("end", function() {
3234
+ server.emit("close", proxyRes, proxySocket, proxyHead);
3235
+ });
3236
+ socket.removeListener("error", onSocketError);
3237
+ socket.on("error", function() {
3238
+ proxySocket.end();
3239
+ });
3240
+ setupSocket(proxySocket);
3241
+ if (proxyHead && proxyHead.length > 0) proxySocket.unshift(proxyHead);
3242
+ socket.write(createHttpHeader("HTTP/1.1 101 Switching Protocols", proxyRes.headers));
3243
+ proxySocket.pipe(socket).pipe(proxySocket);
3244
+ server.emit("open", proxySocket);
3245
+ server.emit("proxySocket", proxySocket);
3246
+ });
3247
+ proxyReq.end();
3248
+ function onSocketError(err) {
3249
+ if (callback) callback(err, req, socket);
3250
+ else server.emit("error", err, req, socket);
3251
+ proxyReq.destroy();
3252
+ }
3253
+ function onOutgoingError(err) {
3254
+ if (callback) callback(err, req, socket);
3255
+ else server.emit("error", err, req, socket);
3256
+ socket.end();
3257
+ }
3258
+ })
3259
+ ];
3260
+ var ProxyServer = class extends EventEmitter {
3261
+ _server;
3262
+ _webPasses = [
3263
+ ...webIncomingMiddleware
3264
+ ];
3265
+ _wsPasses = [
3266
+ ...websocketIncomingMiddleware
3267
+ ];
3268
+ options;
3269
+ web;
3270
+ ws;
3271
+ constructor(options = {}){
3272
+ super();
3273
+ this.options = options || {};
3274
+ this.options.prependPath = false !== options.prependPath;
3275
+ this.web = _createProxyFn("web", this);
3276
+ this.ws = _createProxyFn("ws", this);
3277
+ }
3278
+ listen(port, hostname, listeningListener) {
3279
+ const closure = (req, res)=>this.web(req, res);
3280
+ if (this.options.http2) {
3281
+ if (!this.options.ssl) throw new Error("HTTP/2 requires ssl option");
3282
+ this._server = node_http2.createSecureServer({
3283
+ ...this.options.ssl,
3284
+ allowHTTP1: true
3285
+ }, closure);
3286
+ } else if (this.options.ssl) this._server = node_https.createServer(this.options.ssl, closure);
3287
+ else this._server = node_http.createServer(closure);
3288
+ if (this.options.ws) this._server.on("upgrade", (req, socket, head)=>{
3289
+ this.ws(req, socket, this.options, head).catch(()=>{});
3290
+ });
3291
+ this._server.listen(port, hostname, listeningListener);
3292
+ return this;
3293
+ }
3294
+ close(callback) {
3295
+ if (this._server) this._server.close((...args)=>{
3296
+ this._server = void 0;
3297
+ if (callback) Reflect.apply(callback, void 0, args);
3298
+ });
3299
+ }
3300
+ before(type, passName, pass) {
3301
+ if ("ws" !== type && "web" !== type) throw new Error("type must be `web` or `ws`");
3302
+ const passes = this._getPasses(type);
3303
+ let i = false;
3304
+ for (const [idx, v] of passes.entries())if (v.name === passName) i = idx;
3305
+ if (false === i) throw new Error("No such pass");
3306
+ passes.splice(i, 0, pass);
3307
+ }
3308
+ after(type, passName, pass) {
3309
+ if ("ws" !== type && "web" !== type) throw new Error("type must be `web` or `ws`");
3310
+ const passes = this._getPasses(type);
3311
+ let i = false;
3312
+ for (const [idx, v] of passes.entries())if (v.name === passName) i = idx;
3313
+ if (false === i) throw new Error("No such pass");
3314
+ passes.splice(i++, 0, pass);
3315
+ }
3316
+ _getPasses(type) {
3317
+ return "ws" === type ? this._wsPasses : this._webPasses;
3318
+ }
3319
+ };
3320
+ function createProxyServer(options = {}) {
3321
+ return new ProxyServer(options);
3322
+ }
3323
+ function _createProxyFn(type, server) {
3324
+ return function(req, res, opts, head) {
3325
+ const requestOptions = {
3326
+ ...opts,
3327
+ ...server.options
3328
+ };
3329
+ for (const key of [
3330
+ "target",
3331
+ "forward"
3332
+ ])if ("string" == typeof requestOptions[key]) requestOptions[key] = new URL(requestOptions[key]);
3333
+ if (!requestOptions.target && !requestOptions.forward) {
3334
+ this.emit("error", /* @__PURE__ */ new Error("Must provide a proper URL as target"));
3335
+ return Promise.resolve();
3336
+ }
3337
+ let _resolve;
3338
+ let _reject;
3339
+ const callbackPromise = new Promise((resolve, reject)=>{
3340
+ _resolve = resolve;
3341
+ _reject = reject;
3342
+ });
3343
+ res.on("close", ()=>{
3344
+ _resolve();
3345
+ });
3346
+ res.on("error", (error)=>{
3347
+ _reject(error);
3348
+ });
3349
+ for (const pass of server._getPasses(type)){
3350
+ let stop;
3351
+ try {
3352
+ stop = pass(req, res, requestOptions, server, head, (error)=>{
3353
+ if (server.listenerCount("error") > 0) {
3354
+ server.emit("error", error, req, res);
3355
+ _resolve();
3356
+ } else _reject(error);
3357
+ });
3358
+ } catch (error) {
3359
+ if (server.listenerCount("error") > 0) {
3360
+ server.emit("error", error, req, res);
3361
+ _resolve();
3362
+ } else _reject(error);
3363
+ break;
3364
+ }
3365
+ if (stop) {
3366
+ _resolve();
3367
+ break;
3368
+ }
3369
+ }
3370
+ return callbackPromise;
3371
+ };
3372
+ }
3373
+ new Set([
3374
+ 301,
3375
+ 302,
3376
+ 303,
3377
+ 307,
3378
+ 308
3379
+ ]);
3380
+ var errors_ERRORS;
3381
+ (function(ERRORS) {
3382
+ ERRORS["ERR_CONFIG_FACTORY_TARGET_MISSING"] = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}";
3383
+ ERRORS["ERR_CONTEXT_MATCHER_GENERIC"] = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]";
3384
+ ERRORS["ERR_CONTEXT_MATCHER_INVALID_ARRAY"] = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].";
3385
+ ERRORS["ERR_PATH_REWRITER_CONFIG"] = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
3386
+ })(errors_ERRORS || (errors_ERRORS = {}));
3387
+ function verifyConfig(options) {
3388
+ if (!options.target && !options.router) throw new Error(errors_ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING);
3389
+ }
3390
+ const src = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js");
3391
+ const Debug = src('http-proxy-middleware');
3392
+ const debug = Debug.extend('debug-proxy-errors-plugin');
3393
+ const debugProxyErrorsPlugin = (proxyServer)=>{
3394
+ proxyServer.on('error', (error, req, res, target)=>{
3395
+ debug(`httpxy error event: \n%O`, error);
3396
+ });
3397
+ proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
3398
+ socket.on('error', (error)=>{
3399
+ debug('Socket error in proxyReq event: \n%O', error);
3400
+ });
3401
+ });
3402
+ proxyServer.on('proxyRes', (proxyRes, req, res)=>{
3403
+ res.on('close', ()=>{
3404
+ if (!res.writableEnded) {
3405
+ debug('Destroying proxyRes in proxyRes close event');
3406
+ proxyRes.destroy();
3407
+ }
3408
+ });
3409
+ });
3410
+ proxyServer.on('proxyReqWs', (proxyReq, req, socket)=>{
3411
+ socket.on('error', (error)=>{
3412
+ debug('Socket error in proxyReqWs event: \n%O', error);
3413
+ });
3414
+ });
3415
+ proxyServer.on('open', (proxySocket)=>{
3416
+ proxySocket.on('error', (error)=>{
3417
+ debug('Socket error in open event: \n%O', error);
3418
+ });
3419
+ });
3420
+ proxyServer.on('close', (req, socket, head)=>{
3421
+ socket.on('error', (error)=>{
3422
+ debug('Socket error in close event: \n%O', error);
3423
+ });
3424
+ });
3425
+ proxyServer.on('econnreset', (error, req, res, target)=>{
3426
+ debug(`httpxy econnreset event: \n%O`, error);
3427
+ });
3428
+ };
3429
+ function getStatusCode(errorCode) {
3430
+ let statusCode;
3431
+ if (/HPE_INVALID/.test(errorCode)) statusCode = 502;
3432
+ else switch(errorCode){
3433
+ case 'ECONNRESET':
3434
+ case 'ENOTFOUND':
3435
+ case 'ECONNREFUSED':
3436
+ case 'ETIMEDOUT':
3437
+ statusCode = 504;
3438
+ break;
3439
+ default:
3440
+ statusCode = 500;
3441
+ break;
3442
+ }
3443
+ return statusCode;
3444
+ }
3445
+ function sanitize(input) {
3446
+ return input?.replace(/[<>]/g, (i)=>encodeURIComponent(i)) ?? '';
3447
+ }
3448
+ function isResponseLike(obj) {
3449
+ return obj && 'function' == typeof obj.writeHead;
3450
+ }
3451
+ function isSocketLike(obj) {
3452
+ return obj && 'function' == typeof obj.write && !('writeHead' in obj);
3453
+ }
3454
+ const errorResponsePlugin = (proxyServer, options)=>{
3455
+ proxyServer.on('error', (err, req, res, target)=>{
3456
+ if (!req || !res) throw err;
3457
+ if (isResponseLike(res)) {
3458
+ if (!res.headersSent) {
3459
+ const statusCode = getStatusCode(err.code);
3460
+ res.writeHead(statusCode);
3461
+ }
3462
+ const host = req.headers && req.headers.host;
3463
+ res.end(`Error occurred while trying to proxy: ${sanitize(host)}${sanitize(req.url)}`);
3464
+ } else if (isSocketLike(res)) res.destroy();
3465
+ });
3466
+ };
3467
+ const noopLogger = {
3468
+ info: ()=>{},
3469
+ warn: ()=>{},
3470
+ error: ()=>{}
3471
+ };
3472
+ function getLogger(options) {
3473
+ return options.logger || noopLogger;
3474
+ }
3475
+ function createUrl({ protocol, host, port, path }) {
3476
+ const ipv6Host = host?.includes(':') ? `[${host}]` : host;
3477
+ const base = `${protocol || 'undefined:'}//${ipv6Host || '[::]'}`;
3478
+ const url = new external_url_URL(base);
3479
+ if (port) url.port = port;
3480
+ if (path) url.pathname = path;
3481
+ return url;
3482
+ }
3483
+ function logger_plugin_getPort(sockets) {
3484
+ return Object.keys(sockets || {})?.[0]?.split(':')[1];
3485
+ }
3486
+ const loggerPlugin = (proxyServer, options)=>{
3487
+ const logger = getLogger(options);
3488
+ proxyServer.on('error', (err, req, res, target)=>{
3489
+ const hostname = req?.headers?.host;
3490
+ const requestHref = `${hostname}${req?.url}`;
3491
+ const targetHref = `${target?.href}`;
3492
+ const errorMessage = '[HPM] Error occurred while proxying request %s to %s [%s] (%s)';
3493
+ const errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors';
3494
+ logger.error(errorMessage, requestHref, targetHref, err.code || err, errReference);
3495
+ });
3496
+ proxyServer.on('proxyRes', (proxyRes, req, res)=>{
3497
+ const originalUrl = req.originalUrl ?? `${req.baseUrl || ''}${req.url}`;
3498
+ let target;
3499
+ try {
3500
+ const port = logger_plugin_getPort(proxyRes.req?.agent?.sockets);
3501
+ const { protocol, host, path } = proxyRes.req;
3502
+ target = createUrl({
3503
+ protocol,
3504
+ host,
3505
+ port,
3506
+ path
3507
+ });
3508
+ } catch (err) {
3509
+ console.error('[HPM] Unexpected error while creating target URL', err);
3510
+ target = new external_node_url_URL(options.target);
3511
+ target.pathname = proxyRes.req.path;
3512
+ }
3513
+ const targetUrl = target.toString();
3514
+ const exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
3515
+ logger.info(exchange);
3516
+ });
3517
+ proxyServer.on('open', (socket)=>{
3518
+ logger.info('[HPM] Client connected: %o', socket.address());
3519
+ });
3520
+ proxyServer.on('close', (req, proxySocket, proxyHead)=>{
3521
+ logger.info('[HPM] Client disconnected: %o', proxySocket.address());
3522
+ });
3523
+ };
3524
+ function function_getFunctionName(fn) {
3525
+ return fn.name || '[anonymous Function]';
3526
+ }
3527
+ const proxy_events_debug = Debug.extend('proxy-events-plugin');
3528
+ const proxyEventsPlugin = (proxyServer, options)=>{
3529
+ if (!options.on) return;
3530
+ let eventName;
3531
+ for(eventName in options.on)if (Object.prototype.hasOwnProperty.call(options.on, eventName)) {
3532
+ const handler = options.on[eventName];
3533
+ if (!handler) continue;
3534
+ proxy_events_debug(`register event handler: "${eventName}" -> "${function_getFunctionName(handler)}"`);
3535
+ proxyServer.on(eventName, handler);
3536
+ }
3537
+ };
3538
+ function getPlugins(options) {
3539
+ const maybeErrorResponsePlugin = options.on?.error ? [] : [
3540
+ errorResponsePlugin
3541
+ ];
3542
+ const defaultPlugins = options.ejectPlugins ? [] : [
3543
+ debugProxyErrorsPlugin,
3544
+ proxyEventsPlugin,
3545
+ loggerPlugin,
3546
+ ...maybeErrorResponsePlugin
3547
+ ];
3548
+ const userPlugins = options.plugins ?? [];
3549
+ return [
3550
+ ...defaultPlugins,
3551
+ ...userPlugins
3552
+ ];
3553
+ }
3554
+ const is_glob = __webpack_require__("./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js");
3555
+ const micromatch = __webpack_require__("./node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js");
3556
+ function matchPathFilter(pathFilter = '/', uri, req) {
3557
+ if (isStringPath(pathFilter)) return matchSingleStringPath(pathFilter, uri);
3558
+ if (isGlobPath(pathFilter)) return matchSingleGlobPath(pathFilter, uri);
3559
+ if (Array.isArray(pathFilter)) {
3560
+ if (pathFilter.every(isStringPath)) return matchMultiPath(pathFilter, uri);
3561
+ if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
3562
+ throw new Error(errors_ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY);
3563
+ }
3564
+ if ('function' == typeof pathFilter) {
3565
+ const pathname = getUrlPathName(uri);
3566
+ return pathFilter(pathname, req);
3567
+ }
3568
+ throw new Error(errors_ERRORS.ERR_CONTEXT_MATCHER_GENERIC);
3569
+ }
3570
+ function matchSingleStringPath(pathFilter, uri) {
3571
+ const pathname = getUrlPathName(uri);
3572
+ return pathname?.indexOf(pathFilter) === 0;
3573
+ }
3574
+ function matchSingleGlobPath(pattern, uri) {
3575
+ const pathname = getUrlPathName(uri);
3576
+ const matches = micromatch([
3577
+ pathname
3578
+ ], pattern);
3579
+ return matches && matches.length > 0;
3580
+ }
3581
+ function matchMultiGlobPath(patternList, uri) {
3582
+ return matchSingleGlobPath(patternList, uri);
3583
+ }
3584
+ function matchMultiPath(pathFilterList, uri) {
3585
+ let isMultiPath = false;
3586
+ for (const context of pathFilterList)if (matchSingleStringPath(context, uri)) {
3587
+ isMultiPath = true;
3588
+ break;
3589
+ }
3590
+ return isMultiPath;
3591
+ }
3592
+ function getUrlPathName(uri) {
3593
+ return uri && new URL(uri, 'http://0.0.0.0').pathname;
3594
+ }
3595
+ function isStringPath(pathFilter) {
3596
+ return 'string' == typeof pathFilter && !is_glob(pathFilter);
3597
+ }
3598
+ function isGlobPath(pathFilter) {
3599
+ return is_glob(pathFilter);
3600
+ }
3601
+ function isPlainObject(value) {
3602
+ if ('object' != typeof value || null === value) return false;
3603
+ const prototype = Object.getPrototypeOf(value);
3604
+ return (null === prototype || prototype === Object.prototype || null === Object.getPrototypeOf(prototype)) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
3605
+ }
3606
+ const path_rewriter_debug = Debug.extend('path-rewriter');
3607
+ function createPathRewriter(rewriteConfig) {
3608
+ let rulesCache;
3609
+ if (!isValidRewriteConfig(rewriteConfig)) return;
3610
+ if ('function' == typeof rewriteConfig) {
3611
+ const customRewriteFn = rewriteConfig;
3612
+ return customRewriteFn;
3613
+ }
3614
+ rulesCache = parsePathRewriteRules(rewriteConfig);
3615
+ return rewritePath;
3616
+ function rewritePath(path) {
3617
+ let result = path;
3618
+ for (const rule of rulesCache)if (rule.regex.test(path)) {
3619
+ result = result.replace(rule.regex, rule.value);
3620
+ path_rewriter_debug('rewriting path from "%s" to "%s"', path, result);
3621
+ break;
3622
+ }
3623
+ return result;
3624
+ }
3625
+ }
3626
+ function isValidRewriteConfig(rewriteConfig) {
3627
+ if ('function' == typeof rewriteConfig) return true;
3628
+ if (isPlainObject(rewriteConfig)) return 0 !== Object.keys(rewriteConfig).length;
3629
+ if (null == rewriteConfig) return false;
3630
+ throw new Error(errors_ERRORS.ERR_PATH_REWRITER_CONFIG);
3631
+ }
3632
+ function parsePathRewriteRules(rewriteConfig) {
3633
+ const rules = [];
3634
+ if (isPlainObject(rewriteConfig)) for (const [key, value] of Object.entries(rewriteConfig)){
3635
+ rules.push({
3636
+ regex: new RegExp(key),
3637
+ value: value
3638
+ });
3639
+ path_rewriter_debug('rewrite rule created: "%s" ~> "%s"', key, value);
3640
+ }
3641
+ return rules;
3642
+ }
3643
+ const router_debug = Debug.extend('router');
3644
+ async function getTarget(req, config) {
3645
+ let newTarget;
3646
+ const router = config.router;
3647
+ if (isPlainObject(router)) newTarget = getTargetFromProxyTable(req, router);
3648
+ else if ('function' == typeof router) newTarget = await router(req);
3649
+ return newTarget;
3650
+ }
3651
+ function getTargetFromProxyTable(req, table) {
3652
+ let result;
3653
+ const host = req.headers.host ?? '';
3654
+ const path = req.url ?? '';
3655
+ const hostAndPath = host + path;
3656
+ for (const [key, value] of Object.entries(table))if (containsPath(key)) {
3657
+ if (hostAndPath.indexOf(key) > -1) {
3658
+ result = value;
3659
+ router_debug('match: "%s" -> "%s"', key, result);
3660
+ break;
3661
+ }
3662
+ } else if (key === host) {
3663
+ result = value;
3664
+ router_debug('match: "%s" -> "%s"', host, result);
3665
+ break;
3666
+ }
3667
+ return result;
3668
+ }
3669
+ function containsPath(v) {
3670
+ return v.indexOf('/') > -1;
3671
+ }
3672
+ const ipv6_debug = Debug.extend('ipv6');
3673
+ function normalizeIPv6LiteralTargets(options) {
3674
+ options.target = normalizeIPv6ProxyTarget(options.target, 'target');
3675
+ options.forward = normalizeIPv6ProxyTarget(options.forward, 'forward');
3676
+ }
3677
+ function normalizeIPv6ProxyTarget(target, optionName) {
3678
+ const targetUrl = toTargetUrl(target);
3679
+ if (targetUrl && isBracketedIPv6Hostname(targetUrl.hostname)) {
3680
+ ipv6_debug('normalized IPv6 "%s" %s', optionName, target);
3681
+ return {
3682
+ hostname: stripBrackets(targetUrl.hostname),
3683
+ pathname: targetUrl.pathname,
3684
+ port: targetUrl.port,
3685
+ protocol: targetUrl.protocol,
3686
+ search: targetUrl.search
3687
+ };
3688
+ }
3689
+ return target;
3690
+ }
3691
+ function toTargetUrl(target) {
3692
+ if ('string' == typeof target) return new URL(target);
3693
+ if (target instanceof URL) return target;
3694
+ }
3695
+ function isBracketedIPv6Hostname(hostname) {
3696
+ return hostname.startsWith('[') && hostname.endsWith(']');
3697
+ }
3698
+ function stripBrackets(hostname) {
3699
+ return hostname.replace(/^\[|\]$/g, '');
3700
+ }
3701
+ class HttpProxyMiddleware {
3702
+ wsInternalSubscribed = false;
3703
+ serverOnCloseSubscribed = false;
3704
+ proxyOptions;
3705
+ proxy;
3706
+ pathRewriter;
3707
+ logger;
3708
+ constructor(options){
3709
+ verifyConfig(options);
3710
+ this.proxyOptions = options;
3711
+ this.logger = getLogger(options);
3712
+ Debug("create proxy server");
3713
+ this.proxy = createProxyServer({});
3714
+ this.registerPlugins(this.proxy, this.proxyOptions);
3715
+ this.pathRewriter = createPathRewriter(this.proxyOptions.pathRewrite);
3716
+ this.middleware.upgrade = (req, socket, head)=>{
3717
+ if (!this.wsInternalSubscribed) this.handleUpgrade(req, socket, head);
3718
+ };
3719
+ }
3720
+ middleware = async (req, res, next)=>{
3721
+ if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
3722
+ let activeProxyOptions;
3723
+ try {
3724
+ activeProxyOptions = await this.prepareProxyRequest(req);
3725
+ if (!activeProxyOptions.target && !activeProxyOptions.forward) throw new Error('Must provide a proper URL as target');
3726
+ } catch (err) {
3727
+ next?.(err);
3728
+ return;
3729
+ }
3730
+ try {
3731
+ Debug("proxy request to target: %O", activeProxyOptions.target);
3732
+ await this.proxy.web(req, res, activeProxyOptions);
3733
+ } catch (err) {
3734
+ this.proxy.emit('error', err, req, res, activeProxyOptions.target);
3735
+ next?.(err);
3736
+ }
3737
+ } else next?.();
3738
+ const server = req.socket?.server;
3739
+ if (server && !this.serverOnCloseSubscribed) {
3740
+ server.on('close', ()=>{
3741
+ Debug('server close signal received: closing proxy server');
3742
+ this.proxy.close(()=>{
3743
+ Debug('proxy server closed');
3744
+ });
3745
+ });
3746
+ this.serverOnCloseSubscribed = true;
3747
+ }
3748
+ if (true === this.proxyOptions.ws && server) this.catchUpgradeRequest(server);
3749
+ };
3750
+ registerPlugins(proxy, options) {
3751
+ const plugins = getPlugins(options);
3752
+ plugins.forEach((plugin)=>{
3753
+ Debug(`register plugin: "${function_getFunctionName(plugin)}"`);
3754
+ plugin(proxy, options);
3755
+ });
3756
+ }
3757
+ catchUpgradeRequest = (server)=>{
3758
+ if (!this.wsInternalSubscribed) {
3759
+ Debug('subscribing to server upgrade event');
3760
+ server.on('upgrade', this.handleUpgrade);
3761
+ this.wsInternalSubscribed = true;
3762
+ }
3763
+ };
3764
+ handleUpgrade = async (req, socket, head)=>{
3765
+ try {
3766
+ if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
3767
+ const proxiedReq = req;
3768
+ const activeProxyOptions = await this.prepareProxyRequest(proxiedReq);
3769
+ await this.proxy.ws(proxiedReq, socket, activeProxyOptions, head);
3770
+ Debug('server upgrade event received. Proxying WebSocket');
3771
+ }
3772
+ } catch (err) {
3773
+ this.proxy.emit('error', err, req, socket);
3774
+ }
3775
+ };
3776
+ shouldProxy = (pathFilter, req)=>{
3777
+ try {
3778
+ return matchPathFilter(pathFilter, req.url, req);
3779
+ } catch (err) {
3780
+ Debug('Error: matchPathFilter() called with request url: ', `"${req.url}"`);
3781
+ this.logger.error(err);
3782
+ return false;
3783
+ }
3784
+ };
3785
+ prepareProxyRequest = async (req)=>{
3786
+ const newProxyOptions = Object.assign({}, this.proxyOptions);
3787
+ await this.applyRouter(req, newProxyOptions);
3788
+ normalizeIPv6LiteralTargets(newProxyOptions);
3789
+ await this.applyPathRewrite(req, this.pathRewriter);
3790
+ return newProxyOptions;
3791
+ };
3792
+ applyRouter = async (req, options)=>{
3793
+ let newTarget;
3794
+ if (options.router) {
3795
+ newTarget = await getTarget(req, options);
3796
+ if (newTarget) {
3797
+ Debug('router new target: "%s"', newTarget);
3798
+ options.target = newTarget;
3799
+ }
3800
+ }
3801
+ };
3802
+ applyPathRewrite = async (req, pathRewriter)=>{
3803
+ if (req.url && pathRewriter) {
3804
+ const path = await pathRewriter(req.url, req);
3805
+ if ('string' == typeof path) {
3806
+ Debug('pathRewrite new path: %s', path);
3807
+ req.url = path;
3808
+ } else Debug('pathRewrite: no rewritten path found: %s', req.url);
3809
+ }
3810
+ };
3811
+ }
3812
+ function createProxyMiddleware(options) {
3813
+ const { middleware } = new HttpProxyMiddleware(options);
3814
+ return middleware;
3815
+ }
3816
+ Debug.extend('response-interceptor');
3817
+ export { createProxyMiddleware };