@shgysk8zer0/polyfills 0.3.14 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/array.js CHANGED
@@ -282,7 +282,7 @@ if (! (Uint8Array.prototype.toHex instanceof Function)) {
282
282
  Uint8Array.prototype.toHex = function toHex() {
283
283
  return Array.from(
284
284
  this,
285
- n => n.toString(16).padStart('0', 2)
285
+ byte => byte.toString(16).padStart(2, '0')
286
286
  ).join('');
287
287
  };
288
288
  }
@@ -0,0 +1,172 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
7
+ var dedent_umd = {exports: {}};
8
+
9
+ (function (module, exports) {
10
+ (function (global, factory) {
11
+ module.exports = factory() ;
12
+ })(commonjsGlobal, (function () {
13
+ const cache = new WeakMap();
14
+ const newline = /(\n|\r\n?|\u2028|\u2029)/g;
15
+ const leadingWhitespace = /^\s*/;
16
+ const nonWhitespace = /\S/;
17
+ const slice = Array.prototype.slice;
18
+ function dedent(arg) {
19
+ if (typeof arg === 'string') {
20
+ return process([arg])[0];
21
+ }
22
+ if (typeof arg === 'function') {
23
+ return function () {
24
+ const args = slice.call(arguments);
25
+ args[0] = processTemplateStringsArray(args[0]);
26
+ return arg.apply(this, args);
27
+ };
28
+ }
29
+ const strings = processTemplateStringsArray(arg);
30
+ // TODO: This is just `String.cooked`: https://tc39.es/proposal-string-cooked/
31
+ let s = getCooked(strings, 0);
32
+ for (let i = 1; i < strings.length; i++) {
33
+ s += arguments[i] + getCooked(strings, i);
34
+ }
35
+ return s;
36
+ }
37
+ function getCooked(strings, index) {
38
+ const str = strings[index];
39
+ if (str === undefined)
40
+ throw new TypeError(`invalid cooked string at index ${index}`);
41
+ return str;
42
+ }
43
+ function processTemplateStringsArray(strings) {
44
+ const cached = cache.get(strings);
45
+ if (cached)
46
+ return cached;
47
+ const dedented = process(strings);
48
+ cache.set(strings, dedented);
49
+ Object.defineProperty(dedented, 'raw', {
50
+ value: Object.freeze(process(strings.raw)),
51
+ });
52
+ Object.freeze(dedented);
53
+ return dedented;
54
+ }
55
+ function process(strings) {
56
+ // splitQuasis is now an array of arrays. The inner array is contains text content lines on the
57
+ // even indices, and the newline char that ends the text content line on the odd indices.
58
+ // In the first array, the inner array's 0 index is the opening line of the template literal.
59
+ // In all other arrays, the inner array's 0 index is the continuation of the line directly after a
60
+ // template expression.
61
+ //
62
+ // Eg, in the following case:
63
+ //
64
+ // ```
65
+ // String.dedent`
66
+ // first
67
+ // ${expression} second
68
+ // third
69
+ // `
70
+ // ```
71
+ //
72
+ // We expect the following splitQuasis:
73
+ //
74
+ // ```
75
+ // [
76
+ // ["", "\n", " first", "\n", " "],
77
+ // [" second", "\n", " third", "\n", ""],
78
+ // ]
79
+ // ```
80
+ const splitQuasis = strings.map((quasi) => quasi === null || quasi === void 0 ? void 0 : quasi.split(newline));
81
+ let common;
82
+ for (let i = 0; i < splitQuasis.length; i++) {
83
+ const lines = splitQuasis[i];
84
+ if (lines === undefined)
85
+ continue;
86
+ // The first split is the static text starting at the opening line until the first template
87
+ // expression (or the end of the template if there are no expressions).
88
+ const firstSplit = i === 0;
89
+ // The last split is all the static text after the final template expression until the closing
90
+ // line. If there are no template expressions, then the first split is also the last split.
91
+ const lastSplit = i + 1 === splitQuasis.length;
92
+ // The opening line must be empty (it very likely is) and it must not contain a template
93
+ // expression. The opening line's trailing newline char is removed.
94
+ if (firstSplit) {
95
+ // Length > 1 ensures there is a newline, and there is not a template expression.
96
+ if (lines.length === 1 || lines[0].length > 0) {
97
+ throw new Error('invalid content on opening line');
98
+ }
99
+ // Clear the captured newline char.
100
+ lines[1] = '';
101
+ }
102
+ // The closing line may only contain whitespace and must not contain a template expression. The
103
+ // closing line and its preceding newline are removed.
104
+ if (lastSplit) {
105
+ // Length > 1 ensures there is a newline, and there is not a template expression.
106
+ if (lines.length === 1 || nonWhitespace.test(lines[lines.length - 1])) {
107
+ throw new Error('invalid content on closing line');
108
+ }
109
+ // Clear the captured newline char, and the whitespace on the closing line.
110
+ lines[lines.length - 2] = '';
111
+ lines[lines.length - 1] = '';
112
+ }
113
+ // In the first spit, the index 0 is the opening line (which must be empty by now), and in all
114
+ // other splits, its the content trailing the template expression (and so can't be part of
115
+ // leading whitespace).
116
+ // Every odd index is the captured newline char, so we'll skip and only process evens.
117
+ for (let j = 2; j < lines.length; j += 2) {
118
+ const text = lines[j];
119
+ // If we are on the last line of this split, and we are not processing the last split (which
120
+ // is after all template expressions), then this line contains a template expression.
121
+ const lineContainsTemplateExpression = j + 1 === lines.length && !lastSplit;
122
+ // leadingWhitespace is guaranteed to match something, but it could be 0 chars.
123
+ const leading = leadingWhitespace.exec(text)[0];
124
+ // Empty lines do not affect the common indentation, and whitespace only lines are emptied
125
+ // (and also don't affect the comon indentation).
126
+ if (!lineContainsTemplateExpression && leading.length === text.length) {
127
+ lines[j] = '';
128
+ continue;
129
+ }
130
+ common = commonStart(leading, common);
131
+ }
132
+ }
133
+ const min = common ? common.length : 0;
134
+ return splitQuasis.map((lines) => {
135
+ if (lines === undefined)
136
+ return lines;
137
+ let quasi = lines[0];
138
+ for (let i = 1; i < lines.length; i += 2) {
139
+ const newline = lines[i];
140
+ const text = lines[i + 1];
141
+ quasi += newline + text.slice(min);
142
+ }
143
+ return quasi;
144
+ });
145
+ }
146
+ function commonStart(a, b) {
147
+ if (b === undefined || a === b)
148
+ return a;
149
+ let i = 0;
150
+ for (const len = Math.min(a.length, b.length); i < len; i++) {
151
+ if (a[i] !== b[i])
152
+ break;
153
+ }
154
+ return a.slice(0, i);
155
+ }
156
+
157
+ return dedent;
158
+
159
+ }));
160
+
161
+ } (dedent_umd));
162
+
163
+ var dedent_umdExports = dedent_umd.exports;
164
+
165
+ /* eslint-env node */
166
+
167
+ // This exists just to re-export dedent as a module in the codebase
168
+ var dedent = dedent_umdExports;
169
+
170
+ var dedent$1 = /*@__PURE__*/getDefaultExportFromCjs(dedent);
171
+
172
+ export { dedent$1 as default };
@@ -0,0 +1,4 @@
1
+ /* eslint-env node */
2
+ // This exists just to re-export urlpattern-polyfill as a module in the codebase
3
+ module.exports = require('urlpattern-polyfill');
4
+
@@ -0,0 +1,22 @@
1
+ function getDefaultExportFromCjs (x) {
2
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
+ }
4
+
5
+ var M=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Ee=Object.prototype.hasOwnProperty;var Oe=(e,t)=>{for(var r in t)M(e,r,{get:t[r],enumerable:!0});},ke=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Re(t))!Ee.call(e,a)&&a!==r&&M(e,a,{get:()=>t[a],enumerable:!(n=Pe(t,a))||n.enumerable});return e};var Te=e=>ke(M({},"__esModule",{value:!0}),e);var Ne={};Oe(Ne,{URLPattern:()=>Y});var urlpattern=Te(Ne);var R=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,r,n,a,c,l){this.type=t,this.name=r,this.prefix=n,this.value=a,this.suffix=c,this.modifier=l;}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Ae=/[$_\p{ID_Start}]/u,ye=/[$_\u200C\u200D\p{ID_Continue}]/u,v=".*";function we(e,t){return (t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function D(e,t=!1){let r=[],n=0;for(;n<e.length;){let a=e[n],c=function(l){if(!t)throw new TypeError(l);r.push({type:"INVALID_CHAR",index:n,value:e[n++]});};if(a==="*"){r.push({type:"ASTERISK",index:n,value:e[n++]});continue}if(a==="+"||a==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});continue}if(a==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(a==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(a==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(a===":"){let l="",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&Ae.test(i)||s!==n+1&&ye.test(i)){l+=e[s++];continue}break}if(!l){c(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:l}),n=s;continue}if(a==="("){let l=1,s="",i=n+1,o=!1;if(e[i]==="?"){c(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!we(e[i],!1)){c(`Invalid character '${e[i]}' at ${i}.`),o=!0;break}if(e[i]==="\\"){s+=e[i++]+e[i++];continue}if(e[i]===")"){if(l--,l===0){i++;break}}else if(e[i]==="("&&(l++,e[i+1]!=="?")){c(`Capturing groups are not allowed at ${i}`),o=!0;break}s+=e[i++];}if(o)continue;if(l){c(`Unbalanced pattern at ${n}`);continue}if(!s){c(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:s}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]});}return r.push({type:"END",index:n,value:""}),r}function F(e,t={}){let r=D(e);t.delimiter??="/#?",t.prefixes??="./";let n=`[^${S(t.delimiter)}]+?`,a=[],c=0,l=0,i=new Set,o=h=>{if(l<r.length&&r[l].type===h)return r[l++].value},f=()=>o("OTHER_MODIFIER")??o("ASTERISK"),d=h=>{let u=o(h);if(u!==void 0)return u;let{type:p,index:A}=r[l];throw new TypeError(`Unexpected ${p} at ${A}, expected ${h}`)},T=()=>{let h="",u;for(;u=o("CHAR")??o("ESCAPED_CHAR");)h+=u;return h},xe=h=>h,L=t.encodePart||xe,I="",U=h=>{I+=h;},$=()=>{I.length&&(a.push(new R(3,"","",L(I),"",3)),I="");},X=(h,u,p,A,Z)=>{let g=3;switch(Z){case"?":g=1;break;case"*":g=0;break;case"+":g=2;break}if(!u&&!p&&g===3){U(h);return}if($(),!u&&!p){if(!h)return;a.push(new R(3,"","",L(h),"",g));return}let m;p?p==="*"?m=v:m=p:m=n;let O=2;m===n?(O=1,m=""):m===v&&(O=0,m="");let P;if(u?P=u:p&&(P=c++),i.has(P))throw new TypeError(`Duplicate name '${P}'.`);i.add(P),a.push(new R(O,P,L(h),m,L(A),g));};for(;l<r.length;){let h=o("CHAR"),u=o("NAME"),p=o("REGEX");if(!u&&!p&&(p=o("ASTERISK")),u||p){let g=h??"";t.prefixes.indexOf(g)===-1&&(U(g),g=""),$();let m=f();X(g,u,p,"",m);continue}let A=h??o("ESCAPED_CHAR");if(A){U(A);continue}if(o("OPEN")){let g=T(),m=o("NAME"),O=o("REGEX");!m&&!O&&(O=o("ASTERISK"));let P=T();d("CLOSE");let be=f();X(g,m,O,P,be);continue}$(),d("END");}return a}function S(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function B(e){return e&&e.ignoreCase?"ui":"u"}function q(e,t,r){return W(F(e,r),t,r)}function k(e){switch(e){case 0:return "*";case 1:return "?";case 2:return "+";case 3:return ""}}function W(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let s of e){if(s.type===3){s.modifier===3?n+=S(s.value):n+=`(?:${S(s.value)})${k(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${S(r.delimiter)}]+?`,o=s.value;if(s.type===1?o=i:s.type===0&&(o=v),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${o})${k(s.modifier)}`:n+=`((?:${o})${k(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${S(s.prefix)}(${o})${S(s.suffix)})`,n+=k(s.modifier);continue}n+=`(?:${S(s.prefix)}`,n+=`((?:${o})(?:`,n+=S(s.suffix),n+=S(s.prefix),n+=`(?:${o}))*)${S(s.suffix)})`,s.modifier===0&&(n+="?");}let a=`[${S(r.endsWith)}]|$`,c=`[${S(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${c}?`),r.endsWith.length?n+=`(?=${a})`:n+="$",new RegExp(n,B(r));r.strict||(n+=`(?:${c}(?=${a}))?`);let l=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(l=r.delimiter.indexOf(s)>-1);}return l||(n+=`(?=${c}|${a})`),new RegExp(n,B(r))}var x={delimiter:"",prefixes:"",sensitive:!0,strict:!0},J={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Q={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]==="/"?!0:!t||e.length<2?!1:(e[0]=="\\"||e[0]=="{")&&e[1]=="/":!1}function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function Ce(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function _(e){return !e||e.length<2?!1:e[0]==="["||(e[0]==="\\"||e[0]==="{")&&e[1]==="["}var re=["ftp","file","http","https","ws","wss"];function N(e){if(!e)return !0;for(let t of re)if(e.test(t))return !0;return !1}function ne(e,t){if(e=te(e,"#"),t||e==="")return e;let r=new URL("https://example.com");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):""}function se(e,t){if(e=te(e,"?"),t||e==="")return e;let r=new URL("https://example.com");return r.search=e,r.search?r.search.substring(1,r.search.length):""}function ie(e,t){return t||e===""?e:_(e)?K(e):j(e)}function ae(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.password=e,r.password}function oe(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.username=e,r.username}function ce(e,t,r){if(r||e==="")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]=="/";return e=new URL(n?e:"/-"+e,"https://example.com").pathname,n||(e=e.substring(2,e.length)),e}function le(e,t,r){return z(t)===e&&(e=""),r||e===""?e:G(e)}function fe(e,t){return e=Ce(e,":"),t||e===""?e:y(e)}function z(e){switch(e){case"ws":case"http":return "80";case"wws":case"https":return "443";case"ftp":return "21";default:return ""}}function y(e){if(e==="")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}function he(e){if(e==="")return e;let t=new URL("https://example.com");return t.username=e,t.username}function ue(e){if(e==="")return e;let t=new URL("https://example.com");return t.password=e,t.password}function j(e){if(e==="")return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL("https://example.com");return t.hostname=e,t.hostname}function K(e){if(e==="")return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function G(e){if(e===""||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}function de(e){if(e==="")return e;let t=new URL("https://example.com");return t.pathname=e[0]!=="/"?"/-"+e:e,e[0]!=="/"?t.pathname.substring(2,t.pathname.length):t.pathname}function pe(e){return e===""?e:new URL(`data:${e}`).pathname}function ge(e){if(e==="")return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}function me(e){if(e==="")return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}var H=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t;}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type==="END"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r);}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5: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);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="");}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;}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);}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0;}#b(){this.#e=this.#l,this.#s=0;}#u(t){this.#b(),this.#o=t;}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")}#P(){return this.#a(this.#e,":")}#E(){return this.#a(this.#e+1,"/")&&this.#a(this.#e+2,"/")}#S(){return this.#a(this.#e,"@")}#O(){return this.#a(this.#e,":")}#k(){return this.#a(this.#e,":")}#x(){return this.#a(this.#e,"/")}#h(){if(this.#a(this.#e,"?"))return !0;if(this.#n[this.#e].value!=="?")return !1;let t=this.#m(this.#e-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#f(){return this.#a(this.#e,"#")}#T(){return this.#n[this.#e].type=="OPEN"}#A(){return this.#n[this.#e].type=="CLOSE"}#y(){return this.#a(this.#e,"[")}#w(){return this.#a(this.#e,"]")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,x),t.encodePart=y;let r=q(this.#c(),void 0,t);this.#g=N(r);}};var V=["protocol","username","password","hostname","port","pathname","search","hash"],E="*";function Se(e,t){if(typeof e!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);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):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}function b(e,t){return t?C(e):e}function w(e,t,r){let n;if(typeof t.baseURL=="string")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=b(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=b(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=b(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=b(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=b(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=b(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=b(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=b(n.hash.substring(1,n.hash.length),r));}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol=="string"&&(e.protocol=fe(t.protocol,r)),typeof t.username=="string"&&(e.username=oe(t.username,r)),typeof t.password=="string"&&(e.password=ae(t.password,r)),typeof t.hostname=="string"&&(e.hostname=ie(t.hostname,r)),typeof t.port=="string"&&(e.port=le(t.port,e.protocol,r)),typeof t.pathname=="string"){if(e.pathname=t.pathname,n&&!ee(e.pathname,r)){let a=n.pathname.lastIndexOf("/");a>=0&&(e.pathname=b(n.pathname.substring(0,a+1),r)+e.pathname);}e.pathname=ce(e.pathname,e.protocol,r);}return typeof t.search=="string"&&(e.search=se(t.search,r)),typeof t.hash=="string"&&(e.hash=ne(t.hash,r)),e}function C(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}function Le(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Ie(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith="";let r=".*",n=`[^${Le(t.delimiter)}]+?`,a=/[$_\u200C\u200D\p{ID_Continue}]/u,c="";for(let l=0;l<e.length;++l){let s=e[l];if(s.type===3){if(s.modifier===3){c+=C(s.value);continue}c+=`{${C(s.value)}}${k(s.modifier)}`;continue}let i=s.hasCustomName(),o=!!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;if(!o&&i&&s.type===1&&s.modifier===3&&d&&!d.prefix.length&&!d.suffix.length)if(d.type===3){let T=d.value.length>0?d.value[0]:"";o=a.test(T);}else o=!d.hasCustomName();if(!o&&!s.prefix.length&&f&&f.type===3){let T=f.value[f.value.length-1];o=t.prefixes.includes(T);}o&&(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||o||s.prefix!=="")?c+="*":c+=`(${r})`),s.type===1&&i&&s.suffix.length&&a.test(s.suffix[0])&&(c+="\\"),c+=C(s.suffix),o&&(c+="}"),s.modifier!==3&&(c+=k(s.modifier));}return c}var Y=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let a;if(typeof r=="string"?a=r:n=r,typeof t=="string"){let i=new H(t);if(i.parse(),t=i.result,a===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=a;}else {if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(a)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let c={ignoreCase:n.ignoreCase===!0},l={pathname:E,protocol:E,username:E,password:E,hostname:E,port:E,search:E,hash:E};this.#i=w(l,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port="");let s;for(s of V){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case"protocol":Object.assign(i,x),i.encodePart=y;break;case"username":Object.assign(i,x),i.encodePart=he;break;case"password":Object.assign(i,x),i.encodePart=ue;break;case"hostname":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case"port":Object.assign(i,x),i.encodePart=G;break;case"pathname":N(this.#n.protocol)?(Object.assign(i,Q,c),i.encodePart=de):(Object.assign(i,x,c),i.encodePart=pe);break;case"search":Object.assign(i,x,c),i.encodePart=ge;break;case"hash":Object.assign(i,x,c),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ie(this.#s[s],i),this.#l=this.#l||this.#s[s].some(f=>f.type===2);}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(a){throw new TypeError(`Failed to construct 'URLPattern': ${a.message}`)}}test(t={},r){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&r)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return !1;try{typeof t=="object"?n=w(n,t,!1):n=w(n,Se(t,r),!1);}catch{return !1}let a;for(a of V)if(!this.#n[a].exec(n[a]))return !1;return !0}exec(t={},r){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&r)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?n=w(n,t,!1):n=w(n,Se(t,r),!1);}catch{return null}let a={};r?a.inputs=[t,r]:a.inputs=[t];let c;for(c of V){let l=this.#n[c].exec(n[c]);if(!l)return null;let s={};for(let[i,o]of this.#t[c].entries())if(typeof o=="string"||typeof o=="number"){let f=l[i+1];s[o]=f;}a[c]={input:n[c]??"",groups:s};}return a}static compareComponent(t,r,n){let a=(i,o)=>{for(let f of ["type","modifier","prefix","value","suffix"]){if(i[f]<o[f])return -1;if(i[f]===o[f])continue;return 1}return 0},c=new R(3,"","","","",3),l=new R(0,"","","","",3),s=(i,o)=>{let f=0;for(;f<Math.min(i.length,o.length);++f){let d=a(i[f],o[f]);if(d)return d}return i.length===o.length?0:a(i[f]??c,o[f]??c)};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])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};
6
+
7
+ const { URLPattern } = urlpattern;
8
+
9
+ var urlpatternPolyfill = { URLPattern };
10
+
11
+ if (!globalThis.URLPattern) {
12
+ globalThis.URLPattern = URLPattern;
13
+ }
14
+
15
+ /* eslint-env node */
16
+
17
+ // This exists just to re-export urlpattern-polyfill as a module in the codebase
18
+ var urlPattern = urlpatternPolyfill;
19
+
20
+ var urlPattern$1 = /*@__PURE__*/getDefaultExportFromCjs(urlPattern);
21
+
22
+ export { urlPattern$1 as default };
package/node.js ADDED
@@ -0,0 +1,19 @@
1
+ import './abort.js';
2
+ import './array.js';
3
+ import './blob.js';
4
+ import './errors.js';
5
+ import './function.js';
6
+ import './iterator.js';
7
+ import './map.js';
8
+ import './math.js';
9
+ import './object.js';
10
+ import './performance.js';
11
+ import './promise.js';
12
+ import './request.js';
13
+ import './response.js';
14
+ import './scheduler.js';
15
+ import './string.js';
16
+ import './symbols.js';
17
+ import './set.js';
18
+ import './url.js';
19
+ import './weakMap.js';
package/node.min.js ADDED
@@ -0,0 +1,6 @@
1
+ !function(){"use strict";if(!("AbortSignal"in globalThis)){const t={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class e extends EventTarget{constructor(){super(),Object.defineProperties(this,{[t.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[t.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[t.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(t=>{this.onabort instanceof Function&&this.onabort.call(this,t)}))}get aborted(){return this[t.aborted]}get onabort(){return this[t.onabort]}set onabort(e){this[t.onabort]=e instanceof Function?e:null}get reason(){return this[t.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new e;return n[t.aborted]=!0,n[t.reason]=r,n}},globalThis.AbortController=class{constructor(){this[t.signal]=new AbortSignal}get signal(){return this[t.signal]}abort(e=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[t.aborted]=!0,r[t.reason]=e,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const t=new WeakMap,e=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const e=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=e();return t.set(n,r),n}}else AbortSignal.abort=function(t=new DOMException("Operation aborted")){const e=new AbortController;return e.abort(t),e.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return t.has(this)?t.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){t.set(this.signal,r),e.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(t){if(void 0===t)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(t)){if(t<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const e=new AbortController;return setTimeout((()=>e.abort(new DOMException("The operation timed out."))),t),e.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(t){if(!Array.isArray(t))throw new TypeError("Expected an array of signals");const e=new AbortController;for(const r of t){if(!(r instanceof AbortSignal)){const t=new TypeError("`signal` is not an `AbortSignal`");throw e.abort(t),t}if(r.aborted){e.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",(({target:t})=>{e.abort(t.reason||new DOMException("Operation aborted."))}),{signal:e.signal})}return e.signal});const t=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(t=1){const e=[];t=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,t));const r=(t,n)=>{Array.isArray(t)&&n>=0?t.forEach((t=>r(t,n-1))):e.push(t)};return r(this,Number.isNaN(t)?0:t),e}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(t,e){return this.map(t,e).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(t,e){let r;return this.forEach(((n,o,i)=>{t.call(e,n,o,i)&&(r=n)}),e),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(t){this[this.lastIndex]=t}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(t,e){let r=-1;return this.forEach(((n,o,i)=>{t.call(e,n,o,i)&&(r=o)}),e),r}),!(Array.prototype.at instanceof Function)){const e=function(t){if((t=Math.trunc(t)||0)<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]};for(const r of t)void 0!==r&&Object.defineProperty(r.prototype,"at",{value:e,writable:!0,enumerable:!1,configurable:!0})}function e(t,e,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){t[e]instanceof Function||Object.defineProperty(t,e,{value:r,writable:n,enumerable:o,configurable:i})}!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(t){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,t)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(t){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,t)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(t){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,t)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(t){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,t)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(t,e,r=globalThis){let n=[];for await(const e of t)n.push(await e);return Array.from(n,e,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(t){return this===t||!!Array.isArray(t)&&(this.length===t.length&&this.every(((e,r)=>{const n=t[r];return Array.isArray(e)?Array.isArray(n)&&e.equals(n):Object.is(e,n)})))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(t){if(void 0===t)return[...new Set(this)];if("string"==typeof t){const e=[];return this.filter((r=>{const n=r[t];return!e.includes(n)&&(e.push(n),!0)}))}if(t instanceof Function){const e=[];return this.filter(((...r)=>{try{const n=t.apply(this,r);return"string"==typeof n&&(!e.includes(n)&&(e.push(n),!0))}catch(t){return!1}}))}throw new TypeError("Not a valid argument for uniqueBy")}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(t){return[...this].sort(t)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(t,e,...r){const n=[...this];return n.splice(t,e,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(t,e){const r=[...this];return r[t]=e,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(t){return!!(Array.isArray(t)&&Array.isArray(t.raw)&&Object.isFrozen(t)&&Object.isFrozen(t.raw))&&(0!==t.length&&t.length===t.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,(t=>t.toString(16).padStart(2,"0"))).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:t="base64"}={}){if("base64"===t){const t=32768;let e="";for(let r=0;r<this.length;r+=t){const n=this.subarray(r,r+t);e+=String.fromCharCode.apply(null,n)}return btoa(e)}if("base64url"===t)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(t){if("string"!=typeof t)throw new TypeError("expected input to be a string");if(0===!(1&t.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,t.length,{step:2}),(e=>parseInt(t.substring(e,e+2),16)))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(t,{alphabet:e="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof t)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(e))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==e)return Uint8Array.fromBase64(t.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const e=t.length%4;if(1===e)throw new TypeError("Invalid string length.");if(0===e)return Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(t.padEnd(t.length+(4-e),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(t.slice(0,t.length-e),{alphabet:"base64",lastChunkHandling:"strict"})}}}),e(Blob.prototype,"bytes",(async function(){return new Uint8Array(await this.arrayBuffer())})),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(t,e){void 0===e?(super(t),this.errors=[]):(super(e),this.errors=t)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(t){globalThis.dispatchEvent(function(t,e="error"){if(t instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:s}=t;return new ErrorEvent(e,{error:t,message:`${n}: ${r}`,filename:o,lineno:i,colno:s})}throw new TypeError("`errorToEvent()` only accepts Errors")}(t))}),function(){if(!(Function.prototype.once instanceof Function)){const t=new WeakMap;Function.prototype.once=function(e){const r=this;return function(...n){if(t.has(r))return t.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(e||r,n).catch((e=>{throw t.delete(r),e}));return t.set(r,o),o}if(r instanceof Function){const o=r.apply(e||r,n);return t.set(r,o),o}}}}}();const r="Iterator"in globalThis,n=r?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),o=r?globalThis.Iterator:(t=>{class e{[Symbol.iterator](){return this}}return Object.setPrototypeOf(e,t),e})(n);var i;o.range instanceof Function||(o.range=function(t,e,r){if("number"==typeof r||"bigint"==typeof r)return o.range(t,e,{step:r});if("object"!=typeof r||Object.is(r,null))return o.range(t,e,{});{const{step:n=("number"==typeof t?t<e?1:-1:t<e?1n:-1n),inclusive:i=!1}=r;if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("Start must be a number");if(Number.isNaN(t))throw new RangeError("Invalid start");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("End must be a number");if(Number.isNaN(e))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&t<e||n>0&&t>e)return;if(i){let r=t;return n>0?o.from({next(){const t=r<=e?{value:r,done:!1}:{done:!0};return r+=n,t}}):o.from({next(){const t=r>=e?{value:r,done:!1}:{done:!0};return r+=n,t}})}{let r=t;if(n>0)return o.from({next(){const t=r<e?{value:r,done:!1}:{done:!0};return r+=n,t}});{let r=t;return o.from({next(){const t=r>e?{value:r,done:!1}:{done:!0};return r+=n,t}})}}}}),n[Symbol.toStringTag]||(n[Symbol.toStringTag]="Iterator"),n.take instanceof Function||(n.take=function(t){let e=0;const r=this;return o.from({next:()=>e++>=t?{done:!0}:r.next()})}),n.drop instanceof Function||(n.drop=function(t){for(let e=0;e<t;e++){const{done:t}=this.next();if(t)break}return this}),n.toArray instanceof Function||(n.toArray=function(){return Array.from(this)}),n.forEach instanceof Function||(n.forEach=function(t){for(const e of this)t.call(this,e)}),n.flatMap instanceof Function||(n.flatMap=function(t){const e=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?o.from({next:()=>({done:!0})}):o.from(t.call(e,r));let i=n(r);return o.from({next(){const{value:t,done:o=!0}=i.next();return r.done&&o?{done:!0}:o?r.done?{done:!0}:(r=e.next(),i=n(r),i.next()):{value:t,done:o}}})}),n.map instanceof Function||(n.map=function(t){const e=this;return o.from({next(){const{done:r,value:n}=e.next();return r?{done:r}:{value:t.call(e,n),done:!1}}})}),n.reduce instanceof Function||(n.reduce=function(t,e){let r=void 0===e?this.next().value:e;for(const e of this)r=t.call(this,r,e);return r}),n.filter instanceof Function||(n.filter=function(t){const e=this;let r,n=!1;return o.from({next(){for(;!n;){const o=e.next();if(n=o.done,n)break;if(t.call(e,o.value)){r=o.value;break}}return{done:n,value:r}}})}),n.some instanceof Function||(n.some=function(t){let e=!1;for(const r of this)if(t.call(this,r)){e=!0;break}return e}),n.every instanceof Function||(n.every=function(t){let e=!0;for(const r of this)if(!t.call(this,r)){e=!1;break}return e}),n.find instanceof Function||(n.find=function(t){for(const e of this)if(t.call(this,e))return e}),n.indexed instanceof Function||(n.indexed=function(){let t=0;return this.map((e=>[t++,e]))}),n.chunks instanceof Function||(n.chunks=function(t){if(!Number.isSafeInteger(t)||t<1)throw new TypeError("Size must be a positive integer.");{const e=this;let r=!1;return o.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<t&&!r;){const t=e.next();if(t.done){r=!0,void 0!==t.value&&n.push(t.value);break}n.push(t.value)}return{value:n,done:!1}}}})}}),o.from instanceof Function||(o.from=function(t){if("object"!=typeof t||null===t)throw new TypeError("Not an object.");if(t.next instanceof Function){return Object.create(n,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...e)=>t.next(...e)}})}if(t[Symbol.iterator]instanceof Function)return o.from(t[Symbol.iterator]())}),r||(globalThis.Iterator=o),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(t,{insert:e,update:r}={}){const n=this.has(t);if(n&&r instanceof Function){const e=this.get(t),n=r.call(this,e,t,this);return n!==e&&this.set(t,n),n}if(n)return this.get(t);if(e instanceof Function){const r=e.call(this,t,this);return this.set(t,r),r}throw new Error("Key is not found and no `insert()` given")}),Map.groupBy instanceof Function||(Map.groupBy=function(t,e){return Array.from(t).reduce(((t,r,n)=>(t.emplace(e.call(t,r,n),{insert:()=>[r],update:t=>(t.push(r),t)}),t)),new Map)}),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=t=>t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=t=>(t>0)-(t<0)||+t),Math.hasOwnProperty("trunc")||(Math.trunc=t=>{const e=t-t%1;return 0===e&&(t<0||0===t&&1/t!=1/0)?-0:e}),Math.hasOwnProperty("expm1")||(Math.expm1=t=>Math.exp(t)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...t)=>Math.sqrt(t.reduce(((t,e)=>t+e**2),0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=t=>t**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=t=>Math.log(t)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=t=>Math.log(t)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=t=>Math.log(1+t)),Math.hasOwnProperty("fround")||(Math.fround=(i=new Float32Array(1),function(t){return i[0]=t,i[0]})),Math.clamp instanceof Function||(Math.clamp=function(t,e,r){return Math.min(Math.max(t,e),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(t){let e=-0;for(const r of t){if(!Number.isFinite(r)){e=-0;break}e+=r}return e}),Math.sum instanceof Function||(Math.sum=function(...t){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(t)}),Object.groupBy instanceof Function||(Object.groupBy=function(t,e){return Array.from(t).reduce(((t,r,n)=>{const o=e.call(t,r,n);return t.hasOwnProperty(o)?t[o].push(r):t[o]=[r],t}),{})}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const t=t=>Number.isSafeInteger(t)&&t>0;globalThis.requestIdleCallback=function(e,{timeout:r}={}){const n=performance.now(),o=()=>t(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout((()=>e({didTimeout:!!t(r)&&0===o(),timeRemaining:o})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=t=>clearTimeout(t)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=t=>setTimeout((()=>t(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=t=>clearTimeout(t)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=t=>Promise.resolve().then(t).catch((t=>setTimeout((()=>{throw t})))))}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(t){return this.then((async e=>(await t(),e)),(async e=>(await t(),e)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(t){return Promise.all(Array.from(t).map((function(t){return new Promise((function(e){t instanceof Promise||(t=Promise.resolve(t)),t.then((function(t){e({status:"fulfilled",value:t})})).catch((function(t){e({status:"rejected",reason:t})}))}))})))}),Promise.any instanceof Function||(Promise.any=t=>new Promise(((e,r)=>{let n=[];t.forEach((o=>{o.then(e).catch((e=>{n.push(e),n.length===t.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=t=>new Promise(((e,r)=>{t.forEach((t=>t.then(e,r)))}))),Promise.try instanceof Function||(Promise.try=t=>new Promise((e=>e(t())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const t={};return t.promise=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),t}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(t){const e=[],r=[];for(const[n,o]of t)e.push(n),r.push(o);return await Promise.all(r).then((t=>Object.fromEntries(t.map(((t,r)=>[e[r],t])))))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(t){return await Promise.fromEntries(Object.entries(t))})),e(Request.prototype,"bytes",(async function(){return new Uint8Array(await this.arrayBuffer())})),e(Response,"json",((t,{status:e=200,statusText:r="",headers:n=new Headers}={})=>n instanceof Headers?(n.set("Content-Type","application/json"),new Response(JSON.stringify(t),{status:e,statusText:r,headers:n})):Response.json(t,{status:e,statusText:r,headers:new Headers(n)}))),e(Response,"redirect",((t,e=302)=>new Response("",{status:e,headers:new Headers({Location:t})}))),e(Response.prototype,"bytes",(async function(){return new Uint8Array(await this.arrayBuffer())}));
2
+ /**
3
+ * @copyright 2023 Chris Zuber <admin@kernvalley.us>
4
+ */
5
+ const s="user-blocking",a="user-visible",c="background";async function u(t,{delay:e=0,signal:r}={}){return new Promise(((n,o)=>{if(r instanceof AbortSignal&&r.aborted)o(r.reason);else{const i=new AbortController,s=setTimeout((()=>{n(t()),i.abort()}),e);r instanceof AbortSignal&&r.addEventListener("abort",(({target:t})=>{o(t.reason),clearTimeout(s)}),{once:!0,signal:i.signal})}}))}class l{async postTask(t,{priority:e=a,delay:r,signal:n}={}){return new Promise(((o,i)=>{if(n instanceof AbortSignal&&n.aborted)i(n.reason);else switch(e){case s:"number"==typeof r&&!Number.isNaN(r)&&r>0?u(t,{delay:r,signal:n}).then(o,i):o((async()=>await t())());break;case a:if("number"==typeof r&&!Number.isNaN(r)&&r>0)u((()=>requestAnimationFrame((async()=>{try{const e=await t();o(e)}catch(t){i(t)}}))),{delay:r,signal:n}).catch(i);else{const e=new AbortController,r=requestAnimationFrame((async()=>{try{const e=await t();o(e)}catch(t){i(t)}finally{e.abort()}}));n instanceof AbortSignal&&n.addEventListener("abort",(({target:t})=>{cancelAnimationFrame(r),i(t.reason)}),{once:!0,signal:e.signal})}break;case c:if("number"==typeof r&&!Number.isNaN(r)&&r>0)u((()=>requestIdleCallback((async()=>{try{const e=await t();o(e)}catch(t){i(t)}}))),{delay:r,signal:n}).catch(i);else{const e=new AbortController,r=requestIdleCallback((async()=>{try{const e=await t();o(e)}catch(t){i(t)}finally{e.abort()}}));n instanceof AbortSignal&&n.addEventListener("abort",(({target:t})=>{cancelIdleCallback(r),i(t.reason)}),{once:!0,signal:e.signal})}break;default:throw new TypeError(`Scheduler.postTask: '${e}' (value of 'priority' member of SchedulerPostTaskOptions) is not a valid value for enumeration TaskPriority.`)}}))}}"scheduler"in globalThis||(globalThis.scheduler=new l);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var f={exports:{}};f.exports=function(){const t=new WeakMap,e=/(\n|\r\n?|\u2028|\u2029)/g,r=/^\s*/,n=/\S/,o=Array.prototype.slice;function i(t){if("string"==typeof t)return c([t])[0];if("function"==typeof t)return function(){const e=o.call(arguments);return e[0]=a(e[0]),t.apply(this,e)};const e=a(t);let r=s(e,0);for(let t=1;t<e.length;t++)r+=arguments[t]+s(e,t);return r}function s(t,e){const r=t[e];if(void 0===r)throw new TypeError(`invalid cooked string at index ${e}`);return r}function a(e){const r=t.get(e);if(r)return r;const n=c(e);return t.set(e,n),Object.defineProperty(n,"raw",{value:Object.freeze(c(e.raw))}),Object.freeze(n),n}function c(t){const o=t.map((t=>null==t?void 0:t.split(e)));let i;for(let t=0;t<o.length;t++){const e=o[t];if(void 0===e)continue;const s=0===t,a=t+1===o.length;if(s){if(1===e.length||e[0].length>0)throw new Error("invalid content on opening line");e[1]=""}if(a){if(1===e.length||n.test(e[e.length-1]))throw new Error("invalid content on closing line");e[e.length-2]="",e[e.length-1]=""}for(let t=2;t<e.length;t+=2){const n=e[t],o=t+1===e.length&&!a,s=r.exec(n)[0];o||s.length!==n.length?i=u(s,i):e[t]=""}}const s=i?i.length:0;return o.map((t=>{if(void 0===t)return t;let e=t[0];for(let r=1;r<t.length;r+=2)e+=t[r]+t[r+1].slice(s);return e}))}function u(t,e){if(void 0===e||t===e)return t;let r=0;for(const n=Math.min(t.length,e.length);r<n&&t[r]===e[r];r++);return t.slice(0,r)}return i}();var p=h(f.exports);if(String.dedent instanceof Function||(String.dedent=p),"Symbol"in globalThis){const t=new Set(Reflect.ownKeys(Symbol).filter((t=>"symbol"==typeof Symbol[t])).map((t=>Symbol[t])));void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator")),e(Symbol,"isRegistered",(function(t){return"symbol"==typeof t&&"string"==typeof Symbol.keyFor(t)})),e(Symbol,"isWellKnown",(function(e){return t.has(e)}))}const y="Expected a set-like object.",b=["has","keys"],g=["size"],m=t=>t instanceof Set,d=t=>m(t)||"object"==typeof t&&null!==t&&b.every((e=>t[e]instanceof Function))&&g.every((e=>e in t));function w(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(t){if(!d(t))throw new TypeError(y);return new Set([...this].filter((e=>t.has(e))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(t){if(!d(t))throw new TypeError(y);return new Set([...this].filter((e=>!t.has(e))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(t){return new Set([...this,...t])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(t){if(!d(t))throw new TypeError(y);return[...this].every((e=>t.has(e)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(t){if(!d(t))throw new TypeError(y);return m(t)?t.isSubsetOf(this):new Set(t.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(t){if(!d(t))throw new TypeError(y);return m(t)?new Set([...this.difference(t),...t.difference(this)]):new Set([...this.difference(t),...new Set(t.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(t){if(!d(t))throw new TypeError(y);return new Set([...this,...t]).size===this.size+t.size});var A=Object.defineProperty,v=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,x=Object.prototype.hasOwnProperty,S={};((t,e)=>{for(var r in e)A(t,r,{get:e[r],enumerable:!0})})(S,{URLPattern:()=>ut});var T,F=(T=S,((t,e,r,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let o of E(e))!x.call(t,o)&&o!==r&&A(t,o,{get:()=>e[o],enumerable:!(n=v(e,o))||n.enumerable});return t})(A({},"__esModule",{value:!0}),T)),O=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,n,o,i){this.type=t,this.name=e,this.prefix=r,this.value=n,this.suffix=o,this.modifier=i}hasCustomName(){return""!==this.name&&"number"!=typeof this.name}},P=/[$_\p{ID_Start}]/u,M=/[$_\u200C\u200D\p{ID_Continue}]/u,R=".*";function k(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function I(t,e=!1){let r=[],n=0;for(;n<t.length;){let o=t[n],i=function(o){if(!e)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:t[n++]})};if("*"!==o)if("+"!==o&&"?"!==o)if("\\"!==o)if("{"!==o)if("}"!==o)if(":"!==o)if("("!==o)r.push({type:"CHAR",index:n,value:t[n++]});else{let e=1,o="",s=n+1,a=!1;if("?"===t[s]){i(`Pattern cannot start with "?" at ${s}`);continue}for(;s<t.length;){if(!k(t[s],!1)){i(`Invalid character '${t[s]}' at ${s}.`),a=!0;break}if("\\"!==t[s]){if(")"===t[s]){if(e--,0===e){s++;break}}else if("("===t[s]&&(e++,"?"!==t[s+1])){i(`Capturing groups are not allowed at ${s}`),a=!0;break}o+=t[s++]}else o+=t[s++]+t[s++]}if(a)continue;if(e){i(`Unbalanced pattern at ${n}`);continue}if(!o){i(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:o}),n=s}else{let e="",o=n+1;for(;o<t.length;){let r=t.substr(o,1);if(!(o===n+1&&P.test(r)||o!==n+1&&M.test(r)))break;e+=t[o++]}if(!e){i(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:e}),n=o}else r.push({type:"CLOSE",index:n,value:t[n++]});else r.push({type:"OPEN",index:n,value:t[n++]});else r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});else r.push({type:"OTHER_MODIFIER",index:n,value:t[n++]});else r.push({type:"ASTERISK",index:n,value:t[n++]})}return r.push({type:"END",index:n,value:""}),r}function $(t,e={}){let r=I(t);e.delimiter??="/#?",e.prefixes??="./";let n=`[^${N(e.delimiter)}]+?`,o=[],i=0,s=0,a=new Set,c=t=>{if(s<r.length&&r[s].type===t)return r[s++].value},u=()=>c("OTHER_MODIFIER")??c("ASTERISK"),l=t=>{let e=c(t);if(void 0!==e)return e;let{type:n,index:o}=r[s];throw new TypeError(`Unexpected ${n} at ${o}, expected ${t}`)},h=()=>{let t,e="";for(;t=c("CHAR")??c("ESCAPED_CHAR");)e+=t;return e},f=e.encodePart||(t=>t),p="",y=t=>{p+=t},b=()=>{p.length&&(o.push(new O(3,"","",f(p),"",3)),p="")},g=(t,e,r,s,c)=>{let u,l=3;switch(c){case"?":l=1;break;case"*":l=0;break;case"+":l=2}if(!e&&!r&&3===l)return void y(t);if(b(),!e&&!r){if(!t)return;return void o.push(new O(3,"","",f(t),"",l))}u=r?"*"===r?R:r:n;let h,p=2;if(u===n?(p=1,u=""):u===R&&(p=0,u=""),e?h=e:r&&(h=i++),a.has(h))throw new TypeError(`Duplicate name '${h}'.`);a.add(h),o.push(new O(p,h,f(t),u,f(s),l))};for(;s<r.length;){let t=c("CHAR"),r=c("NAME"),n=c("REGEX");if(!r&&!n&&(n=c("ASTERISK")),r||n){let o=t??"";-1===e.prefixes.indexOf(o)&&(y(o),o=""),b(),g(o,r,n,"",u());continue}let o=t??c("ESCAPED_CHAR");if(o)y(o);else if(c("OPEN")){let t=h(),e=c("NAME"),r=c("REGEX");!e&&!r&&(r=c("ASTERISK"));let n=h();l("CLOSE"),g(t,e,r,n,u())}else b(),l("END")}return o}function N(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function j(t){return t&&t.ignoreCase?"ui":"u"}function C(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function U(t,e,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let o of t){if(3===o.type){3===o.modifier?n+=N(o.value):n+=`(?:${N(o.value)})${C(o.modifier)}`;continue}e&&e.push(o.name);let t=`[^${N(r.delimiter)}]+?`,i=o.value;(1===o.type?i=t:0===o.type&&(i=R),o.prefix.length||o.suffix.length)?3!==o.modifier&&1!==o.modifier?(n+=`(?:${N(o.prefix)}`,n+=`((?:${i})(?:`,n+=N(o.suffix),n+=N(o.prefix),n+=`(?:${i}))*)${N(o.suffix)})`,0===o.modifier&&(n+="?")):(n+=`(?:${N(o.prefix)}(${i})${N(o.suffix)})`,n+=C(o.modifier)):3===o.modifier||1===o.modifier?n+=`(${i})${C(o.modifier)}`:n+=`((?:${i})${C(o.modifier)})`}let o=`[${N(r.endsWith)}]|$`,i=`[${N(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,j(r));r.strict||(n+=`(?:${i}(?=${o}))?`);let s=!1;if(t.length){let e=t[t.length-1];3===e.type&&3===e.modifier&&(s=r.delimiter.indexOf(e)>-1)}return s||(n+=`(?=${i}|${o})`),new RegExp(n,j(r))}var L={delimiter:"",prefixes:"",sensitive:!0,strict:!0},B={delimiter:".",prefixes:"",sensitive:!0,strict:!0},_={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function D(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function H(t){return!(!t||t.length<2)&&("["===t[0]||("\\"===t[0]||"{"===t[0])&&"["===t[1])}var q=["ftp","file","http","https","ws","wss"];function G(t){if(!t)return!0;for(let e of q)if(t.test(e))return!0;return!1}function W(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function z(t){if(""===t)return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function K(t){if(""===t)return t;let e=new URL("https://example.com");return e.username=t,e.username}function X(t){if(""===t)return t;let e=new URL("https://example.com");return e.password=t,e.password}function V(t){if(""===t)return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function J(t){if(""===t)return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function Z(t){if(""===t||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Q(t){if(""===t)return t;let e=new URL("https://example.com");return e.pathname="/"!==t[0]?"/-"+t:t,"/"!==t[0]?e.pathname.substring(2,e.pathname.length):e.pathname}function Y(t){return""===t?t:new URL(`data:${t}`).pathname}function tt(t){if(""===t)return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function et(t){if(""===t)return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}var rt=["protocol","username","password","hostname","port","pathname","search","hash"],nt="*";function ot(t,e){if("string"!=typeof t)throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);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):void 0,hash:""!==r.hash?r.hash.substring(1,r.hash.length):void 0}}function it(t,e){return e?at(t):t}function st(t,e,r){let n;if("string"==typeof e.baseURL)try{n=new URL(e.baseURL),void 0===e.protocol&&(t.protocol=it(n.protocol.substring(0,n.protocol.length-1),r)),!r&&void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&void 0===e.username&&(t.username=it(n.username,r)),!r&&void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&void 0===e.username&&void 0===e.password&&(t.password=it(n.password,r)),void 0===e.protocol&&void 0===e.hostname&&(t.hostname=it(n.hostname,r)),void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&(t.port=it(n.port,r)),void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&void 0===e.pathname&&(t.pathname=it(n.pathname,r)),void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&void 0===e.pathname&&void 0===e.search&&(t.search=it(n.search.substring(1,n.search.length),r)),void 0===e.protocol&&void 0===e.hostname&&void 0===e.port&&void 0===e.pathname&&void 0===e.search&&void 0===e.hash&&(t.hash=it(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if("string"==typeof e.protocol&&(t.protocol=function(t,e){return t=function(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}(t,":"),e||""===t?t:z(t)}(e.protocol,r)),"string"==typeof e.username&&(t.username=function(t,e){if(e||""===t)return t;let r=new URL("https://example.com");return r.username=t,r.username}(e.username,r)),"string"==typeof e.password&&(t.password=function(t,e){if(e||""===t)return t;let r=new URL("https://example.com");return r.password=t,r.password}(e.password,r)),"string"==typeof e.hostname&&(t.hostname=function(t,e){return e||""===t?t:H(t)?J(t):V(t)}(e.hostname,r)),"string"==typeof e.port&&(t.port=function(t,e,r){return W(e)===t&&(t=""),r||""===t?t:Z(t)}(e.port,t.protocol,r)),"string"==typeof e.pathname){if(t.pathname=e.pathname,n&&!function(t,e){return!(!t.length||"/"!==t[0]&&(!e||t.length<2||"\\"!=t[0]&&"{"!=t[0]||"/"!=t[1]))}(t.pathname,r)){let e=n.pathname.lastIndexOf("/");e>=0&&(t.pathname=it(n.pathname.substring(0,e+1),r)+t.pathname)}t.pathname=function(t,e,r){if(r||""===t)return t;if(e&&!q.includes(e))return new URL(`${e}:${t}`).pathname;let n="/"==t[0];return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}(t.pathname,t.protocol,r)}return"string"==typeof e.search&&(t.search=function(t,e){if(t=D(t,"?"),e||""===t)return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}(e.search,r)),"string"==typeof e.hash&&(t.hash=function(t,e){if(t=D(t,"#"),e||""===t)return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}(e.hash,r)),t}function at(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function ct(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=!1,e.strict??=!1,e.end??=!0,e.start??=!0,e.endsWith="";let r=`[^${function(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}(e.delimiter)}]+?`,n=/[$_\u200C\u200D\p{ID_Continue}]/u,o="";for(let i=0;i<t.length;++i){let s=t[i];if(3===s.type){if(3===s.modifier){o+=at(s.value);continue}o+=`{${at(s.value)}}${C(s.modifier)}`;continue}let a=s.hasCustomName(),c=!!s.suffix.length||!!s.prefix.length&&(1!==s.prefix.length||!e.prefixes.includes(s.prefix)),u=i>0?t[i-1]:null,l=i<t.length-1?t[i+1]:null;if(!c&&a&&1===s.type&&3===s.modifier&&l&&!l.prefix.length&&!l.suffix.length)if(3===l.type){let t=l.value.length>0?l.value[0]:"";c=n.test(t)}else c=!l.hasCustomName();if(!c&&!s.prefix.length&&u&&3===u.type){let t=u.value[u.value.length-1];c=e.prefixes.includes(t)}c&&(o+="{"),o+=at(s.prefix),a&&(o+=`:${s.name}`),2===s.type?o+=`(${s.value})`:1===s.type?a||(o+=`(${r})`):0===s.type&&(a||u&&3!==u.type&&3===u.modifier&&!c&&""===s.prefix?o+="(.*)":o+="*"),1===s.type&&a&&s.suffix.length&&n.test(s.suffix[0])&&(o+="\\"),o+=at(s.suffix),c&&(o+="}"),3!==s.modifier&&(o+=C(s.modifier))}return o}var ut=class{#t;#e={};#r={};#n={};#o={};#i=!1;constructor(t={},e,r){try{let n;if("string"==typeof e?n=e:r=e,"string"==typeof t){let e=new class{#t;#e=[];#r={};#n=0;#o=1;#i=0;#s=0;#a=0;#c=0;#u=!1;constructor(t){this.#t=t}get result(){return this.#r}parse(){for(this.#e=I(this.#t,!0);this.#n<this.#e.length;this.#n+=this.#o){if(this.#o=1,"END"===this.#e[this.#n].type){if(0===this.#s){this.#l(),this.#h()?this.#f(9,1):this.#p()?this.#f(8,1):this.#f(7,0);continue}if(2===this.#s){this.#y(5);continue}this.#f(10,0);break}if(this.#a>0){if(!this.#b())continue;this.#a-=1}if(this.#g())this.#a+=1;else switch(this.#s){case 0:this.#m()&&this.#y(1);break;case 1:if(this.#m()){this.#d();let t=7,e=1;this.#w()?(t=2,e=3):this.#u&&(t=2),this.#f(t,e)}break;case 2:this.#A()?this.#y(3):(this.#v()||this.#p()||this.#h())&&this.#y(5);break;case 3:this.#E()?this.#f(4,1):this.#A()&&this.#f(5,1);break;case 4:this.#A()&&this.#f(5,1);break;case 5:this.#x()?this.#c+=1:this.#S()&&(this.#c-=1),this.#T()&&!this.#c?this.#f(6,1):this.#v()?this.#f(7,0):this.#p()?this.#f(8,1):this.#h()&&this.#f(9,1);break;case 6:this.#v()?this.#f(7,0):this.#p()?this.#f(8,1):this.#h()&&this.#f(9,1);break;case 7:this.#p()?this.#f(8,1):this.#h()&&this.#f(9,1);break;case 8:this.#h()&&this.#f(9,1)}}void 0!==this.#r.hostname&&void 0===this.#r.port&&(this.#r.port="")}#f(t,e){switch(this.#s){case 0:case 2:break;case 1:this.#r.protocol=this.#F();break;case 3:this.#r.username=this.#F();break;case 4:this.#r.password=this.#F();break;case 5:this.#r.hostname=this.#F();break;case 6:this.#r.port=this.#F();break;case 7:this.#r.pathname=this.#F();break;case 8:this.#r.search=this.#F();break;case 9:this.#r.hash=this.#F()}0!==this.#s&&10!==t&&([1,2,3,4].includes(this.#s)&&[6,7,8,9].includes(t)&&(this.#r.hostname??=""),[1,2,3,4,5,6].includes(this.#s)&&[8,9].includes(t)&&(this.#r.pathname??=this.#u?"/":""),[1,2,3,4,5,6,7].includes(this.#s)&&9===t&&(this.#r.search??="")),this.#O(t,e)}#O(t,e){this.#s=t,this.#i=this.#n+e,this.#n+=e,this.#o=0}#l(){this.#n=this.#i,this.#o=0}#y(t){this.#l(),this.#s=t}#P(t){return t<0&&(t=this.#e.length-t),t<this.#e.length?this.#e[t]:this.#e[this.#e.length-1]}#M(t,e){let r=this.#P(t);return r.value===e&&("CHAR"===r.type||"ESCAPED_CHAR"===r.type||"INVALID_CHAR"===r.type)}#m(){return this.#M(this.#n,":")}#w(){return this.#M(this.#n+1,"/")&&this.#M(this.#n+2,"/")}#A(){return this.#M(this.#n,"@")}#E(){return this.#M(this.#n,":")}#T(){return this.#M(this.#n,":")}#v(){return this.#M(this.#n,"/")}#p(){if(this.#M(this.#n,"?"))return!0;if("?"!==this.#e[this.#n].value)return!1;let t=this.#P(this.#n-1);return"NAME"!==t.type&&"REGEX"!==t.type&&"CLOSE"!==t.type&&"ASTERISK"!==t.type}#h(){return this.#M(this.#n,"#")}#g(){return"OPEN"==this.#e[this.#n].type}#b(){return"CLOSE"==this.#e[this.#n].type}#x(){return this.#M(this.#n,"[")}#S(){return this.#M(this.#n,"]")}#F(){let t=this.#e[this.#n],e=this.#P(this.#i).index;return this.#t.substring(e,t.index)}#d(){let t={};Object.assign(t,L),t.encodePart=z;let e=function(t,e,r){return U($(t,r),e,r)}(this.#F(),void 0,t);this.#u=G(e)}}(t);if(e.parse(),t=e.result,void 0===n&&"string"!=typeof t.protocol)throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=n}else{if(!t||"object"!=typeof t)throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let o,i={ignoreCase:!0===r.ignoreCase},s={pathname:nt,protocol:nt,username:nt,password:nt,hostname:nt,port:nt,search:nt,hash:nt};for(o of(this.#t=st(s,t,!0),W(this.#t.protocol)===this.#t.port&&(this.#t.port=""),rt)){if(!(o in this.#t))continue;let t={},e=this.#t[o];switch(this.#r[o]=[],o){case"protocol":Object.assign(t,L),t.encodePart=z;break;case"username":Object.assign(t,L),t.encodePart=K;break;case"password":Object.assign(t,L),t.encodePart=X;break;case"hostname":Object.assign(t,B),H(e)?t.encodePart=J:t.encodePart=V;break;case"port":Object.assign(t,L),t.encodePart=Z;break;case"pathname":G(this.#e.protocol)?(Object.assign(t,_,i),t.encodePart=Q):(Object.assign(t,L,i),t.encodePart=Y);break;case"search":Object.assign(t,L,i),t.encodePart=tt;break;case"hash":Object.assign(t,L,i),t.encodePart=et}try{this.#o[o]=$(e,t),this.#e[o]=U(this.#o[o],this.#r[o],t),this.#n[o]=ct(this.#o[o],t),this.#i=this.#i||this.#o[o].some((t=>2===t.type))}catch{throw new TypeError(`invalid ${o} pattern '${this.#t[o]}'.`)}}}catch(t){throw new TypeError(`Failed to construct 'URLPattern': ${t.message}`)}}test(t={},e){let r,n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof t&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{n=st(n,"object"==typeof t?t:ot(t,e),!1)}catch{return!1}for(r of rt)if(!this.#e[r].exec(n[r]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof t&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{r=st(r,"object"==typeof t?t:ot(t,e),!1)}catch{return null}let n,o={};for(n of(o.inputs=e?[t,e]:[t],rt)){let t=this.#e[n].exec(r[n]);if(!t)return null;let e={};for(let[r,o]of this.#r[n].entries())if("string"==typeof o||"number"==typeof o){let n=t[r+1];e[o]=n}o[n]={input:r[n]??"",groups:e}}return o}static compareComponent(t,e,r){let n=(t,e)=>{for(let r of["type","modifier","prefix","value","suffix"]){if(t[r]<e[r])return-1;if(t[r]!==e[r])return 1}return 0},o=new O(3,"","","","",3),i=new O(0,"","","","",3),s=(t,e)=>{let r=0;for(;r<Math.min(t.length,e.length);++r){let o=n(t[r],e[r]);if(o)return o}return t.length===e.length?0:n(t[r]??o,e[r]??o)};return e.#n[t]||r.#n[t]?e.#n[t]&&!r.#n[t]?s(e.#o[t],[i]):!e.#n[t]&&r.#n[t]?s([i],r.#o[t]):s(e.#o[t],r.#o[t]):0}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#i}};const{URLPattern:lt}=F;var ht={URLPattern:lt};globalThis.URLPattern||(globalThis.URLPattern=lt);var ft=w(ht);"URLPattern"in globalThis||(globalThis.URLPattern=ft),e(URL,"parse",((t,e)=>{try{return new URL(t,e)}catch{return null}})),e(URL,"canParse",((t,e)=>{try{return new URL(t,e)instanceof URL}catch{return!1}})),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(t,{insert:e,update:r}={}){const n=this.has(t);if(n&&r instanceof Function){const e=this.get(t),n=r.call(this,e,t,this);return n!==e&&this.set(t,e),n}if(n)return this.get(t);if(e instanceof Function){const r=e.call(this,t,this);return this.set(t,r),r}throw new Error("Key is not found and no `insert()` given")})}();
6
+ //# sourceMappingURL=node.min.js.map