@grizzlee/react 0.3.0 → 0.3.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/CHANGELOG.md +4 -0
- package/native.cjs +22 -4544
- package/native.cjs.map +4 -4
- package/native.js +8 -4548
- package/native.js.map +4 -4
- package/package.json +4 -1
package/native.js
CHANGED
|
@@ -1,4512 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __esm = (fn, res, err) => function __init() {
|
|
8
|
-
if (err) throw err[0];
|
|
9
|
-
try {
|
|
10
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
throw err = [e], e;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
try {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
throw mod = 0, e;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(from))
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
-
mod
|
|
41
|
-
));
|
|
42
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
-
|
|
44
|
-
// node_modules/.pnpm/webidl-conversions@5.0.0/node_modules/webidl-conversions/lib/index.js
|
|
45
|
-
var require_lib = __commonJS({
|
|
46
|
-
"node_modules/.pnpm/webidl-conversions@5.0.0/node_modules/webidl-conversions/lib/index.js"(exports) {
|
|
47
|
-
"use strict";
|
|
48
|
-
function _(message, opts) {
|
|
49
|
-
return `${opts && opts.context ? opts.context : "Value"} ${message}.`;
|
|
50
|
-
}
|
|
51
|
-
function type(V) {
|
|
52
|
-
if (V === null) {
|
|
53
|
-
return "Null";
|
|
54
|
-
}
|
|
55
|
-
switch (typeof V) {
|
|
56
|
-
case "undefined":
|
|
57
|
-
return "Undefined";
|
|
58
|
-
case "boolean":
|
|
59
|
-
return "Boolean";
|
|
60
|
-
case "number":
|
|
61
|
-
return "Number";
|
|
62
|
-
case "string":
|
|
63
|
-
return "String";
|
|
64
|
-
case "symbol":
|
|
65
|
-
return "Symbol";
|
|
66
|
-
case "object":
|
|
67
|
-
// Falls through
|
|
68
|
-
case "function":
|
|
69
|
-
// Falls through
|
|
70
|
-
default:
|
|
71
|
-
return "Object";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function evenRound(x) {
|
|
75
|
-
if (x > 0 && x % 1 === 0.5 && (x & 1) === 0 || x < 0 && x % 1 === -0.5 && (x & 1) === 1) {
|
|
76
|
-
return censorNegativeZero(Math.floor(x));
|
|
77
|
-
}
|
|
78
|
-
return censorNegativeZero(Math.round(x));
|
|
79
|
-
}
|
|
80
|
-
function integerPart(n) {
|
|
81
|
-
return censorNegativeZero(Math.trunc(n));
|
|
82
|
-
}
|
|
83
|
-
function sign(x) {
|
|
84
|
-
return x < 0 ? -1 : 1;
|
|
85
|
-
}
|
|
86
|
-
function modulo(x, y) {
|
|
87
|
-
const signMightNotMatch = x % y;
|
|
88
|
-
if (sign(y) !== sign(signMightNotMatch)) {
|
|
89
|
-
return signMightNotMatch + y;
|
|
90
|
-
}
|
|
91
|
-
return signMightNotMatch;
|
|
92
|
-
}
|
|
93
|
-
function censorNegativeZero(x) {
|
|
94
|
-
return x === 0 ? 0 : x;
|
|
95
|
-
}
|
|
96
|
-
function createIntegerConversion(bitLength, typeOpts) {
|
|
97
|
-
const isSigned = !typeOpts.unsigned;
|
|
98
|
-
let lowerBound;
|
|
99
|
-
let upperBound;
|
|
100
|
-
if (bitLength === 64) {
|
|
101
|
-
upperBound = Math.pow(2, 53) - 1;
|
|
102
|
-
lowerBound = !isSigned ? 0 : -Math.pow(2, 53) + 1;
|
|
103
|
-
} else if (!isSigned) {
|
|
104
|
-
lowerBound = 0;
|
|
105
|
-
upperBound = Math.pow(2, bitLength) - 1;
|
|
106
|
-
} else {
|
|
107
|
-
lowerBound = -Math.pow(2, bitLength - 1);
|
|
108
|
-
upperBound = Math.pow(2, bitLength - 1) - 1;
|
|
109
|
-
}
|
|
110
|
-
const twoToTheBitLength = Math.pow(2, bitLength);
|
|
111
|
-
const twoToOneLessThanTheBitLength = Math.pow(2, bitLength - 1);
|
|
112
|
-
return (V, opts) => {
|
|
113
|
-
if (opts === void 0) {
|
|
114
|
-
opts = {};
|
|
115
|
-
}
|
|
116
|
-
let x = +V;
|
|
117
|
-
x = censorNegativeZero(x);
|
|
118
|
-
if (opts.enforceRange) {
|
|
119
|
-
if (!Number.isFinite(x)) {
|
|
120
|
-
throw new TypeError(_("is not a finite number", opts));
|
|
121
|
-
}
|
|
122
|
-
x = integerPart(x);
|
|
123
|
-
if (x < lowerBound || x > upperBound) {
|
|
124
|
-
throw new TypeError(_(
|
|
125
|
-
`is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
|
|
126
|
-
opts
|
|
127
|
-
));
|
|
128
|
-
}
|
|
129
|
-
return x;
|
|
130
|
-
}
|
|
131
|
-
if (!Number.isNaN(x) && opts.clamp) {
|
|
132
|
-
x = Math.min(Math.max(x, lowerBound), upperBound);
|
|
133
|
-
x = evenRound(x);
|
|
134
|
-
return x;
|
|
135
|
-
}
|
|
136
|
-
if (!Number.isFinite(x) || x === 0) {
|
|
137
|
-
return 0;
|
|
138
|
-
}
|
|
139
|
-
x = integerPart(x);
|
|
140
|
-
if (x >= lowerBound && x <= upperBound) {
|
|
141
|
-
return x;
|
|
142
|
-
}
|
|
143
|
-
x = modulo(x, twoToTheBitLength);
|
|
144
|
-
if (isSigned && x >= twoToOneLessThanTheBitLength) {
|
|
145
|
-
return x - twoToTheBitLength;
|
|
146
|
-
}
|
|
147
|
-
return x;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
exports.any = (V) => {
|
|
151
|
-
return V;
|
|
152
|
-
};
|
|
153
|
-
exports.void = function() {
|
|
154
|
-
return void 0;
|
|
155
|
-
};
|
|
156
|
-
exports.boolean = function(val) {
|
|
157
|
-
return !!val;
|
|
158
|
-
};
|
|
159
|
-
exports.byte = createIntegerConversion(8, { unsigned: false });
|
|
160
|
-
exports.octet = createIntegerConversion(8, { unsigned: true });
|
|
161
|
-
exports.short = createIntegerConversion(16, { unsigned: false });
|
|
162
|
-
exports["unsigned short"] = createIntegerConversion(16, { unsigned: true });
|
|
163
|
-
exports.long = createIntegerConversion(32, { unsigned: false });
|
|
164
|
-
exports["unsigned long"] = createIntegerConversion(32, { unsigned: true });
|
|
165
|
-
exports["long long"] = createIntegerConversion(64, { unsigned: false });
|
|
166
|
-
exports["unsigned long long"] = createIntegerConversion(64, { unsigned: true });
|
|
167
|
-
exports.double = (V, opts) => {
|
|
168
|
-
const x = +V;
|
|
169
|
-
if (!Number.isFinite(x)) {
|
|
170
|
-
throw new TypeError(_("is not a finite floating-point value", opts));
|
|
171
|
-
}
|
|
172
|
-
return x;
|
|
173
|
-
};
|
|
174
|
-
exports["unrestricted double"] = (V) => {
|
|
175
|
-
const x = +V;
|
|
176
|
-
return x;
|
|
177
|
-
};
|
|
178
|
-
exports.float = (V, opts) => {
|
|
179
|
-
const x = +V;
|
|
180
|
-
if (!Number.isFinite(x)) {
|
|
181
|
-
throw new TypeError(_("is not a finite floating-point value", opts));
|
|
182
|
-
}
|
|
183
|
-
if (Object.is(x, -0)) {
|
|
184
|
-
return x;
|
|
185
|
-
}
|
|
186
|
-
const y = Math.fround(x);
|
|
187
|
-
if (!Number.isFinite(y)) {
|
|
188
|
-
throw new TypeError(_("is outside the range of a single-precision floating-point value", opts));
|
|
189
|
-
}
|
|
190
|
-
return y;
|
|
191
|
-
};
|
|
192
|
-
exports["unrestricted float"] = (V) => {
|
|
193
|
-
const x = +V;
|
|
194
|
-
if (isNaN(x)) {
|
|
195
|
-
return x;
|
|
196
|
-
}
|
|
197
|
-
if (Object.is(x, -0)) {
|
|
198
|
-
return x;
|
|
199
|
-
}
|
|
200
|
-
return Math.fround(x);
|
|
201
|
-
};
|
|
202
|
-
exports.DOMString = function(V, opts) {
|
|
203
|
-
if (opts === void 0) {
|
|
204
|
-
opts = {};
|
|
205
|
-
}
|
|
206
|
-
if (opts.treatNullAsEmptyString && V === null) {
|
|
207
|
-
return "";
|
|
208
|
-
}
|
|
209
|
-
if (typeof V === "symbol") {
|
|
210
|
-
throw new TypeError(_("is a symbol, which cannot be converted to a string", opts));
|
|
211
|
-
}
|
|
212
|
-
return String(V);
|
|
213
|
-
};
|
|
214
|
-
exports.ByteString = (V, opts) => {
|
|
215
|
-
const x = exports.DOMString(V, opts);
|
|
216
|
-
let c;
|
|
217
|
-
for (let i = 0; (c = x.codePointAt(i)) !== void 0; ++i) {
|
|
218
|
-
if (c > 255) {
|
|
219
|
-
throw new TypeError(_("is not a valid ByteString", opts));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return x;
|
|
223
|
-
};
|
|
224
|
-
exports.USVString = (V, opts) => {
|
|
225
|
-
const S = exports.DOMString(V, opts);
|
|
226
|
-
const n = S.length;
|
|
227
|
-
const U = [];
|
|
228
|
-
for (let i = 0; i < n; ++i) {
|
|
229
|
-
const c = S.charCodeAt(i);
|
|
230
|
-
if (c < 55296 || c > 57343) {
|
|
231
|
-
U.push(String.fromCodePoint(c));
|
|
232
|
-
} else if (56320 <= c && c <= 57343) {
|
|
233
|
-
U.push(String.fromCodePoint(65533));
|
|
234
|
-
} else if (i === n - 1) {
|
|
235
|
-
U.push(String.fromCodePoint(65533));
|
|
236
|
-
} else {
|
|
237
|
-
const d = S.charCodeAt(i + 1);
|
|
238
|
-
if (56320 <= d && d <= 57343) {
|
|
239
|
-
const a = c & 1023;
|
|
240
|
-
const b = d & 1023;
|
|
241
|
-
U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b));
|
|
242
|
-
++i;
|
|
243
|
-
} else {
|
|
244
|
-
U.push(String.fromCodePoint(65533));
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return U.join("");
|
|
249
|
-
};
|
|
250
|
-
exports.object = (V, opts) => {
|
|
251
|
-
if (type(V) !== "Object") {
|
|
252
|
-
throw new TypeError(_("is not an object", opts));
|
|
253
|
-
}
|
|
254
|
-
return V;
|
|
255
|
-
};
|
|
256
|
-
function convertCallbackFunction(V, opts) {
|
|
257
|
-
if (typeof V !== "function") {
|
|
258
|
-
throw new TypeError(_("is not a function", opts));
|
|
259
|
-
}
|
|
260
|
-
return V;
|
|
261
|
-
}
|
|
262
|
-
var abByteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
263
|
-
function isArrayBuffer(V) {
|
|
264
|
-
try {
|
|
265
|
-
abByteLengthGetter.call(V);
|
|
266
|
-
return true;
|
|
267
|
-
} catch (e) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
exports.ArrayBuffer = (V, opts) => {
|
|
272
|
-
if (!isArrayBuffer(V)) {
|
|
273
|
-
throw new TypeError(_("is not a view on an ArrayBuffer object", opts));
|
|
274
|
-
}
|
|
275
|
-
return V;
|
|
276
|
-
};
|
|
277
|
-
var dvByteLengthGetter = Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength").get;
|
|
278
|
-
exports.DataView = (V, opts) => {
|
|
279
|
-
try {
|
|
280
|
-
dvByteLengthGetter.call(V);
|
|
281
|
-
return V;
|
|
282
|
-
} catch (e) {
|
|
283
|
-
throw new TypeError(_("is not a view on an DataView object", opts));
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
[
|
|
287
|
-
Int8Array,
|
|
288
|
-
Int16Array,
|
|
289
|
-
Int32Array,
|
|
290
|
-
Uint8Array,
|
|
291
|
-
Uint16Array,
|
|
292
|
-
Uint32Array,
|
|
293
|
-
Uint8ClampedArray,
|
|
294
|
-
Float32Array,
|
|
295
|
-
Float64Array
|
|
296
|
-
].forEach((func) => {
|
|
297
|
-
const name = func.name;
|
|
298
|
-
const article = /^[AEIOU]/.test(name) ? "an" : "a";
|
|
299
|
-
exports[name] = (V, opts) => {
|
|
300
|
-
if (!ArrayBuffer.isView(V) || V.constructor.name !== name) {
|
|
301
|
-
throw new TypeError(_(`is not ${article} ${name} object`, opts));
|
|
302
|
-
}
|
|
303
|
-
return V;
|
|
304
|
-
};
|
|
305
|
-
});
|
|
306
|
-
exports.ArrayBufferView = (V, opts) => {
|
|
307
|
-
if (!ArrayBuffer.isView(V)) {
|
|
308
|
-
throw new TypeError(_("is not a view on an ArrayBuffer object", opts));
|
|
309
|
-
}
|
|
310
|
-
return V;
|
|
311
|
-
};
|
|
312
|
-
exports.BufferSource = (V, opts) => {
|
|
313
|
-
if (!ArrayBuffer.isView(V) && !isArrayBuffer(V)) {
|
|
314
|
-
throw new TypeError(_("is not an ArrayBuffer object or a view on one", opts));
|
|
315
|
-
}
|
|
316
|
-
return V;
|
|
317
|
-
};
|
|
318
|
-
exports.DOMTimeStamp = exports["unsigned long long"];
|
|
319
|
-
exports.Function = convertCallbackFunction;
|
|
320
|
-
exports.VoidFunction = convertCallbackFunction;
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/utils.js
|
|
325
|
-
var require_utils = __commonJS({
|
|
326
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/utils.js"(exports, module) {
|
|
327
|
-
"use strict";
|
|
328
|
-
function isObject(value) {
|
|
329
|
-
return typeof value === "object" && value !== null || typeof value === "function";
|
|
330
|
-
}
|
|
331
|
-
function hasOwn(obj, prop) {
|
|
332
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
333
|
-
}
|
|
334
|
-
var wrapperSymbol = /* @__PURE__ */ Symbol("wrapper");
|
|
335
|
-
var implSymbol = /* @__PURE__ */ Symbol("impl");
|
|
336
|
-
var sameObjectCaches = /* @__PURE__ */ Symbol("SameObject caches");
|
|
337
|
-
var ctorRegistrySymbol = /* @__PURE__ */ Symbol.for("[webidl2js] constructor registry");
|
|
338
|
-
function getSameObject(wrapper, prop, creator) {
|
|
339
|
-
if (!wrapper[sameObjectCaches]) {
|
|
340
|
-
wrapper[sameObjectCaches] = /* @__PURE__ */ Object.create(null);
|
|
341
|
-
}
|
|
342
|
-
if (prop in wrapper[sameObjectCaches]) {
|
|
343
|
-
return wrapper[sameObjectCaches][prop];
|
|
344
|
-
}
|
|
345
|
-
wrapper[sameObjectCaches][prop] = creator();
|
|
346
|
-
return wrapper[sameObjectCaches][prop];
|
|
347
|
-
}
|
|
348
|
-
function wrapperForImpl(impl) {
|
|
349
|
-
return impl ? impl[wrapperSymbol] : null;
|
|
350
|
-
}
|
|
351
|
-
function implForWrapper(wrapper) {
|
|
352
|
-
return wrapper ? wrapper[implSymbol] : null;
|
|
353
|
-
}
|
|
354
|
-
function tryWrapperForImpl(impl) {
|
|
355
|
-
const wrapper = wrapperForImpl(impl);
|
|
356
|
-
return wrapper ? wrapper : impl;
|
|
357
|
-
}
|
|
358
|
-
function tryImplForWrapper(wrapper) {
|
|
359
|
-
const impl = implForWrapper(wrapper);
|
|
360
|
-
return impl ? impl : wrapper;
|
|
361
|
-
}
|
|
362
|
-
var iterInternalSymbol = /* @__PURE__ */ Symbol("internal");
|
|
363
|
-
var IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
|
364
|
-
function isArrayIndexPropName(P) {
|
|
365
|
-
if (typeof P !== "string") {
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
const i = P >>> 0;
|
|
369
|
-
if (i === Math.pow(2, 32) - 1) {
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
372
|
-
const s = `${i}`;
|
|
373
|
-
if (P !== s) {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
return true;
|
|
377
|
-
}
|
|
378
|
-
var byteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
379
|
-
function isArrayBuffer(value) {
|
|
380
|
-
try {
|
|
381
|
-
byteLengthGetter.call(value);
|
|
382
|
-
return true;
|
|
383
|
-
} catch (e) {
|
|
384
|
-
return false;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
var supportsPropertyIndex = /* @__PURE__ */ Symbol("supports property index");
|
|
388
|
-
var supportedPropertyIndices = /* @__PURE__ */ Symbol("supported property indices");
|
|
389
|
-
var supportsPropertyName = /* @__PURE__ */ Symbol("supports property name");
|
|
390
|
-
var supportedPropertyNames = /* @__PURE__ */ Symbol("supported property names");
|
|
391
|
-
var indexedGet = /* @__PURE__ */ Symbol("indexed property get");
|
|
392
|
-
var indexedSetNew = /* @__PURE__ */ Symbol("indexed property set new");
|
|
393
|
-
var indexedSetExisting = /* @__PURE__ */ Symbol("indexed property set existing");
|
|
394
|
-
var namedGet = /* @__PURE__ */ Symbol("named property get");
|
|
395
|
-
var namedSetNew = /* @__PURE__ */ Symbol("named property set new");
|
|
396
|
-
var namedSetExisting = /* @__PURE__ */ Symbol("named property set existing");
|
|
397
|
-
var namedDelete = /* @__PURE__ */ Symbol("named property delete");
|
|
398
|
-
module.exports = exports = {
|
|
399
|
-
isObject,
|
|
400
|
-
hasOwn,
|
|
401
|
-
wrapperSymbol,
|
|
402
|
-
implSymbol,
|
|
403
|
-
getSameObject,
|
|
404
|
-
ctorRegistrySymbol,
|
|
405
|
-
wrapperForImpl,
|
|
406
|
-
implForWrapper,
|
|
407
|
-
tryWrapperForImpl,
|
|
408
|
-
tryImplForWrapper,
|
|
409
|
-
iterInternalSymbol,
|
|
410
|
-
IteratorPrototype,
|
|
411
|
-
isArrayBuffer,
|
|
412
|
-
isArrayIndexPropName,
|
|
413
|
-
supportsPropertyIndex,
|
|
414
|
-
supportedPropertyIndices,
|
|
415
|
-
supportsPropertyName,
|
|
416
|
-
supportedPropertyNames,
|
|
417
|
-
indexedGet,
|
|
418
|
-
indexedSetNew,
|
|
419
|
-
indexedSetExisting,
|
|
420
|
-
namedGet,
|
|
421
|
-
namedSetNew,
|
|
422
|
-
namedSetExisting,
|
|
423
|
-
namedDelete
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
// node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
|
429
|
-
var require_base64_js = __commonJS({
|
|
430
|
-
"node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports) {
|
|
431
|
-
"use strict";
|
|
432
|
-
exports.byteLength = byteLength;
|
|
433
|
-
exports.toByteArray = toByteArray;
|
|
434
|
-
exports.fromByteArray = fromByteArray;
|
|
435
|
-
var lookup = [];
|
|
436
|
-
var revLookup = [];
|
|
437
|
-
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
438
|
-
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
439
|
-
for (i = 0, len = code.length; i < len; ++i) {
|
|
440
|
-
lookup[i] = code[i];
|
|
441
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
442
|
-
}
|
|
443
|
-
var i;
|
|
444
|
-
var len;
|
|
445
|
-
revLookup["-".charCodeAt(0)] = 62;
|
|
446
|
-
revLookup["_".charCodeAt(0)] = 63;
|
|
447
|
-
function getLens(b64) {
|
|
448
|
-
var len2 = b64.length;
|
|
449
|
-
if (len2 % 4 > 0) {
|
|
450
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
451
|
-
}
|
|
452
|
-
var validLen = b64.indexOf("=");
|
|
453
|
-
if (validLen === -1) validLen = len2;
|
|
454
|
-
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
|
455
|
-
return [validLen, placeHoldersLen];
|
|
456
|
-
}
|
|
457
|
-
function byteLength(b64) {
|
|
458
|
-
var lens = getLens(b64);
|
|
459
|
-
var validLen = lens[0];
|
|
460
|
-
var placeHoldersLen = lens[1];
|
|
461
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
462
|
-
}
|
|
463
|
-
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
464
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
465
|
-
}
|
|
466
|
-
function toByteArray(b64) {
|
|
467
|
-
var tmp;
|
|
468
|
-
var lens = getLens(b64);
|
|
469
|
-
var validLen = lens[0];
|
|
470
|
-
var placeHoldersLen = lens[1];
|
|
471
|
-
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
|
472
|
-
var curByte = 0;
|
|
473
|
-
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
474
|
-
var i2;
|
|
475
|
-
for (i2 = 0; i2 < len2; i2 += 4) {
|
|
476
|
-
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
|
|
477
|
-
arr[curByte++] = tmp >> 16 & 255;
|
|
478
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
479
|
-
arr[curByte++] = tmp & 255;
|
|
480
|
-
}
|
|
481
|
-
if (placeHoldersLen === 2) {
|
|
482
|
-
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
|
|
483
|
-
arr[curByte++] = tmp & 255;
|
|
484
|
-
}
|
|
485
|
-
if (placeHoldersLen === 1) {
|
|
486
|
-
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
|
|
487
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
488
|
-
arr[curByte++] = tmp & 255;
|
|
489
|
-
}
|
|
490
|
-
return arr;
|
|
491
|
-
}
|
|
492
|
-
function tripletToBase64(num) {
|
|
493
|
-
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
494
|
-
}
|
|
495
|
-
function encodeChunk(uint8, start, end) {
|
|
496
|
-
var tmp;
|
|
497
|
-
var output = [];
|
|
498
|
-
for (var i2 = start; i2 < end; i2 += 3) {
|
|
499
|
-
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
|
|
500
|
-
output.push(tripletToBase64(tmp));
|
|
501
|
-
}
|
|
502
|
-
return output.join("");
|
|
503
|
-
}
|
|
504
|
-
function fromByteArray(uint8) {
|
|
505
|
-
var tmp;
|
|
506
|
-
var len2 = uint8.length;
|
|
507
|
-
var extraBytes = len2 % 3;
|
|
508
|
-
var parts = [];
|
|
509
|
-
var maxChunkLength = 16383;
|
|
510
|
-
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
|
|
511
|
-
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
|
|
512
|
-
}
|
|
513
|
-
if (extraBytes === 1) {
|
|
514
|
-
tmp = uint8[len2 - 1];
|
|
515
|
-
parts.push(
|
|
516
|
-
lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
|
|
517
|
-
);
|
|
518
|
-
} else if (extraBytes === 2) {
|
|
519
|
-
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
|
|
520
|
-
parts.push(
|
|
521
|
-
lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
return parts.join("");
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
// node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
|
530
|
-
var require_ieee754 = __commonJS({
|
|
531
|
-
"node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports) {
|
|
532
|
-
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
533
|
-
var e, m;
|
|
534
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
535
|
-
var eMax = (1 << eLen) - 1;
|
|
536
|
-
var eBias = eMax >> 1;
|
|
537
|
-
var nBits = -7;
|
|
538
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
539
|
-
var d = isLE ? -1 : 1;
|
|
540
|
-
var s = buffer[offset + i];
|
|
541
|
-
i += d;
|
|
542
|
-
e = s & (1 << -nBits) - 1;
|
|
543
|
-
s >>= -nBits;
|
|
544
|
-
nBits += eLen;
|
|
545
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
546
|
-
}
|
|
547
|
-
m = e & (1 << -nBits) - 1;
|
|
548
|
-
e >>= -nBits;
|
|
549
|
-
nBits += mLen;
|
|
550
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
551
|
-
}
|
|
552
|
-
if (e === 0) {
|
|
553
|
-
e = 1 - eBias;
|
|
554
|
-
} else if (e === eMax) {
|
|
555
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
556
|
-
} else {
|
|
557
|
-
m = m + Math.pow(2, mLen);
|
|
558
|
-
e = e - eBias;
|
|
559
|
-
}
|
|
560
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
561
|
-
};
|
|
562
|
-
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
563
|
-
var e, m, c;
|
|
564
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
565
|
-
var eMax = (1 << eLen) - 1;
|
|
566
|
-
var eBias = eMax >> 1;
|
|
567
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
568
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
569
|
-
var d = isLE ? 1 : -1;
|
|
570
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
571
|
-
value = Math.abs(value);
|
|
572
|
-
if (isNaN(value) || value === Infinity) {
|
|
573
|
-
m = isNaN(value) ? 1 : 0;
|
|
574
|
-
e = eMax;
|
|
575
|
-
} else {
|
|
576
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
577
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
578
|
-
e--;
|
|
579
|
-
c *= 2;
|
|
580
|
-
}
|
|
581
|
-
if (e + eBias >= 1) {
|
|
582
|
-
value += rt / c;
|
|
583
|
-
} else {
|
|
584
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
585
|
-
}
|
|
586
|
-
if (value * c >= 2) {
|
|
587
|
-
e++;
|
|
588
|
-
c /= 2;
|
|
589
|
-
}
|
|
590
|
-
if (e + eBias >= eMax) {
|
|
591
|
-
m = 0;
|
|
592
|
-
e = eMax;
|
|
593
|
-
} else if (e + eBias >= 1) {
|
|
594
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
595
|
-
e = e + eBias;
|
|
596
|
-
} else {
|
|
597
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
598
|
-
e = 0;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
602
|
-
}
|
|
603
|
-
e = e << mLen | m;
|
|
604
|
-
eLen += mLen;
|
|
605
|
-
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
606
|
-
}
|
|
607
|
-
buffer[offset + i - d] |= s * 128;
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
|
|
612
|
-
// node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
|
|
613
|
-
var require_buffer = __commonJS({
|
|
614
|
-
"node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"(exports) {
|
|
615
|
-
"use strict";
|
|
616
|
-
var base64 = require_base64_js();
|
|
617
|
-
var ieee754 = require_ieee754();
|
|
618
|
-
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
619
|
-
exports.Buffer = Buffer2;
|
|
620
|
-
exports.SlowBuffer = SlowBuffer;
|
|
621
|
-
exports.INSPECT_MAX_BYTES = 50;
|
|
622
|
-
var K_MAX_LENGTH = 2147483647;
|
|
623
|
-
exports.kMaxLength = K_MAX_LENGTH;
|
|
624
|
-
Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
625
|
-
if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
626
|
-
console.error(
|
|
627
|
-
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
628
|
-
);
|
|
629
|
-
}
|
|
630
|
-
function typedArraySupport() {
|
|
631
|
-
try {
|
|
632
|
-
var arr = new Uint8Array(1);
|
|
633
|
-
var proto = { foo: function() {
|
|
634
|
-
return 42;
|
|
635
|
-
} };
|
|
636
|
-
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
|
637
|
-
Object.setPrototypeOf(arr, proto);
|
|
638
|
-
return arr.foo() === 42;
|
|
639
|
-
} catch (e) {
|
|
640
|
-
return false;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
Object.defineProperty(Buffer2.prototype, "parent", {
|
|
644
|
-
enumerable: true,
|
|
645
|
-
get: function() {
|
|
646
|
-
if (!Buffer2.isBuffer(this)) return void 0;
|
|
647
|
-
return this.buffer;
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
Object.defineProperty(Buffer2.prototype, "offset", {
|
|
651
|
-
enumerable: true,
|
|
652
|
-
get: function() {
|
|
653
|
-
if (!Buffer2.isBuffer(this)) return void 0;
|
|
654
|
-
return this.byteOffset;
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
function createBuffer(length) {
|
|
658
|
-
if (length > K_MAX_LENGTH) {
|
|
659
|
-
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
660
|
-
}
|
|
661
|
-
var buf = new Uint8Array(length);
|
|
662
|
-
Object.setPrototypeOf(buf, Buffer2.prototype);
|
|
663
|
-
return buf;
|
|
664
|
-
}
|
|
665
|
-
function Buffer2(arg, encodingOrOffset, length) {
|
|
666
|
-
if (typeof arg === "number") {
|
|
667
|
-
if (typeof encodingOrOffset === "string") {
|
|
668
|
-
throw new TypeError(
|
|
669
|
-
'The "string" argument must be of type string. Received type number'
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
return allocUnsafe(arg);
|
|
673
|
-
}
|
|
674
|
-
return from(arg, encodingOrOffset, length);
|
|
675
|
-
}
|
|
676
|
-
Buffer2.poolSize = 8192;
|
|
677
|
-
function from(value, encodingOrOffset, length) {
|
|
678
|
-
if (typeof value === "string") {
|
|
679
|
-
return fromString(value, encodingOrOffset);
|
|
680
|
-
}
|
|
681
|
-
if (ArrayBuffer.isView(value)) {
|
|
682
|
-
return fromArrayView(value);
|
|
683
|
-
}
|
|
684
|
-
if (value == null) {
|
|
685
|
-
throw new TypeError(
|
|
686
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
|
690
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
691
|
-
}
|
|
692
|
-
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
|
693
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
694
|
-
}
|
|
695
|
-
if (typeof value === "number") {
|
|
696
|
-
throw new TypeError(
|
|
697
|
-
'The "value" argument must not be of type number. Received type number'
|
|
698
|
-
);
|
|
699
|
-
}
|
|
700
|
-
var valueOf = value.valueOf && value.valueOf();
|
|
701
|
-
if (valueOf != null && valueOf !== value) {
|
|
702
|
-
return Buffer2.from(valueOf, encodingOrOffset, length);
|
|
703
|
-
}
|
|
704
|
-
var b = fromObject(value);
|
|
705
|
-
if (b) return b;
|
|
706
|
-
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
707
|
-
return Buffer2.from(
|
|
708
|
-
value[Symbol.toPrimitive]("string"),
|
|
709
|
-
encodingOrOffset,
|
|
710
|
-
length
|
|
711
|
-
);
|
|
712
|
-
}
|
|
713
|
-
throw new TypeError(
|
|
714
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
715
|
-
);
|
|
716
|
-
}
|
|
717
|
-
Buffer2.from = function(value, encodingOrOffset, length) {
|
|
718
|
-
return from(value, encodingOrOffset, length);
|
|
719
|
-
};
|
|
720
|
-
Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);
|
|
721
|
-
Object.setPrototypeOf(Buffer2, Uint8Array);
|
|
722
|
-
function assertSize(size) {
|
|
723
|
-
if (typeof size !== "number") {
|
|
724
|
-
throw new TypeError('"size" argument must be of type number');
|
|
725
|
-
} else if (size < 0) {
|
|
726
|
-
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
function alloc(size, fill, encoding) {
|
|
730
|
-
assertSize(size);
|
|
731
|
-
if (size <= 0) {
|
|
732
|
-
return createBuffer(size);
|
|
733
|
-
}
|
|
734
|
-
if (fill !== void 0) {
|
|
735
|
-
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
736
|
-
}
|
|
737
|
-
return createBuffer(size);
|
|
738
|
-
}
|
|
739
|
-
Buffer2.alloc = function(size, fill, encoding) {
|
|
740
|
-
return alloc(size, fill, encoding);
|
|
741
|
-
};
|
|
742
|
-
function allocUnsafe(size) {
|
|
743
|
-
assertSize(size);
|
|
744
|
-
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
745
|
-
}
|
|
746
|
-
Buffer2.allocUnsafe = function(size) {
|
|
747
|
-
return allocUnsafe(size);
|
|
748
|
-
};
|
|
749
|
-
Buffer2.allocUnsafeSlow = function(size) {
|
|
750
|
-
return allocUnsafe(size);
|
|
751
|
-
};
|
|
752
|
-
function fromString(string, encoding) {
|
|
753
|
-
if (typeof encoding !== "string" || encoding === "") {
|
|
754
|
-
encoding = "utf8";
|
|
755
|
-
}
|
|
756
|
-
if (!Buffer2.isEncoding(encoding)) {
|
|
757
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
758
|
-
}
|
|
759
|
-
var length = byteLength(string, encoding) | 0;
|
|
760
|
-
var buf = createBuffer(length);
|
|
761
|
-
var actual = buf.write(string, encoding);
|
|
762
|
-
if (actual !== length) {
|
|
763
|
-
buf = buf.slice(0, actual);
|
|
764
|
-
}
|
|
765
|
-
return buf;
|
|
766
|
-
}
|
|
767
|
-
function fromArrayLike(array) {
|
|
768
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
769
|
-
var buf = createBuffer(length);
|
|
770
|
-
for (var i = 0; i < length; i += 1) {
|
|
771
|
-
buf[i] = array[i] & 255;
|
|
772
|
-
}
|
|
773
|
-
return buf;
|
|
774
|
-
}
|
|
775
|
-
function fromArrayView(arrayView) {
|
|
776
|
-
if (isInstance(arrayView, Uint8Array)) {
|
|
777
|
-
var copy = new Uint8Array(arrayView);
|
|
778
|
-
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
779
|
-
}
|
|
780
|
-
return fromArrayLike(arrayView);
|
|
781
|
-
}
|
|
782
|
-
function fromArrayBuffer(array, byteOffset, length) {
|
|
783
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
784
|
-
throw new RangeError('"offset" is outside of buffer bounds');
|
|
785
|
-
}
|
|
786
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
787
|
-
throw new RangeError('"length" is outside of buffer bounds');
|
|
788
|
-
}
|
|
789
|
-
var buf;
|
|
790
|
-
if (byteOffset === void 0 && length === void 0) {
|
|
791
|
-
buf = new Uint8Array(array);
|
|
792
|
-
} else if (length === void 0) {
|
|
793
|
-
buf = new Uint8Array(array, byteOffset);
|
|
794
|
-
} else {
|
|
795
|
-
buf = new Uint8Array(array, byteOffset, length);
|
|
796
|
-
}
|
|
797
|
-
Object.setPrototypeOf(buf, Buffer2.prototype);
|
|
798
|
-
return buf;
|
|
799
|
-
}
|
|
800
|
-
function fromObject(obj) {
|
|
801
|
-
if (Buffer2.isBuffer(obj)) {
|
|
802
|
-
var len = checked(obj.length) | 0;
|
|
803
|
-
var buf = createBuffer(len);
|
|
804
|
-
if (buf.length === 0) {
|
|
805
|
-
return buf;
|
|
806
|
-
}
|
|
807
|
-
obj.copy(buf, 0, 0, len);
|
|
808
|
-
return buf;
|
|
809
|
-
}
|
|
810
|
-
if (obj.length !== void 0) {
|
|
811
|
-
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
|
812
|
-
return createBuffer(0);
|
|
813
|
-
}
|
|
814
|
-
return fromArrayLike(obj);
|
|
815
|
-
}
|
|
816
|
-
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
817
|
-
return fromArrayLike(obj.data);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
function checked(length) {
|
|
821
|
-
if (length >= K_MAX_LENGTH) {
|
|
822
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
|
823
|
-
}
|
|
824
|
-
return length | 0;
|
|
825
|
-
}
|
|
826
|
-
function SlowBuffer(length) {
|
|
827
|
-
if (+length != length) {
|
|
828
|
-
length = 0;
|
|
829
|
-
}
|
|
830
|
-
return Buffer2.alloc(+length);
|
|
831
|
-
}
|
|
832
|
-
Buffer2.isBuffer = function isBuffer(b) {
|
|
833
|
-
return b != null && b._isBuffer === true && b !== Buffer2.prototype;
|
|
834
|
-
};
|
|
835
|
-
Buffer2.compare = function compare(a, b) {
|
|
836
|
-
if (isInstance(a, Uint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);
|
|
837
|
-
if (isInstance(b, Uint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);
|
|
838
|
-
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
839
|
-
throw new TypeError(
|
|
840
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
if (a === b) return 0;
|
|
844
|
-
var x = a.length;
|
|
845
|
-
var y = b.length;
|
|
846
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
847
|
-
if (a[i] !== b[i]) {
|
|
848
|
-
x = a[i];
|
|
849
|
-
y = b[i];
|
|
850
|
-
break;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
if (x < y) return -1;
|
|
854
|
-
if (y < x) return 1;
|
|
855
|
-
return 0;
|
|
856
|
-
};
|
|
857
|
-
Buffer2.isEncoding = function isEncoding(encoding) {
|
|
858
|
-
switch (String(encoding).toLowerCase()) {
|
|
859
|
-
case "hex":
|
|
860
|
-
case "utf8":
|
|
861
|
-
case "utf-8":
|
|
862
|
-
case "ascii":
|
|
863
|
-
case "latin1":
|
|
864
|
-
case "binary":
|
|
865
|
-
case "base64":
|
|
866
|
-
case "ucs2":
|
|
867
|
-
case "ucs-2":
|
|
868
|
-
case "utf16le":
|
|
869
|
-
case "utf-16le":
|
|
870
|
-
return true;
|
|
871
|
-
default:
|
|
872
|
-
return false;
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
Buffer2.concat = function concat(list, length) {
|
|
876
|
-
if (!Array.isArray(list)) {
|
|
877
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
878
|
-
}
|
|
879
|
-
if (list.length === 0) {
|
|
880
|
-
return Buffer2.alloc(0);
|
|
881
|
-
}
|
|
882
|
-
var i;
|
|
883
|
-
if (length === void 0) {
|
|
884
|
-
length = 0;
|
|
885
|
-
for (i = 0; i < list.length; ++i) {
|
|
886
|
-
length += list[i].length;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
var buffer = Buffer2.allocUnsafe(length);
|
|
890
|
-
var pos = 0;
|
|
891
|
-
for (i = 0; i < list.length; ++i) {
|
|
892
|
-
var buf = list[i];
|
|
893
|
-
if (isInstance(buf, Uint8Array)) {
|
|
894
|
-
if (pos + buf.length > buffer.length) {
|
|
895
|
-
Buffer2.from(buf).copy(buffer, pos);
|
|
896
|
-
} else {
|
|
897
|
-
Uint8Array.prototype.set.call(
|
|
898
|
-
buffer,
|
|
899
|
-
buf,
|
|
900
|
-
pos
|
|
901
|
-
);
|
|
902
|
-
}
|
|
903
|
-
} else if (!Buffer2.isBuffer(buf)) {
|
|
904
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
905
|
-
} else {
|
|
906
|
-
buf.copy(buffer, pos);
|
|
907
|
-
}
|
|
908
|
-
pos += buf.length;
|
|
909
|
-
}
|
|
910
|
-
return buffer;
|
|
911
|
-
};
|
|
912
|
-
function byteLength(string, encoding) {
|
|
913
|
-
if (Buffer2.isBuffer(string)) {
|
|
914
|
-
return string.length;
|
|
915
|
-
}
|
|
916
|
-
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
917
|
-
return string.byteLength;
|
|
918
|
-
}
|
|
919
|
-
if (typeof string !== "string") {
|
|
920
|
-
throw new TypeError(
|
|
921
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
|
|
922
|
-
);
|
|
923
|
-
}
|
|
924
|
-
var len = string.length;
|
|
925
|
-
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
926
|
-
if (!mustMatch && len === 0) return 0;
|
|
927
|
-
var loweredCase = false;
|
|
928
|
-
for (; ; ) {
|
|
929
|
-
switch (encoding) {
|
|
930
|
-
case "ascii":
|
|
931
|
-
case "latin1":
|
|
932
|
-
case "binary":
|
|
933
|
-
return len;
|
|
934
|
-
case "utf8":
|
|
935
|
-
case "utf-8":
|
|
936
|
-
return utf8ToBytes(string).length;
|
|
937
|
-
case "ucs2":
|
|
938
|
-
case "ucs-2":
|
|
939
|
-
case "utf16le":
|
|
940
|
-
case "utf-16le":
|
|
941
|
-
return len * 2;
|
|
942
|
-
case "hex":
|
|
943
|
-
return len >>> 1;
|
|
944
|
-
case "base64":
|
|
945
|
-
return base64ToBytes(string).length;
|
|
946
|
-
default:
|
|
947
|
-
if (loweredCase) {
|
|
948
|
-
return mustMatch ? -1 : utf8ToBytes(string).length;
|
|
949
|
-
}
|
|
950
|
-
encoding = ("" + encoding).toLowerCase();
|
|
951
|
-
loweredCase = true;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
Buffer2.byteLength = byteLength;
|
|
956
|
-
function slowToString(encoding, start, end) {
|
|
957
|
-
var loweredCase = false;
|
|
958
|
-
if (start === void 0 || start < 0) {
|
|
959
|
-
start = 0;
|
|
960
|
-
}
|
|
961
|
-
if (start > this.length) {
|
|
962
|
-
return "";
|
|
963
|
-
}
|
|
964
|
-
if (end === void 0 || end > this.length) {
|
|
965
|
-
end = this.length;
|
|
966
|
-
}
|
|
967
|
-
if (end <= 0) {
|
|
968
|
-
return "";
|
|
969
|
-
}
|
|
970
|
-
end >>>= 0;
|
|
971
|
-
start >>>= 0;
|
|
972
|
-
if (end <= start) {
|
|
973
|
-
return "";
|
|
974
|
-
}
|
|
975
|
-
if (!encoding) encoding = "utf8";
|
|
976
|
-
while (true) {
|
|
977
|
-
switch (encoding) {
|
|
978
|
-
case "hex":
|
|
979
|
-
return hexSlice(this, start, end);
|
|
980
|
-
case "utf8":
|
|
981
|
-
case "utf-8":
|
|
982
|
-
return utf8Slice(this, start, end);
|
|
983
|
-
case "ascii":
|
|
984
|
-
return asciiSlice(this, start, end);
|
|
985
|
-
case "latin1":
|
|
986
|
-
case "binary":
|
|
987
|
-
return latin1Slice(this, start, end);
|
|
988
|
-
case "base64":
|
|
989
|
-
return base64Slice(this, start, end);
|
|
990
|
-
case "ucs2":
|
|
991
|
-
case "ucs-2":
|
|
992
|
-
case "utf16le":
|
|
993
|
-
case "utf-16le":
|
|
994
|
-
return utf16leSlice(this, start, end);
|
|
995
|
-
default:
|
|
996
|
-
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
997
|
-
encoding = (encoding + "").toLowerCase();
|
|
998
|
-
loweredCase = true;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
Buffer2.prototype._isBuffer = true;
|
|
1003
|
-
function swap(b, n, m) {
|
|
1004
|
-
var i = b[n];
|
|
1005
|
-
b[n] = b[m];
|
|
1006
|
-
b[m] = i;
|
|
1007
|
-
}
|
|
1008
|
-
Buffer2.prototype.swap16 = function swap16() {
|
|
1009
|
-
var len = this.length;
|
|
1010
|
-
if (len % 2 !== 0) {
|
|
1011
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1012
|
-
}
|
|
1013
|
-
for (var i = 0; i < len; i += 2) {
|
|
1014
|
-
swap(this, i, i + 1);
|
|
1015
|
-
}
|
|
1016
|
-
return this;
|
|
1017
|
-
};
|
|
1018
|
-
Buffer2.prototype.swap32 = function swap32() {
|
|
1019
|
-
var len = this.length;
|
|
1020
|
-
if (len % 4 !== 0) {
|
|
1021
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1022
|
-
}
|
|
1023
|
-
for (var i = 0; i < len; i += 4) {
|
|
1024
|
-
swap(this, i, i + 3);
|
|
1025
|
-
swap(this, i + 1, i + 2);
|
|
1026
|
-
}
|
|
1027
|
-
return this;
|
|
1028
|
-
};
|
|
1029
|
-
Buffer2.prototype.swap64 = function swap64() {
|
|
1030
|
-
var len = this.length;
|
|
1031
|
-
if (len % 8 !== 0) {
|
|
1032
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1033
|
-
}
|
|
1034
|
-
for (var i = 0; i < len; i += 8) {
|
|
1035
|
-
swap(this, i, i + 7);
|
|
1036
|
-
swap(this, i + 1, i + 6);
|
|
1037
|
-
swap(this, i + 2, i + 5);
|
|
1038
|
-
swap(this, i + 3, i + 4);
|
|
1039
|
-
}
|
|
1040
|
-
return this;
|
|
1041
|
-
};
|
|
1042
|
-
Buffer2.prototype.toString = function toString() {
|
|
1043
|
-
var length = this.length;
|
|
1044
|
-
if (length === 0) return "";
|
|
1045
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1046
|
-
return slowToString.apply(this, arguments);
|
|
1047
|
-
};
|
|
1048
|
-
Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
|
|
1049
|
-
Buffer2.prototype.equals = function equals(b) {
|
|
1050
|
-
if (!Buffer2.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1051
|
-
if (this === b) return true;
|
|
1052
|
-
return Buffer2.compare(this, b) === 0;
|
|
1053
|
-
};
|
|
1054
|
-
Buffer2.prototype.inspect = function inspect() {
|
|
1055
|
-
var str = "";
|
|
1056
|
-
var max = exports.INSPECT_MAX_BYTES;
|
|
1057
|
-
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1058
|
-
if (this.length > max) str += " ... ";
|
|
1059
|
-
return "<Buffer " + str + ">";
|
|
1060
|
-
};
|
|
1061
|
-
if (customInspectSymbol) {
|
|
1062
|
-
Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;
|
|
1063
|
-
}
|
|
1064
|
-
Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1065
|
-
if (isInstance(target, Uint8Array)) {
|
|
1066
|
-
target = Buffer2.from(target, target.offset, target.byteLength);
|
|
1067
|
-
}
|
|
1068
|
-
if (!Buffer2.isBuffer(target)) {
|
|
1069
|
-
throw new TypeError(
|
|
1070
|
-
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
|
|
1071
|
-
);
|
|
1072
|
-
}
|
|
1073
|
-
if (start === void 0) {
|
|
1074
|
-
start = 0;
|
|
1075
|
-
}
|
|
1076
|
-
if (end === void 0) {
|
|
1077
|
-
end = target ? target.length : 0;
|
|
1078
|
-
}
|
|
1079
|
-
if (thisStart === void 0) {
|
|
1080
|
-
thisStart = 0;
|
|
1081
|
-
}
|
|
1082
|
-
if (thisEnd === void 0) {
|
|
1083
|
-
thisEnd = this.length;
|
|
1084
|
-
}
|
|
1085
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1086
|
-
throw new RangeError("out of range index");
|
|
1087
|
-
}
|
|
1088
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
1089
|
-
return 0;
|
|
1090
|
-
}
|
|
1091
|
-
if (thisStart >= thisEnd) {
|
|
1092
|
-
return -1;
|
|
1093
|
-
}
|
|
1094
|
-
if (start >= end) {
|
|
1095
|
-
return 1;
|
|
1096
|
-
}
|
|
1097
|
-
start >>>= 0;
|
|
1098
|
-
end >>>= 0;
|
|
1099
|
-
thisStart >>>= 0;
|
|
1100
|
-
thisEnd >>>= 0;
|
|
1101
|
-
if (this === target) return 0;
|
|
1102
|
-
var x = thisEnd - thisStart;
|
|
1103
|
-
var y = end - start;
|
|
1104
|
-
var len = Math.min(x, y);
|
|
1105
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
1106
|
-
var targetCopy = target.slice(start, end);
|
|
1107
|
-
for (var i = 0; i < len; ++i) {
|
|
1108
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
1109
|
-
x = thisCopy[i];
|
|
1110
|
-
y = targetCopy[i];
|
|
1111
|
-
break;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
if (x < y) return -1;
|
|
1115
|
-
if (y < x) return 1;
|
|
1116
|
-
return 0;
|
|
1117
|
-
};
|
|
1118
|
-
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1119
|
-
if (buffer.length === 0) return -1;
|
|
1120
|
-
if (typeof byteOffset === "string") {
|
|
1121
|
-
encoding = byteOffset;
|
|
1122
|
-
byteOffset = 0;
|
|
1123
|
-
} else if (byteOffset > 2147483647) {
|
|
1124
|
-
byteOffset = 2147483647;
|
|
1125
|
-
} else if (byteOffset < -2147483648) {
|
|
1126
|
-
byteOffset = -2147483648;
|
|
1127
|
-
}
|
|
1128
|
-
byteOffset = +byteOffset;
|
|
1129
|
-
if (numberIsNaN(byteOffset)) {
|
|
1130
|
-
byteOffset = dir ? 0 : buffer.length - 1;
|
|
1131
|
-
}
|
|
1132
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1133
|
-
if (byteOffset >= buffer.length) {
|
|
1134
|
-
if (dir) return -1;
|
|
1135
|
-
else byteOffset = buffer.length - 1;
|
|
1136
|
-
} else if (byteOffset < 0) {
|
|
1137
|
-
if (dir) byteOffset = 0;
|
|
1138
|
-
else return -1;
|
|
1139
|
-
}
|
|
1140
|
-
if (typeof val === "string") {
|
|
1141
|
-
val = Buffer2.from(val, encoding);
|
|
1142
|
-
}
|
|
1143
|
-
if (Buffer2.isBuffer(val)) {
|
|
1144
|
-
if (val.length === 0) {
|
|
1145
|
-
return -1;
|
|
1146
|
-
}
|
|
1147
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
1148
|
-
} else if (typeof val === "number") {
|
|
1149
|
-
val = val & 255;
|
|
1150
|
-
if (typeof Uint8Array.prototype.indexOf === "function") {
|
|
1151
|
-
if (dir) {
|
|
1152
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
1153
|
-
} else {
|
|
1154
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
1158
|
-
}
|
|
1159
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
1160
|
-
}
|
|
1161
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
1162
|
-
var indexSize = 1;
|
|
1163
|
-
var arrLength = arr.length;
|
|
1164
|
-
var valLength = val.length;
|
|
1165
|
-
if (encoding !== void 0) {
|
|
1166
|
-
encoding = String(encoding).toLowerCase();
|
|
1167
|
-
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
1168
|
-
if (arr.length < 2 || val.length < 2) {
|
|
1169
|
-
return -1;
|
|
1170
|
-
}
|
|
1171
|
-
indexSize = 2;
|
|
1172
|
-
arrLength /= 2;
|
|
1173
|
-
valLength /= 2;
|
|
1174
|
-
byteOffset /= 2;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
function read(buf, i2) {
|
|
1178
|
-
if (indexSize === 1) {
|
|
1179
|
-
return buf[i2];
|
|
1180
|
-
} else {
|
|
1181
|
-
return buf.readUInt16BE(i2 * indexSize);
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
var i;
|
|
1185
|
-
if (dir) {
|
|
1186
|
-
var foundIndex = -1;
|
|
1187
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
1188
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1189
|
-
if (foundIndex === -1) foundIndex = i;
|
|
1190
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
1191
|
-
} else {
|
|
1192
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1193
|
-
foundIndex = -1;
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
} else {
|
|
1197
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1198
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
1199
|
-
var found = true;
|
|
1200
|
-
for (var j = 0; j < valLength; j++) {
|
|
1201
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
1202
|
-
found = false;
|
|
1203
|
-
break;
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
if (found) return i;
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
return -1;
|
|
1210
|
-
}
|
|
1211
|
-
Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1212
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1213
|
-
};
|
|
1214
|
-
Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1215
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1216
|
-
};
|
|
1217
|
-
Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1218
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1219
|
-
};
|
|
1220
|
-
function hexWrite(buf, string, offset, length) {
|
|
1221
|
-
offset = Number(offset) || 0;
|
|
1222
|
-
var remaining = buf.length - offset;
|
|
1223
|
-
if (!length) {
|
|
1224
|
-
length = remaining;
|
|
1225
|
-
} else {
|
|
1226
|
-
length = Number(length);
|
|
1227
|
-
if (length > remaining) {
|
|
1228
|
-
length = remaining;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
var strLen = string.length;
|
|
1232
|
-
if (length > strLen / 2) {
|
|
1233
|
-
length = strLen / 2;
|
|
1234
|
-
}
|
|
1235
|
-
for (var i = 0; i < length; ++i) {
|
|
1236
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1237
|
-
if (numberIsNaN(parsed)) return i;
|
|
1238
|
-
buf[offset + i] = parsed;
|
|
1239
|
-
}
|
|
1240
|
-
return i;
|
|
1241
|
-
}
|
|
1242
|
-
function utf8Write(buf, string, offset, length) {
|
|
1243
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
1244
|
-
}
|
|
1245
|
-
function asciiWrite(buf, string, offset, length) {
|
|
1246
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
1247
|
-
}
|
|
1248
|
-
function base64Write(buf, string, offset, length) {
|
|
1249
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
1250
|
-
}
|
|
1251
|
-
function ucs2Write(buf, string, offset, length) {
|
|
1252
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1253
|
-
}
|
|
1254
|
-
Buffer2.prototype.write = function write(string, offset, length, encoding) {
|
|
1255
|
-
if (offset === void 0) {
|
|
1256
|
-
encoding = "utf8";
|
|
1257
|
-
length = this.length;
|
|
1258
|
-
offset = 0;
|
|
1259
|
-
} else if (length === void 0 && typeof offset === "string") {
|
|
1260
|
-
encoding = offset;
|
|
1261
|
-
length = this.length;
|
|
1262
|
-
offset = 0;
|
|
1263
|
-
} else if (isFinite(offset)) {
|
|
1264
|
-
offset = offset >>> 0;
|
|
1265
|
-
if (isFinite(length)) {
|
|
1266
|
-
length = length >>> 0;
|
|
1267
|
-
if (encoding === void 0) encoding = "utf8";
|
|
1268
|
-
} else {
|
|
1269
|
-
encoding = length;
|
|
1270
|
-
length = void 0;
|
|
1271
|
-
}
|
|
1272
|
-
} else {
|
|
1273
|
-
throw new Error(
|
|
1274
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1275
|
-
);
|
|
1276
|
-
}
|
|
1277
|
-
var remaining = this.length - offset;
|
|
1278
|
-
if (length === void 0 || length > remaining) length = remaining;
|
|
1279
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1280
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1281
|
-
}
|
|
1282
|
-
if (!encoding) encoding = "utf8";
|
|
1283
|
-
var loweredCase = false;
|
|
1284
|
-
for (; ; ) {
|
|
1285
|
-
switch (encoding) {
|
|
1286
|
-
case "hex":
|
|
1287
|
-
return hexWrite(this, string, offset, length);
|
|
1288
|
-
case "utf8":
|
|
1289
|
-
case "utf-8":
|
|
1290
|
-
return utf8Write(this, string, offset, length);
|
|
1291
|
-
case "ascii":
|
|
1292
|
-
case "latin1":
|
|
1293
|
-
case "binary":
|
|
1294
|
-
return asciiWrite(this, string, offset, length);
|
|
1295
|
-
case "base64":
|
|
1296
|
-
return base64Write(this, string, offset, length);
|
|
1297
|
-
case "ucs2":
|
|
1298
|
-
case "ucs-2":
|
|
1299
|
-
case "utf16le":
|
|
1300
|
-
case "utf-16le":
|
|
1301
|
-
return ucs2Write(this, string, offset, length);
|
|
1302
|
-
default:
|
|
1303
|
-
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1304
|
-
encoding = ("" + encoding).toLowerCase();
|
|
1305
|
-
loweredCase = true;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
};
|
|
1309
|
-
Buffer2.prototype.toJSON = function toJSON() {
|
|
1310
|
-
return {
|
|
1311
|
-
type: "Buffer",
|
|
1312
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1313
|
-
};
|
|
1314
|
-
};
|
|
1315
|
-
function base64Slice(buf, start, end) {
|
|
1316
|
-
if (start === 0 && end === buf.length) {
|
|
1317
|
-
return base64.fromByteArray(buf);
|
|
1318
|
-
} else {
|
|
1319
|
-
return base64.fromByteArray(buf.slice(start, end));
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
function utf8Slice(buf, start, end) {
|
|
1323
|
-
end = Math.min(buf.length, end);
|
|
1324
|
-
var res = [];
|
|
1325
|
-
var i = start;
|
|
1326
|
-
while (i < end) {
|
|
1327
|
-
var firstByte = buf[i];
|
|
1328
|
-
var codePoint = null;
|
|
1329
|
-
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
1330
|
-
if (i + bytesPerSequence <= end) {
|
|
1331
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
1332
|
-
switch (bytesPerSequence) {
|
|
1333
|
-
case 1:
|
|
1334
|
-
if (firstByte < 128) {
|
|
1335
|
-
codePoint = firstByte;
|
|
1336
|
-
}
|
|
1337
|
-
break;
|
|
1338
|
-
case 2:
|
|
1339
|
-
secondByte = buf[i + 1];
|
|
1340
|
-
if ((secondByte & 192) === 128) {
|
|
1341
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
1342
|
-
if (tempCodePoint > 127) {
|
|
1343
|
-
codePoint = tempCodePoint;
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
break;
|
|
1347
|
-
case 3:
|
|
1348
|
-
secondByte = buf[i + 1];
|
|
1349
|
-
thirdByte = buf[i + 2];
|
|
1350
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
1351
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
1352
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
1353
|
-
codePoint = tempCodePoint;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
break;
|
|
1357
|
-
case 4:
|
|
1358
|
-
secondByte = buf[i + 1];
|
|
1359
|
-
thirdByte = buf[i + 2];
|
|
1360
|
-
fourthByte = buf[i + 3];
|
|
1361
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
1362
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
1363
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
1364
|
-
codePoint = tempCodePoint;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
if (codePoint === null) {
|
|
1370
|
-
codePoint = 65533;
|
|
1371
|
-
bytesPerSequence = 1;
|
|
1372
|
-
} else if (codePoint > 65535) {
|
|
1373
|
-
codePoint -= 65536;
|
|
1374
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
1375
|
-
codePoint = 56320 | codePoint & 1023;
|
|
1376
|
-
}
|
|
1377
|
-
res.push(codePoint);
|
|
1378
|
-
i += bytesPerSequence;
|
|
1379
|
-
}
|
|
1380
|
-
return decodeCodePointsArray(res);
|
|
1381
|
-
}
|
|
1382
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
1383
|
-
function decodeCodePointsArray(codePoints) {
|
|
1384
|
-
var len = codePoints.length;
|
|
1385
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1386
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
1387
|
-
}
|
|
1388
|
-
var res = "";
|
|
1389
|
-
var i = 0;
|
|
1390
|
-
while (i < len) {
|
|
1391
|
-
res += String.fromCharCode.apply(
|
|
1392
|
-
String,
|
|
1393
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1394
|
-
);
|
|
1395
|
-
}
|
|
1396
|
-
return res;
|
|
1397
|
-
}
|
|
1398
|
-
function asciiSlice(buf, start, end) {
|
|
1399
|
-
var ret = "";
|
|
1400
|
-
end = Math.min(buf.length, end);
|
|
1401
|
-
for (var i = start; i < end; ++i) {
|
|
1402
|
-
ret += String.fromCharCode(buf[i] & 127);
|
|
1403
|
-
}
|
|
1404
|
-
return ret;
|
|
1405
|
-
}
|
|
1406
|
-
function latin1Slice(buf, start, end) {
|
|
1407
|
-
var ret = "";
|
|
1408
|
-
end = Math.min(buf.length, end);
|
|
1409
|
-
for (var i = start; i < end; ++i) {
|
|
1410
|
-
ret += String.fromCharCode(buf[i]);
|
|
1411
|
-
}
|
|
1412
|
-
return ret;
|
|
1413
|
-
}
|
|
1414
|
-
function hexSlice(buf, start, end) {
|
|
1415
|
-
var len = buf.length;
|
|
1416
|
-
if (!start || start < 0) start = 0;
|
|
1417
|
-
if (!end || end < 0 || end > len) end = len;
|
|
1418
|
-
var out = "";
|
|
1419
|
-
for (var i = start; i < end; ++i) {
|
|
1420
|
-
out += hexSliceLookupTable[buf[i]];
|
|
1421
|
-
}
|
|
1422
|
-
return out;
|
|
1423
|
-
}
|
|
1424
|
-
function utf16leSlice(buf, start, end) {
|
|
1425
|
-
var bytes = buf.slice(start, end);
|
|
1426
|
-
var res = "";
|
|
1427
|
-
for (var i = 0; i < bytes.length - 1; i += 2) {
|
|
1428
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
1429
|
-
}
|
|
1430
|
-
return res;
|
|
1431
|
-
}
|
|
1432
|
-
Buffer2.prototype.slice = function slice(start, end) {
|
|
1433
|
-
var len = this.length;
|
|
1434
|
-
start = ~~start;
|
|
1435
|
-
end = end === void 0 ? len : ~~end;
|
|
1436
|
-
if (start < 0) {
|
|
1437
|
-
start += len;
|
|
1438
|
-
if (start < 0) start = 0;
|
|
1439
|
-
} else if (start > len) {
|
|
1440
|
-
start = len;
|
|
1441
|
-
}
|
|
1442
|
-
if (end < 0) {
|
|
1443
|
-
end += len;
|
|
1444
|
-
if (end < 0) end = 0;
|
|
1445
|
-
} else if (end > len) {
|
|
1446
|
-
end = len;
|
|
1447
|
-
}
|
|
1448
|
-
if (end < start) end = start;
|
|
1449
|
-
var newBuf = this.subarray(start, end);
|
|
1450
|
-
Object.setPrototypeOf(newBuf, Buffer2.prototype);
|
|
1451
|
-
return newBuf;
|
|
1452
|
-
};
|
|
1453
|
-
function checkOffset(offset, ext, length) {
|
|
1454
|
-
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1455
|
-
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1456
|
-
}
|
|
1457
|
-
Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
|
|
1458
|
-
offset = offset >>> 0;
|
|
1459
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1460
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1461
|
-
var val = this[offset];
|
|
1462
|
-
var mul = 1;
|
|
1463
|
-
var i = 0;
|
|
1464
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1465
|
-
val += this[offset + i] * mul;
|
|
1466
|
-
}
|
|
1467
|
-
return val;
|
|
1468
|
-
};
|
|
1469
|
-
Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
|
|
1470
|
-
offset = offset >>> 0;
|
|
1471
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1472
|
-
if (!noAssert) {
|
|
1473
|
-
checkOffset(offset, byteLength2, this.length);
|
|
1474
|
-
}
|
|
1475
|
-
var val = this[offset + --byteLength2];
|
|
1476
|
-
var mul = 1;
|
|
1477
|
-
while (byteLength2 > 0 && (mul *= 256)) {
|
|
1478
|
-
val += this[offset + --byteLength2] * mul;
|
|
1479
|
-
}
|
|
1480
|
-
return val;
|
|
1481
|
-
};
|
|
1482
|
-
Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1483
|
-
offset = offset >>> 0;
|
|
1484
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1485
|
-
return this[offset];
|
|
1486
|
-
};
|
|
1487
|
-
Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1488
|
-
offset = offset >>> 0;
|
|
1489
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1490
|
-
return this[offset] | this[offset + 1] << 8;
|
|
1491
|
-
};
|
|
1492
|
-
Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1493
|
-
offset = offset >>> 0;
|
|
1494
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1495
|
-
return this[offset] << 8 | this[offset + 1];
|
|
1496
|
-
};
|
|
1497
|
-
Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1498
|
-
offset = offset >>> 0;
|
|
1499
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1500
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1501
|
-
};
|
|
1502
|
-
Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1503
|
-
offset = offset >>> 0;
|
|
1504
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1505
|
-
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1506
|
-
};
|
|
1507
|
-
Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
|
|
1508
|
-
offset = offset >>> 0;
|
|
1509
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1510
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1511
|
-
var val = this[offset];
|
|
1512
|
-
var mul = 1;
|
|
1513
|
-
var i = 0;
|
|
1514
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1515
|
-
val += this[offset + i] * mul;
|
|
1516
|
-
}
|
|
1517
|
-
mul *= 128;
|
|
1518
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1519
|
-
return val;
|
|
1520
|
-
};
|
|
1521
|
-
Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
|
|
1522
|
-
offset = offset >>> 0;
|
|
1523
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1524
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1525
|
-
var i = byteLength2;
|
|
1526
|
-
var mul = 1;
|
|
1527
|
-
var val = this[offset + --i];
|
|
1528
|
-
while (i > 0 && (mul *= 256)) {
|
|
1529
|
-
val += this[offset + --i] * mul;
|
|
1530
|
-
}
|
|
1531
|
-
mul *= 128;
|
|
1532
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1533
|
-
return val;
|
|
1534
|
-
};
|
|
1535
|
-
Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1536
|
-
offset = offset >>> 0;
|
|
1537
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1538
|
-
if (!(this[offset] & 128)) return this[offset];
|
|
1539
|
-
return (255 - this[offset] + 1) * -1;
|
|
1540
|
-
};
|
|
1541
|
-
Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1542
|
-
offset = offset >>> 0;
|
|
1543
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1544
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
1545
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
1546
|
-
};
|
|
1547
|
-
Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1548
|
-
offset = offset >>> 0;
|
|
1549
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1550
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
1551
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
1552
|
-
};
|
|
1553
|
-
Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1554
|
-
offset = offset >>> 0;
|
|
1555
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1556
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
1557
|
-
};
|
|
1558
|
-
Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
1559
|
-
offset = offset >>> 0;
|
|
1560
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1561
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
1562
|
-
};
|
|
1563
|
-
Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
1564
|
-
offset = offset >>> 0;
|
|
1565
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1566
|
-
return ieee754.read(this, offset, true, 23, 4);
|
|
1567
|
-
};
|
|
1568
|
-
Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
1569
|
-
offset = offset >>> 0;
|
|
1570
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1571
|
-
return ieee754.read(this, offset, false, 23, 4);
|
|
1572
|
-
};
|
|
1573
|
-
Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
1574
|
-
offset = offset >>> 0;
|
|
1575
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1576
|
-
return ieee754.read(this, offset, true, 52, 8);
|
|
1577
|
-
};
|
|
1578
|
-
Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
1579
|
-
offset = offset >>> 0;
|
|
1580
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1581
|
-
return ieee754.read(this, offset, false, 52, 8);
|
|
1582
|
-
};
|
|
1583
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
1584
|
-
if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1585
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
1586
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
1587
|
-
}
|
|
1588
|
-
Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
|
|
1589
|
-
value = +value;
|
|
1590
|
-
offset = offset >>> 0;
|
|
1591
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1592
|
-
if (!noAssert) {
|
|
1593
|
-
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
1594
|
-
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
1595
|
-
}
|
|
1596
|
-
var mul = 1;
|
|
1597
|
-
var i = 0;
|
|
1598
|
-
this[offset] = value & 255;
|
|
1599
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1600
|
-
this[offset + i] = value / mul & 255;
|
|
1601
|
-
}
|
|
1602
|
-
return offset + byteLength2;
|
|
1603
|
-
};
|
|
1604
|
-
Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
|
|
1605
|
-
value = +value;
|
|
1606
|
-
offset = offset >>> 0;
|
|
1607
|
-
byteLength2 = byteLength2 >>> 0;
|
|
1608
|
-
if (!noAssert) {
|
|
1609
|
-
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
1610
|
-
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
1611
|
-
}
|
|
1612
|
-
var i = byteLength2 - 1;
|
|
1613
|
-
var mul = 1;
|
|
1614
|
-
this[offset + i] = value & 255;
|
|
1615
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
1616
|
-
this[offset + i] = value / mul & 255;
|
|
1617
|
-
}
|
|
1618
|
-
return offset + byteLength2;
|
|
1619
|
-
};
|
|
1620
|
-
Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
1621
|
-
value = +value;
|
|
1622
|
-
offset = offset >>> 0;
|
|
1623
|
-
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
1624
|
-
this[offset] = value & 255;
|
|
1625
|
-
return offset + 1;
|
|
1626
|
-
};
|
|
1627
|
-
Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
1628
|
-
value = +value;
|
|
1629
|
-
offset = offset >>> 0;
|
|
1630
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1631
|
-
this[offset] = value & 255;
|
|
1632
|
-
this[offset + 1] = value >>> 8;
|
|
1633
|
-
return offset + 2;
|
|
1634
|
-
};
|
|
1635
|
-
Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
1636
|
-
value = +value;
|
|
1637
|
-
offset = offset >>> 0;
|
|
1638
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1639
|
-
this[offset] = value >>> 8;
|
|
1640
|
-
this[offset + 1] = value & 255;
|
|
1641
|
-
return offset + 2;
|
|
1642
|
-
};
|
|
1643
|
-
Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
1644
|
-
value = +value;
|
|
1645
|
-
offset = offset >>> 0;
|
|
1646
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1647
|
-
this[offset + 3] = value >>> 24;
|
|
1648
|
-
this[offset + 2] = value >>> 16;
|
|
1649
|
-
this[offset + 1] = value >>> 8;
|
|
1650
|
-
this[offset] = value & 255;
|
|
1651
|
-
return offset + 4;
|
|
1652
|
-
};
|
|
1653
|
-
Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
1654
|
-
value = +value;
|
|
1655
|
-
offset = offset >>> 0;
|
|
1656
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1657
|
-
this[offset] = value >>> 24;
|
|
1658
|
-
this[offset + 1] = value >>> 16;
|
|
1659
|
-
this[offset + 2] = value >>> 8;
|
|
1660
|
-
this[offset + 3] = value & 255;
|
|
1661
|
-
return offset + 4;
|
|
1662
|
-
};
|
|
1663
|
-
Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
|
|
1664
|
-
value = +value;
|
|
1665
|
-
offset = offset >>> 0;
|
|
1666
|
-
if (!noAssert) {
|
|
1667
|
-
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
1668
|
-
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
1669
|
-
}
|
|
1670
|
-
var i = 0;
|
|
1671
|
-
var mul = 1;
|
|
1672
|
-
var sub = 0;
|
|
1673
|
-
this[offset] = value & 255;
|
|
1674
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1675
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
1676
|
-
sub = 1;
|
|
1677
|
-
}
|
|
1678
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
1679
|
-
}
|
|
1680
|
-
return offset + byteLength2;
|
|
1681
|
-
};
|
|
1682
|
-
Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
|
|
1683
|
-
value = +value;
|
|
1684
|
-
offset = offset >>> 0;
|
|
1685
|
-
if (!noAssert) {
|
|
1686
|
-
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
1687
|
-
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
1688
|
-
}
|
|
1689
|
-
var i = byteLength2 - 1;
|
|
1690
|
-
var mul = 1;
|
|
1691
|
-
var sub = 0;
|
|
1692
|
-
this[offset + i] = value & 255;
|
|
1693
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
1694
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
1695
|
-
sub = 1;
|
|
1696
|
-
}
|
|
1697
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
1698
|
-
}
|
|
1699
|
-
return offset + byteLength2;
|
|
1700
|
-
};
|
|
1701
|
-
Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
1702
|
-
value = +value;
|
|
1703
|
-
offset = offset >>> 0;
|
|
1704
|
-
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
1705
|
-
if (value < 0) value = 255 + value + 1;
|
|
1706
|
-
this[offset] = value & 255;
|
|
1707
|
-
return offset + 1;
|
|
1708
|
-
};
|
|
1709
|
-
Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
1710
|
-
value = +value;
|
|
1711
|
-
offset = offset >>> 0;
|
|
1712
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1713
|
-
this[offset] = value & 255;
|
|
1714
|
-
this[offset + 1] = value >>> 8;
|
|
1715
|
-
return offset + 2;
|
|
1716
|
-
};
|
|
1717
|
-
Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
1718
|
-
value = +value;
|
|
1719
|
-
offset = offset >>> 0;
|
|
1720
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1721
|
-
this[offset] = value >>> 8;
|
|
1722
|
-
this[offset + 1] = value & 255;
|
|
1723
|
-
return offset + 2;
|
|
1724
|
-
};
|
|
1725
|
-
Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
1726
|
-
value = +value;
|
|
1727
|
-
offset = offset >>> 0;
|
|
1728
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1729
|
-
this[offset] = value & 255;
|
|
1730
|
-
this[offset + 1] = value >>> 8;
|
|
1731
|
-
this[offset + 2] = value >>> 16;
|
|
1732
|
-
this[offset + 3] = value >>> 24;
|
|
1733
|
-
return offset + 4;
|
|
1734
|
-
};
|
|
1735
|
-
Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
1736
|
-
value = +value;
|
|
1737
|
-
offset = offset >>> 0;
|
|
1738
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1739
|
-
if (value < 0) value = 4294967295 + value + 1;
|
|
1740
|
-
this[offset] = value >>> 24;
|
|
1741
|
-
this[offset + 1] = value >>> 16;
|
|
1742
|
-
this[offset + 2] = value >>> 8;
|
|
1743
|
-
this[offset + 3] = value & 255;
|
|
1744
|
-
return offset + 4;
|
|
1745
|
-
};
|
|
1746
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
1747
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
1748
|
-
if (offset < 0) throw new RangeError("Index out of range");
|
|
1749
|
-
}
|
|
1750
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
1751
|
-
value = +value;
|
|
1752
|
-
offset = offset >>> 0;
|
|
1753
|
-
if (!noAssert) {
|
|
1754
|
-
checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
|
|
1755
|
-
}
|
|
1756
|
-
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
1757
|
-
return offset + 4;
|
|
1758
|
-
}
|
|
1759
|
-
Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
1760
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
1761
|
-
};
|
|
1762
|
-
Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
1763
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
1764
|
-
};
|
|
1765
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
1766
|
-
value = +value;
|
|
1767
|
-
offset = offset >>> 0;
|
|
1768
|
-
if (!noAssert) {
|
|
1769
|
-
checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
|
|
1770
|
-
}
|
|
1771
|
-
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
1772
|
-
return offset + 8;
|
|
1773
|
-
}
|
|
1774
|
-
Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
1775
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
1776
|
-
};
|
|
1777
|
-
Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
1778
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
1779
|
-
};
|
|
1780
|
-
Buffer2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
1781
|
-
if (!Buffer2.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
1782
|
-
if (!start) start = 0;
|
|
1783
|
-
if (!end && end !== 0) end = this.length;
|
|
1784
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
1785
|
-
if (!targetStart) targetStart = 0;
|
|
1786
|
-
if (end > 0 && end < start) end = start;
|
|
1787
|
-
if (end === start) return 0;
|
|
1788
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
1789
|
-
if (targetStart < 0) {
|
|
1790
|
-
throw new RangeError("targetStart out of bounds");
|
|
1791
|
-
}
|
|
1792
|
-
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
1793
|
-
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
1794
|
-
if (end > this.length) end = this.length;
|
|
1795
|
-
if (target.length - targetStart < end - start) {
|
|
1796
|
-
end = target.length - targetStart + start;
|
|
1797
|
-
}
|
|
1798
|
-
var len = end - start;
|
|
1799
|
-
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
|
1800
|
-
this.copyWithin(targetStart, start, end);
|
|
1801
|
-
} else {
|
|
1802
|
-
Uint8Array.prototype.set.call(
|
|
1803
|
-
target,
|
|
1804
|
-
this.subarray(start, end),
|
|
1805
|
-
targetStart
|
|
1806
|
-
);
|
|
1807
|
-
}
|
|
1808
|
-
return len;
|
|
1809
|
-
};
|
|
1810
|
-
Buffer2.prototype.fill = function fill(val, start, end, encoding) {
|
|
1811
|
-
if (typeof val === "string") {
|
|
1812
|
-
if (typeof start === "string") {
|
|
1813
|
-
encoding = start;
|
|
1814
|
-
start = 0;
|
|
1815
|
-
end = this.length;
|
|
1816
|
-
} else if (typeof end === "string") {
|
|
1817
|
-
encoding = end;
|
|
1818
|
-
end = this.length;
|
|
1819
|
-
}
|
|
1820
|
-
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
1821
|
-
throw new TypeError("encoding must be a string");
|
|
1822
|
-
}
|
|
1823
|
-
if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
|
|
1824
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1825
|
-
}
|
|
1826
|
-
if (val.length === 1) {
|
|
1827
|
-
var code = val.charCodeAt(0);
|
|
1828
|
-
if (encoding === "utf8" && code < 128 || encoding === "latin1") {
|
|
1829
|
-
val = code;
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
} else if (typeof val === "number") {
|
|
1833
|
-
val = val & 255;
|
|
1834
|
-
} else if (typeof val === "boolean") {
|
|
1835
|
-
val = Number(val);
|
|
1836
|
-
}
|
|
1837
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
1838
|
-
throw new RangeError("Out of range index");
|
|
1839
|
-
}
|
|
1840
|
-
if (end <= start) {
|
|
1841
|
-
return this;
|
|
1842
|
-
}
|
|
1843
|
-
start = start >>> 0;
|
|
1844
|
-
end = end === void 0 ? this.length : end >>> 0;
|
|
1845
|
-
if (!val) val = 0;
|
|
1846
|
-
var i;
|
|
1847
|
-
if (typeof val === "number") {
|
|
1848
|
-
for (i = start; i < end; ++i) {
|
|
1849
|
-
this[i] = val;
|
|
1850
|
-
}
|
|
1851
|
-
} else {
|
|
1852
|
-
var bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);
|
|
1853
|
-
var len = bytes.length;
|
|
1854
|
-
if (len === 0) {
|
|
1855
|
-
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
1856
|
-
}
|
|
1857
|
-
for (i = 0; i < end - start; ++i) {
|
|
1858
|
-
this[i + start] = bytes[i % len];
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
return this;
|
|
1862
|
-
};
|
|
1863
|
-
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
1864
|
-
function base64clean(str) {
|
|
1865
|
-
str = str.split("=")[0];
|
|
1866
|
-
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
1867
|
-
if (str.length < 2) return "";
|
|
1868
|
-
while (str.length % 4 !== 0) {
|
|
1869
|
-
str = str + "=";
|
|
1870
|
-
}
|
|
1871
|
-
return str;
|
|
1872
|
-
}
|
|
1873
|
-
function utf8ToBytes(string, units) {
|
|
1874
|
-
units = units || Infinity;
|
|
1875
|
-
var codePoint;
|
|
1876
|
-
var length = string.length;
|
|
1877
|
-
var leadSurrogate = null;
|
|
1878
|
-
var bytes = [];
|
|
1879
|
-
for (var i = 0; i < length; ++i) {
|
|
1880
|
-
codePoint = string.charCodeAt(i);
|
|
1881
|
-
if (codePoint > 55295 && codePoint < 57344) {
|
|
1882
|
-
if (!leadSurrogate) {
|
|
1883
|
-
if (codePoint > 56319) {
|
|
1884
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
1885
|
-
continue;
|
|
1886
|
-
} else if (i + 1 === length) {
|
|
1887
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
1888
|
-
continue;
|
|
1889
|
-
}
|
|
1890
|
-
leadSurrogate = codePoint;
|
|
1891
|
-
continue;
|
|
1892
|
-
}
|
|
1893
|
-
if (codePoint < 56320) {
|
|
1894
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
1895
|
-
leadSurrogate = codePoint;
|
|
1896
|
-
continue;
|
|
1897
|
-
}
|
|
1898
|
-
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
1899
|
-
} else if (leadSurrogate) {
|
|
1900
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
1901
|
-
}
|
|
1902
|
-
leadSurrogate = null;
|
|
1903
|
-
if (codePoint < 128) {
|
|
1904
|
-
if ((units -= 1) < 0) break;
|
|
1905
|
-
bytes.push(codePoint);
|
|
1906
|
-
} else if (codePoint < 2048) {
|
|
1907
|
-
if ((units -= 2) < 0) break;
|
|
1908
|
-
bytes.push(
|
|
1909
|
-
codePoint >> 6 | 192,
|
|
1910
|
-
codePoint & 63 | 128
|
|
1911
|
-
);
|
|
1912
|
-
} else if (codePoint < 65536) {
|
|
1913
|
-
if ((units -= 3) < 0) break;
|
|
1914
|
-
bytes.push(
|
|
1915
|
-
codePoint >> 12 | 224,
|
|
1916
|
-
codePoint >> 6 & 63 | 128,
|
|
1917
|
-
codePoint & 63 | 128
|
|
1918
|
-
);
|
|
1919
|
-
} else if (codePoint < 1114112) {
|
|
1920
|
-
if ((units -= 4) < 0) break;
|
|
1921
|
-
bytes.push(
|
|
1922
|
-
codePoint >> 18 | 240,
|
|
1923
|
-
codePoint >> 12 & 63 | 128,
|
|
1924
|
-
codePoint >> 6 & 63 | 128,
|
|
1925
|
-
codePoint & 63 | 128
|
|
1926
|
-
);
|
|
1927
|
-
} else {
|
|
1928
|
-
throw new Error("Invalid code point");
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
return bytes;
|
|
1932
|
-
}
|
|
1933
|
-
function asciiToBytes(str) {
|
|
1934
|
-
var byteArray = [];
|
|
1935
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1936
|
-
byteArray.push(str.charCodeAt(i) & 255);
|
|
1937
|
-
}
|
|
1938
|
-
return byteArray;
|
|
1939
|
-
}
|
|
1940
|
-
function utf16leToBytes(str, units) {
|
|
1941
|
-
var c, hi, lo;
|
|
1942
|
-
var byteArray = [];
|
|
1943
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1944
|
-
if ((units -= 2) < 0) break;
|
|
1945
|
-
c = str.charCodeAt(i);
|
|
1946
|
-
hi = c >> 8;
|
|
1947
|
-
lo = c % 256;
|
|
1948
|
-
byteArray.push(lo);
|
|
1949
|
-
byteArray.push(hi);
|
|
1950
|
-
}
|
|
1951
|
-
return byteArray;
|
|
1952
|
-
}
|
|
1953
|
-
function base64ToBytes(str) {
|
|
1954
|
-
return base64.toByteArray(base64clean(str));
|
|
1955
|
-
}
|
|
1956
|
-
function blitBuffer(src, dst, offset, length) {
|
|
1957
|
-
for (var i = 0; i < length; ++i) {
|
|
1958
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
1959
|
-
dst[i + offset] = src[i];
|
|
1960
|
-
}
|
|
1961
|
-
return i;
|
|
1962
|
-
}
|
|
1963
|
-
function isInstance(obj, type) {
|
|
1964
|
-
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
|
1965
|
-
}
|
|
1966
|
-
function numberIsNaN(obj) {
|
|
1967
|
-
return obj !== obj;
|
|
1968
|
-
}
|
|
1969
|
-
var hexSliceLookupTable = (function() {
|
|
1970
|
-
var alphabet = "0123456789abcdef";
|
|
1971
|
-
var table = new Array(256);
|
|
1972
|
-
for (var i = 0; i < 16; ++i) {
|
|
1973
|
-
var i16 = i * 16;
|
|
1974
|
-
for (var j = 0; j < 16; ++j) {
|
|
1975
|
-
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
return table;
|
|
1979
|
-
})();
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
|
|
1983
|
-
// node_modules/.pnpm/punycode@2.3.1/node_modules/punycode/punycode.es6.js
|
|
1984
|
-
var punycode_es6_exports = {};
|
|
1985
|
-
__export(punycode_es6_exports, {
|
|
1986
|
-
decode: () => decode,
|
|
1987
|
-
default: () => punycode_es6_default,
|
|
1988
|
-
encode: () => encode,
|
|
1989
|
-
toASCII: () => toASCII,
|
|
1990
|
-
toUnicode: () => toUnicode,
|
|
1991
|
-
ucs2decode: () => ucs2decode,
|
|
1992
|
-
ucs2encode: () => ucs2encode
|
|
1993
|
-
});
|
|
1994
|
-
function error(type) {
|
|
1995
|
-
throw new RangeError(errors[type]);
|
|
1996
|
-
}
|
|
1997
|
-
function map(array, callback) {
|
|
1998
|
-
const result = [];
|
|
1999
|
-
let length = array.length;
|
|
2000
|
-
while (length--) {
|
|
2001
|
-
result[length] = callback(array[length]);
|
|
2002
|
-
}
|
|
2003
|
-
return result;
|
|
2004
|
-
}
|
|
2005
|
-
function mapDomain(domain, callback) {
|
|
2006
|
-
const parts = domain.split("@");
|
|
2007
|
-
let result = "";
|
|
2008
|
-
if (parts.length > 1) {
|
|
2009
|
-
result = parts[0] + "@";
|
|
2010
|
-
domain = parts[1];
|
|
2011
|
-
}
|
|
2012
|
-
domain = domain.replace(regexSeparators, ".");
|
|
2013
|
-
const labels = domain.split(".");
|
|
2014
|
-
const encoded = map(labels, callback).join(".");
|
|
2015
|
-
return result + encoded;
|
|
2016
|
-
}
|
|
2017
|
-
function ucs2decode(string) {
|
|
2018
|
-
const output = [];
|
|
2019
|
-
let counter = 0;
|
|
2020
|
-
const length = string.length;
|
|
2021
|
-
while (counter < length) {
|
|
2022
|
-
const value = string.charCodeAt(counter++);
|
|
2023
|
-
if (value >= 55296 && value <= 56319 && counter < length) {
|
|
2024
|
-
const extra = string.charCodeAt(counter++);
|
|
2025
|
-
if ((extra & 64512) == 56320) {
|
|
2026
|
-
output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
|
|
2027
|
-
} else {
|
|
2028
|
-
output.push(value);
|
|
2029
|
-
counter--;
|
|
2030
|
-
}
|
|
2031
|
-
} else {
|
|
2032
|
-
output.push(value);
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
return output;
|
|
2036
|
-
}
|
|
2037
|
-
var maxInt, base, tMin, tMax, skew, damp, initialBias, initialN, delimiter, regexPunycode, regexNonASCII, regexSeparators, errors, baseMinusTMin, floor, stringFromCharCode, ucs2encode, basicToDigit, digitToBasic, adapt, decode, encode, toUnicode, toASCII, punycode, punycode_es6_default;
|
|
2038
|
-
var init_punycode_es6 = __esm({
|
|
2039
|
-
"node_modules/.pnpm/punycode@2.3.1/node_modules/punycode/punycode.es6.js"() {
|
|
2040
|
-
"use strict";
|
|
2041
|
-
maxInt = 2147483647;
|
|
2042
|
-
base = 36;
|
|
2043
|
-
tMin = 1;
|
|
2044
|
-
tMax = 26;
|
|
2045
|
-
skew = 38;
|
|
2046
|
-
damp = 700;
|
|
2047
|
-
initialBias = 72;
|
|
2048
|
-
initialN = 128;
|
|
2049
|
-
delimiter = "-";
|
|
2050
|
-
regexPunycode = /^xn--/;
|
|
2051
|
-
regexNonASCII = /[^\0-\x7F]/;
|
|
2052
|
-
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
|
|
2053
|
-
errors = {
|
|
2054
|
-
"overflow": "Overflow: input needs wider integers to process",
|
|
2055
|
-
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
2056
|
-
"invalid-input": "Invalid input"
|
|
2057
|
-
};
|
|
2058
|
-
baseMinusTMin = base - tMin;
|
|
2059
|
-
floor = Math.floor;
|
|
2060
|
-
stringFromCharCode = String.fromCharCode;
|
|
2061
|
-
ucs2encode = (codePoints) => String.fromCodePoint(...codePoints);
|
|
2062
|
-
basicToDigit = function(codePoint) {
|
|
2063
|
-
if (codePoint >= 48 && codePoint < 58) {
|
|
2064
|
-
return 26 + (codePoint - 48);
|
|
2065
|
-
}
|
|
2066
|
-
if (codePoint >= 65 && codePoint < 91) {
|
|
2067
|
-
return codePoint - 65;
|
|
2068
|
-
}
|
|
2069
|
-
if (codePoint >= 97 && codePoint < 123) {
|
|
2070
|
-
return codePoint - 97;
|
|
2071
|
-
}
|
|
2072
|
-
return base;
|
|
2073
|
-
};
|
|
2074
|
-
digitToBasic = function(digit, flag) {
|
|
2075
|
-
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
2076
|
-
};
|
|
2077
|
-
adapt = function(delta, numPoints, firstTime) {
|
|
2078
|
-
let k = 0;
|
|
2079
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
2080
|
-
delta += floor(delta / numPoints);
|
|
2081
|
-
for (; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
2082
|
-
delta = floor(delta / baseMinusTMin);
|
|
2083
|
-
}
|
|
2084
|
-
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
2085
|
-
};
|
|
2086
|
-
decode = function(input) {
|
|
2087
|
-
const output = [];
|
|
2088
|
-
const inputLength = input.length;
|
|
2089
|
-
let i = 0;
|
|
2090
|
-
let n = initialN;
|
|
2091
|
-
let bias = initialBias;
|
|
2092
|
-
let basic = input.lastIndexOf(delimiter);
|
|
2093
|
-
if (basic < 0) {
|
|
2094
|
-
basic = 0;
|
|
2095
|
-
}
|
|
2096
|
-
for (let j = 0; j < basic; ++j) {
|
|
2097
|
-
if (input.charCodeAt(j) >= 128) {
|
|
2098
|
-
error("not-basic");
|
|
2099
|
-
}
|
|
2100
|
-
output.push(input.charCodeAt(j));
|
|
2101
|
-
}
|
|
2102
|
-
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
|
2103
|
-
const oldi = i;
|
|
2104
|
-
for (let w = 1, k = base; ; k += base) {
|
|
2105
|
-
if (index >= inputLength) {
|
|
2106
|
-
error("invalid-input");
|
|
2107
|
-
}
|
|
2108
|
-
const digit = basicToDigit(input.charCodeAt(index++));
|
|
2109
|
-
if (digit >= base) {
|
|
2110
|
-
error("invalid-input");
|
|
2111
|
-
}
|
|
2112
|
-
if (digit > floor((maxInt - i) / w)) {
|
|
2113
|
-
error("overflow");
|
|
2114
|
-
}
|
|
2115
|
-
i += digit * w;
|
|
2116
|
-
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
2117
|
-
if (digit < t) {
|
|
2118
|
-
break;
|
|
2119
|
-
}
|
|
2120
|
-
const baseMinusT = base - t;
|
|
2121
|
-
if (w > floor(maxInt / baseMinusT)) {
|
|
2122
|
-
error("overflow");
|
|
2123
|
-
}
|
|
2124
|
-
w *= baseMinusT;
|
|
2125
|
-
}
|
|
2126
|
-
const out = output.length + 1;
|
|
2127
|
-
bias = adapt(i - oldi, out, oldi == 0);
|
|
2128
|
-
if (floor(i / out) > maxInt - n) {
|
|
2129
|
-
error("overflow");
|
|
2130
|
-
}
|
|
2131
|
-
n += floor(i / out);
|
|
2132
|
-
i %= out;
|
|
2133
|
-
output.splice(i++, 0, n);
|
|
2134
|
-
}
|
|
2135
|
-
return String.fromCodePoint(...output);
|
|
2136
|
-
};
|
|
2137
|
-
encode = function(input) {
|
|
2138
|
-
const output = [];
|
|
2139
|
-
input = ucs2decode(input);
|
|
2140
|
-
const inputLength = input.length;
|
|
2141
|
-
let n = initialN;
|
|
2142
|
-
let delta = 0;
|
|
2143
|
-
let bias = initialBias;
|
|
2144
|
-
for (const currentValue of input) {
|
|
2145
|
-
if (currentValue < 128) {
|
|
2146
|
-
output.push(stringFromCharCode(currentValue));
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
const basicLength = output.length;
|
|
2150
|
-
let handledCPCount = basicLength;
|
|
2151
|
-
if (basicLength) {
|
|
2152
|
-
output.push(delimiter);
|
|
2153
|
-
}
|
|
2154
|
-
while (handledCPCount < inputLength) {
|
|
2155
|
-
let m = maxInt;
|
|
2156
|
-
for (const currentValue of input) {
|
|
2157
|
-
if (currentValue >= n && currentValue < m) {
|
|
2158
|
-
m = currentValue;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
const handledCPCountPlusOne = handledCPCount + 1;
|
|
2162
|
-
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
2163
|
-
error("overflow");
|
|
2164
|
-
}
|
|
2165
|
-
delta += (m - n) * handledCPCountPlusOne;
|
|
2166
|
-
n = m;
|
|
2167
|
-
for (const currentValue of input) {
|
|
2168
|
-
if (currentValue < n && ++delta > maxInt) {
|
|
2169
|
-
error("overflow");
|
|
2170
|
-
}
|
|
2171
|
-
if (currentValue === n) {
|
|
2172
|
-
let q = delta;
|
|
2173
|
-
for (let k = base; ; k += base) {
|
|
2174
|
-
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
2175
|
-
if (q < t) {
|
|
2176
|
-
break;
|
|
2177
|
-
}
|
|
2178
|
-
const qMinusT = q - t;
|
|
2179
|
-
const baseMinusT = base - t;
|
|
2180
|
-
output.push(
|
|
2181
|
-
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
2182
|
-
);
|
|
2183
|
-
q = floor(qMinusT / baseMinusT);
|
|
2184
|
-
}
|
|
2185
|
-
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
2186
|
-
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
|
2187
|
-
delta = 0;
|
|
2188
|
-
++handledCPCount;
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
++delta;
|
|
2192
|
-
++n;
|
|
2193
|
-
}
|
|
2194
|
-
return output.join("");
|
|
2195
|
-
};
|
|
2196
|
-
toUnicode = function(input) {
|
|
2197
|
-
return mapDomain(input, function(string) {
|
|
2198
|
-
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
2199
|
-
});
|
|
2200
|
-
};
|
|
2201
|
-
toASCII = function(input) {
|
|
2202
|
-
return mapDomain(input, function(string) {
|
|
2203
|
-
return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
|
|
2204
|
-
});
|
|
2205
|
-
};
|
|
2206
|
-
punycode = {
|
|
2207
|
-
/**
|
|
2208
|
-
* A string representing the current Punycode.js version number.
|
|
2209
|
-
* @memberOf punycode
|
|
2210
|
-
* @type String
|
|
2211
|
-
*/
|
|
2212
|
-
"version": "2.3.1",
|
|
2213
|
-
/**
|
|
2214
|
-
* An object of methods to convert from JavaScript's internal character
|
|
2215
|
-
* representation (UCS-2) to Unicode code points, and back.
|
|
2216
|
-
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
2217
|
-
* @memberOf punycode
|
|
2218
|
-
* @type Object
|
|
2219
|
-
*/
|
|
2220
|
-
"ucs2": {
|
|
2221
|
-
"decode": ucs2decode,
|
|
2222
|
-
"encode": ucs2encode
|
|
2223
|
-
},
|
|
2224
|
-
"decode": decode,
|
|
2225
|
-
"encode": encode,
|
|
2226
|
-
"toASCII": toASCII,
|
|
2227
|
-
"toUnicode": toUnicode
|
|
2228
|
-
};
|
|
2229
|
-
punycode_es6_default = punycode;
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
|
|
2233
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/infra.js
|
|
2234
|
-
var require_infra = __commonJS({
|
|
2235
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/infra.js"(exports, module) {
|
|
2236
|
-
"use strict";
|
|
2237
|
-
function isASCIIDigit(c) {
|
|
2238
|
-
return c >= 48 && c <= 57;
|
|
2239
|
-
}
|
|
2240
|
-
function isASCIIAlpha(c) {
|
|
2241
|
-
return c >= 65 && c <= 90 || c >= 97 && c <= 122;
|
|
2242
|
-
}
|
|
2243
|
-
function isASCIIAlphanumeric(c) {
|
|
2244
|
-
return isASCIIAlpha(c) || isASCIIDigit(c);
|
|
2245
|
-
}
|
|
2246
|
-
function isASCIIHex(c) {
|
|
2247
|
-
return isASCIIDigit(c) || c >= 65 && c <= 70 || c >= 97 && c <= 102;
|
|
2248
|
-
}
|
|
2249
|
-
module.exports = {
|
|
2250
|
-
isASCIIDigit,
|
|
2251
|
-
isASCIIAlpha,
|
|
2252
|
-
isASCIIAlphanumeric,
|
|
2253
|
-
isASCIIHex
|
|
2254
|
-
};
|
|
2255
|
-
}
|
|
2256
|
-
});
|
|
2257
|
-
|
|
2258
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/urlencoded.js
|
|
2259
|
-
var require_urlencoded = __commonJS({
|
|
2260
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/urlencoded.js"(exports, module) {
|
|
2261
|
-
"use strict";
|
|
2262
|
-
var { Buffer: Buffer2 } = require_buffer();
|
|
2263
|
-
var { isASCIIHex } = require_infra();
|
|
2264
|
-
function strictlySplitByteSequence(buf, cp) {
|
|
2265
|
-
const list = [];
|
|
2266
|
-
let last = 0;
|
|
2267
|
-
let i = buf.indexOf(cp);
|
|
2268
|
-
while (i >= 0) {
|
|
2269
|
-
list.push(buf.slice(last, i));
|
|
2270
|
-
last = i + 1;
|
|
2271
|
-
i = buf.indexOf(cp, last);
|
|
2272
|
-
}
|
|
2273
|
-
if (last !== buf.length) {
|
|
2274
|
-
list.push(buf.slice(last));
|
|
2275
|
-
}
|
|
2276
|
-
return list;
|
|
2277
|
-
}
|
|
2278
|
-
function replaceByteInByteSequence(buf, from, to) {
|
|
2279
|
-
let i = buf.indexOf(from);
|
|
2280
|
-
while (i >= 0) {
|
|
2281
|
-
buf[i] = to;
|
|
2282
|
-
i = buf.indexOf(from, i + 1);
|
|
2283
|
-
}
|
|
2284
|
-
return buf;
|
|
2285
|
-
}
|
|
2286
|
-
function percentEncode(c) {
|
|
2287
|
-
let hex = c.toString(16).toUpperCase();
|
|
2288
|
-
if (hex.length === 1) {
|
|
2289
|
-
hex = "0" + hex;
|
|
2290
|
-
}
|
|
2291
|
-
return "%" + hex;
|
|
2292
|
-
}
|
|
2293
|
-
function percentDecode(input) {
|
|
2294
|
-
const output = Buffer2.alloc(input.byteLength);
|
|
2295
|
-
let ptr = 0;
|
|
2296
|
-
for (let i = 0; i < input.length; ++i) {
|
|
2297
|
-
if (input[i] !== 37 || !isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2])) {
|
|
2298
|
-
output[ptr++] = input[i];
|
|
2299
|
-
} else {
|
|
2300
|
-
output[ptr++] = parseInt(input.slice(i + 1, i + 3).toString(), 16);
|
|
2301
|
-
i += 2;
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
return output.slice(0, ptr);
|
|
2305
|
-
}
|
|
2306
|
-
function parseUrlencoded(input) {
|
|
2307
|
-
const sequences = strictlySplitByteSequence(input, 38);
|
|
2308
|
-
const output = [];
|
|
2309
|
-
for (const bytes of sequences) {
|
|
2310
|
-
if (bytes.length === 0) {
|
|
2311
|
-
continue;
|
|
2312
|
-
}
|
|
2313
|
-
let name;
|
|
2314
|
-
let value;
|
|
2315
|
-
const indexOfEqual = bytes.indexOf(61);
|
|
2316
|
-
if (indexOfEqual >= 0) {
|
|
2317
|
-
name = bytes.slice(0, indexOfEqual);
|
|
2318
|
-
value = bytes.slice(indexOfEqual + 1);
|
|
2319
|
-
} else {
|
|
2320
|
-
name = bytes;
|
|
2321
|
-
value = Buffer2.alloc(0);
|
|
2322
|
-
}
|
|
2323
|
-
name = replaceByteInByteSequence(Buffer2.from(name), 43, 32);
|
|
2324
|
-
value = replaceByteInByteSequence(Buffer2.from(value), 43, 32);
|
|
2325
|
-
output.push([percentDecode(name).toString(), percentDecode(value).toString()]);
|
|
2326
|
-
}
|
|
2327
|
-
return output;
|
|
2328
|
-
}
|
|
2329
|
-
function serializeUrlencodedByte(input) {
|
|
2330
|
-
let output = "";
|
|
2331
|
-
for (const byte of input) {
|
|
2332
|
-
if (byte === 32) {
|
|
2333
|
-
output += "+";
|
|
2334
|
-
} else if (byte === 42 || byte === 45 || byte === 46 || byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte === 95 || byte >= 97 && byte <= 122) {
|
|
2335
|
-
output += String.fromCodePoint(byte);
|
|
2336
|
-
} else {
|
|
2337
|
-
output += percentEncode(byte);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
return output;
|
|
2341
|
-
}
|
|
2342
|
-
function serializeUrlencoded(tuples, encodingOverride = void 0) {
|
|
2343
|
-
let encoding = "utf-8";
|
|
2344
|
-
if (encodingOverride !== void 0) {
|
|
2345
|
-
encoding = encodingOverride;
|
|
2346
|
-
}
|
|
2347
|
-
let output = "";
|
|
2348
|
-
for (const [i, tuple] of tuples.entries()) {
|
|
2349
|
-
const name = serializeUrlencodedByte(Buffer2.from(tuple[0]));
|
|
2350
|
-
let value = tuple[1];
|
|
2351
|
-
if (tuple.length > 2 && tuple[2] !== void 0) {
|
|
2352
|
-
if (tuple[2] === "hidden" && name === "_charset_") {
|
|
2353
|
-
value = encoding;
|
|
2354
|
-
} else if (tuple[2] === "file") {
|
|
2355
|
-
value = value.name;
|
|
2356
|
-
}
|
|
2357
|
-
}
|
|
2358
|
-
value = serializeUrlencodedByte(Buffer2.from(value));
|
|
2359
|
-
if (i !== 0) {
|
|
2360
|
-
output += "&";
|
|
2361
|
-
}
|
|
2362
|
-
output += `${name}=${value}`;
|
|
2363
|
-
}
|
|
2364
|
-
return output;
|
|
2365
|
-
}
|
|
2366
|
-
module.exports = {
|
|
2367
|
-
percentEncode,
|
|
2368
|
-
percentDecode,
|
|
2369
|
-
// application/x-www-form-urlencoded string parser
|
|
2370
|
-
parseUrlencoded(input) {
|
|
2371
|
-
return parseUrlencoded(Buffer2.from(input));
|
|
2372
|
-
},
|
|
2373
|
-
// application/x-www-form-urlencoded serializer
|
|
2374
|
-
serializeUrlencoded
|
|
2375
|
-
};
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
|
|
2379
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/url-state-machine.js
|
|
2380
|
-
var require_url_state_machine = __commonJS({
|
|
2381
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/url-state-machine.js"(exports, module) {
|
|
2382
|
-
"use strict";
|
|
2383
|
-
var { Buffer: Buffer2 } = require_buffer();
|
|
2384
|
-
var punycode2 = (init_punycode_es6(), __toCommonJS(punycode_es6_exports));
|
|
2385
|
-
var infra = require_infra();
|
|
2386
|
-
var { percentEncode, percentDecode } = require_urlencoded();
|
|
2387
|
-
var specialSchemes = {
|
|
2388
|
-
ftp: 21,
|
|
2389
|
-
file: null,
|
|
2390
|
-
http: 80,
|
|
2391
|
-
https: 443,
|
|
2392
|
-
ws: 80,
|
|
2393
|
-
wss: 443
|
|
2394
|
-
};
|
|
2395
|
-
var failure = /* @__PURE__ */ Symbol("failure");
|
|
2396
|
-
function countSymbols(str) {
|
|
2397
|
-
return punycode2.ucs2.decode(str).length;
|
|
2398
|
-
}
|
|
2399
|
-
function at(input, idx) {
|
|
2400
|
-
const c = input[idx];
|
|
2401
|
-
return isNaN(c) ? void 0 : String.fromCodePoint(c);
|
|
2402
|
-
}
|
|
2403
|
-
function isSingleDot(buffer) {
|
|
2404
|
-
return buffer === "." || buffer.toLowerCase() === "%2e";
|
|
2405
|
-
}
|
|
2406
|
-
function isDoubleDot(buffer) {
|
|
2407
|
-
buffer = buffer.toLowerCase();
|
|
2408
|
-
return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e";
|
|
2409
|
-
}
|
|
2410
|
-
function isWindowsDriveLetterCodePoints(cp1, cp2) {
|
|
2411
|
-
return infra.isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124);
|
|
2412
|
-
}
|
|
2413
|
-
function isWindowsDriveLetterString(string) {
|
|
2414
|
-
return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|");
|
|
2415
|
-
}
|
|
2416
|
-
function isNormalizedWindowsDriveLetterString(string) {
|
|
2417
|
-
return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && string[1] === ":";
|
|
2418
|
-
}
|
|
2419
|
-
function containsForbiddenHostCodePoint(string) {
|
|
2420
|
-
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1;
|
|
2421
|
-
}
|
|
2422
|
-
function containsForbiddenHostCodePointExcludingPercent(string) {
|
|
2423
|
-
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1;
|
|
2424
|
-
}
|
|
2425
|
-
function isSpecialScheme(scheme) {
|
|
2426
|
-
return specialSchemes[scheme] !== void 0;
|
|
2427
|
-
}
|
|
2428
|
-
function isSpecial(url) {
|
|
2429
|
-
return isSpecialScheme(url.scheme);
|
|
2430
|
-
}
|
|
2431
|
-
function isNotSpecial(url) {
|
|
2432
|
-
return !isSpecialScheme(url.scheme);
|
|
2433
|
-
}
|
|
2434
|
-
function defaultPort(scheme) {
|
|
2435
|
-
return specialSchemes[scheme];
|
|
2436
|
-
}
|
|
2437
|
-
function utf8PercentEncode(c) {
|
|
2438
|
-
const buf = Buffer2.from(c);
|
|
2439
|
-
let str = "";
|
|
2440
|
-
for (let i = 0; i < buf.length; ++i) {
|
|
2441
|
-
str += percentEncode(buf[i]);
|
|
2442
|
-
}
|
|
2443
|
-
return str;
|
|
2444
|
-
}
|
|
2445
|
-
function isC0ControlPercentEncode(c) {
|
|
2446
|
-
return c <= 31 || c > 126;
|
|
2447
|
-
}
|
|
2448
|
-
var extraUserinfoPercentEncodeSet = /* @__PURE__ */ new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]);
|
|
2449
|
-
function isUserinfoPercentEncode(c) {
|
|
2450
|
-
return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);
|
|
2451
|
-
}
|
|
2452
|
-
var extraFragmentPercentEncodeSet = /* @__PURE__ */ new Set([32, 34, 60, 62, 96]);
|
|
2453
|
-
function isFragmentPercentEncode(c) {
|
|
2454
|
-
return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);
|
|
2455
|
-
}
|
|
2456
|
-
var extraPathPercentEncodeSet = /* @__PURE__ */ new Set([35, 63, 123, 125]);
|
|
2457
|
-
function isPathPercentEncode(c) {
|
|
2458
|
-
return isFragmentPercentEncode(c) || extraPathPercentEncodeSet.has(c);
|
|
2459
|
-
}
|
|
2460
|
-
function percentEncodeChar(c, encodeSetPredicate) {
|
|
2461
|
-
const cStr = String.fromCodePoint(c);
|
|
2462
|
-
if (encodeSetPredicate(c)) {
|
|
2463
|
-
return utf8PercentEncode(cStr);
|
|
2464
|
-
}
|
|
2465
|
-
return cStr;
|
|
2466
|
-
}
|
|
2467
|
-
function parseIPv4Number(input) {
|
|
2468
|
-
let R = 10;
|
|
2469
|
-
if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") {
|
|
2470
|
-
input = input.substring(2);
|
|
2471
|
-
R = 16;
|
|
2472
|
-
} else if (input.length >= 2 && input.charAt(0) === "0") {
|
|
2473
|
-
input = input.substring(1);
|
|
2474
|
-
R = 8;
|
|
2475
|
-
}
|
|
2476
|
-
if (input === "") {
|
|
2477
|
-
return 0;
|
|
2478
|
-
}
|
|
2479
|
-
let regex = /[^0-7]/;
|
|
2480
|
-
if (R === 10) {
|
|
2481
|
-
regex = /[^0-9]/;
|
|
2482
|
-
}
|
|
2483
|
-
if (R === 16) {
|
|
2484
|
-
regex = /[^0-9A-Fa-f]/;
|
|
2485
|
-
}
|
|
2486
|
-
if (regex.test(input)) {
|
|
2487
|
-
return failure;
|
|
2488
|
-
}
|
|
2489
|
-
return parseInt(input, R);
|
|
2490
|
-
}
|
|
2491
|
-
function parseIPv4(input) {
|
|
2492
|
-
const parts = input.split(".");
|
|
2493
|
-
if (parts[parts.length - 1] === "") {
|
|
2494
|
-
if (parts.length > 1) {
|
|
2495
|
-
parts.pop();
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
if (parts.length > 4) {
|
|
2499
|
-
return input;
|
|
2500
|
-
}
|
|
2501
|
-
const numbers = [];
|
|
2502
|
-
for (const part of parts) {
|
|
2503
|
-
if (part === "") {
|
|
2504
|
-
return input;
|
|
2505
|
-
}
|
|
2506
|
-
const n = parseIPv4Number(part);
|
|
2507
|
-
if (n === failure) {
|
|
2508
|
-
return input;
|
|
2509
|
-
}
|
|
2510
|
-
numbers.push(n);
|
|
2511
|
-
}
|
|
2512
|
-
for (let i = 0; i < numbers.length - 1; ++i) {
|
|
2513
|
-
if (numbers[i] > 255) {
|
|
2514
|
-
return failure;
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) {
|
|
2518
|
-
return failure;
|
|
2519
|
-
}
|
|
2520
|
-
let ipv4 = numbers.pop();
|
|
2521
|
-
let counter = 0;
|
|
2522
|
-
for (const n of numbers) {
|
|
2523
|
-
ipv4 += n * Math.pow(256, 3 - counter);
|
|
2524
|
-
++counter;
|
|
2525
|
-
}
|
|
2526
|
-
return ipv4;
|
|
2527
|
-
}
|
|
2528
|
-
function serializeIPv4(address) {
|
|
2529
|
-
let output = "";
|
|
2530
|
-
let n = address;
|
|
2531
|
-
for (let i = 1; i <= 4; ++i) {
|
|
2532
|
-
output = String(n % 256) + output;
|
|
2533
|
-
if (i !== 4) {
|
|
2534
|
-
output = "." + output;
|
|
2535
|
-
}
|
|
2536
|
-
n = Math.floor(n / 256);
|
|
2537
|
-
}
|
|
2538
|
-
return output;
|
|
2539
|
-
}
|
|
2540
|
-
function parseIPv6(input) {
|
|
2541
|
-
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
|
2542
|
-
let pieceIndex = 0;
|
|
2543
|
-
let compress = null;
|
|
2544
|
-
let pointer = 0;
|
|
2545
|
-
input = punycode2.ucs2.decode(input);
|
|
2546
|
-
if (input[pointer] === 58) {
|
|
2547
|
-
if (input[pointer + 1] !== 58) {
|
|
2548
|
-
return failure;
|
|
2549
|
-
}
|
|
2550
|
-
pointer += 2;
|
|
2551
|
-
++pieceIndex;
|
|
2552
|
-
compress = pieceIndex;
|
|
2553
|
-
}
|
|
2554
|
-
while (pointer < input.length) {
|
|
2555
|
-
if (pieceIndex === 8) {
|
|
2556
|
-
return failure;
|
|
2557
|
-
}
|
|
2558
|
-
if (input[pointer] === 58) {
|
|
2559
|
-
if (compress !== null) {
|
|
2560
|
-
return failure;
|
|
2561
|
-
}
|
|
2562
|
-
++pointer;
|
|
2563
|
-
++pieceIndex;
|
|
2564
|
-
compress = pieceIndex;
|
|
2565
|
-
continue;
|
|
2566
|
-
}
|
|
2567
|
-
let value = 0;
|
|
2568
|
-
let length = 0;
|
|
2569
|
-
while (length < 4 && infra.isASCIIHex(input[pointer])) {
|
|
2570
|
-
value = value * 16 + parseInt(at(input, pointer), 16);
|
|
2571
|
-
++pointer;
|
|
2572
|
-
++length;
|
|
2573
|
-
}
|
|
2574
|
-
if (input[pointer] === 46) {
|
|
2575
|
-
if (length === 0) {
|
|
2576
|
-
return failure;
|
|
2577
|
-
}
|
|
2578
|
-
pointer -= length;
|
|
2579
|
-
if (pieceIndex > 6) {
|
|
2580
|
-
return failure;
|
|
2581
|
-
}
|
|
2582
|
-
let numbersSeen = 0;
|
|
2583
|
-
while (input[pointer] !== void 0) {
|
|
2584
|
-
let ipv4Piece = null;
|
|
2585
|
-
if (numbersSeen > 0) {
|
|
2586
|
-
if (input[pointer] === 46 && numbersSeen < 4) {
|
|
2587
|
-
++pointer;
|
|
2588
|
-
} else {
|
|
2589
|
-
return failure;
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
if (!infra.isASCIIDigit(input[pointer])) {
|
|
2593
|
-
return failure;
|
|
2594
|
-
}
|
|
2595
|
-
while (infra.isASCIIDigit(input[pointer])) {
|
|
2596
|
-
const number = parseInt(at(input, pointer));
|
|
2597
|
-
if (ipv4Piece === null) {
|
|
2598
|
-
ipv4Piece = number;
|
|
2599
|
-
} else if (ipv4Piece === 0) {
|
|
2600
|
-
return failure;
|
|
2601
|
-
} else {
|
|
2602
|
-
ipv4Piece = ipv4Piece * 10 + number;
|
|
2603
|
-
}
|
|
2604
|
-
if (ipv4Piece > 255) {
|
|
2605
|
-
return failure;
|
|
2606
|
-
}
|
|
2607
|
-
++pointer;
|
|
2608
|
-
}
|
|
2609
|
-
address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
|
|
2610
|
-
++numbersSeen;
|
|
2611
|
-
if (numbersSeen === 2 || numbersSeen === 4) {
|
|
2612
|
-
++pieceIndex;
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
if (numbersSeen !== 4) {
|
|
2616
|
-
return failure;
|
|
2617
|
-
}
|
|
2618
|
-
break;
|
|
2619
|
-
} else if (input[pointer] === 58) {
|
|
2620
|
-
++pointer;
|
|
2621
|
-
if (input[pointer] === void 0) {
|
|
2622
|
-
return failure;
|
|
2623
|
-
}
|
|
2624
|
-
} else if (input[pointer] !== void 0) {
|
|
2625
|
-
return failure;
|
|
2626
|
-
}
|
|
2627
|
-
address[pieceIndex] = value;
|
|
2628
|
-
++pieceIndex;
|
|
2629
|
-
}
|
|
2630
|
-
if (compress !== null) {
|
|
2631
|
-
let swaps = pieceIndex - compress;
|
|
2632
|
-
pieceIndex = 7;
|
|
2633
|
-
while (pieceIndex !== 0 && swaps > 0) {
|
|
2634
|
-
const temp = address[compress + swaps - 1];
|
|
2635
|
-
address[compress + swaps - 1] = address[pieceIndex];
|
|
2636
|
-
address[pieceIndex] = temp;
|
|
2637
|
-
--pieceIndex;
|
|
2638
|
-
--swaps;
|
|
2639
|
-
}
|
|
2640
|
-
} else if (compress === null && pieceIndex !== 8) {
|
|
2641
|
-
return failure;
|
|
2642
|
-
}
|
|
2643
|
-
return address;
|
|
2644
|
-
}
|
|
2645
|
-
function serializeIPv6(address) {
|
|
2646
|
-
let output = "";
|
|
2647
|
-
const seqResult = findLongestZeroSequence(address);
|
|
2648
|
-
const compress = seqResult.idx;
|
|
2649
|
-
let ignore0 = false;
|
|
2650
|
-
for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {
|
|
2651
|
-
if (ignore0 && address[pieceIndex] === 0) {
|
|
2652
|
-
continue;
|
|
2653
|
-
} else if (ignore0) {
|
|
2654
|
-
ignore0 = false;
|
|
2655
|
-
}
|
|
2656
|
-
if (compress === pieceIndex) {
|
|
2657
|
-
const separator = pieceIndex === 0 ? "::" : ":";
|
|
2658
|
-
output += separator;
|
|
2659
|
-
ignore0 = true;
|
|
2660
|
-
continue;
|
|
2661
|
-
}
|
|
2662
|
-
output += address[pieceIndex].toString(16);
|
|
2663
|
-
if (pieceIndex !== 7) {
|
|
2664
|
-
output += ":";
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
return output;
|
|
2668
|
-
}
|
|
2669
|
-
function parseHost(input, isNotSpecialArg = false) {
|
|
2670
|
-
if (input[0] === "[") {
|
|
2671
|
-
if (input[input.length - 1] !== "]") {
|
|
2672
|
-
return failure;
|
|
2673
|
-
}
|
|
2674
|
-
return parseIPv6(input.substring(1, input.length - 1));
|
|
2675
|
-
}
|
|
2676
|
-
if (isNotSpecialArg) {
|
|
2677
|
-
return parseOpaqueHost(input);
|
|
2678
|
-
}
|
|
2679
|
-
const domain = percentDecode(Buffer2.from(input)).toString();
|
|
2680
|
-
const asciiDomain = domainToASCII(domain);
|
|
2681
|
-
if (asciiDomain === failure) {
|
|
2682
|
-
return failure;
|
|
2683
|
-
}
|
|
2684
|
-
if (containsForbiddenHostCodePoint(asciiDomain)) {
|
|
2685
|
-
return failure;
|
|
2686
|
-
}
|
|
2687
|
-
const ipv4Host = parseIPv4(asciiDomain);
|
|
2688
|
-
if (typeof ipv4Host === "number" || ipv4Host === failure) {
|
|
2689
|
-
return ipv4Host;
|
|
2690
|
-
}
|
|
2691
|
-
return asciiDomain;
|
|
2692
|
-
}
|
|
2693
|
-
function parseOpaqueHost(input) {
|
|
2694
|
-
if (containsForbiddenHostCodePointExcludingPercent(input)) {
|
|
2695
|
-
return failure;
|
|
2696
|
-
}
|
|
2697
|
-
let output = "";
|
|
2698
|
-
const decoded = punycode2.ucs2.decode(input);
|
|
2699
|
-
for (let i = 0; i < decoded.length; ++i) {
|
|
2700
|
-
output += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
|
2701
|
-
}
|
|
2702
|
-
return output;
|
|
2703
|
-
}
|
|
2704
|
-
function findLongestZeroSequence(arr) {
|
|
2705
|
-
let maxIdx = null;
|
|
2706
|
-
let maxLen = 1;
|
|
2707
|
-
let currStart = null;
|
|
2708
|
-
let currLen = 0;
|
|
2709
|
-
for (let i = 0; i < arr.length; ++i) {
|
|
2710
|
-
if (arr[i] !== 0) {
|
|
2711
|
-
if (currLen > maxLen) {
|
|
2712
|
-
maxIdx = currStart;
|
|
2713
|
-
maxLen = currLen;
|
|
2714
|
-
}
|
|
2715
|
-
currStart = null;
|
|
2716
|
-
currLen = 0;
|
|
2717
|
-
} else {
|
|
2718
|
-
if (currStart === null) {
|
|
2719
|
-
currStart = i;
|
|
2720
|
-
}
|
|
2721
|
-
++currLen;
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
if (currLen > maxLen) {
|
|
2725
|
-
maxIdx = currStart;
|
|
2726
|
-
maxLen = currLen;
|
|
2727
|
-
}
|
|
2728
|
-
return {
|
|
2729
|
-
idx: maxIdx,
|
|
2730
|
-
len: maxLen
|
|
2731
|
-
};
|
|
2732
|
-
}
|
|
2733
|
-
function serializeHost(host) {
|
|
2734
|
-
if (typeof host === "number") {
|
|
2735
|
-
return serializeIPv4(host);
|
|
2736
|
-
}
|
|
2737
|
-
if (host instanceof Array) {
|
|
2738
|
-
return "[" + serializeIPv6(host) + "]";
|
|
2739
|
-
}
|
|
2740
|
-
return host;
|
|
2741
|
-
}
|
|
2742
|
-
function domainToASCII(domain) {
|
|
2743
|
-
const result = domain;
|
|
2744
|
-
if (result === null) {
|
|
2745
|
-
return failure;
|
|
2746
|
-
}
|
|
2747
|
-
return result;
|
|
2748
|
-
}
|
|
2749
|
-
function trimControlChars(url) {
|
|
2750
|
-
return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, "");
|
|
2751
|
-
}
|
|
2752
|
-
function trimTabAndNewline(url) {
|
|
2753
|
-
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
2754
|
-
}
|
|
2755
|
-
function shortenPath(url) {
|
|
2756
|
-
const { path } = url;
|
|
2757
|
-
if (path.length === 0) {
|
|
2758
|
-
return;
|
|
2759
|
-
}
|
|
2760
|
-
if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) {
|
|
2761
|
-
return;
|
|
2762
|
-
}
|
|
2763
|
-
path.pop();
|
|
2764
|
-
}
|
|
2765
|
-
function includesCredentials(url) {
|
|
2766
|
-
return url.username !== "" || url.password !== "";
|
|
2767
|
-
}
|
|
2768
|
-
function cannotHaveAUsernamePasswordPort(url) {
|
|
2769
|
-
return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file";
|
|
2770
|
-
}
|
|
2771
|
-
function isNormalizedWindowsDriveLetter(string) {
|
|
2772
|
-
return /^[A-Za-z]:$/.test(string);
|
|
2773
|
-
}
|
|
2774
|
-
function URLStateMachine(input, base2, encodingOverride, url, stateOverride) {
|
|
2775
|
-
this.pointer = 0;
|
|
2776
|
-
this.input = input;
|
|
2777
|
-
this.base = base2 || null;
|
|
2778
|
-
this.encodingOverride = encodingOverride || "utf-8";
|
|
2779
|
-
this.stateOverride = stateOverride;
|
|
2780
|
-
this.url = url;
|
|
2781
|
-
this.failure = false;
|
|
2782
|
-
this.parseError = false;
|
|
2783
|
-
if (!this.url) {
|
|
2784
|
-
this.url = {
|
|
2785
|
-
scheme: "",
|
|
2786
|
-
username: "",
|
|
2787
|
-
password: "",
|
|
2788
|
-
host: null,
|
|
2789
|
-
port: null,
|
|
2790
|
-
path: [],
|
|
2791
|
-
query: null,
|
|
2792
|
-
fragment: null,
|
|
2793
|
-
cannotBeABaseURL: false
|
|
2794
|
-
};
|
|
2795
|
-
const res2 = trimControlChars(this.input);
|
|
2796
|
-
if (res2 !== this.input) {
|
|
2797
|
-
this.parseError = true;
|
|
2798
|
-
}
|
|
2799
|
-
this.input = res2;
|
|
2800
|
-
}
|
|
2801
|
-
const res = trimTabAndNewline(this.input);
|
|
2802
|
-
if (res !== this.input) {
|
|
2803
|
-
this.parseError = true;
|
|
2804
|
-
}
|
|
2805
|
-
this.input = res;
|
|
2806
|
-
this.state = stateOverride || "scheme start";
|
|
2807
|
-
this.buffer = "";
|
|
2808
|
-
this.atFlag = false;
|
|
2809
|
-
this.arrFlag = false;
|
|
2810
|
-
this.passwordTokenSeenFlag = false;
|
|
2811
|
-
this.input = punycode2.ucs2.decode(this.input);
|
|
2812
|
-
for (; this.pointer <= this.input.length; ++this.pointer) {
|
|
2813
|
-
const c = this.input[this.pointer];
|
|
2814
|
-
const cStr = isNaN(c) ? void 0 : String.fromCodePoint(c);
|
|
2815
|
-
const ret = this["parse " + this.state](c, cStr);
|
|
2816
|
-
if (!ret) {
|
|
2817
|
-
break;
|
|
2818
|
-
} else if (ret === failure) {
|
|
2819
|
-
this.failure = true;
|
|
2820
|
-
break;
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) {
|
|
2825
|
-
if (infra.isASCIIAlpha(c)) {
|
|
2826
|
-
this.buffer += cStr.toLowerCase();
|
|
2827
|
-
this.state = "scheme";
|
|
2828
|
-
} else if (!this.stateOverride) {
|
|
2829
|
-
this.state = "no scheme";
|
|
2830
|
-
--this.pointer;
|
|
2831
|
-
} else {
|
|
2832
|
-
this.parseError = true;
|
|
2833
|
-
return failure;
|
|
2834
|
-
}
|
|
2835
|
-
return true;
|
|
2836
|
-
};
|
|
2837
|
-
URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) {
|
|
2838
|
-
if (infra.isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) {
|
|
2839
|
-
this.buffer += cStr.toLowerCase();
|
|
2840
|
-
} else if (c === 58) {
|
|
2841
|
-
if (this.stateOverride) {
|
|
2842
|
-
if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) {
|
|
2843
|
-
return false;
|
|
2844
|
-
}
|
|
2845
|
-
if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {
|
|
2846
|
-
return false;
|
|
2847
|
-
}
|
|
2848
|
-
if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") {
|
|
2849
|
-
return false;
|
|
2850
|
-
}
|
|
2851
|
-
if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) {
|
|
2852
|
-
return false;
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
this.url.scheme = this.buffer;
|
|
2856
|
-
if (this.stateOverride) {
|
|
2857
|
-
if (this.url.port === defaultPort(this.url.scheme)) {
|
|
2858
|
-
this.url.port = null;
|
|
2859
|
-
}
|
|
2860
|
-
return false;
|
|
2861
|
-
}
|
|
2862
|
-
this.buffer = "";
|
|
2863
|
-
if (this.url.scheme === "file") {
|
|
2864
|
-
if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) {
|
|
2865
|
-
this.parseError = true;
|
|
2866
|
-
}
|
|
2867
|
-
this.state = "file";
|
|
2868
|
-
} else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) {
|
|
2869
|
-
this.state = "special relative or authority";
|
|
2870
|
-
} else if (isSpecial(this.url)) {
|
|
2871
|
-
this.state = "special authority slashes";
|
|
2872
|
-
} else if (this.input[this.pointer + 1] === 47) {
|
|
2873
|
-
this.state = "path or authority";
|
|
2874
|
-
++this.pointer;
|
|
2875
|
-
} else {
|
|
2876
|
-
this.url.cannotBeABaseURL = true;
|
|
2877
|
-
this.url.path.push("");
|
|
2878
|
-
this.state = "cannot-be-a-base-URL path";
|
|
2879
|
-
}
|
|
2880
|
-
} else if (!this.stateOverride) {
|
|
2881
|
-
this.buffer = "";
|
|
2882
|
-
this.state = "no scheme";
|
|
2883
|
-
this.pointer = -1;
|
|
2884
|
-
} else {
|
|
2885
|
-
this.parseError = true;
|
|
2886
|
-
return failure;
|
|
2887
|
-
}
|
|
2888
|
-
return true;
|
|
2889
|
-
};
|
|
2890
|
-
URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) {
|
|
2891
|
-
if (this.base === null || this.base.cannotBeABaseURL && c !== 35) {
|
|
2892
|
-
return failure;
|
|
2893
|
-
} else if (this.base.cannotBeABaseURL && c === 35) {
|
|
2894
|
-
this.url.scheme = this.base.scheme;
|
|
2895
|
-
this.url.path = this.base.path.slice();
|
|
2896
|
-
this.url.query = this.base.query;
|
|
2897
|
-
this.url.fragment = "";
|
|
2898
|
-
this.url.cannotBeABaseURL = true;
|
|
2899
|
-
this.state = "fragment";
|
|
2900
|
-
} else if (this.base.scheme === "file") {
|
|
2901
|
-
this.state = "file";
|
|
2902
|
-
--this.pointer;
|
|
2903
|
-
} else {
|
|
2904
|
-
this.state = "relative";
|
|
2905
|
-
--this.pointer;
|
|
2906
|
-
}
|
|
2907
|
-
return true;
|
|
2908
|
-
};
|
|
2909
|
-
URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) {
|
|
2910
|
-
if (c === 47 && this.input[this.pointer + 1] === 47) {
|
|
2911
|
-
this.state = "special authority ignore slashes";
|
|
2912
|
-
++this.pointer;
|
|
2913
|
-
} else {
|
|
2914
|
-
this.parseError = true;
|
|
2915
|
-
this.state = "relative";
|
|
2916
|
-
--this.pointer;
|
|
2917
|
-
}
|
|
2918
|
-
return true;
|
|
2919
|
-
};
|
|
2920
|
-
URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) {
|
|
2921
|
-
if (c === 47) {
|
|
2922
|
-
this.state = "authority";
|
|
2923
|
-
} else {
|
|
2924
|
-
this.state = "path";
|
|
2925
|
-
--this.pointer;
|
|
2926
|
-
}
|
|
2927
|
-
return true;
|
|
2928
|
-
};
|
|
2929
|
-
URLStateMachine.prototype["parse relative"] = function parseRelative(c) {
|
|
2930
|
-
this.url.scheme = this.base.scheme;
|
|
2931
|
-
if (isNaN(c)) {
|
|
2932
|
-
this.url.username = this.base.username;
|
|
2933
|
-
this.url.password = this.base.password;
|
|
2934
|
-
this.url.host = this.base.host;
|
|
2935
|
-
this.url.port = this.base.port;
|
|
2936
|
-
this.url.path = this.base.path.slice();
|
|
2937
|
-
this.url.query = this.base.query;
|
|
2938
|
-
} else if (c === 47) {
|
|
2939
|
-
this.state = "relative slash";
|
|
2940
|
-
} else if (c === 63) {
|
|
2941
|
-
this.url.username = this.base.username;
|
|
2942
|
-
this.url.password = this.base.password;
|
|
2943
|
-
this.url.host = this.base.host;
|
|
2944
|
-
this.url.port = this.base.port;
|
|
2945
|
-
this.url.path = this.base.path.slice();
|
|
2946
|
-
this.url.query = "";
|
|
2947
|
-
this.state = "query";
|
|
2948
|
-
} else if (c === 35) {
|
|
2949
|
-
this.url.username = this.base.username;
|
|
2950
|
-
this.url.password = this.base.password;
|
|
2951
|
-
this.url.host = this.base.host;
|
|
2952
|
-
this.url.port = this.base.port;
|
|
2953
|
-
this.url.path = this.base.path.slice();
|
|
2954
|
-
this.url.query = this.base.query;
|
|
2955
|
-
this.url.fragment = "";
|
|
2956
|
-
this.state = "fragment";
|
|
2957
|
-
} else if (isSpecial(this.url) && c === 92) {
|
|
2958
|
-
this.parseError = true;
|
|
2959
|
-
this.state = "relative slash";
|
|
2960
|
-
} else {
|
|
2961
|
-
this.url.username = this.base.username;
|
|
2962
|
-
this.url.password = this.base.password;
|
|
2963
|
-
this.url.host = this.base.host;
|
|
2964
|
-
this.url.port = this.base.port;
|
|
2965
|
-
this.url.path = this.base.path.slice(0, this.base.path.length - 1);
|
|
2966
|
-
this.state = "path";
|
|
2967
|
-
--this.pointer;
|
|
2968
|
-
}
|
|
2969
|
-
return true;
|
|
2970
|
-
};
|
|
2971
|
-
URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) {
|
|
2972
|
-
if (isSpecial(this.url) && (c === 47 || c === 92)) {
|
|
2973
|
-
if (c === 92) {
|
|
2974
|
-
this.parseError = true;
|
|
2975
|
-
}
|
|
2976
|
-
this.state = "special authority ignore slashes";
|
|
2977
|
-
} else if (c === 47) {
|
|
2978
|
-
this.state = "authority";
|
|
2979
|
-
} else {
|
|
2980
|
-
this.url.username = this.base.username;
|
|
2981
|
-
this.url.password = this.base.password;
|
|
2982
|
-
this.url.host = this.base.host;
|
|
2983
|
-
this.url.port = this.base.port;
|
|
2984
|
-
this.state = "path";
|
|
2985
|
-
--this.pointer;
|
|
2986
|
-
}
|
|
2987
|
-
return true;
|
|
2988
|
-
};
|
|
2989
|
-
URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) {
|
|
2990
|
-
if (c === 47 && this.input[this.pointer + 1] === 47) {
|
|
2991
|
-
this.state = "special authority ignore slashes";
|
|
2992
|
-
++this.pointer;
|
|
2993
|
-
} else {
|
|
2994
|
-
this.parseError = true;
|
|
2995
|
-
this.state = "special authority ignore slashes";
|
|
2996
|
-
--this.pointer;
|
|
2997
|
-
}
|
|
2998
|
-
return true;
|
|
2999
|
-
};
|
|
3000
|
-
URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) {
|
|
3001
|
-
if (c !== 47 && c !== 92) {
|
|
3002
|
-
this.state = "authority";
|
|
3003
|
-
--this.pointer;
|
|
3004
|
-
} else {
|
|
3005
|
-
this.parseError = true;
|
|
3006
|
-
}
|
|
3007
|
-
return true;
|
|
3008
|
-
};
|
|
3009
|
-
URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) {
|
|
3010
|
-
if (c === 64) {
|
|
3011
|
-
this.parseError = true;
|
|
3012
|
-
if (this.atFlag) {
|
|
3013
|
-
this.buffer = "%40" + this.buffer;
|
|
3014
|
-
}
|
|
3015
|
-
this.atFlag = true;
|
|
3016
|
-
const len = countSymbols(this.buffer);
|
|
3017
|
-
for (let pointer = 0; pointer < len; ++pointer) {
|
|
3018
|
-
const codePoint = this.buffer.codePointAt(pointer);
|
|
3019
|
-
if (codePoint === 58 && !this.passwordTokenSeenFlag) {
|
|
3020
|
-
this.passwordTokenSeenFlag = true;
|
|
3021
|
-
continue;
|
|
3022
|
-
}
|
|
3023
|
-
const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode);
|
|
3024
|
-
if (this.passwordTokenSeenFlag) {
|
|
3025
|
-
this.url.password += encodedCodePoints;
|
|
3026
|
-
} else {
|
|
3027
|
-
this.url.username += encodedCodePoints;
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
this.buffer = "";
|
|
3031
|
-
} else if (isNaN(c) || c === 47 || c === 63 || c === 35 || isSpecial(this.url) && c === 92) {
|
|
3032
|
-
if (this.atFlag && this.buffer === "") {
|
|
3033
|
-
this.parseError = true;
|
|
3034
|
-
return failure;
|
|
3035
|
-
}
|
|
3036
|
-
this.pointer -= countSymbols(this.buffer) + 1;
|
|
3037
|
-
this.buffer = "";
|
|
3038
|
-
this.state = "host";
|
|
3039
|
-
} else {
|
|
3040
|
-
this.buffer += cStr;
|
|
3041
|
-
}
|
|
3042
|
-
return true;
|
|
3043
|
-
};
|
|
3044
|
-
URLStateMachine.prototype["parse hostname"] = URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) {
|
|
3045
|
-
if (this.stateOverride && this.url.scheme === "file") {
|
|
3046
|
-
--this.pointer;
|
|
3047
|
-
this.state = "file host";
|
|
3048
|
-
} else if (c === 58 && !this.arrFlag) {
|
|
3049
|
-
if (this.buffer === "") {
|
|
3050
|
-
this.parseError = true;
|
|
3051
|
-
return failure;
|
|
3052
|
-
}
|
|
3053
|
-
const host = parseHost(this.buffer, isNotSpecial(this.url));
|
|
3054
|
-
if (host === failure) {
|
|
3055
|
-
return failure;
|
|
3056
|
-
}
|
|
3057
|
-
this.url.host = host;
|
|
3058
|
-
this.buffer = "";
|
|
3059
|
-
this.state = "port";
|
|
3060
|
-
if (this.stateOverride === "hostname") {
|
|
3061
|
-
return false;
|
|
3062
|
-
}
|
|
3063
|
-
} else if (isNaN(c) || c === 47 || c === 63 || c === 35 || isSpecial(this.url) && c === 92) {
|
|
3064
|
-
--this.pointer;
|
|
3065
|
-
if (isSpecial(this.url) && this.buffer === "") {
|
|
3066
|
-
this.parseError = true;
|
|
3067
|
-
return failure;
|
|
3068
|
-
} else if (this.stateOverride && this.buffer === "" && (includesCredentials(this.url) || this.url.port !== null)) {
|
|
3069
|
-
this.parseError = true;
|
|
3070
|
-
return false;
|
|
3071
|
-
}
|
|
3072
|
-
const host = parseHost(this.buffer, isNotSpecial(this.url));
|
|
3073
|
-
if (host === failure) {
|
|
3074
|
-
return failure;
|
|
3075
|
-
}
|
|
3076
|
-
this.url.host = host;
|
|
3077
|
-
this.buffer = "";
|
|
3078
|
-
this.state = "path start";
|
|
3079
|
-
if (this.stateOverride) {
|
|
3080
|
-
return false;
|
|
3081
|
-
}
|
|
3082
|
-
} else {
|
|
3083
|
-
if (c === 91) {
|
|
3084
|
-
this.arrFlag = true;
|
|
3085
|
-
} else if (c === 93) {
|
|
3086
|
-
this.arrFlag = false;
|
|
3087
|
-
}
|
|
3088
|
-
this.buffer += cStr;
|
|
3089
|
-
}
|
|
3090
|
-
return true;
|
|
3091
|
-
};
|
|
3092
|
-
URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) {
|
|
3093
|
-
if (infra.isASCIIDigit(c)) {
|
|
3094
|
-
this.buffer += cStr;
|
|
3095
|
-
} else if (isNaN(c) || c === 47 || c === 63 || c === 35 || isSpecial(this.url) && c === 92 || this.stateOverride) {
|
|
3096
|
-
if (this.buffer !== "") {
|
|
3097
|
-
const port = parseInt(this.buffer);
|
|
3098
|
-
if (port > Math.pow(2, 16) - 1) {
|
|
3099
|
-
this.parseError = true;
|
|
3100
|
-
return failure;
|
|
3101
|
-
}
|
|
3102
|
-
this.url.port = port === defaultPort(this.url.scheme) ? null : port;
|
|
3103
|
-
this.buffer = "";
|
|
3104
|
-
}
|
|
3105
|
-
if (this.stateOverride) {
|
|
3106
|
-
return false;
|
|
3107
|
-
}
|
|
3108
|
-
this.state = "path start";
|
|
3109
|
-
--this.pointer;
|
|
3110
|
-
} else {
|
|
3111
|
-
this.parseError = true;
|
|
3112
|
-
return failure;
|
|
3113
|
-
}
|
|
3114
|
-
return true;
|
|
3115
|
-
};
|
|
3116
|
-
var fileOtherwiseCodePoints = /* @__PURE__ */ new Set([47, 92, 63, 35]);
|
|
3117
|
-
function startsWithWindowsDriveLetter(input, pointer) {
|
|
3118
|
-
const length = input.length - pointer;
|
|
3119
|
-
return length >= 2 && isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) && (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2]));
|
|
3120
|
-
}
|
|
3121
|
-
URLStateMachine.prototype["parse file"] = function parseFile(c) {
|
|
3122
|
-
this.url.scheme = "file";
|
|
3123
|
-
if (c === 47 || c === 92) {
|
|
3124
|
-
if (c === 92) {
|
|
3125
|
-
this.parseError = true;
|
|
3126
|
-
}
|
|
3127
|
-
this.state = "file slash";
|
|
3128
|
-
} else if (this.base !== null && this.base.scheme === "file") {
|
|
3129
|
-
if (isNaN(c)) {
|
|
3130
|
-
this.url.host = this.base.host;
|
|
3131
|
-
this.url.path = this.base.path.slice();
|
|
3132
|
-
this.url.query = this.base.query;
|
|
3133
|
-
} else if (c === 63) {
|
|
3134
|
-
this.url.host = this.base.host;
|
|
3135
|
-
this.url.path = this.base.path.slice();
|
|
3136
|
-
this.url.query = "";
|
|
3137
|
-
this.state = "query";
|
|
3138
|
-
} else if (c === 35) {
|
|
3139
|
-
this.url.host = this.base.host;
|
|
3140
|
-
this.url.path = this.base.path.slice();
|
|
3141
|
-
this.url.query = this.base.query;
|
|
3142
|
-
this.url.fragment = "";
|
|
3143
|
-
this.state = "fragment";
|
|
3144
|
-
} else {
|
|
3145
|
-
if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {
|
|
3146
|
-
this.url.host = this.base.host;
|
|
3147
|
-
this.url.path = this.base.path.slice();
|
|
3148
|
-
shortenPath(this.url);
|
|
3149
|
-
} else {
|
|
3150
|
-
this.parseError = true;
|
|
3151
|
-
}
|
|
3152
|
-
this.state = "path";
|
|
3153
|
-
--this.pointer;
|
|
3154
|
-
}
|
|
3155
|
-
} else {
|
|
3156
|
-
this.state = "path";
|
|
3157
|
-
--this.pointer;
|
|
3158
|
-
}
|
|
3159
|
-
return true;
|
|
3160
|
-
};
|
|
3161
|
-
URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) {
|
|
3162
|
-
if (c === 47 || c === 92) {
|
|
3163
|
-
if (c === 92) {
|
|
3164
|
-
this.parseError = true;
|
|
3165
|
-
}
|
|
3166
|
-
this.state = "file host";
|
|
3167
|
-
} else {
|
|
3168
|
-
if (this.base !== null && this.base.scheme === "file" && !startsWithWindowsDriveLetter(this.input, this.pointer)) {
|
|
3169
|
-
if (isNormalizedWindowsDriveLetterString(this.base.path[0])) {
|
|
3170
|
-
this.url.path.push(this.base.path[0]);
|
|
3171
|
-
} else {
|
|
3172
|
-
this.url.host = this.base.host;
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
this.state = "path";
|
|
3176
|
-
--this.pointer;
|
|
3177
|
-
}
|
|
3178
|
-
return true;
|
|
3179
|
-
};
|
|
3180
|
-
URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) {
|
|
3181
|
-
if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) {
|
|
3182
|
-
--this.pointer;
|
|
3183
|
-
if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) {
|
|
3184
|
-
this.parseError = true;
|
|
3185
|
-
this.state = "path";
|
|
3186
|
-
} else if (this.buffer === "") {
|
|
3187
|
-
this.url.host = "";
|
|
3188
|
-
if (this.stateOverride) {
|
|
3189
|
-
return false;
|
|
3190
|
-
}
|
|
3191
|
-
this.state = "path start";
|
|
3192
|
-
} else {
|
|
3193
|
-
let host = parseHost(this.buffer, isNotSpecial(this.url));
|
|
3194
|
-
if (host === failure) {
|
|
3195
|
-
return failure;
|
|
3196
|
-
}
|
|
3197
|
-
if (host === "localhost") {
|
|
3198
|
-
host = "";
|
|
3199
|
-
}
|
|
3200
|
-
this.url.host = host;
|
|
3201
|
-
if (this.stateOverride) {
|
|
3202
|
-
return false;
|
|
3203
|
-
}
|
|
3204
|
-
this.buffer = "";
|
|
3205
|
-
this.state = "path start";
|
|
3206
|
-
}
|
|
3207
|
-
} else {
|
|
3208
|
-
this.buffer += cStr;
|
|
3209
|
-
}
|
|
3210
|
-
return true;
|
|
3211
|
-
};
|
|
3212
|
-
URLStateMachine.prototype["parse path start"] = function parsePathStart(c) {
|
|
3213
|
-
if (isSpecial(this.url)) {
|
|
3214
|
-
if (c === 92) {
|
|
3215
|
-
this.parseError = true;
|
|
3216
|
-
}
|
|
3217
|
-
this.state = "path";
|
|
3218
|
-
if (c !== 47 && c !== 92) {
|
|
3219
|
-
--this.pointer;
|
|
3220
|
-
}
|
|
3221
|
-
} else if (!this.stateOverride && c === 63) {
|
|
3222
|
-
this.url.query = "";
|
|
3223
|
-
this.state = "query";
|
|
3224
|
-
} else if (!this.stateOverride && c === 35) {
|
|
3225
|
-
this.url.fragment = "";
|
|
3226
|
-
this.state = "fragment";
|
|
3227
|
-
} else if (c !== void 0) {
|
|
3228
|
-
this.state = "path";
|
|
3229
|
-
if (c !== 47) {
|
|
3230
|
-
--this.pointer;
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
return true;
|
|
3234
|
-
};
|
|
3235
|
-
URLStateMachine.prototype["parse path"] = function parsePath(c) {
|
|
3236
|
-
if (isNaN(c) || c === 47 || isSpecial(this.url) && c === 92 || !this.stateOverride && (c === 63 || c === 35)) {
|
|
3237
|
-
if (isSpecial(this.url) && c === 92) {
|
|
3238
|
-
this.parseError = true;
|
|
3239
|
-
}
|
|
3240
|
-
if (isDoubleDot(this.buffer)) {
|
|
3241
|
-
shortenPath(this.url);
|
|
3242
|
-
if (c !== 47 && !(isSpecial(this.url) && c === 92)) {
|
|
3243
|
-
this.url.path.push("");
|
|
3244
|
-
}
|
|
3245
|
-
} else if (isSingleDot(this.buffer) && c !== 47 && !(isSpecial(this.url) && c === 92)) {
|
|
3246
|
-
this.url.path.push("");
|
|
3247
|
-
} else if (!isSingleDot(this.buffer)) {
|
|
3248
|
-
if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) {
|
|
3249
|
-
if (this.url.host !== "" && this.url.host !== null) {
|
|
3250
|
-
this.parseError = true;
|
|
3251
|
-
this.url.host = "";
|
|
3252
|
-
}
|
|
3253
|
-
this.buffer = this.buffer[0] + ":";
|
|
3254
|
-
}
|
|
3255
|
-
this.url.path.push(this.buffer);
|
|
3256
|
-
}
|
|
3257
|
-
this.buffer = "";
|
|
3258
|
-
if (this.url.scheme === "file" && (c === void 0 || c === 63 || c === 35)) {
|
|
3259
|
-
while (this.url.path.length > 1 && this.url.path[0] === "") {
|
|
3260
|
-
this.parseError = true;
|
|
3261
|
-
this.url.path.shift();
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
|
-
if (c === 63) {
|
|
3265
|
-
this.url.query = "";
|
|
3266
|
-
this.state = "query";
|
|
3267
|
-
}
|
|
3268
|
-
if (c === 35) {
|
|
3269
|
-
this.url.fragment = "";
|
|
3270
|
-
this.state = "fragment";
|
|
3271
|
-
}
|
|
3272
|
-
} else {
|
|
3273
|
-
if (c === 37 && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
|
|
3274
|
-
this.parseError = true;
|
|
3275
|
-
}
|
|
3276
|
-
this.buffer += percentEncodeChar(c, isPathPercentEncode);
|
|
3277
|
-
}
|
|
3278
|
-
return true;
|
|
3279
|
-
};
|
|
3280
|
-
URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) {
|
|
3281
|
-
if (c === 63) {
|
|
3282
|
-
this.url.query = "";
|
|
3283
|
-
this.state = "query";
|
|
3284
|
-
} else if (c === 35) {
|
|
3285
|
-
this.url.fragment = "";
|
|
3286
|
-
this.state = "fragment";
|
|
3287
|
-
} else {
|
|
3288
|
-
if (!isNaN(c) && c !== 37) {
|
|
3289
|
-
this.parseError = true;
|
|
3290
|
-
}
|
|
3291
|
-
if (c === 37 && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
|
|
3292
|
-
this.parseError = true;
|
|
3293
|
-
}
|
|
3294
|
-
if (!isNaN(c)) {
|
|
3295
|
-
this.url.path[0] += percentEncodeChar(c, isC0ControlPercentEncode);
|
|
3296
|
-
}
|
|
3297
|
-
}
|
|
3298
|
-
return true;
|
|
3299
|
-
};
|
|
3300
|
-
URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) {
|
|
3301
|
-
if (isNaN(c) || !this.stateOverride && c === 35) {
|
|
3302
|
-
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") {
|
|
3303
|
-
this.encodingOverride = "utf-8";
|
|
3304
|
-
}
|
|
3305
|
-
const buffer = Buffer2.from(this.buffer);
|
|
3306
|
-
for (let i = 0; i < buffer.length; ++i) {
|
|
3307
|
-
if (buffer[i] < 33 || buffer[i] > 126 || buffer[i] === 34 || buffer[i] === 35 || buffer[i] === 60 || buffer[i] === 62 || buffer[i] === 39 && isSpecial(this.url)) {
|
|
3308
|
-
this.url.query += percentEncode(buffer[i]);
|
|
3309
|
-
} else {
|
|
3310
|
-
this.url.query += String.fromCodePoint(buffer[i]);
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
this.buffer = "";
|
|
3314
|
-
if (c === 35) {
|
|
3315
|
-
this.url.fragment = "";
|
|
3316
|
-
this.state = "fragment";
|
|
3317
|
-
}
|
|
3318
|
-
} else {
|
|
3319
|
-
if (c === 37 && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
|
|
3320
|
-
this.parseError = true;
|
|
3321
|
-
}
|
|
3322
|
-
this.buffer += cStr;
|
|
3323
|
-
}
|
|
3324
|
-
return true;
|
|
3325
|
-
};
|
|
3326
|
-
URLStateMachine.prototype["parse fragment"] = function parseFragment(c) {
|
|
3327
|
-
if (isNaN(c)) {
|
|
3328
|
-
} else if (c === 0) {
|
|
3329
|
-
this.parseError = true;
|
|
3330
|
-
} else {
|
|
3331
|
-
if (c === 37 && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
|
|
3332
|
-
this.parseError = true;
|
|
3333
|
-
}
|
|
3334
|
-
this.url.fragment += percentEncodeChar(c, isFragmentPercentEncode);
|
|
3335
|
-
}
|
|
3336
|
-
return true;
|
|
3337
|
-
};
|
|
3338
|
-
function serializeURL(url, excludeFragment) {
|
|
3339
|
-
let output = url.scheme + ":";
|
|
3340
|
-
if (url.host !== null) {
|
|
3341
|
-
output += "//";
|
|
3342
|
-
if (url.username !== "" || url.password !== "") {
|
|
3343
|
-
output += url.username;
|
|
3344
|
-
if (url.password !== "") {
|
|
3345
|
-
output += ":" + url.password;
|
|
3346
|
-
}
|
|
3347
|
-
output += "@";
|
|
3348
|
-
}
|
|
3349
|
-
output += serializeHost(url.host);
|
|
3350
|
-
if (url.port !== null) {
|
|
3351
|
-
output += ":" + url.port;
|
|
3352
|
-
}
|
|
3353
|
-
} else if (url.host === null && url.scheme === "file") {
|
|
3354
|
-
output += "//";
|
|
3355
|
-
}
|
|
3356
|
-
if (url.cannotBeABaseURL) {
|
|
3357
|
-
output += url.path[0];
|
|
3358
|
-
} else {
|
|
3359
|
-
for (const string of url.path) {
|
|
3360
|
-
output += "/" + string;
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
if (url.query !== null) {
|
|
3364
|
-
output += "?" + url.query;
|
|
3365
|
-
}
|
|
3366
|
-
if (!excludeFragment && url.fragment !== null) {
|
|
3367
|
-
output += "#" + url.fragment;
|
|
3368
|
-
}
|
|
3369
|
-
return output;
|
|
3370
|
-
}
|
|
3371
|
-
function serializeOrigin(tuple) {
|
|
3372
|
-
let result = tuple.scheme + "://";
|
|
3373
|
-
result += serializeHost(tuple.host);
|
|
3374
|
-
if (tuple.port !== null) {
|
|
3375
|
-
result += ":" + tuple.port;
|
|
3376
|
-
}
|
|
3377
|
-
return result;
|
|
3378
|
-
}
|
|
3379
|
-
module.exports.serializeURL = serializeURL;
|
|
3380
|
-
module.exports.serializeURLOrigin = function(url) {
|
|
3381
|
-
switch (url.scheme) {
|
|
3382
|
-
case "blob":
|
|
3383
|
-
try {
|
|
3384
|
-
return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0]));
|
|
3385
|
-
} catch (e) {
|
|
3386
|
-
return "null";
|
|
3387
|
-
}
|
|
3388
|
-
case "ftp":
|
|
3389
|
-
case "http":
|
|
3390
|
-
case "https":
|
|
3391
|
-
case "ws":
|
|
3392
|
-
case "wss":
|
|
3393
|
-
return serializeOrigin({
|
|
3394
|
-
scheme: url.scheme,
|
|
3395
|
-
host: url.host,
|
|
3396
|
-
port: url.port
|
|
3397
|
-
});
|
|
3398
|
-
case "file":
|
|
3399
|
-
return "null";
|
|
3400
|
-
default:
|
|
3401
|
-
return "null";
|
|
3402
|
-
}
|
|
3403
|
-
};
|
|
3404
|
-
module.exports.basicURLParse = function(input, options) {
|
|
3405
|
-
if (options === void 0) {
|
|
3406
|
-
options = {};
|
|
3407
|
-
}
|
|
3408
|
-
const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride);
|
|
3409
|
-
if (usm.failure) {
|
|
3410
|
-
return null;
|
|
3411
|
-
}
|
|
3412
|
-
return usm.url;
|
|
3413
|
-
};
|
|
3414
|
-
module.exports.setTheUsername = function(url, username) {
|
|
3415
|
-
url.username = "";
|
|
3416
|
-
const decoded = punycode2.ucs2.decode(username);
|
|
3417
|
-
for (let i = 0; i < decoded.length; ++i) {
|
|
3418
|
-
url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
|
3419
|
-
}
|
|
3420
|
-
};
|
|
3421
|
-
module.exports.setThePassword = function(url, password) {
|
|
3422
|
-
url.password = "";
|
|
3423
|
-
const decoded = punycode2.ucs2.decode(password);
|
|
3424
|
-
for (let i = 0; i < decoded.length; ++i) {
|
|
3425
|
-
url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
|
3426
|
-
}
|
|
3427
|
-
};
|
|
3428
|
-
module.exports.serializeHost = serializeHost;
|
|
3429
|
-
module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort;
|
|
3430
|
-
module.exports.serializeInteger = function(integer) {
|
|
3431
|
-
return String(integer);
|
|
3432
|
-
};
|
|
3433
|
-
module.exports.parseURL = function(input, options) {
|
|
3434
|
-
if (options === void 0) {
|
|
3435
|
-
options = {};
|
|
3436
|
-
}
|
|
3437
|
-
return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
|
|
3438
|
-
};
|
|
3439
|
-
}
|
|
3440
|
-
});
|
|
3441
|
-
|
|
3442
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URLSearchParams-impl.js
|
|
3443
|
-
var require_URLSearchParams_impl = __commonJS({
|
|
3444
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URLSearchParams-impl.js"(exports) {
|
|
3445
|
-
"use strict";
|
|
3446
|
-
var urlencoded = require_urlencoded();
|
|
3447
|
-
function stableSortBy(arr, compare) {
|
|
3448
|
-
return arr.map((item, index) => ({ item, index })).sort((a, b) => compare(a.item, b.item) || a.index - b.index).map(({ item }) => item);
|
|
3449
|
-
}
|
|
3450
|
-
exports.implementation = class URLSearchParamsImpl {
|
|
3451
|
-
constructor(globalObject, constructorArgs, { doNotStripQMark = false }) {
|
|
3452
|
-
let init = constructorArgs[0];
|
|
3453
|
-
this._list = [];
|
|
3454
|
-
this._url = null;
|
|
3455
|
-
if (!doNotStripQMark && typeof init === "string" && init[0] === "?") {
|
|
3456
|
-
init = init.slice(1);
|
|
3457
|
-
}
|
|
3458
|
-
if (Array.isArray(init)) {
|
|
3459
|
-
for (const pair of init) {
|
|
3460
|
-
if (pair.length !== 2) {
|
|
3461
|
-
throw new TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");
|
|
3462
|
-
}
|
|
3463
|
-
this._list.push([pair[0], pair[1]]);
|
|
3464
|
-
}
|
|
3465
|
-
} else if (typeof init === "object" && Object.getPrototypeOf(init) === null) {
|
|
3466
|
-
for (const name of Object.keys(init)) {
|
|
3467
|
-
const value = init[name];
|
|
3468
|
-
this._list.push([name, value]);
|
|
3469
|
-
}
|
|
3470
|
-
} else {
|
|
3471
|
-
this._list = urlencoded.parseUrlencoded(init);
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
_updateSteps() {
|
|
3475
|
-
if (this._url !== null) {
|
|
3476
|
-
let query = urlencoded.serializeUrlencoded(this._list);
|
|
3477
|
-
if (query === "") {
|
|
3478
|
-
query = null;
|
|
3479
|
-
}
|
|
3480
|
-
this._url._url.query = query;
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
append(name, value) {
|
|
3484
|
-
this._list.push([name, value]);
|
|
3485
|
-
this._updateSteps();
|
|
3486
|
-
}
|
|
3487
|
-
delete(name) {
|
|
3488
|
-
let i = 0;
|
|
3489
|
-
while (i < this._list.length) {
|
|
3490
|
-
if (this._list[i][0] === name) {
|
|
3491
|
-
this._list.splice(i, 1);
|
|
3492
|
-
} else {
|
|
3493
|
-
i++;
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
this._updateSteps();
|
|
3497
|
-
}
|
|
3498
|
-
get(name) {
|
|
3499
|
-
for (const tuple of this._list) {
|
|
3500
|
-
if (tuple[0] === name) {
|
|
3501
|
-
return tuple[1];
|
|
3502
|
-
}
|
|
3503
|
-
}
|
|
3504
|
-
return null;
|
|
3505
|
-
}
|
|
3506
|
-
getAll(name) {
|
|
3507
|
-
const output = [];
|
|
3508
|
-
for (const tuple of this._list) {
|
|
3509
|
-
if (tuple[0] === name) {
|
|
3510
|
-
output.push(tuple[1]);
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
return output;
|
|
3514
|
-
}
|
|
3515
|
-
has(name) {
|
|
3516
|
-
for (const tuple of this._list) {
|
|
3517
|
-
if (tuple[0] === name) {
|
|
3518
|
-
return true;
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
return false;
|
|
3522
|
-
}
|
|
3523
|
-
set(name, value) {
|
|
3524
|
-
let found = false;
|
|
3525
|
-
let i = 0;
|
|
3526
|
-
while (i < this._list.length) {
|
|
3527
|
-
if (this._list[i][0] === name) {
|
|
3528
|
-
if (found) {
|
|
3529
|
-
this._list.splice(i, 1);
|
|
3530
|
-
} else {
|
|
3531
|
-
found = true;
|
|
3532
|
-
this._list[i][1] = value;
|
|
3533
|
-
i++;
|
|
3534
|
-
}
|
|
3535
|
-
} else {
|
|
3536
|
-
i++;
|
|
3537
|
-
}
|
|
3538
|
-
}
|
|
3539
|
-
if (!found) {
|
|
3540
|
-
this._list.push([name, value]);
|
|
3541
|
-
}
|
|
3542
|
-
this._updateSteps();
|
|
3543
|
-
}
|
|
3544
|
-
sort() {
|
|
3545
|
-
this._list = stableSortBy(this._list, (a, b) => a[0] > b[0]);
|
|
3546
|
-
this._updateSteps();
|
|
3547
|
-
}
|
|
3548
|
-
[Symbol.iterator]() {
|
|
3549
|
-
return this._list[Symbol.iterator]();
|
|
3550
|
-
}
|
|
3551
|
-
toString() {
|
|
3552
|
-
return urlencoded.serializeUrlencoded(this._list);
|
|
3553
|
-
}
|
|
3554
|
-
};
|
|
3555
|
-
}
|
|
3556
|
-
});
|
|
3557
|
-
|
|
3558
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URLSearchParams.js
|
|
3559
|
-
var require_URLSearchParams = __commonJS({
|
|
3560
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URLSearchParams.js"(exports, module) {
|
|
3561
|
-
"use strict";
|
|
3562
|
-
var conversions = require_lib();
|
|
3563
|
-
var utils = require_utils();
|
|
3564
|
-
var impl = utils.implSymbol;
|
|
3565
|
-
var ctorRegistry = utils.ctorRegistrySymbol;
|
|
3566
|
-
var IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
|
3567
|
-
next: {
|
|
3568
|
-
value: function next() {
|
|
3569
|
-
const internal = this[utils.iterInternalSymbol];
|
|
3570
|
-
const { target, kind, index } = internal;
|
|
3571
|
-
const values = Array.from(target[impl]);
|
|
3572
|
-
const len = values.length;
|
|
3573
|
-
if (index >= len) {
|
|
3574
|
-
return { value: void 0, done: true };
|
|
3575
|
-
}
|
|
3576
|
-
const pair = values[index];
|
|
3577
|
-
internal.index = index + 1;
|
|
3578
|
-
const [key, value] = pair.map(utils.tryWrapperForImpl);
|
|
3579
|
-
let result;
|
|
3580
|
-
switch (kind) {
|
|
3581
|
-
case "key":
|
|
3582
|
-
result = key;
|
|
3583
|
-
break;
|
|
3584
|
-
case "value":
|
|
3585
|
-
result = value;
|
|
3586
|
-
break;
|
|
3587
|
-
case "key+value":
|
|
3588
|
-
result = [key, value];
|
|
3589
|
-
break;
|
|
3590
|
-
}
|
|
3591
|
-
return { value: result, done: false };
|
|
3592
|
-
},
|
|
3593
|
-
writable: true,
|
|
3594
|
-
enumerable: true,
|
|
3595
|
-
configurable: true
|
|
3596
|
-
},
|
|
3597
|
-
[Symbol.toStringTag]: {
|
|
3598
|
-
value: "URLSearchParams Iterator",
|
|
3599
|
-
configurable: true
|
|
3600
|
-
}
|
|
3601
|
-
});
|
|
3602
|
-
var iface = {
|
|
3603
|
-
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
|
3604
|
-
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
|
3605
|
-
// implementing this mixin interface.
|
|
3606
|
-
_mixedIntoPredicates: [],
|
|
3607
|
-
is(obj) {
|
|
3608
|
-
if (obj) {
|
|
3609
|
-
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
|
3610
|
-
return true;
|
|
3611
|
-
}
|
|
3612
|
-
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
|
3613
|
-
if (isMixedInto(obj)) {
|
|
3614
|
-
return true;
|
|
3615
|
-
}
|
|
3616
|
-
}
|
|
3617
|
-
}
|
|
3618
|
-
return false;
|
|
3619
|
-
},
|
|
3620
|
-
isImpl(obj) {
|
|
3621
|
-
if (obj) {
|
|
3622
|
-
if (obj instanceof Impl.implementation) {
|
|
3623
|
-
return true;
|
|
3624
|
-
}
|
|
3625
|
-
const wrapper = utils.wrapperForImpl(obj);
|
|
3626
|
-
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
|
3627
|
-
if (isMixedInto(wrapper)) {
|
|
3628
|
-
return true;
|
|
3629
|
-
}
|
|
3630
|
-
}
|
|
3631
|
-
}
|
|
3632
|
-
return false;
|
|
3633
|
-
},
|
|
3634
|
-
convert(obj, { context = "The provided value" } = {}) {
|
|
3635
|
-
if (module.exports.is(obj)) {
|
|
3636
|
-
return utils.implForWrapper(obj);
|
|
3637
|
-
}
|
|
3638
|
-
throw new TypeError(`${context} is not of type 'URLSearchParams'.`);
|
|
3639
|
-
},
|
|
3640
|
-
createDefaultIterator(target, kind) {
|
|
3641
|
-
const iterator = Object.create(IteratorPrototype);
|
|
3642
|
-
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
|
3643
|
-
value: { target, kind, index: 0 },
|
|
3644
|
-
configurable: true
|
|
3645
|
-
});
|
|
3646
|
-
return iterator;
|
|
3647
|
-
},
|
|
3648
|
-
create(globalObject, constructorArgs, privateData) {
|
|
3649
|
-
if (globalObject[ctorRegistry] === void 0) {
|
|
3650
|
-
throw new Error("Internal error: invalid global object");
|
|
3651
|
-
}
|
|
3652
|
-
const ctor = globalObject[ctorRegistry]["URLSearchParams"];
|
|
3653
|
-
if (ctor === void 0) {
|
|
3654
|
-
throw new Error("Internal error: constructor URLSearchParams is not installed on the passed global object");
|
|
3655
|
-
}
|
|
3656
|
-
let obj = Object.create(ctor.prototype);
|
|
3657
|
-
obj = iface.setup(obj, globalObject, constructorArgs, privateData);
|
|
3658
|
-
return obj;
|
|
3659
|
-
},
|
|
3660
|
-
createImpl(globalObject, constructorArgs, privateData) {
|
|
3661
|
-
const obj = iface.create(globalObject, constructorArgs, privateData);
|
|
3662
|
-
return utils.implForWrapper(obj);
|
|
3663
|
-
},
|
|
3664
|
-
_internalSetup(obj) {
|
|
3665
|
-
},
|
|
3666
|
-
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
|
|
3667
|
-
privateData.wrapper = obj;
|
|
3668
|
-
iface._internalSetup(obj);
|
|
3669
|
-
Object.defineProperty(obj, impl, {
|
|
3670
|
-
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
|
3671
|
-
configurable: true
|
|
3672
|
-
});
|
|
3673
|
-
obj[impl][utils.wrapperSymbol] = obj;
|
|
3674
|
-
if (Impl.init) {
|
|
3675
|
-
Impl.init(obj[impl], privateData);
|
|
3676
|
-
}
|
|
3677
|
-
return obj;
|
|
3678
|
-
},
|
|
3679
|
-
install(globalObject) {
|
|
3680
|
-
class URLSearchParams2 {
|
|
3681
|
-
constructor() {
|
|
3682
|
-
const args = [];
|
|
3683
|
-
{
|
|
3684
|
-
let curArg = arguments[0];
|
|
3685
|
-
if (curArg !== void 0) {
|
|
3686
|
-
if (utils.isObject(curArg)) {
|
|
3687
|
-
if (curArg[Symbol.iterator] !== void 0) {
|
|
3688
|
-
if (!utils.isObject(curArg)) {
|
|
3689
|
-
throw new TypeError(
|
|
3690
|
-
"Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object."
|
|
3691
|
-
);
|
|
3692
|
-
} else {
|
|
3693
|
-
const V = [];
|
|
3694
|
-
const tmp = curArg;
|
|
3695
|
-
for (let nextItem of tmp) {
|
|
3696
|
-
if (!utils.isObject(nextItem)) {
|
|
3697
|
-
throw new TypeError(
|
|
3698
|
-
"Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object."
|
|
3699
|
-
);
|
|
3700
|
-
} else {
|
|
3701
|
-
const V2 = [];
|
|
3702
|
-
const tmp2 = nextItem;
|
|
3703
|
-
for (let nextItem2 of tmp2) {
|
|
3704
|
-
nextItem2 = conversions["USVString"](nextItem2, {
|
|
3705
|
-
context: "Failed to construct 'URLSearchParams': parameter 1 sequence's element's element"
|
|
3706
|
-
});
|
|
3707
|
-
V2.push(nextItem2);
|
|
3708
|
-
}
|
|
3709
|
-
nextItem = V2;
|
|
3710
|
-
}
|
|
3711
|
-
V.push(nextItem);
|
|
3712
|
-
}
|
|
3713
|
-
curArg = V;
|
|
3714
|
-
}
|
|
3715
|
-
} else {
|
|
3716
|
-
if (!utils.isObject(curArg)) {
|
|
3717
|
-
throw new TypeError(
|
|
3718
|
-
"Failed to construct 'URLSearchParams': parameter 1 record is not an object."
|
|
3719
|
-
);
|
|
3720
|
-
} else {
|
|
3721
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
3722
|
-
for (const key of Reflect.ownKeys(curArg)) {
|
|
3723
|
-
const desc = Object.getOwnPropertyDescriptor(curArg, key);
|
|
3724
|
-
if (desc && desc.enumerable) {
|
|
3725
|
-
let typedKey = key;
|
|
3726
|
-
typedKey = conversions["USVString"](typedKey, {
|
|
3727
|
-
context: "Failed to construct 'URLSearchParams': parameter 1 record's key"
|
|
3728
|
-
});
|
|
3729
|
-
let typedValue = curArg[key];
|
|
3730
|
-
typedValue = conversions["USVString"](typedValue, {
|
|
3731
|
-
context: "Failed to construct 'URLSearchParams': parameter 1 record's value"
|
|
3732
|
-
});
|
|
3733
|
-
result[typedKey] = typedValue;
|
|
3734
|
-
}
|
|
3735
|
-
}
|
|
3736
|
-
curArg = result;
|
|
3737
|
-
}
|
|
3738
|
-
}
|
|
3739
|
-
} else {
|
|
3740
|
-
curArg = conversions["USVString"](curArg, {
|
|
3741
|
-
context: "Failed to construct 'URLSearchParams': parameter 1"
|
|
3742
|
-
});
|
|
3743
|
-
}
|
|
3744
|
-
} else {
|
|
3745
|
-
curArg = "";
|
|
3746
|
-
}
|
|
3747
|
-
args.push(curArg);
|
|
3748
|
-
}
|
|
3749
|
-
return iface.setup(Object.create(this.constructor.prototype), globalObject, args);
|
|
3750
|
-
}
|
|
3751
|
-
append(name, value) {
|
|
3752
|
-
if (!this || !module.exports.is(this)) {
|
|
3753
|
-
throw new TypeError("Illegal invocation");
|
|
3754
|
-
}
|
|
3755
|
-
if (arguments.length < 2) {
|
|
3756
|
-
throw new TypeError(
|
|
3757
|
-
"Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only " + arguments.length + " present."
|
|
3758
|
-
);
|
|
3759
|
-
}
|
|
3760
|
-
const args = [];
|
|
3761
|
-
{
|
|
3762
|
-
let curArg = arguments[0];
|
|
3763
|
-
curArg = conversions["USVString"](curArg, {
|
|
3764
|
-
context: "Failed to execute 'append' on 'URLSearchParams': parameter 1"
|
|
3765
|
-
});
|
|
3766
|
-
args.push(curArg);
|
|
3767
|
-
}
|
|
3768
|
-
{
|
|
3769
|
-
let curArg = arguments[1];
|
|
3770
|
-
curArg = conversions["USVString"](curArg, {
|
|
3771
|
-
context: "Failed to execute 'append' on 'URLSearchParams': parameter 2"
|
|
3772
|
-
});
|
|
3773
|
-
args.push(curArg);
|
|
3774
|
-
}
|
|
3775
|
-
return this[impl].append(...args);
|
|
3776
|
-
}
|
|
3777
|
-
delete(name) {
|
|
3778
|
-
if (!this || !module.exports.is(this)) {
|
|
3779
|
-
throw new TypeError("Illegal invocation");
|
|
3780
|
-
}
|
|
3781
|
-
if (arguments.length < 1) {
|
|
3782
|
-
throw new TypeError(
|
|
3783
|
-
"Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
|
3784
|
-
);
|
|
3785
|
-
}
|
|
3786
|
-
const args = [];
|
|
3787
|
-
{
|
|
3788
|
-
let curArg = arguments[0];
|
|
3789
|
-
curArg = conversions["USVString"](curArg, {
|
|
3790
|
-
context: "Failed to execute 'delete' on 'URLSearchParams': parameter 1"
|
|
3791
|
-
});
|
|
3792
|
-
args.push(curArg);
|
|
3793
|
-
}
|
|
3794
|
-
return this[impl].delete(...args);
|
|
3795
|
-
}
|
|
3796
|
-
get(name) {
|
|
3797
|
-
if (!this || !module.exports.is(this)) {
|
|
3798
|
-
throw new TypeError("Illegal invocation");
|
|
3799
|
-
}
|
|
3800
|
-
if (arguments.length < 1) {
|
|
3801
|
-
throw new TypeError(
|
|
3802
|
-
"Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
|
3803
|
-
);
|
|
3804
|
-
}
|
|
3805
|
-
const args = [];
|
|
3806
|
-
{
|
|
3807
|
-
let curArg = arguments[0];
|
|
3808
|
-
curArg = conversions["USVString"](curArg, {
|
|
3809
|
-
context: "Failed to execute 'get' on 'URLSearchParams': parameter 1"
|
|
3810
|
-
});
|
|
3811
|
-
args.push(curArg);
|
|
3812
|
-
}
|
|
3813
|
-
return this[impl].get(...args);
|
|
3814
|
-
}
|
|
3815
|
-
getAll(name) {
|
|
3816
|
-
if (!this || !module.exports.is(this)) {
|
|
3817
|
-
throw new TypeError("Illegal invocation");
|
|
3818
|
-
}
|
|
3819
|
-
if (arguments.length < 1) {
|
|
3820
|
-
throw new TypeError(
|
|
3821
|
-
"Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
|
3822
|
-
);
|
|
3823
|
-
}
|
|
3824
|
-
const args = [];
|
|
3825
|
-
{
|
|
3826
|
-
let curArg = arguments[0];
|
|
3827
|
-
curArg = conversions["USVString"](curArg, {
|
|
3828
|
-
context: "Failed to execute 'getAll' on 'URLSearchParams': parameter 1"
|
|
3829
|
-
});
|
|
3830
|
-
args.push(curArg);
|
|
3831
|
-
}
|
|
3832
|
-
return utils.tryWrapperForImpl(this[impl].getAll(...args));
|
|
3833
|
-
}
|
|
3834
|
-
has(name) {
|
|
3835
|
-
if (!this || !module.exports.is(this)) {
|
|
3836
|
-
throw new TypeError("Illegal invocation");
|
|
3837
|
-
}
|
|
3838
|
-
if (arguments.length < 1) {
|
|
3839
|
-
throw new TypeError(
|
|
3840
|
-
"Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
|
3841
|
-
);
|
|
3842
|
-
}
|
|
3843
|
-
const args = [];
|
|
3844
|
-
{
|
|
3845
|
-
let curArg = arguments[0];
|
|
3846
|
-
curArg = conversions["USVString"](curArg, {
|
|
3847
|
-
context: "Failed to execute 'has' on 'URLSearchParams': parameter 1"
|
|
3848
|
-
});
|
|
3849
|
-
args.push(curArg);
|
|
3850
|
-
}
|
|
3851
|
-
return this[impl].has(...args);
|
|
3852
|
-
}
|
|
3853
|
-
set(name, value) {
|
|
3854
|
-
if (!this || !module.exports.is(this)) {
|
|
3855
|
-
throw new TypeError("Illegal invocation");
|
|
3856
|
-
}
|
|
3857
|
-
if (arguments.length < 2) {
|
|
3858
|
-
throw new TypeError(
|
|
3859
|
-
"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only " + arguments.length + " present."
|
|
3860
|
-
);
|
|
3861
|
-
}
|
|
3862
|
-
const args = [];
|
|
3863
|
-
{
|
|
3864
|
-
let curArg = arguments[0];
|
|
3865
|
-
curArg = conversions["USVString"](curArg, {
|
|
3866
|
-
context: "Failed to execute 'set' on 'URLSearchParams': parameter 1"
|
|
3867
|
-
});
|
|
3868
|
-
args.push(curArg);
|
|
3869
|
-
}
|
|
3870
|
-
{
|
|
3871
|
-
let curArg = arguments[1];
|
|
3872
|
-
curArg = conversions["USVString"](curArg, {
|
|
3873
|
-
context: "Failed to execute 'set' on 'URLSearchParams': parameter 2"
|
|
3874
|
-
});
|
|
3875
|
-
args.push(curArg);
|
|
3876
|
-
}
|
|
3877
|
-
return this[impl].set(...args);
|
|
3878
|
-
}
|
|
3879
|
-
sort() {
|
|
3880
|
-
if (!this || !module.exports.is(this)) {
|
|
3881
|
-
throw new TypeError("Illegal invocation");
|
|
3882
|
-
}
|
|
3883
|
-
return this[impl].sort();
|
|
3884
|
-
}
|
|
3885
|
-
toString() {
|
|
3886
|
-
if (!this || !module.exports.is(this)) {
|
|
3887
|
-
throw new TypeError("Illegal invocation");
|
|
3888
|
-
}
|
|
3889
|
-
return this[impl].toString();
|
|
3890
|
-
}
|
|
3891
|
-
keys() {
|
|
3892
|
-
if (!this || !module.exports.is(this)) {
|
|
3893
|
-
throw new TypeError("Illegal invocation");
|
|
3894
|
-
}
|
|
3895
|
-
return module.exports.createDefaultIterator(this, "key");
|
|
3896
|
-
}
|
|
3897
|
-
values() {
|
|
3898
|
-
if (!this || !module.exports.is(this)) {
|
|
3899
|
-
throw new TypeError("Illegal invocation");
|
|
3900
|
-
}
|
|
3901
|
-
return module.exports.createDefaultIterator(this, "value");
|
|
3902
|
-
}
|
|
3903
|
-
entries() {
|
|
3904
|
-
if (!this || !module.exports.is(this)) {
|
|
3905
|
-
throw new TypeError("Illegal invocation");
|
|
3906
|
-
}
|
|
3907
|
-
return module.exports.createDefaultIterator(this, "key+value");
|
|
3908
|
-
}
|
|
3909
|
-
forEach(callback) {
|
|
3910
|
-
if (!this || !module.exports.is(this)) {
|
|
3911
|
-
throw new TypeError("Illegal invocation");
|
|
3912
|
-
}
|
|
3913
|
-
if (arguments.length < 1) {
|
|
3914
|
-
throw new TypeError(
|
|
3915
|
-
"Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present."
|
|
3916
|
-
);
|
|
3917
|
-
}
|
|
3918
|
-
if (typeof callback !== "function") {
|
|
3919
|
-
throw new TypeError(
|
|
3920
|
-
"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1 is not a function."
|
|
3921
|
-
);
|
|
3922
|
-
}
|
|
3923
|
-
const thisArg = arguments[1];
|
|
3924
|
-
let pairs = Array.from(this[impl]);
|
|
3925
|
-
let i = 0;
|
|
3926
|
-
while (i < pairs.length) {
|
|
3927
|
-
const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
|
|
3928
|
-
callback.call(thisArg, value, key, this);
|
|
3929
|
-
pairs = Array.from(this[impl]);
|
|
3930
|
-
i++;
|
|
3931
|
-
}
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3934
|
-
Object.defineProperties(URLSearchParams2.prototype, {
|
|
3935
|
-
append: { enumerable: true },
|
|
3936
|
-
delete: { enumerable: true },
|
|
3937
|
-
get: { enumerable: true },
|
|
3938
|
-
getAll: { enumerable: true },
|
|
3939
|
-
has: { enumerable: true },
|
|
3940
|
-
set: { enumerable: true },
|
|
3941
|
-
sort: { enumerable: true },
|
|
3942
|
-
toString: { enumerable: true },
|
|
3943
|
-
keys: { enumerable: true },
|
|
3944
|
-
values: { enumerable: true },
|
|
3945
|
-
entries: { enumerable: true },
|
|
3946
|
-
forEach: { enumerable: true },
|
|
3947
|
-
[Symbol.toStringTag]: { value: "URLSearchParams", configurable: true },
|
|
3948
|
-
[Symbol.iterator]: { value: URLSearchParams2.prototype.entries, configurable: true, writable: true }
|
|
3949
|
-
});
|
|
3950
|
-
if (globalObject[ctorRegistry] === void 0) {
|
|
3951
|
-
globalObject[ctorRegistry] = /* @__PURE__ */ Object.create(null);
|
|
3952
|
-
}
|
|
3953
|
-
globalObject[ctorRegistry]["URLSearchParams"] = URLSearchParams2;
|
|
3954
|
-
Object.defineProperty(globalObject, "URLSearchParams", {
|
|
3955
|
-
configurable: true,
|
|
3956
|
-
writable: true,
|
|
3957
|
-
value: URLSearchParams2
|
|
3958
|
-
});
|
|
3959
|
-
}
|
|
3960
|
-
};
|
|
3961
|
-
module.exports = iface;
|
|
3962
|
-
var Impl = require_URLSearchParams_impl();
|
|
3963
|
-
}
|
|
3964
|
-
});
|
|
3965
|
-
|
|
3966
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URL-impl.js
|
|
3967
|
-
var require_URL_impl = __commonJS({
|
|
3968
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URL-impl.js"(exports) {
|
|
3969
|
-
"use strict";
|
|
3970
|
-
var usm = require_url_state_machine();
|
|
3971
|
-
var urlencoded = require_urlencoded();
|
|
3972
|
-
var URLSearchParams2 = require_URLSearchParams();
|
|
3973
|
-
exports.implementation = class URLImpl {
|
|
3974
|
-
constructor(globalObject, constructorArgs) {
|
|
3975
|
-
const url = constructorArgs[0];
|
|
3976
|
-
const base2 = constructorArgs[1];
|
|
3977
|
-
let parsedBase = null;
|
|
3978
|
-
if (base2 !== void 0) {
|
|
3979
|
-
parsedBase = usm.basicURLParse(base2);
|
|
3980
|
-
if (parsedBase === null) {
|
|
3981
|
-
throw new TypeError(`Invalid base URL: ${base2}`);
|
|
3982
|
-
}
|
|
3983
|
-
}
|
|
3984
|
-
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
|
3985
|
-
if (parsedURL === null) {
|
|
3986
|
-
throw new TypeError(`Invalid URL: ${url}`);
|
|
3987
|
-
}
|
|
3988
|
-
const query = parsedURL.query !== null ? parsedURL.query : "";
|
|
3989
|
-
this._url = parsedURL;
|
|
3990
|
-
this._query = URLSearchParams2.createImpl(globalObject, [query], { doNotStripQMark: true });
|
|
3991
|
-
this._query._url = this;
|
|
3992
|
-
}
|
|
3993
|
-
get href() {
|
|
3994
|
-
return usm.serializeURL(this._url);
|
|
3995
|
-
}
|
|
3996
|
-
set href(v) {
|
|
3997
|
-
const parsedURL = usm.basicURLParse(v);
|
|
3998
|
-
if (parsedURL === null) {
|
|
3999
|
-
throw new TypeError(`Invalid URL: ${v}`);
|
|
4000
|
-
}
|
|
4001
|
-
this._url = parsedURL;
|
|
4002
|
-
this._query._list.splice(0);
|
|
4003
|
-
const { query } = parsedURL;
|
|
4004
|
-
if (query !== null) {
|
|
4005
|
-
this._query._list = urlencoded.parseUrlencoded(query);
|
|
4006
|
-
}
|
|
4007
|
-
}
|
|
4008
|
-
get origin() {
|
|
4009
|
-
return usm.serializeURLOrigin(this._url);
|
|
4010
|
-
}
|
|
4011
|
-
get protocol() {
|
|
4012
|
-
return this._url.scheme + ":";
|
|
4013
|
-
}
|
|
4014
|
-
set protocol(v) {
|
|
4015
|
-
usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" });
|
|
4016
|
-
}
|
|
4017
|
-
get username() {
|
|
4018
|
-
return this._url.username;
|
|
4019
|
-
}
|
|
4020
|
-
set username(v) {
|
|
4021
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
4022
|
-
return;
|
|
4023
|
-
}
|
|
4024
|
-
usm.setTheUsername(this._url, v);
|
|
4025
|
-
}
|
|
4026
|
-
get password() {
|
|
4027
|
-
return this._url.password;
|
|
4028
|
-
}
|
|
4029
|
-
set password(v) {
|
|
4030
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
4031
|
-
return;
|
|
4032
|
-
}
|
|
4033
|
-
usm.setThePassword(this._url, v);
|
|
4034
|
-
}
|
|
4035
|
-
get host() {
|
|
4036
|
-
const url = this._url;
|
|
4037
|
-
if (url.host === null) {
|
|
4038
|
-
return "";
|
|
4039
|
-
}
|
|
4040
|
-
if (url.port === null) {
|
|
4041
|
-
return usm.serializeHost(url.host);
|
|
4042
|
-
}
|
|
4043
|
-
return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port);
|
|
4044
|
-
}
|
|
4045
|
-
set host(v) {
|
|
4046
|
-
if (this._url.cannotBeABaseURL) {
|
|
4047
|
-
return;
|
|
4048
|
-
}
|
|
4049
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
|
|
4050
|
-
}
|
|
4051
|
-
get hostname() {
|
|
4052
|
-
if (this._url.host === null) {
|
|
4053
|
-
return "";
|
|
4054
|
-
}
|
|
4055
|
-
return usm.serializeHost(this._url.host);
|
|
4056
|
-
}
|
|
4057
|
-
set hostname(v) {
|
|
4058
|
-
if (this._url.cannotBeABaseURL) {
|
|
4059
|
-
return;
|
|
4060
|
-
}
|
|
4061
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
|
|
4062
|
-
}
|
|
4063
|
-
get port() {
|
|
4064
|
-
if (this._url.port === null) {
|
|
4065
|
-
return "";
|
|
4066
|
-
}
|
|
4067
|
-
return usm.serializeInteger(this._url.port);
|
|
4068
|
-
}
|
|
4069
|
-
set port(v) {
|
|
4070
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
4071
|
-
return;
|
|
4072
|
-
}
|
|
4073
|
-
if (v === "") {
|
|
4074
|
-
this._url.port = null;
|
|
4075
|
-
} else {
|
|
4076
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
get pathname() {
|
|
4080
|
-
if (this._url.cannotBeABaseURL) {
|
|
4081
|
-
return this._url.path[0];
|
|
4082
|
-
}
|
|
4083
|
-
if (this._url.path.length === 0) {
|
|
4084
|
-
return "";
|
|
4085
|
-
}
|
|
4086
|
-
return "/" + this._url.path.join("/");
|
|
4087
|
-
}
|
|
4088
|
-
set pathname(v) {
|
|
4089
|
-
if (this._url.cannotBeABaseURL) {
|
|
4090
|
-
return;
|
|
4091
|
-
}
|
|
4092
|
-
this._url.path = [];
|
|
4093
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
|
|
4094
|
-
}
|
|
4095
|
-
get search() {
|
|
4096
|
-
if (this._url.query === null || this._url.query === "") {
|
|
4097
|
-
return "";
|
|
4098
|
-
}
|
|
4099
|
-
return "?" + this._url.query;
|
|
4100
|
-
}
|
|
4101
|
-
set search(v) {
|
|
4102
|
-
const url = this._url;
|
|
4103
|
-
if (v === "") {
|
|
4104
|
-
url.query = null;
|
|
4105
|
-
this._query._list = [];
|
|
4106
|
-
return;
|
|
4107
|
-
}
|
|
4108
|
-
const input = v[0] === "?" ? v.substring(1) : v;
|
|
4109
|
-
url.query = "";
|
|
4110
|
-
usm.basicURLParse(input, { url, stateOverride: "query" });
|
|
4111
|
-
this._query._list = urlencoded.parseUrlencoded(input);
|
|
4112
|
-
}
|
|
4113
|
-
get searchParams() {
|
|
4114
|
-
return this._query;
|
|
4115
|
-
}
|
|
4116
|
-
get hash() {
|
|
4117
|
-
if (this._url.fragment === null || this._url.fragment === "") {
|
|
4118
|
-
return "";
|
|
4119
|
-
}
|
|
4120
|
-
return "#" + this._url.fragment;
|
|
4121
|
-
}
|
|
4122
|
-
set hash(v) {
|
|
4123
|
-
if (v === "") {
|
|
4124
|
-
this._url.fragment = null;
|
|
4125
|
-
return;
|
|
4126
|
-
}
|
|
4127
|
-
const input = v[0] === "#" ? v.substring(1) : v;
|
|
4128
|
-
this._url.fragment = "";
|
|
4129
|
-
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
|
|
4130
|
-
}
|
|
4131
|
-
toJSON() {
|
|
4132
|
-
return this.href;
|
|
4133
|
-
}
|
|
4134
|
-
};
|
|
4135
|
-
}
|
|
4136
|
-
});
|
|
4137
|
-
|
|
4138
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URL.js
|
|
4139
|
-
var require_URL = __commonJS({
|
|
4140
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/lib/URL.js"(exports, module) {
|
|
4141
|
-
"use strict";
|
|
4142
|
-
var conversions = require_lib();
|
|
4143
|
-
var utils = require_utils();
|
|
4144
|
-
var impl = utils.implSymbol;
|
|
4145
|
-
var ctorRegistry = utils.ctorRegistrySymbol;
|
|
4146
|
-
var iface = {
|
|
4147
|
-
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
|
4148
|
-
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
|
4149
|
-
// implementing this mixin interface.
|
|
4150
|
-
_mixedIntoPredicates: [],
|
|
4151
|
-
is(obj) {
|
|
4152
|
-
if (obj) {
|
|
4153
|
-
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
|
4154
|
-
return true;
|
|
4155
|
-
}
|
|
4156
|
-
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
|
4157
|
-
if (isMixedInto(obj)) {
|
|
4158
|
-
return true;
|
|
4159
|
-
}
|
|
4160
|
-
}
|
|
4161
|
-
}
|
|
4162
|
-
return false;
|
|
4163
|
-
},
|
|
4164
|
-
isImpl(obj) {
|
|
4165
|
-
if (obj) {
|
|
4166
|
-
if (obj instanceof Impl.implementation) {
|
|
4167
|
-
return true;
|
|
4168
|
-
}
|
|
4169
|
-
const wrapper = utils.wrapperForImpl(obj);
|
|
4170
|
-
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
|
4171
|
-
if (isMixedInto(wrapper)) {
|
|
4172
|
-
return true;
|
|
4173
|
-
}
|
|
4174
|
-
}
|
|
4175
|
-
}
|
|
4176
|
-
return false;
|
|
4177
|
-
},
|
|
4178
|
-
convert(obj, { context = "The provided value" } = {}) {
|
|
4179
|
-
if (module.exports.is(obj)) {
|
|
4180
|
-
return utils.implForWrapper(obj);
|
|
4181
|
-
}
|
|
4182
|
-
throw new TypeError(`${context} is not of type 'URL'.`);
|
|
4183
|
-
},
|
|
4184
|
-
create(globalObject, constructorArgs, privateData) {
|
|
4185
|
-
if (globalObject[ctorRegistry] === void 0) {
|
|
4186
|
-
throw new Error("Internal error: invalid global object");
|
|
4187
|
-
}
|
|
4188
|
-
const ctor = globalObject[ctorRegistry]["URL"];
|
|
4189
|
-
if (ctor === void 0) {
|
|
4190
|
-
throw new Error("Internal error: constructor URL is not installed on the passed global object");
|
|
4191
|
-
}
|
|
4192
|
-
let obj = Object.create(ctor.prototype);
|
|
4193
|
-
obj = iface.setup(obj, globalObject, constructorArgs, privateData);
|
|
4194
|
-
return obj;
|
|
4195
|
-
},
|
|
4196
|
-
createImpl(globalObject, constructorArgs, privateData) {
|
|
4197
|
-
const obj = iface.create(globalObject, constructorArgs, privateData);
|
|
4198
|
-
return utils.implForWrapper(obj);
|
|
4199
|
-
},
|
|
4200
|
-
_internalSetup(obj) {
|
|
4201
|
-
},
|
|
4202
|
-
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
|
|
4203
|
-
privateData.wrapper = obj;
|
|
4204
|
-
iface._internalSetup(obj);
|
|
4205
|
-
Object.defineProperty(obj, impl, {
|
|
4206
|
-
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
|
4207
|
-
configurable: true
|
|
4208
|
-
});
|
|
4209
|
-
obj[impl][utils.wrapperSymbol] = obj;
|
|
4210
|
-
if (Impl.init) {
|
|
4211
|
-
Impl.init(obj[impl], privateData);
|
|
4212
|
-
}
|
|
4213
|
-
return obj;
|
|
4214
|
-
},
|
|
4215
|
-
install(globalObject) {
|
|
4216
|
-
class URL3 {
|
|
4217
|
-
constructor(url) {
|
|
4218
|
-
if (arguments.length < 1) {
|
|
4219
|
-
throw new TypeError(
|
|
4220
|
-
"Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."
|
|
4221
|
-
);
|
|
4222
|
-
}
|
|
4223
|
-
const args = [];
|
|
4224
|
-
{
|
|
4225
|
-
let curArg = arguments[0];
|
|
4226
|
-
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 1" });
|
|
4227
|
-
args.push(curArg);
|
|
4228
|
-
}
|
|
4229
|
-
{
|
|
4230
|
-
let curArg = arguments[1];
|
|
4231
|
-
if (curArg !== void 0) {
|
|
4232
|
-
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 2" });
|
|
4233
|
-
}
|
|
4234
|
-
args.push(curArg);
|
|
4235
|
-
}
|
|
4236
|
-
return iface.setup(Object.create(this.constructor.prototype), globalObject, args);
|
|
4237
|
-
}
|
|
4238
|
-
toJSON() {
|
|
4239
|
-
if (!this || !module.exports.is(this)) {
|
|
4240
|
-
throw new TypeError("Illegal invocation");
|
|
4241
|
-
}
|
|
4242
|
-
return this[impl].toJSON();
|
|
4243
|
-
}
|
|
4244
|
-
get href() {
|
|
4245
|
-
if (!this || !module.exports.is(this)) {
|
|
4246
|
-
throw new TypeError("Illegal invocation");
|
|
4247
|
-
}
|
|
4248
|
-
return this[impl]["href"];
|
|
4249
|
-
}
|
|
4250
|
-
set href(V) {
|
|
4251
|
-
if (!this || !module.exports.is(this)) {
|
|
4252
|
-
throw new TypeError("Illegal invocation");
|
|
4253
|
-
}
|
|
4254
|
-
V = conversions["USVString"](V, { context: "Failed to set the 'href' property on 'URL': The provided value" });
|
|
4255
|
-
this[impl]["href"] = V;
|
|
4256
|
-
}
|
|
4257
|
-
toString() {
|
|
4258
|
-
if (!this || !module.exports.is(this)) {
|
|
4259
|
-
throw new TypeError("Illegal invocation");
|
|
4260
|
-
}
|
|
4261
|
-
return this[impl]["href"];
|
|
4262
|
-
}
|
|
4263
|
-
get origin() {
|
|
4264
|
-
if (!this || !module.exports.is(this)) {
|
|
4265
|
-
throw new TypeError("Illegal invocation");
|
|
4266
|
-
}
|
|
4267
|
-
return this[impl]["origin"];
|
|
4268
|
-
}
|
|
4269
|
-
get protocol() {
|
|
4270
|
-
if (!this || !module.exports.is(this)) {
|
|
4271
|
-
throw new TypeError("Illegal invocation");
|
|
4272
|
-
}
|
|
4273
|
-
return this[impl]["protocol"];
|
|
4274
|
-
}
|
|
4275
|
-
set protocol(V) {
|
|
4276
|
-
if (!this || !module.exports.is(this)) {
|
|
4277
|
-
throw new TypeError("Illegal invocation");
|
|
4278
|
-
}
|
|
4279
|
-
V = conversions["USVString"](V, {
|
|
4280
|
-
context: "Failed to set the 'protocol' property on 'URL': The provided value"
|
|
4281
|
-
});
|
|
4282
|
-
this[impl]["protocol"] = V;
|
|
4283
|
-
}
|
|
4284
|
-
get username() {
|
|
4285
|
-
if (!this || !module.exports.is(this)) {
|
|
4286
|
-
throw new TypeError("Illegal invocation");
|
|
4287
|
-
}
|
|
4288
|
-
return this[impl]["username"];
|
|
4289
|
-
}
|
|
4290
|
-
set username(V) {
|
|
4291
|
-
if (!this || !module.exports.is(this)) {
|
|
4292
|
-
throw new TypeError("Illegal invocation");
|
|
4293
|
-
}
|
|
4294
|
-
V = conversions["USVString"](V, {
|
|
4295
|
-
context: "Failed to set the 'username' property on 'URL': The provided value"
|
|
4296
|
-
});
|
|
4297
|
-
this[impl]["username"] = V;
|
|
4298
|
-
}
|
|
4299
|
-
get password() {
|
|
4300
|
-
if (!this || !module.exports.is(this)) {
|
|
4301
|
-
throw new TypeError("Illegal invocation");
|
|
4302
|
-
}
|
|
4303
|
-
return this[impl]["password"];
|
|
4304
|
-
}
|
|
4305
|
-
set password(V) {
|
|
4306
|
-
if (!this || !module.exports.is(this)) {
|
|
4307
|
-
throw new TypeError("Illegal invocation");
|
|
4308
|
-
}
|
|
4309
|
-
V = conversions["USVString"](V, {
|
|
4310
|
-
context: "Failed to set the 'password' property on 'URL': The provided value"
|
|
4311
|
-
});
|
|
4312
|
-
this[impl]["password"] = V;
|
|
4313
|
-
}
|
|
4314
|
-
get host() {
|
|
4315
|
-
if (!this || !module.exports.is(this)) {
|
|
4316
|
-
throw new TypeError("Illegal invocation");
|
|
4317
|
-
}
|
|
4318
|
-
return this[impl]["host"];
|
|
4319
|
-
}
|
|
4320
|
-
set host(V) {
|
|
4321
|
-
if (!this || !module.exports.is(this)) {
|
|
4322
|
-
throw new TypeError("Illegal invocation");
|
|
4323
|
-
}
|
|
4324
|
-
V = conversions["USVString"](V, { context: "Failed to set the 'host' property on 'URL': The provided value" });
|
|
4325
|
-
this[impl]["host"] = V;
|
|
4326
|
-
}
|
|
4327
|
-
get hostname() {
|
|
4328
|
-
if (!this || !module.exports.is(this)) {
|
|
4329
|
-
throw new TypeError("Illegal invocation");
|
|
4330
|
-
}
|
|
4331
|
-
return this[impl]["hostname"];
|
|
4332
|
-
}
|
|
4333
|
-
set hostname(V) {
|
|
4334
|
-
if (!this || !module.exports.is(this)) {
|
|
4335
|
-
throw new TypeError("Illegal invocation");
|
|
4336
|
-
}
|
|
4337
|
-
V = conversions["USVString"](V, {
|
|
4338
|
-
context: "Failed to set the 'hostname' property on 'URL': The provided value"
|
|
4339
|
-
});
|
|
4340
|
-
this[impl]["hostname"] = V;
|
|
4341
|
-
}
|
|
4342
|
-
get port() {
|
|
4343
|
-
if (!this || !module.exports.is(this)) {
|
|
4344
|
-
throw new TypeError("Illegal invocation");
|
|
4345
|
-
}
|
|
4346
|
-
return this[impl]["port"];
|
|
4347
|
-
}
|
|
4348
|
-
set port(V) {
|
|
4349
|
-
if (!this || !module.exports.is(this)) {
|
|
4350
|
-
throw new TypeError("Illegal invocation");
|
|
4351
|
-
}
|
|
4352
|
-
V = conversions["USVString"](V, { context: "Failed to set the 'port' property on 'URL': The provided value" });
|
|
4353
|
-
this[impl]["port"] = V;
|
|
4354
|
-
}
|
|
4355
|
-
get pathname() {
|
|
4356
|
-
if (!this || !module.exports.is(this)) {
|
|
4357
|
-
throw new TypeError("Illegal invocation");
|
|
4358
|
-
}
|
|
4359
|
-
return this[impl]["pathname"];
|
|
4360
|
-
}
|
|
4361
|
-
set pathname(V) {
|
|
4362
|
-
if (!this || !module.exports.is(this)) {
|
|
4363
|
-
throw new TypeError("Illegal invocation");
|
|
4364
|
-
}
|
|
4365
|
-
V = conversions["USVString"](V, {
|
|
4366
|
-
context: "Failed to set the 'pathname' property on 'URL': The provided value"
|
|
4367
|
-
});
|
|
4368
|
-
this[impl]["pathname"] = V;
|
|
4369
|
-
}
|
|
4370
|
-
get search() {
|
|
4371
|
-
if (!this || !module.exports.is(this)) {
|
|
4372
|
-
throw new TypeError("Illegal invocation");
|
|
4373
|
-
}
|
|
4374
|
-
return this[impl]["search"];
|
|
4375
|
-
}
|
|
4376
|
-
set search(V) {
|
|
4377
|
-
if (!this || !module.exports.is(this)) {
|
|
4378
|
-
throw new TypeError("Illegal invocation");
|
|
4379
|
-
}
|
|
4380
|
-
V = conversions["USVString"](V, {
|
|
4381
|
-
context: "Failed to set the 'search' property on 'URL': The provided value"
|
|
4382
|
-
});
|
|
4383
|
-
this[impl]["search"] = V;
|
|
4384
|
-
}
|
|
4385
|
-
get searchParams() {
|
|
4386
|
-
if (!this || !module.exports.is(this)) {
|
|
4387
|
-
throw new TypeError("Illegal invocation");
|
|
4388
|
-
}
|
|
4389
|
-
return utils.getSameObject(this, "searchParams", () => {
|
|
4390
|
-
return utils.tryWrapperForImpl(this[impl]["searchParams"]);
|
|
4391
|
-
});
|
|
4392
|
-
}
|
|
4393
|
-
get hash() {
|
|
4394
|
-
if (!this || !module.exports.is(this)) {
|
|
4395
|
-
throw new TypeError("Illegal invocation");
|
|
4396
|
-
}
|
|
4397
|
-
return this[impl]["hash"];
|
|
4398
|
-
}
|
|
4399
|
-
set hash(V) {
|
|
4400
|
-
if (!this || !module.exports.is(this)) {
|
|
4401
|
-
throw new TypeError("Illegal invocation");
|
|
4402
|
-
}
|
|
4403
|
-
V = conversions["USVString"](V, { context: "Failed to set the 'hash' property on 'URL': The provided value" });
|
|
4404
|
-
this[impl]["hash"] = V;
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
Object.defineProperties(URL3.prototype, {
|
|
4408
|
-
toJSON: { enumerable: true },
|
|
4409
|
-
href: { enumerable: true },
|
|
4410
|
-
toString: { enumerable: true },
|
|
4411
|
-
origin: { enumerable: true },
|
|
4412
|
-
protocol: { enumerable: true },
|
|
4413
|
-
username: { enumerable: true },
|
|
4414
|
-
password: { enumerable: true },
|
|
4415
|
-
host: { enumerable: true },
|
|
4416
|
-
hostname: { enumerable: true },
|
|
4417
|
-
port: { enumerable: true },
|
|
4418
|
-
pathname: { enumerable: true },
|
|
4419
|
-
search: { enumerable: true },
|
|
4420
|
-
searchParams: { enumerable: true },
|
|
4421
|
-
hash: { enumerable: true },
|
|
4422
|
-
[Symbol.toStringTag]: { value: "URL", configurable: true }
|
|
4423
|
-
});
|
|
4424
|
-
if (globalObject[ctorRegistry] === void 0) {
|
|
4425
|
-
globalObject[ctorRegistry] = /* @__PURE__ */ Object.create(null);
|
|
4426
|
-
}
|
|
4427
|
-
globalObject[ctorRegistry]["URL"] = URL3;
|
|
4428
|
-
Object.defineProperty(globalObject, "URL", {
|
|
4429
|
-
configurable: true,
|
|
4430
|
-
writable: true,
|
|
4431
|
-
value: URL3
|
|
4432
|
-
});
|
|
4433
|
-
}
|
|
4434
|
-
};
|
|
4435
|
-
module.exports = iface;
|
|
4436
|
-
var Impl = require_URL_impl();
|
|
4437
|
-
}
|
|
4438
|
-
});
|
|
4439
|
-
|
|
4440
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/webidl2js-wrapper.js
|
|
4441
|
-
var require_webidl2js_wrapper = __commonJS({
|
|
4442
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/webidl2js-wrapper.js"(exports) {
|
|
4443
|
-
"use strict";
|
|
4444
|
-
var URL3 = require_URL();
|
|
4445
|
-
var URLSearchParams2 = require_URLSearchParams();
|
|
4446
|
-
exports.URL = URL3;
|
|
4447
|
-
exports.URLSearchParams = URLSearchParams2;
|
|
4448
|
-
}
|
|
4449
|
-
});
|
|
4450
|
-
|
|
4451
|
-
// node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/index.js
|
|
4452
|
-
var require_whatwg_url_without_unicode = __commonJS({
|
|
4453
|
-
"node_modules/.pnpm/whatwg-url-without-unicode@8.0.0-3/node_modules/whatwg-url-without-unicode/index.js"(exports) {
|
|
4454
|
-
"use strict";
|
|
4455
|
-
var { URL: URL3, URLSearchParams: URLSearchParams2 } = require_webidl2js_wrapper();
|
|
4456
|
-
var urlStateMachine = require_url_state_machine();
|
|
4457
|
-
var urlEncoded = require_urlencoded();
|
|
4458
|
-
var sharedGlobalObject = {};
|
|
4459
|
-
URL3.install(sharedGlobalObject);
|
|
4460
|
-
URLSearchParams2.install(sharedGlobalObject);
|
|
4461
|
-
exports.URL = sharedGlobalObject.URL;
|
|
4462
|
-
exports.URLSearchParams = sharedGlobalObject.URLSearchParams;
|
|
4463
|
-
exports.parseURL = urlStateMachine.parseURL;
|
|
4464
|
-
exports.basicURLParse = urlStateMachine.basicURLParse;
|
|
4465
|
-
exports.serializeURL = urlStateMachine.serializeURL;
|
|
4466
|
-
exports.serializeHost = urlStateMachine.serializeHost;
|
|
4467
|
-
exports.serializeInteger = urlStateMachine.serializeInteger;
|
|
4468
|
-
exports.serializeURLOrigin = urlStateMachine.serializeURLOrigin;
|
|
4469
|
-
exports.setTheUsername = urlStateMachine.setTheUsername;
|
|
4470
|
-
exports.setThePassword = urlStateMachine.setThePassword;
|
|
4471
|
-
exports.cannotHaveAUsernamePasswordPort = urlStateMachine.cannotHaveAUsernamePasswordPort;
|
|
4472
|
-
exports.percentDecode = urlEncoded.percentDecode;
|
|
4473
|
-
}
|
|
4474
|
-
});
|
|
4475
|
-
|
|
4476
|
-
// node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/js/URL.js
|
|
4477
|
-
import { NativeModules } from "react-native";
|
|
4478
|
-
var import_whatwg_url_without_unicode, BLOB_URL_PREFIX, BlobModule, URL2;
|
|
4479
|
-
var init_URL = __esm({
|
|
4480
|
-
"node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/js/URL.js"() {
|
|
4481
|
-
import_whatwg_url_without_unicode = __toESM(require_whatwg_url_without_unicode());
|
|
4482
|
-
BLOB_URL_PREFIX = null;
|
|
4483
|
-
({ BlobModule } = NativeModules);
|
|
4484
|
-
if (BlobModule && typeof BlobModule.BLOB_URI_SCHEME === "string") {
|
|
4485
|
-
BLOB_URL_PREFIX = BlobModule.BLOB_URI_SCHEME + ":";
|
|
4486
|
-
if (typeof BlobModule.BLOB_URI_HOST === "string") {
|
|
4487
|
-
BLOB_URL_PREFIX += `//${BlobModule.BLOB_URI_HOST}/`;
|
|
4488
|
-
}
|
|
4489
|
-
}
|
|
4490
|
-
import_whatwg_url_without_unicode.URL.createObjectURL = function createObjectURL(blob) {
|
|
4491
|
-
if (BLOB_URL_PREFIX === null) {
|
|
4492
|
-
throw new Error("Cannot create URL for blob!");
|
|
4493
|
-
}
|
|
4494
|
-
return `${BLOB_URL_PREFIX}${blob.data.blobId}?offset=${blob.data.offset}&size=${blob.size}`;
|
|
4495
|
-
};
|
|
4496
|
-
import_whatwg_url_without_unicode.URL.revokeObjectURL = function revokeObjectURL(url) {
|
|
4497
|
-
};
|
|
4498
|
-
URL2 = import_whatwg_url_without_unicode.URL;
|
|
4499
|
-
}
|
|
4500
|
-
});
|
|
4501
|
-
|
|
4502
|
-
// node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/js/URLSearchParams.js
|
|
4503
|
-
var import_whatwg_url_without_unicode2;
|
|
4504
|
-
var init_URLSearchParams = __esm({
|
|
4505
|
-
"node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/js/URLSearchParams.js"() {
|
|
4506
|
-
import_whatwg_url_without_unicode2 = __toESM(require_whatwg_url_without_unicode());
|
|
4507
|
-
}
|
|
4508
|
-
});
|
|
4509
|
-
|
|
4510
1
|
// packages/react/src/native.ts
|
|
4511
2
|
import {
|
|
4512
3
|
createElement,
|
|
@@ -4516,25 +7,7 @@ import {
|
|
|
4516
7
|
} from "react";
|
|
4517
8
|
import { Share } from "react-native";
|
|
4518
9
|
import { WebView } from "react-native-webview";
|
|
4519
|
-
|
|
4520
|
-
// node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/js/ios10Fix.js
|
|
4521
|
-
import { Platform } from "react-native";
|
|
4522
|
-
var majorVersionIOS = parseInt(Platform.Version, 10);
|
|
4523
|
-
if (Platform.OS === "ios" && majorVersionIOS === 10) {
|
|
4524
|
-
if (Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength") == null) {
|
|
4525
|
-
Object.defineProperty(ArrayBuffer.prototype, "byteLength", {
|
|
4526
|
-
configurable: true,
|
|
4527
|
-
enumerable: false,
|
|
4528
|
-
get() {
|
|
4529
|
-
return null;
|
|
4530
|
-
}
|
|
4531
|
-
});
|
|
4532
|
-
}
|
|
4533
|
-
}
|
|
4534
|
-
|
|
4535
|
-
// node_modules/.pnpm/react-native-url-polyfill@2.0.0_react-native@0.78.3_@babel+core@7.29.7_@babel+preset-en_ee8dcfe660d91ee8f67afc2ab93d8322/node_modules/react-native-url-polyfill/index.js
|
|
4536
|
-
init_URL();
|
|
4537
|
-
init_URLSearchParams();
|
|
10
|
+
import { URL as NativeURL } from "react-native-url-polyfill";
|
|
4538
11
|
|
|
4539
12
|
// packages/react/src/protocol.ts
|
|
4540
13
|
function embedUrl(url, Url = URL) {
|
|
@@ -4557,7 +30,7 @@ function parseShare(message, validateUrl = embedUrl) {
|
|
|
4557
30
|
}
|
|
4558
31
|
|
|
4559
32
|
// packages/react/src/native.ts
|
|
4560
|
-
var nativeUrl = (value) => embedUrl(value,
|
|
33
|
+
var nativeUrl = (value) => embedUrl(value, NativeURL);
|
|
4561
34
|
function startUrl(value) {
|
|
4562
35
|
const url = nativeUrl(value);
|
|
4563
36
|
if (url.pathname !== "/embed/start" || !url.searchParams.get("session"))
|
|
@@ -4598,10 +71,10 @@ function NativeSession(props) {
|
|
|
4598
71
|
const sender = nativeUrl(value);
|
|
4599
72
|
return sender.pathname === source.pathname && sender.search === source.search;
|
|
4600
73
|
}
|
|
4601
|
-
function reportError(
|
|
74
|
+
function reportError(error) {
|
|
4602
75
|
if (active.current && url === currentUrl.current)
|
|
4603
76
|
current.current.onError?.(
|
|
4604
|
-
|
|
77
|
+
error instanceof Error ? error : new Error("Partner dashboard failed")
|
|
4605
78
|
);
|
|
4606
79
|
}
|
|
4607
80
|
async function renew() {
|
|
@@ -4618,8 +91,8 @@ function NativeSession(props) {
|
|
|
4618
91
|
throw new Error("Session renewal must return a fresh start URL");
|
|
4619
92
|
currentUrl.current = next.href;
|
|
4620
93
|
setUrl(next.href);
|
|
4621
|
-
} catch (
|
|
4622
|
-
reportError(
|
|
94
|
+
} catch (error) {
|
|
95
|
+
reportError(error);
|
|
4623
96
|
} finally {
|
|
4624
97
|
renewing.current = false;
|
|
4625
98
|
}
|
|
@@ -4628,8 +101,8 @@ function NativeSession(props) {
|
|
|
4628
101
|
try {
|
|
4629
102
|
if (current.current.onShare) await current.current.onShare(value);
|
|
4630
103
|
else await Share.share({ message: `${value.text} ${value.url}` });
|
|
4631
|
-
} catch (
|
|
4632
|
-
reportError(
|
|
104
|
+
} catch (error) {
|
|
105
|
+
reportError(error);
|
|
4633
106
|
}
|
|
4634
107
|
}
|
|
4635
108
|
function receive(event) {
|
|
@@ -4701,17 +174,4 @@ function NativeSession(props) {
|
|
|
4701
174
|
export {
|
|
4702
175
|
GrizzleeNativeEmbed
|
|
4703
176
|
};
|
|
4704
|
-
/*! Bundled license information:
|
|
4705
|
-
|
|
4706
|
-
ieee754/index.js:
|
|
4707
|
-
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
4708
|
-
|
|
4709
|
-
buffer/index.js:
|
|
4710
|
-
(*!
|
|
4711
|
-
* The buffer module from node.js, for the browser.
|
|
4712
|
-
*
|
|
4713
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
4714
|
-
* @license MIT
|
|
4715
|
-
*)
|
|
4716
|
-
*/
|
|
4717
177
|
//# sourceMappingURL=native.js.map
|