gemi 0.4.16 → 0.4.18

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.
@@ -0,0 +1,799 @@
1
+ // ../../node_modules/urlpattern-polyfill/dist/urlpattern.js
2
+ var Re = function(e, t) {
3
+ return (t ? /^[\x00-\xFF]*$/ : /^[\x00-\x7F]*$/).test(e);
4
+ };
5
+ var v = function(e, t = false) {
6
+ let r = [], n = 0;
7
+ for (;n < e.length; ) {
8
+ let o = e[n], c = function(l) {
9
+ if (!t)
10
+ throw new TypeError(l);
11
+ r.push({ type: "INVALID_CHAR", index: n, value: e[n++] });
12
+ };
13
+ if (o === "*") {
14
+ r.push({ type: "ASTERISK", index: n, value: e[n++] });
15
+ continue;
16
+ }
17
+ if (o === "+" || o === "?") {
18
+ r.push({ type: "OTHER_MODIFIER", index: n, value: e[n++] });
19
+ continue;
20
+ }
21
+ if (o === "\\") {
22
+ r.push({ type: "ESCAPED_CHAR", index: n++, value: e[n++] });
23
+ continue;
24
+ }
25
+ if (o === "{") {
26
+ r.push({ type: "OPEN", index: n, value: e[n++] });
27
+ continue;
28
+ }
29
+ if (o === "}") {
30
+ r.push({ type: "CLOSE", index: n, value: e[n++] });
31
+ continue;
32
+ }
33
+ if (o === ":") {
34
+ let l = "", s = n + 1;
35
+ for (;s < e.length; ) {
36
+ let i = e.substr(s, 1);
37
+ if (s === n + 1 && be.test(i) || s !== n + 1 && Pe.test(i)) {
38
+ l += e[s++];
39
+ continue;
40
+ }
41
+ break;
42
+ }
43
+ if (!l) {
44
+ c(`Missing parameter name at ${n}`);
45
+ continue;
46
+ }
47
+ r.push({ type: "NAME", index: n, value: l }), n = s;
48
+ continue;
49
+ }
50
+ if (o === "(") {
51
+ let l = 1, s = "", i = n + 1, a = false;
52
+ if (e[i] === "?") {
53
+ c(`Pattern cannot start with "?" at ${i}`);
54
+ continue;
55
+ }
56
+ for (;i < e.length; ) {
57
+ if (!Re(e[i], false)) {
58
+ c(`Invalid character '${e[i]}' at ${i}.`), a = true;
59
+ break;
60
+ }
61
+ if (e[i] === "\\") {
62
+ s += e[i++] + e[i++];
63
+ continue;
64
+ }
65
+ if (e[i] === ")") {
66
+ if (l--, l === 0) {
67
+ i++;
68
+ break;
69
+ }
70
+ } else if (e[i] === "(" && (l++, e[i + 1] !== "?")) {
71
+ c(`Capturing groups are not allowed at ${i}`), a = true;
72
+ break;
73
+ }
74
+ s += e[i++];
75
+ }
76
+ if (a)
77
+ continue;
78
+ if (l) {
79
+ c(`Unbalanced pattern at ${n}`);
80
+ continue;
81
+ }
82
+ if (!s) {
83
+ c(`Missing pattern at ${n}`);
84
+ continue;
85
+ }
86
+ r.push({ type: "REGEX", index: n, value: s }), n = i;
87
+ continue;
88
+ }
89
+ r.push({ type: "CHAR", index: n, value: e[n++] });
90
+ }
91
+ return r.push({ type: "END", index: n, value: "" }), r;
92
+ };
93
+ var D = function(e, t = {}) {
94
+ let r = v(e);
95
+ t.delimiter ??= "/#?", t.prefixes ??= "./";
96
+ let n = `[^${S(t.delimiter)}]+?`, o = [], c = 0, l = 0, s = "", i = new Set, a = (h) => {
97
+ if (l < r.length && r[l].type === h)
98
+ return r[l++].value;
99
+ }, f = () => a("OTHER_MODIFIER") ?? a("ASTERISK"), d = (h) => {
100
+ let u = a(h);
101
+ if (u !== undefined)
102
+ return u;
103
+ let { type: p, index: A } = r[l];
104
+ throw new TypeError(`Unexpected ${p} at ${A}, expected ${h}`);
105
+ }, T = () => {
106
+ let h = "", u;
107
+ for (;u = a("CHAR") ?? a("ESCAPED_CHAR"); )
108
+ h += u;
109
+ return h;
110
+ }, Se = (h) => h, L = t.encodePart || Se, I = "", U = (h) => {
111
+ I += h;
112
+ }, $ = () => {
113
+ I.length && (o.push(new R(3, "", "", L(I), "", 3)), I = "");
114
+ }, V = (h, u, p, A, Y) => {
115
+ let g = 3;
116
+ switch (Y) {
117
+ case "?":
118
+ g = 1;
119
+ break;
120
+ case "*":
121
+ g = 0;
122
+ break;
123
+ case "+":
124
+ g = 2;
125
+ break;
126
+ }
127
+ if (!u && !p && g === 3) {
128
+ U(h);
129
+ return;
130
+ }
131
+ if ($(), !u && !p) {
132
+ if (!h)
133
+ return;
134
+ o.push(new R(3, "", "", L(h), "", g));
135
+ return;
136
+ }
137
+ let m;
138
+ p ? p === "*" ? m = M : m = p : m = n;
139
+ let O = 2;
140
+ m === n ? (O = 1, m = "") : m === M && (O = 0, m = "");
141
+ let P;
142
+ if (u ? P = u : p && (P = c++), i.has(P))
143
+ throw new TypeError(`Duplicate name '${P}'.`);
144
+ i.add(P), o.push(new R(O, P, L(h), m, L(A), g));
145
+ };
146
+ for (;l < r.length; ) {
147
+ let h = a("CHAR"), u = a("NAME"), p = a("REGEX");
148
+ if (!u && !p && (p = a("ASTERISK")), u || p) {
149
+ let g = h ?? "";
150
+ t.prefixes.indexOf(g) === -1 && (U(g), g = ""), $();
151
+ let m = f();
152
+ V(g, u, p, "", m);
153
+ continue;
154
+ }
155
+ let A = h ?? a("ESCAPED_CHAR");
156
+ if (A) {
157
+ U(A);
158
+ continue;
159
+ }
160
+ if (a("OPEN")) {
161
+ let g = T(), m = a("NAME"), O = a("REGEX");
162
+ !m && !O && (O = a("ASTERISK"));
163
+ let P = T();
164
+ d("CLOSE");
165
+ let xe = f();
166
+ V(g, m, O, P, xe);
167
+ continue;
168
+ }
169
+ $(), d("END");
170
+ }
171
+ return o;
172
+ };
173
+ var S = function(e) {
174
+ return e.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
175
+ };
176
+ var X = function(e) {
177
+ return e && e.ignoreCase ? "ui" : "u";
178
+ };
179
+ var Z = function(e, t, r) {
180
+ return F(D(e, r), t, r);
181
+ };
182
+ var k = function(e) {
183
+ switch (e) {
184
+ case 0:
185
+ return "*";
186
+ case 1:
187
+ return "?";
188
+ case 2:
189
+ return "+";
190
+ case 3:
191
+ return "";
192
+ }
193
+ };
194
+ var F = function(e, t, r = {}) {
195
+ r.delimiter ??= "/#?", r.prefixes ??= "./", r.sensitive ??= false, r.strict ??= false, r.end ??= true, r.start ??= true, r.endsWith = "";
196
+ let n = r.start ? "^" : "";
197
+ for (let s of e) {
198
+ if (s.type === 3) {
199
+ s.modifier === 3 ? n += S(s.value) : n += `(?:${S(s.value)})${k(s.modifier)}`;
200
+ continue;
201
+ }
202
+ t && t.push(s.name);
203
+ let i = `[^${S(r.delimiter)}]+?`, a = s.value;
204
+ if (s.type === 1 ? a = i : s.type === 0 && (a = M), !s.prefix.length && !s.suffix.length) {
205
+ s.modifier === 3 || s.modifier === 1 ? n += `(${a})${k(s.modifier)}` : n += `((?:${a})${k(s.modifier)})`;
206
+ continue;
207
+ }
208
+ if (s.modifier === 3 || s.modifier === 1) {
209
+ n += `(?:${S(s.prefix)}(${a})${S(s.suffix)})`, n += k(s.modifier);
210
+ continue;
211
+ }
212
+ n += `(?:${S(s.prefix)}`, n += `((?:${a})(?:`, n += S(s.suffix), n += S(s.prefix), n += `(?:${a}))*)${S(s.suffix)})`, s.modifier === 0 && (n += "?");
213
+ }
214
+ let o = `[${S(r.endsWith)}]|\$`, c = `[${S(r.delimiter)}]`;
215
+ if (r.end)
216
+ return r.strict || (n += `${c}?`), r.endsWith.length ? n += `(?=${o})` : n += "$", new RegExp(n, X(r));
217
+ r.strict || (n += `(?:${c}(?=${o}))?`);
218
+ let l = false;
219
+ if (e.length) {
220
+ let s = e[e.length - 1];
221
+ s.type === 3 && s.modifier === 3 && (l = r.delimiter.indexOf(s) > -1);
222
+ }
223
+ return l || (n += `(?=${c}|${o})`), new RegExp(n, X(r));
224
+ };
225
+ var J = function(e, t) {
226
+ return e.length ? e[0] === "/" ? true : !t || e.length < 2 ? false : (e[0] == "\\" || e[0] == "{") && e[1] == "/" : false;
227
+ };
228
+ var Q = function(e, t) {
229
+ return e.startsWith(t) ? e.substring(t.length, e.length) : e;
230
+ };
231
+ var Ee = function(e, t) {
232
+ return e.endsWith(t) ? e.substr(0, e.length - t.length) : e;
233
+ };
234
+ var W = function(e) {
235
+ return !e || e.length < 2 ? false : e[0] === "[" || (e[0] === "\\" || e[0] === "{") && e[1] === "[";
236
+ };
237
+ var N = function(e) {
238
+ if (!e)
239
+ return true;
240
+ for (let t of ee)
241
+ if (e.test(t))
242
+ return true;
243
+ return false;
244
+ };
245
+ var te = function(e, t) {
246
+ if (e = Q(e, "#"), t || e === "")
247
+ return e;
248
+ let r = new URL("https://example.com");
249
+ return r.hash = e, r.hash ? r.hash.substring(1, r.hash.length) : "";
250
+ };
251
+ var re = function(e, t) {
252
+ if (e = Q(e, "?"), t || e === "")
253
+ return e;
254
+ let r = new URL("https://example.com");
255
+ return r.search = e, r.search ? r.search.substring(1, r.search.length) : "";
256
+ };
257
+ var ne = function(e, t) {
258
+ return t || e === "" ? e : W(e) ? j(e) : z(e);
259
+ };
260
+ var se = function(e, t) {
261
+ if (t || e === "")
262
+ return e;
263
+ let r = new URL("https://example.com");
264
+ return r.password = e, r.password;
265
+ };
266
+ var ie = function(e, t) {
267
+ if (t || e === "")
268
+ return e;
269
+ let r = new URL("https://example.com");
270
+ return r.username = e, r.username;
271
+ };
272
+ var ae = function(e, t, r) {
273
+ if (r || e === "")
274
+ return e;
275
+ if (t && !ee.includes(t))
276
+ return new URL(`${t}:${e}`).pathname;
277
+ let n = e[0] == "/";
278
+ return e = new URL(n ? e : "/-" + e, "https://example.com").pathname, n || (e = e.substring(2, e.length)), e;
279
+ };
280
+ var oe = function(e, t, r) {
281
+ return _(t) === e && (e = ""), r || e === "" ? e : K(e);
282
+ };
283
+ var ce = function(e, t) {
284
+ return e = Ee(e, ":"), t || e === "" ? e : y(e);
285
+ };
286
+ var _ = function(e) {
287
+ switch (e) {
288
+ case "ws":
289
+ case "http":
290
+ return "80";
291
+ case "wws":
292
+ case "https":
293
+ return "443";
294
+ case "ftp":
295
+ return "21";
296
+ default:
297
+ return "";
298
+ }
299
+ };
300
+ var y = function(e) {
301
+ if (e === "")
302
+ return e;
303
+ if (/^[-+.A-Za-z0-9]*$/.test(e))
304
+ return e.toLowerCase();
305
+ throw new TypeError(`Invalid protocol '${e}'.`);
306
+ };
307
+ var le = function(e) {
308
+ if (e === "")
309
+ return e;
310
+ let t = new URL("https://example.com");
311
+ return t.username = e, t.username;
312
+ };
313
+ var fe = function(e) {
314
+ if (e === "")
315
+ return e;
316
+ let t = new URL("https://example.com");
317
+ return t.password = e, t.password;
318
+ };
319
+ var z = function(e) {
320
+ if (e === "")
321
+ return e;
322
+ if (/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))
323
+ throw new TypeError(`Invalid hostname '${e}'`);
324
+ let t = new URL("https://example.com");
325
+ return t.hostname = e, t.hostname;
326
+ };
327
+ var j = function(e) {
328
+ if (e === "")
329
+ return e;
330
+ if (/[^0-9a-fA-F[\]:]/g.test(e))
331
+ throw new TypeError(`Invalid IPv6 hostname '${e}'`);
332
+ return e.toLowerCase();
333
+ };
334
+ var K = function(e) {
335
+ if (e === "" || /^[0-9]*$/.test(e) && parseInt(e) <= 65535)
336
+ return e;
337
+ throw new TypeError(`Invalid port '${e}'.`);
338
+ };
339
+ var he = function(e) {
340
+ if (e === "")
341
+ return e;
342
+ let t = new URL("https://example.com");
343
+ return t.pathname = e[0] !== "/" ? "/-" + e : e, e[0] !== "/" ? t.pathname.substring(2, t.pathname.length) : t.pathname;
344
+ };
345
+ var ue = function(e) {
346
+ return e === "" ? e : new URL(`data:${e}`).pathname;
347
+ };
348
+ var de = function(e) {
349
+ if (e === "")
350
+ return e;
351
+ let t = new URL("https://example.com");
352
+ return t.search = e, t.search.substring(1, t.search.length);
353
+ };
354
+ var pe = function(e) {
355
+ if (e === "")
356
+ return e;
357
+ let t = new URL("https://example.com");
358
+ return t.hash = e, t.hash.substring(1, t.hash.length);
359
+ };
360
+ var ge = function(e, t) {
361
+ if (typeof e != "string")
362
+ throw new TypeError("parameter 1 is not of type 'string'.");
363
+ let r = new URL(e, t);
364
+ return { protocol: r.protocol.substring(0, r.protocol.length - 1), username: r.username, password: r.password, hostname: r.hostname, port: r.port, pathname: r.pathname, search: r.search !== "" ? r.search.substring(1, r.search.length) : undefined, hash: r.hash !== "" ? r.hash.substring(1, r.hash.length) : undefined };
365
+ };
366
+ var b = function(e, t) {
367
+ return t ? C(e) : e;
368
+ };
369
+ var w = function(e, t, r) {
370
+ let n;
371
+ if (typeof t.baseURL == "string")
372
+ try {
373
+ n = new URL(t.baseURL), t.protocol === undefined && (e.protocol = b(n.protocol.substring(0, n.protocol.length - 1), r)), !r && t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.username === undefined && (e.username = b(n.username, r)), !r && t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.username === undefined && t.password === undefined && (e.password = b(n.password, r)), t.protocol === undefined && t.hostname === undefined && (e.hostname = b(n.hostname, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && (e.port = b(n.port, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && (e.pathname = b(n.pathname, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && t.search === undefined && (e.search = b(n.search.substring(1, n.search.length), r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && t.search === undefined && t.hash === undefined && (e.hash = b(n.hash.substring(1, n.hash.length), r));
374
+ } catch {
375
+ throw new TypeError(`invalid baseURL '${t.baseURL}'.`);
376
+ }
377
+ if (typeof t.protocol == "string" && (e.protocol = ce(t.protocol, r)), typeof t.username == "string" && (e.username = ie(t.username, r)), typeof t.password == "string" && (e.password = se(t.password, r)), typeof t.hostname == "string" && (e.hostname = ne(t.hostname, r)), typeof t.port == "string" && (e.port = oe(t.port, e.protocol, r)), typeof t.pathname == "string") {
378
+ if (e.pathname = t.pathname, n && !J(e.pathname, r)) {
379
+ let o = n.pathname.lastIndexOf("/");
380
+ o >= 0 && (e.pathname = b(n.pathname.substring(0, o + 1), r) + e.pathname);
381
+ }
382
+ e.pathname = ae(e.pathname, e.protocol, r);
383
+ }
384
+ return typeof t.search == "string" && (e.search = re(t.search, r)), typeof t.hash == "string" && (e.hash = te(t.hash, r)), e;
385
+ };
386
+ var C = function(e) {
387
+ return e.replace(/([+*?:{}()\\])/g, "\\$1");
388
+ };
389
+ var Oe = function(e) {
390
+ return e.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
391
+ };
392
+ var ke = function(e, t) {
393
+ t.delimiter ??= "/#?", t.prefixes ??= "./", t.sensitive ??= false, t.strict ??= false, t.end ??= true, t.start ??= true, t.endsWith = "";
394
+ let r = ".*", n = `[^${Oe(t.delimiter)}]+?`, o = /[$_\u200C\u200D\p{ID_Continue}]/u, c = "";
395
+ for (let l = 0;l < e.length; ++l) {
396
+ let s = e[l];
397
+ if (s.type === 3) {
398
+ if (s.modifier === 3) {
399
+ c += C(s.value);
400
+ continue;
401
+ }
402
+ c += `{${C(s.value)}}${k(s.modifier)}`;
403
+ continue;
404
+ }
405
+ let i = s.hasCustomName(), a = !!s.suffix.length || !!s.prefix.length && (s.prefix.length !== 1 || !t.prefixes.includes(s.prefix)), f = l > 0 ? e[l - 1] : null, d = l < e.length - 1 ? e[l + 1] : null;
406
+ if (!a && i && s.type === 1 && s.modifier === 3 && d && !d.prefix.length && !d.suffix.length)
407
+ if (d.type === 3) {
408
+ let T = d.value.length > 0 ? d.value[0] : "";
409
+ a = o.test(T);
410
+ } else
411
+ a = !d.hasCustomName();
412
+ if (!a && !s.prefix.length && f && f.type === 3) {
413
+ let T = f.value[f.value.length - 1];
414
+ a = t.prefixes.includes(T);
415
+ }
416
+ a && (c += "{"), c += C(s.prefix), i && (c += `:${s.name}`), s.type === 2 ? c += `(${s.value})` : s.type === 1 ? i || (c += `(${n})`) : s.type === 0 && (!i && (!f || f.type === 3 || f.modifier !== 3 || a || s.prefix !== "") ? c += "*" : c += `(${r})`), s.type === 1 && i && s.suffix.length && o.test(s.suffix[0]) && (c += "\\"), c += C(s.suffix), a && (c += "}"), s.modifier !== 3 && (c += k(s.modifier));
417
+ }
418
+ return c;
419
+ };
420
+ var R = class {
421
+ type = 3;
422
+ name = "";
423
+ prefix = "";
424
+ value = "";
425
+ suffix = "";
426
+ modifier = 3;
427
+ constructor(t, r, n, o, c, l) {
428
+ this.type = t, this.name = r, this.prefix = n, this.value = o, this.suffix = c, this.modifier = l;
429
+ }
430
+ hasCustomName() {
431
+ return this.name !== "" && typeof this.name != "number";
432
+ }
433
+ };
434
+ var be = /[$_\p{ID_Start}]/u;
435
+ var Pe = /[$_\u200C\u200D\p{ID_Continue}]/u;
436
+ var M = ".*";
437
+ var x = { delimiter: "", prefixes: "", sensitive: true, strict: true };
438
+ var B = { delimiter: ".", prefixes: "", sensitive: true, strict: true };
439
+ var q = { delimiter: "/", prefixes: "/", sensitive: true, strict: true };
440
+ var ee = ["ftp", "file", "http", "https", "ws", "wss"];
441
+ var H = class {
442
+ #i;
443
+ #n = [];
444
+ #t = {};
445
+ #e = 0;
446
+ #s = 1;
447
+ #l = 0;
448
+ #o = 0;
449
+ #d = 0;
450
+ #p = 0;
451
+ #g = false;
452
+ constructor(t) {
453
+ this.#i = t;
454
+ }
455
+ get result() {
456
+ return this.#t;
457
+ }
458
+ parse() {
459
+ for (this.#n = v(this.#i, true);this.#e < this.#n.length; this.#e += this.#s) {
460
+ if (this.#s = 1, this.#n[this.#e].type === "END") {
461
+ if (this.#o === 0) {
462
+ this.#b(), this.#f() ? this.#r(9, 1) : this.#h() ? this.#r(8, 1) : this.#r(7, 0);
463
+ continue;
464
+ } else if (this.#o === 2) {
465
+ this.#u(5);
466
+ continue;
467
+ }
468
+ this.#r(10, 0);
469
+ break;
470
+ }
471
+ if (this.#d > 0)
472
+ if (this.#A())
473
+ this.#d -= 1;
474
+ else
475
+ continue;
476
+ if (this.#T()) {
477
+ this.#d += 1;
478
+ continue;
479
+ }
480
+ switch (this.#o) {
481
+ case 0:
482
+ this.#P() && this.#u(1);
483
+ break;
484
+ case 1:
485
+ if (this.#P()) {
486
+ this.#C();
487
+ let t = 7, r = 1;
488
+ this.#E() ? (t = 2, r = 3) : this.#g && (t = 2), this.#r(t, r);
489
+ }
490
+ break;
491
+ case 2:
492
+ this.#S() ? this.#u(3) : (this.#x() || this.#h() || this.#f()) && this.#u(5);
493
+ break;
494
+ case 3:
495
+ this.#O() ? this.#r(4, 1) : this.#S() && this.#r(5, 1);
496
+ break;
497
+ case 4:
498
+ this.#S() && this.#r(5, 1);
499
+ break;
500
+ case 5:
501
+ this.#y() ? this.#p += 1 : this.#w() && (this.#p -= 1), this.#k() && !this.#p ? this.#r(6, 1) : this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
502
+ break;
503
+ case 6:
504
+ this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
505
+ break;
506
+ case 7:
507
+ this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
508
+ break;
509
+ case 8:
510
+ this.#f() && this.#r(9, 1);
511
+ break;
512
+ case 9:
513
+ break;
514
+ case 10:
515
+ break;
516
+ }
517
+ }
518
+ this.#t.hostname !== undefined && this.#t.port === undefined && (this.#t.port = "");
519
+ }
520
+ #r(t, r) {
521
+ switch (this.#o) {
522
+ case 0:
523
+ break;
524
+ case 1:
525
+ this.#t.protocol = this.#c();
526
+ break;
527
+ case 2:
528
+ break;
529
+ case 3:
530
+ this.#t.username = this.#c();
531
+ break;
532
+ case 4:
533
+ this.#t.password = this.#c();
534
+ break;
535
+ case 5:
536
+ this.#t.hostname = this.#c();
537
+ break;
538
+ case 6:
539
+ this.#t.port = this.#c();
540
+ break;
541
+ case 7:
542
+ this.#t.pathname = this.#c();
543
+ break;
544
+ case 8:
545
+ this.#t.search = this.#c();
546
+ break;
547
+ case 9:
548
+ this.#t.hash = this.#c();
549
+ break;
550
+ case 10:
551
+ break;
552
+ }
553
+ this.#o !== 0 && t !== 10 && ([1, 2, 3, 4].includes(this.#o) && [6, 7, 8, 9].includes(t) && (this.#t.hostname ??= ""), [1, 2, 3, 4, 5, 6].includes(this.#o) && [8, 9].includes(t) && (this.#t.pathname ??= this.#g ? "/" : ""), [1, 2, 3, 4, 5, 6, 7].includes(this.#o) && t === 9 && (this.#t.search ??= "")), this.#R(t, r);
554
+ }
555
+ #R(t, r) {
556
+ this.#o = t, this.#l = this.#e + r, this.#e += r, this.#s = 0;
557
+ }
558
+ #b() {
559
+ this.#e = this.#l, this.#s = 0;
560
+ }
561
+ #u(t) {
562
+ this.#b(), this.#o = t;
563
+ }
564
+ #m(t) {
565
+ return t < 0 && (t = this.#n.length - t), t < this.#n.length ? this.#n[t] : this.#n[this.#n.length - 1];
566
+ }
567
+ #a(t, r) {
568
+ let n = this.#m(t);
569
+ return n.value === r && (n.type === "CHAR" || n.type === "ESCAPED_CHAR" || n.type === "INVALID_CHAR");
570
+ }
571
+ #P() {
572
+ return this.#a(this.#e, ":");
573
+ }
574
+ #E() {
575
+ return this.#a(this.#e + 1, "/") && this.#a(this.#e + 2, "/");
576
+ }
577
+ #S() {
578
+ return this.#a(this.#e, "@");
579
+ }
580
+ #O() {
581
+ return this.#a(this.#e, ":");
582
+ }
583
+ #k() {
584
+ return this.#a(this.#e, ":");
585
+ }
586
+ #x() {
587
+ return this.#a(this.#e, "/");
588
+ }
589
+ #h() {
590
+ if (this.#a(this.#e, "?"))
591
+ return true;
592
+ if (this.#n[this.#e].value !== "?")
593
+ return false;
594
+ let t = this.#m(this.#e - 1);
595
+ return t.type !== "NAME" && t.type !== "REGEX" && t.type !== "CLOSE" && t.type !== "ASTERISK";
596
+ }
597
+ #f() {
598
+ return this.#a(this.#e, "#");
599
+ }
600
+ #T() {
601
+ return this.#n[this.#e].type == "OPEN";
602
+ }
603
+ #A() {
604
+ return this.#n[this.#e].type == "CLOSE";
605
+ }
606
+ #y() {
607
+ return this.#a(this.#e, "[");
608
+ }
609
+ #w() {
610
+ return this.#a(this.#e, "]");
611
+ }
612
+ #c() {
613
+ let t = this.#n[this.#e], r = this.#m(this.#l).index;
614
+ return this.#i.substring(r, t.index);
615
+ }
616
+ #C() {
617
+ let t = {};
618
+ Object.assign(t, x), t.encodePart = y;
619
+ let r = Z(this.#c(), undefined, t);
620
+ this.#g = N(r);
621
+ }
622
+ };
623
+ var G = ["protocol", "username", "password", "hostname", "port", "pathname", "search", "hash"];
624
+ var E = "*";
625
+ var me = class {
626
+ #i;
627
+ #n = {};
628
+ #t = {};
629
+ #e = {};
630
+ #s = {};
631
+ #l = false;
632
+ constructor(t = {}, r, n) {
633
+ try {
634
+ let o;
635
+ if (typeof r == "string" ? o = r : n = r, typeof t == "string") {
636
+ let i = new H(t);
637
+ if (i.parse(), t = i.result, o === undefined && typeof t.protocol != "string")
638
+ throw new TypeError("A base URL must be provided for a relative constructor string.");
639
+ t.baseURL = o;
640
+ } else {
641
+ if (!t || typeof t != "object")
642
+ throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");
643
+ if (o)
644
+ throw new TypeError("parameter 1 is not of type 'string'.");
645
+ }
646
+ typeof n > "u" && (n = { ignoreCase: false });
647
+ let c = { ignoreCase: n.ignoreCase === true }, l = { pathname: E, protocol: E, username: E, password: E, hostname: E, port: E, search: E, hash: E };
648
+ this.#i = w(l, t, true), _(this.#i.protocol) === this.#i.port && (this.#i.port = "");
649
+ let s;
650
+ for (s of G) {
651
+ if (!(s in this.#i))
652
+ continue;
653
+ let i = {}, a = this.#i[s];
654
+ switch (this.#t[s] = [], s) {
655
+ case "protocol":
656
+ Object.assign(i, x), i.encodePart = y;
657
+ break;
658
+ case "username":
659
+ Object.assign(i, x), i.encodePart = le;
660
+ break;
661
+ case "password":
662
+ Object.assign(i, x), i.encodePart = fe;
663
+ break;
664
+ case "hostname":
665
+ Object.assign(i, B), W(a) ? i.encodePart = j : i.encodePart = z;
666
+ break;
667
+ case "port":
668
+ Object.assign(i, x), i.encodePart = K;
669
+ break;
670
+ case "pathname":
671
+ N(this.#n.protocol) ? (Object.assign(i, q, c), i.encodePart = he) : (Object.assign(i, x, c), i.encodePart = ue);
672
+ break;
673
+ case "search":
674
+ Object.assign(i, x, c), i.encodePart = de;
675
+ break;
676
+ case "hash":
677
+ Object.assign(i, x, c), i.encodePart = pe;
678
+ break;
679
+ }
680
+ try {
681
+ this.#s[s] = D(a, i), this.#n[s] = F(this.#s[s], this.#t[s], i), this.#e[s] = ke(this.#s[s], i), this.#l = this.#l || this.#s[s].some((f) => f.type === 2);
682
+ } catch {
683
+ throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`);
684
+ }
685
+ }
686
+ } catch (o) {
687
+ throw new TypeError(`Failed to construct 'URLPattern': ${o.message}`);
688
+ }
689
+ }
690
+ test(t = {}, r) {
691
+ let n = { pathname: "", protocol: "", username: "", password: "", hostname: "", port: "", search: "", hash: "" };
692
+ if (typeof t != "string" && r)
693
+ throw new TypeError("parameter 1 is not of type 'string'.");
694
+ if (typeof t > "u")
695
+ return false;
696
+ try {
697
+ typeof t == "object" ? n = w(n, t, false) : n = w(n, ge(t, r), false);
698
+ } catch {
699
+ return false;
700
+ }
701
+ let o;
702
+ for (o of G)
703
+ if (!this.#n[o].exec(n[o]))
704
+ return false;
705
+ return true;
706
+ }
707
+ exec(t = {}, r) {
708
+ let n = { pathname: "", protocol: "", username: "", password: "", hostname: "", port: "", search: "", hash: "" };
709
+ if (typeof t != "string" && r)
710
+ throw new TypeError("parameter 1 is not of type 'string'.");
711
+ if (typeof t > "u")
712
+ return;
713
+ try {
714
+ typeof t == "object" ? n = w(n, t, false) : n = w(n, ge(t, r), false);
715
+ } catch {
716
+ return null;
717
+ }
718
+ let o = {};
719
+ r ? o.inputs = [t, r] : o.inputs = [t];
720
+ let c;
721
+ for (c of G) {
722
+ let l = this.#n[c].exec(n[c]);
723
+ if (!l)
724
+ return null;
725
+ let s = {};
726
+ for (let [i, a] of this.#t[c].entries())
727
+ if (typeof a == "string" || typeof a == "number") {
728
+ let f = l[i + 1];
729
+ s[a] = f;
730
+ }
731
+ o[c] = { input: n[c] ?? "", groups: s };
732
+ }
733
+ return o;
734
+ }
735
+ static compareComponent(t, r, n) {
736
+ let o = (i, a) => {
737
+ for (let f of ["type", "modifier", "prefix", "value", "suffix"]) {
738
+ if (i[f] < a[f])
739
+ return -1;
740
+ if (i[f] === a[f])
741
+ continue;
742
+ return 1;
743
+ }
744
+ return 0;
745
+ }, c = new R(3, "", "", "", "", 3), l = new R(0, "", "", "", "", 3), s = (i, a) => {
746
+ let f = 0;
747
+ for (;f < Math.min(i.length, a.length); ++f) {
748
+ let d = o(i[f], a[f]);
749
+ if (d)
750
+ return d;
751
+ }
752
+ return i.length === a.length ? 0 : o(i[f] ?? c, a[f] ?? c);
753
+ };
754
+ return !r.#e[t] && !n.#e[t] ? 0 : r.#e[t] && !n.#e[t] ? s(r.#s[t], [l]) : !r.#e[t] && n.#e[t] ? s([l], n.#s[t]) : s(r.#s[t], n.#s[t]);
755
+ }
756
+ get protocol() {
757
+ return this.#e.protocol;
758
+ }
759
+ get username() {
760
+ return this.#e.username;
761
+ }
762
+ get password() {
763
+ return this.#e.password;
764
+ }
765
+ get hostname() {
766
+ return this.#e.hostname;
767
+ }
768
+ get port() {
769
+ return this.#e.port;
770
+ }
771
+ get pathname() {
772
+ return this.#e.pathname;
773
+ }
774
+ get search() {
775
+ return this.#e.search;
776
+ }
777
+ get hash() {
778
+ return this.#e.hash;
779
+ }
780
+ get hasRegExpGroups() {
781
+ return this.#l;
782
+ }
783
+ };
784
+
785
+ // ../../node_modules/urlpattern-polyfill/index.js
786
+ if (!globalThis.URLPattern) {
787
+ globalThis.URLPattern = me;
788
+ }
789
+
790
+ // server/generateEtag.ts
791
+ function generateETag(lastModified) {
792
+ const lastModifiedStr = lastModified.toString();
793
+ const hasher = new Bun.CryptoHasher("sha1");
794
+ hasher.update(lastModifiedStr);
795
+ const hash = hasher.digest("hex");
796
+ return hash;
797
+ }
798
+
799
+ export { me, generateETag };