Files
old-kitabcitab-frontend/kitabcitab/node_modules/next/dist/compiled/@edge-runtime/primitives/url.js

4634 lines
400 KiB
JavaScript
Raw Normal View History

2022-12-27 12:05:56 +01:00
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// <define:process>
var init_define_process = __esm({
"<define:process>"() {
}
});
// ../../node_modules/.pnpm/webidl-conversions@7.0.0/node_modules/webidl-conversions/lib/index.js
var require_lib = __commonJS({
"../../node_modules/.pnpm/webidl-conversions@7.0.0/node_modules/webidl-conversions/lib/index.js"(exports) {
"use strict";
init_define_process();
function makeException(ErrorType, message, options) {
if (options.globals) {
ErrorType = options.globals[ErrorType.name];
}
return new ErrorType(`${options.context ? options.context : "Value"} ${message}.`);
}
__name(makeException, "makeException");
function toNumber(value, options) {
if (typeof value === "bigint") {
throw makeException(TypeError, "is a BigInt which cannot be converted to a number", options);
}
if (!options.globals) {
return Number(value);
}
return options.globals.Number(value);
}
__name(toNumber, "toNumber");
function evenRound(x) {
if (x > 0 && x % 1 === 0.5 && (x & 1) === 0 || x < 0 && x % 1 === -0.5 && (x & 1) === 1) {
return censorNegativeZero(Math.floor(x));
}
return censorNegativeZero(Math.round(x));
}
__name(evenRound, "evenRound");
function integerPart(n) {
return censorNegativeZero(Math.trunc(n));
}
__name(integerPart, "integerPart");
function sign(x) {
return x < 0 ? -1 : 1;
}
__name(sign, "sign");
function modulo(x, y) {
const signMightNotMatch = x % y;
if (sign(y) !== sign(signMightNotMatch)) {
return signMightNotMatch + y;
}
return signMightNotMatch;
}
__name(modulo, "modulo");
function censorNegativeZero(x) {
return x === 0 ? 0 : x;
}
__name(censorNegativeZero, "censorNegativeZero");
function createIntegerConversion(bitLength, { unsigned }) {
let lowerBound, upperBound;
if (unsigned) {
lowerBound = 0;
upperBound = 2 ** bitLength - 1;
} else {
lowerBound = -(2 ** (bitLength - 1));
upperBound = 2 ** (bitLength - 1) - 1;
}
const twoToTheBitLength = 2 ** bitLength;
const twoToOneLessThanTheBitLength = 2 ** (bitLength - 1);
return (value, options = {}) => {
let x = toNumber(value, options);
x = censorNegativeZero(x);
if (options.enforceRange) {
if (!Number.isFinite(x)) {
throw makeException(TypeError, "is not a finite number", options);
}
x = integerPart(x);
if (x < lowerBound || x > upperBound) {
throw makeException(
TypeError,
`is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
options
);
}
return x;
}
if (!Number.isNaN(x) && options.clamp) {
x = Math.min(Math.max(x, lowerBound), upperBound);
x = evenRound(x);
return x;
}
if (!Number.isFinite(x) || x === 0) {
return 0;
}
x = integerPart(x);
if (x >= lowerBound && x <= upperBound) {
return x;
}
x = modulo(x, twoToTheBitLength);
if (!unsigned && x >= twoToOneLessThanTheBitLength) {
return x - twoToTheBitLength;
}
return x;
};
}
__name(createIntegerConversion, "createIntegerConversion");
function createLongLongConversion(bitLength, { unsigned }) {
const upperBound = Number.MAX_SAFE_INTEGER;
const lowerBound = unsigned ? 0 : Number.MIN_SAFE_INTEGER;
const asBigIntN = unsigned ? BigInt.asUintN : BigInt.asIntN;
return (value, options = {}) => {
let x = toNumber(value, options);
x = censorNegativeZero(x);
if (options.enforceRange) {
if (!Number.isFinite(x)) {
throw makeException(TypeError, "is not a finite number", options);
}
x = integerPart(x);
if (x < lowerBound || x > upperBound) {
throw makeException(
TypeError,
`is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
options
);
}
return x;
}
if (!Number.isNaN(x) && options.clamp) {
x = Math.min(Math.max(x, lowerBound), upperBound);
x = evenRound(x);
return x;
}
if (!Number.isFinite(x) || x === 0) {
return 0;
}
let xBigInt = BigInt(integerPart(x));
xBigInt = asBigIntN(bitLength, xBigInt);
return Number(xBigInt);
};
}
__name(createLongLongConversion, "createLongLongConversion");
exports.any = (value) => {
return value;
};
exports.undefined = () => {
return void 0;
};
exports.boolean = (value) => {
return Boolean(value);
};
exports.byte = createIntegerConversion(8, { unsigned: false });
exports.octet = createIntegerConversion(8, { unsigned: true });
exports.short = createIntegerConversion(16, { unsigned: false });
exports["unsigned short"] = createIntegerConversion(16, { unsigned: true });
exports.long = createIntegerConversion(32, { unsigned: false });
exports["unsigned long"] = createIntegerConversion(32, { unsigned: true });
exports["long long"] = createLongLongConversion(64, { unsigned: false });
exports["unsigned long long"] = createLongLongConversion(64, { unsigned: true });
exports.double = (value, options = {}) => {
const x = toNumber(value, options);
if (!Number.isFinite(x)) {
throw makeException(TypeError, "is not a finite floating-point value", options);
}
return x;
};
exports["unrestricted double"] = (value, options = {}) => {
const x = toNumber(value, options);
return x;
};
exports.float = (value, options = {}) => {
const x = toNumber(value, options);
if (!Number.isFinite(x)) {
throw makeException(TypeError, "is not a finite floating-point value", options);
}
if (Object.is(x, -0)) {
return x;
}
const y = Math.fround(x);
if (!Number.isFinite(y)) {
throw makeException(TypeError, "is outside the range of a single-precision floating-point value", options);
}
return y;
};
exports["unrestricted float"] = (value, options = {}) => {
const x = toNumber(value, options);
if (isNaN(x)) {
return x;
}
if (Object.is(x, -0)) {
return x;
}
return Math.fround(x);
};
exports.DOMString = (value, options = {}) => {
if (options.treatNullAsEmptyString && value === null) {
return "";
}
if (typeof value === "symbol") {
throw makeException(TypeError, "is a symbol, which cannot be converted to a string", options);
}
const StringCtor = options.globals ? options.globals.String : String;
return StringCtor(value);
};
exports.ByteString = (value, options = {}) => {
const x = exports.DOMString(value, options);
let c;
for (let i = 0; (c = x.codePointAt(i)) !== void 0; ++i) {
if (c > 255) {
throw makeException(TypeError, "is not a valid ByteString", options);
}
}
return x;
};
exports.USVString = (value, options = {}) => {
const S = exports.DOMString(value, options);
const n = S.length;
const U = [];
for (let i = 0; i < n; ++i) {
const c = S.charCodeAt(i);
if (c < 55296 || c > 57343) {
U.push(String.fromCodePoint(c));
} else if (56320 <= c && c <= 57343) {
U.push(String.fromCodePoint(65533));
} else if (i === n - 1) {
U.push(String.fromCodePoint(65533));
} else {
const d = S.charCodeAt(i + 1);
if (56320 <= d && d <= 57343) {
const a = c & 1023;
const b = d & 1023;
U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b));
++i;
} else {
U.push(String.fromCodePoint(65533));
}
}
}
return U.join("");
};
exports.object = (value, options = {}) => {
if (value === null || typeof value !== "object" && typeof value !== "function") {
throw makeException(TypeError, "is not an object", options);
}
return value;
};
var abByteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
var sabByteLengthGetter = typeof SharedArrayBuffer === "function" ? Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get : null;
function isNonSharedArrayBuffer(value) {
try {
abByteLengthGetter.call(value);
return true;
} catch {
return false;
}
}
__name(isNonSharedArrayBuffer, "isNonSharedArrayBuffer");
function isSharedArrayBuffer(value) {
try {
sabByteLengthGetter.call(value);
return true;
} catch {
return false;
}
}
__name(isSharedArrayBuffer, "isSharedArrayBuffer");
function isArrayBufferDetached(value) {
try {
new Uint8Array(value);
return false;
} catch {
return true;
}
}
__name(isArrayBufferDetached, "isArrayBufferDetached");
exports.ArrayBuffer = (value, options = {}) => {
if (!isNonSharedArrayBuffer(value)) {
if (options.allowShared && !isSharedArrayBuffer(value)) {
throw makeException(TypeError, "is not an ArrayBuffer or SharedArrayBuffer", options);
}
throw makeException(TypeError, "is not an ArrayBuffer", options);
}
if (isArrayBufferDetached(value)) {
throw makeException(TypeError, "is a detached ArrayBuffer", options);
}
return value;
};
var dvByteLengthGetter = Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength").get;
exports.DataView = (value, options = {}) => {
try {
dvByteLengthGetter.call(value);
} catch (e) {
throw makeException(TypeError, "is not a DataView", options);
}
if (!options.allowShared && isSharedArrayBuffer(value.buffer)) {
throw makeException(TypeError, "is backed by a SharedArrayBuffer, which is not allowed", options);
}
if (isArrayBufferDetached(value.buffer)) {
throw makeException(TypeError, "is backed by a detached ArrayBuffer", options);
}
return value;
};
var typedArrayNameGetter = Object.getOwnPropertyDescriptor(
Object.getPrototypeOf(Uint8Array).prototype,
Symbol.toStringTag
).get;
[
Int8Array,
Int16Array,
Int32Array,
Uint8Array,
Uint16Array,
Uint32Array,
Uint8ClampedArray,
Float32Array,
Float64Array
].forEach((func) => {
const { name } = func;
const article = /^[AEIOU]/u.test(name) ? "an" : "a";
exports[name] = (value, options = {}) => {
if (!ArrayBuffer.isView(value) || typedArrayNameGetter.call(value) !== name) {
throw makeException(TypeError, `is not ${article} ${name} object`, options);
}
if (!options.allowShared && isSharedArrayBuffer(value.buffer)) {
throw makeException(TypeError, "is a view on a SharedArrayBuffer, which is not allowed", options);
}
if (isArrayBufferDetached(value.buffer)) {
throw makeException(TypeError, "is a view on a detached ArrayBuffer", options);
}
return value;
};
});
exports.ArrayBufferView = (value, options = {}) => {
if (!ArrayBuffer.isView(value)) {
throw makeException(TypeError, "is not a view on an ArrayBuffer or SharedArrayBuffer", options);
}
if (!options.allowShared && isSharedArrayBuffer(value.buffer)) {
throw makeException(TypeError, "is a view on a SharedArrayBuffer, which is not allowed", options);
}
if (isArrayBufferDetached(value.buffer)) {
throw makeException(TypeError, "is a view on a detached ArrayBuffer", options);
}
return value;
};
exports.BufferSource = (value, options = {}) => {
if (ArrayBuffer.isView(value)) {
if (!options.allowShared && isSharedArrayBuffer(value.buffer)) {
throw makeException(TypeError, "is a view on a SharedArrayBuffer, which is not allowed", options);
}
if (isArrayBufferDetached(value.buffer)) {
throw makeException(TypeError, "is a view on a detached ArrayBuffer", options);
}
return value;
}
if (!options.allowShared && !isNonSharedArrayBuffer(value)) {
throw makeException(TypeError, "is not an ArrayBuffer or a view on one", options);
}
if (options.allowShared && !isSharedArrayBuffer(value) && !isNonSharedArrayBuffer(value)) {
throw makeException(TypeError, "is not an ArrayBuffer, SharedArrayBuffer, or a view on one", options);
}
if (isArrayBufferDetached(value)) {
throw makeException(TypeError, "is a detached ArrayBuffer", options);
}
return value;
};
exports.DOMTimeStamp = exports["unsigned long long"];
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/utils.js
var require_utils = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/utils.js"(exports, module2) {
"use strict";
init_define_process();
function isObject(value) {
return typeof value === "object" && value !== null || typeof value === "function";
}
__name(isObject, "isObject");
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
function define(target, source) {
for (const key of Reflect.ownKeys(source)) {
const descriptor = Reflect.getOwnPropertyDescriptor(source, key);
if (descriptor && !Reflect.defineProperty(target, key, descriptor)) {
throw new TypeError(`Cannot redefine property: ${String(key)}`);
}
}
}
__name(define, "define");
function newObjectInRealm(globalObject, object) {
const ctorRegistry = initCtorRegistry(globalObject);
return Object.defineProperties(
Object.create(ctorRegistry["%Object.prototype%"]),
Object.getOwnPropertyDescriptors(object)
);
}
__name(newObjectInRealm, "newObjectInRealm");
var wrapperSymbol = Symbol("wrapper");
var implSymbol = Symbol("impl");
var sameObjectCaches = Symbol("SameObject caches");
var ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
var AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {
}).prototype);
function initCtorRegistry(globalObject) {
if (hasOwn(globalObject, ctorRegistrySymbol)) {
return globalObject[ctorRegistrySymbol];
}
const ctorRegistry = /* @__PURE__ */ Object.create(null);
ctorRegistry["%Object.prototype%"] = globalObject.Object.prototype;
ctorRegistry["%IteratorPrototype%"] = Object.getPrototypeOf(
Object.getPrototypeOf(new globalObject.Array()[Symbol.iterator]())
);
try {
ctorRegistry["%AsyncIteratorPrototype%"] = Object.getPrototypeOf(
Object.getPrototypeOf(
globalObject.eval("(async function* () {})").prototype
)
);
} catch {
ctorRegistry["%AsyncIteratorPrototype%"] = AsyncIteratorPrototype;
}
globalObject[ctorRegistrySymbol] = ctorRegistry;
return ctorRegistry;
}
__name(initCtorRegistry, "initCtorRegistry");
function getSameObject(wrapper, prop, creator) {
if (!wrapper[sameObjectCaches]) {
wrapper[sameObjectCaches] = /* @__PURE__ */ Object.create(null);
}
if (prop in wrapper[sameObjectCaches]) {
return wrapper[sameObjectCaches][prop];
}
wrapper[sameObjectCaches][prop] = creator();
return wrapper[sameObjectCaches][prop];
}
__name(getSameObject, "getSameObject");
function wrapperForImpl(impl) {
return impl ? impl[wrapperSymbol] : null;
}
__name(wrapperForImpl, "wrapperForImpl");
function implForWrapper(wrapper) {
return wrapper ? wrapper[implSymbol] : null;
}
__name(implForWrapper, "implForWrapper");
function tryWrapperForImpl(impl) {
const wrapper = wrapperForImpl(impl);
return wrapper ? wrapper : impl;
}
__name(tryWrapperForImpl, "tryWrapperForImpl");
function tryImplForWrapper(wrapper) {
const impl = implForWrapper(wrapper);
return impl ? impl : wrapper;
}
__name(tryImplForWrapper, "tryImplForWrapper");
var iterInternalSymbol = Symbol("internal");
function isArrayIndexPropName(P) {
if (typeof P !== "string") {
return false;
}
const i = P >>> 0;
if (i === 2 ** 32 - 1) {
return false;
}
const s = `${i}`;
if (P !== s) {
return false;
}
return true;
}
__name(isArrayIndexPropName, "isArrayIndexPropName");
var byteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
function isArrayBuffer(value) {
try {
byteLengthGetter.call(value);
return true;
} catch (e) {
return false;
}
}
__name(isArrayBuffer, "isArrayBuffer");
function iteratorResult([key, value], kind) {
let result;
switch (kind) {
case "key":
result = key;
break;
case "value":
result = value;
break;
case "key+value":
result = [key, value];
break;
}
return { value: result, done: false };
}
__name(iteratorResult, "iteratorResult");
var supportsPropertyIndex = Symbol("supports property index");
var supportedPropertyIndices = Symbol("supported property indices");
var supportsPropertyName = Symbol("supports property name");
var supportedPropertyNames = Symbol("supported property names");
var indexedGet = Symbol("indexed property get");
var indexedSetNew = Symbol("indexed property set new");
var indexedSetExisting = Symbol("indexed property set existing");
var namedGet = Symbol("named property get");
var namedSetNew = Symbol("named property set new");
var namedSetExisting = Symbol("named property set existing");
var namedDelete = Symbol("named property delete");
var asyncIteratorNext = Symbol("async iterator get the next iteration result");
var asyncIteratorReturn = Symbol("async iterator return steps");
var asyncIteratorInit = Symbol("async iterator initialization steps");
var asyncIteratorEOI = Symbol("async iterator end of iteration");
module2.exports = exports = {
isObject,
hasOwn,
define,
newObjectInRealm,
wrapperSymbol,
implSymbol,
getSameObject,
ctorRegistrySymbol,
initCtorRegistry,
wrapperForImpl,
implForWrapper,
tryWrapperForImpl,
tryImplForWrapper,
iterInternalSymbol,
isArrayBuffer,
isArrayIndexPropName,
supportsPropertyIndex,
supportedPropertyIndices,
supportsPropertyName,
supportedPropertyNames,
indexedGet,
indexedSetNew,
indexedSetExisting,
namedGet,
namedSetNew,
namedSetExisting,
namedDelete,
asyncIteratorNext,
asyncIteratorReturn,
asyncIteratorInit,
asyncIteratorEOI,
iteratorResult
};
}
});
// ../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/regexes.js
var require_regexes = __commonJS({
"../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/regexes.js"(exports, module2) {
"use strict";
init_define_process();
var combiningMarks = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10EAB}\u{10EAC}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11000}-\u{11002}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11082}\u{110B0}-\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{11134}\u{11145}\u{11146}\u{11173}\u{11180}-\u{11182}\u{111B3}-\u{111C0}\u{111C9}-\u{111CC}\u{111CE}\u{111CF}\u{1122C}-\u{11237}\u{1123E}\u{112DF}-\u{112EA}\u{11300}-\u{11303}\u{1133B}\u{1133C}\u{1133E}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11357}\u{11362}\u{11363}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11435}-\u{11446}\u{1145E}\u{114B0}-\u{114C3}\u{115AF}-\u{115B5}\u{115B8}-\u{115C0}\u{115DC}\u{115DD}\u{11630}-\u{11640}\u{116AB}-\u{116B7}\u{1171D}-\u{1172B}\u{1182C}-\u{1183A}\u{11930}-\u{11935}\u{11937}\u{11938}\u{1193B}-\u{1193E}\u{11940}\u{11942}\u{11943}\u{119D1}-\u{119D7}\u{119DA}-\u{119E0}\u{119E4}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A39}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A5B}\u{11A8A}-\u{11A99}\u{11C2F}-\u{11C36}\u{11C38}-\u{11C3F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D8A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D97}\u{11EF3}-\u{11EF6}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F51}-\u{16F87}\u{16F8F}-\u{16F92}\u{16FE4}\u{16FF0}\u{16FF1}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D165}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]/u;
var combiningClassVirama = /[\u094D\u09CD\u0A4D\u0ACD\u0B4D\u0BCD\u0C4D\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0EBA\u0F84\u1039\u103A\u1714\u1734\u17D2\u1A60\u1B44\u1BAA\u1BAB\u1BF2\u1BF3\u2D7F\uA806\uA8C4\uA953\uA9C0\uAAF6\uABED\u{10A3F}\u{11046}\u{1107F}\u{110B9}\u{11133}\u{11134}\u{111C0}\u{11235}\u{112EA}\u{1134D}\u{11442}\u{114C2}\u{115BF}\u{1163F}\u{116B6}\u{1172B}\u{11839}\u{119E0}\u{11A34}\u{11A47}\u{11A99}\u{11C3F}\u{11D44}\u{11D45}\u{11D97}]/u;
var validZWNJ = /[\u0620\u0626\u0628\u062A-\u062E\u0633-\u063F\u0641-\u0647\u0649\u064A\u066E\u066F\u0678-\u0687\u069A-\u06BF\u06C1\u06C2\u06CC\u06CE\u06D0\u06D1\u06FA-\u06FC\u06FF\u0712-\u0714\u071A-\u071D\u071F-\u0727\u0729\u072B\u072D\u072E\u074E-\u0758\u075C-\u076A\u076D-\u0770\u0772\u0775-\u0777\u077A-\u077F\u07CA-\u07EA\u0841-\u0845\u0848\u084A-\u0853\u0855\u0860\u0862-\u0865\u0868\u08A0-\u08A9\u08AF\u08B0\u08B3\u08B4\u08B6-\u08B8\u08BA-\u08BD\u1807\u1820-\u1878\u1887-\u18A8\u18AA\uA840-\uA872\u{10AC0}-\u{10AC4}\u{10ACD}\u{10AD3}-\u{10ADC}\u{10ADE}-\u{10AE0}\u{10AEB}-\u{10AEE}\u{10B80}\u{10B82}\u{10B86}-\u{10B88}\u{10B8A}\u{10B8B}\u{10B8D}\u{10B90}\u{10BAD}\u{10BAE}\u{10D00}-\u{10D21}\u{10D23}\u{10F30}-\u{10F32}\u{10F34}-\u{10F44}\u{10F51}-\u{10F53}\u{1E900}-\u{1E943}][\xAD\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u061C\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200B\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFEFF\uFFF9-\uFFFB\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10F46}-\u{10F50}\u{11001}\u{11038}-\u{11046}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{
var bidiDomain = /[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u08A0-\u08C9\u08E2\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u;
var bidiS1LTR = /[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B50-\u1B6A\u1B74-\u1B7E\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u249C-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31BF\u31F0-\u321C\u322
var bidiS1RTL = /[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u;
var bidiS2 = /^[\0-\x08\x0E-\x1B!-@\[-`\{-\x84\x86-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02B9\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u036F\u0374\u0375\u037E\u0384\u0385\u0387\u03F6\u0483-\u0489\u058A\u058D-\u058F\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u0898-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09F2\u09F3\u09FB\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AF1\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0BF3-\u0BFA\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C78-\u0C7E\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E3F\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39-\u0F3D\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1390-\u1399\u1400\u169B\u169C\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DB\u17DD\u17F0-\u17F9\u1800-\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1940\u1944\u1945\u19DE-\u19FF\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u200B-\u200D\u200F-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20C0\u20D0-\u20F0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189-\u218B\u2190-\u2335\u237B-\u2394\u2396-\u2426\u2440-\u244A\u2460-\u249B\u24EA-\u26AB\u26AD-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF9-\u2CFF\u2D7F\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u3004\u3008-\u3020\u302A-\u302D\u3030\u3036\u3037\u303D-\u303F\u3099-\u309C\u30A0\u30FB\u31C0-\u31E3\u321D\u321E\u3250-\u325F\u327C-\u327E\u32B1-\u32BF\u32CC-\u32CF\u3377-\u337A\u33DE\u33DF\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA60D-\uA60F\uA66F-\uA67F\uA69E\uA69F\uA6F0\uA6F1\uA700-\uA721\uA788\uA802\uA806\uA80B\uA825\uA826\uA828-\uA82C\uA838\uA839\uA874-\uA877\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uAB6A\uAB6B\uABE5\uABE8\uABED\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFE19\uFE20-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFE70-\uFE74\uFE76-\uFEFC\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD\u{10101}\u{10140}-\u{1018C}\u{10190}-\u{1019C}\u{101A0}\u{101FD}\u{102E0}-\u{102FB}\u{10376}-\u{1037A}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{1091F}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A38}-\u{10A3A}\u{10A3F}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE6}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B39}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10
var bidiS3 = /[0-9\xB2\xB3\xB9\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u08A0-\u08C9\u08E2\u200F\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\u{102E1}-\u{102FB}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1D7CE}-\u{1D7FF}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}][\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uA
var bidiS4EN = /[0-9\xB2\xB3\xB9\u06F0-\u06F9\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFF10-\uFF19\u{102E1}-\u{102FB}\u{1D7CE}-\u{1D7FF}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}]/u;
var bidiS4AN = /[\u0600-\u0605\u0660-\u0669\u066B\u066C\u06DD\u0890\u0891\u08E2\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}]/u;
var bidiS5 = /^[\0-\x08\x0E-\x1B!-\x84\x86-\u0377\u037A-\u037F\u0384-\u038A\u038C\u038E-\u03A1\u03A3-\u052F\u0531-\u0556\u0559-\u058A\u058D-\u058F\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0606\u0607\u0609\u060A\u060C\u060E-\u061A\u064B-\u065F\u066A\u0670\u06D6-\u06DC\u06DE-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07F6-\u07F9\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A76\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C77-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E3A\u0E3F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FDA\u1000-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u13A0-\u13F5\u13F8-\u13FD\u1400-\u167F\u1681-\u169C\u16A0-\u16F8\u1700-\u1715\u171F-\u1736\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u1800-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE-\u1A1B\u1A1E-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1AB0-\u1ACE\u1B00-\u1B4C\u1B50-\u1B7E\u1B80-\u1BF3\u1BFC-\u1C37\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD0-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u200B-\u200E\u2010-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2071\u2074-\u208E\u2090-\u209C\u20A0-\u20C0\u20D0-\u20F0\u2100-\u218B\u2190-\u2426\u2440-\u244A\u2460-\u2B73\u2B76-\u2B95\u2B97-\u2CF3\u2CF9-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303F\u3041-\u3096\u3099-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31E3\u31F0-\u321E\u3220-\uA48C\uA490-\uA4C6\uA4D0-\uA62B\uA640-\uA6F7\uA700-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA82C\uA830-\uA839\uA840-\uA877\uA880-\uA8C5\uA8CE-\uA8D9\uA8E0-\uA953\uA95F-\uA97C\uA980-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAAC2\uAADB-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB6B\uAB70-\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06
var bidiS6 = /[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u06F0-\u06F9\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B50-\u1B6A\u1B74-\u1B7E\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u2488-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105
module2.exports = {
combiningMarks,
combiningClassVirama,
validZWNJ,
bidiDomain,
bidiS1LTR,
bidiS1RTL,
bidiS2,
bidiS3,
bidiS4EN,
bidiS4AN,
bidiS5,
bidiS6
};
}
});
// ../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/mappingTable.json
var require_mappingTable = __commonJS({
"../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/mappingTable.json"(exports, module2) {
module2.exports = [[[0, 44], 4], [[45, 46], 2], [47, 4], [[48, 57], 2], [[58, 64], 4], [65, 1, "a"], [66, 1, "b"], [67, 1, "c"], [68, 1, "d"], [69, 1, "e"], [70, 1, "f"], [71, 1, "g"], [72, 1, "h"], [73, 1, "i"], [74, 1, "j"], [75, 1, "k"], [76, 1, "l"], [77, 1, "m"], [78, 1, "n"], [79, 1, "o"], [80, 1, "p"], [81, 1, "q"], [82, 1, "r"], [83, 1, "s"], [84, 1, "t"], [85, 1, "u"], [86, 1, "v"], [87, 1, "w"], [88, 1, "x"], [89, 1, "y"], [90, 1, "z"], [[91, 96], 4], [[97, 122], 2], [[123, 127], 4], [[128, 159], 3], [160, 5, " "], [[161, 167], 2], [168, 5, " \u0308"], [169, 2], [170, 1, "a"], [[171, 172], 2], [173, 7], [174, 2], [175, 5, " \u0304"], [[176, 177], 2], [178, 1, "2"], [179, 1, "3"], [180, 5, " \u0301"], [181, 1, "\u03BC"], [182, 2], [183, 2], [184, 5, " \u0327"], [185, 1, "1"], [186, 1, "o"], [187, 2], [188, 1, "1\u20444"], [189, 1, "1\u20442"], [190, 1, "3\u20444"], [191, 2], [192, 1, "\xE0"], [193, 1, "\xE1"], [194, 1, "\xE2"], [195, 1, "\xE3"], [196, 1, "\xE4"], [197, 1, "\xE5"], [198, 1, "\xE6"], [199, 1, "\xE7"], [200, 1, "\xE8"], [201, 1, "\xE9"], [202, 1, "\xEA"], [203, 1, "\xEB"], [204, 1, "\xEC"], [205, 1, "\xED"], [206, 1, "\xEE"], [207, 1, "\xEF"], [208, 1, "\xF0"], [209, 1, "\xF1"], [210, 1, "\xF2"], [211, 1, "\xF3"], [212, 1, "\xF4"], [213, 1, "\xF5"], [214, 1, "\xF6"], [215, 2], [216, 1, "\xF8"], [217, 1, "\xF9"], [218, 1, "\xFA"], [219, 1, "\xFB"], [220, 1, "\xFC"], [221, 1, "\xFD"], [222, 1, "\xFE"], [223, 6, "ss"], [[224, 246], 2], [247, 2], [[248, 255], 2], [256, 1, "\u0101"], [257, 2], [258, 1, "\u0103"], [259, 2], [260, 1, "\u0105"], [261, 2], [262, 1, "\u0107"], [263, 2], [264, 1, "\u0109"], [265, 2], [266, 1, "\u010B"], [267, 2], [268, 1, "\u010D"], [269, 2], [270, 1, "\u010F"], [271, 2], [272, 1, "\u0111"], [273, 2], [274, 1, "\u0113"], [275, 2], [276, 1, "\u0115"], [277, 2], [278, 1, "\u0117"], [279, 2], [280, 1, "\u0119"], [281, 2], [282, 1, "\u011B"], [283, 2], [284, 1, "\u011D"], [285, 2], [286, 1, "\u011F"], [287, 2], [288, 1, "\u0121"], [289, 2], [290, 1, "\u0123"], [291, 2], [292, 1, "\u0125"], [293, 2], [294, 1, "\u0127"], [295, 2], [296, 1, "\u0129"], [297, 2], [298, 1, "\u012B"], [299, 2], [300, 1, "\u012D"], [301, 2], [302, 1, "\u012F"], [303, 2], [304, 1, "i\u0307"], [305, 2], [[306, 307], 1, "ij"], [308, 1, "\u0135"], [309, 2], [310, 1, "\u0137"], [[311, 312], 2], [313, 1, "\u013A"], [314, 2], [315, 1, "\u013C"], [316, 2], [317, 1, "\u013E"], [318, 2], [[319, 320], 1, "l\xB7"], [321, 1, "\u0142"], [322, 2], [323, 1, "\u0144"], [324, 2], [325, 1, "\u0146"], [326, 2], [327, 1, "\u0148"], [328, 2], [329, 1, "\u02BCn"], [330, 1, "\u014B"], [331, 2], [332, 1, "\u014D"], [333, 2], [334, 1, "\u014F"], [335, 2], [336, 1, "\u0151"], [337, 2], [338, 1, "\u0153"], [339, 2], [340, 1, "\u0155"], [341, 2], [342, 1, "\u0157"], [343, 2], [344, 1, "\u0159"], [345, 2], [346, 1, "\u015B"], [347, 2], [348, 1, "\u015D"], [349, 2], [350, 1, "\u015F"], [351, 2], [352, 1, "\u0161"], [353, 2], [354, 1, "\u0163"], [355, 2], [356, 1, "\u0165"], [357, 2], [358, 1, "\u0167"], [359, 2], [360, 1, "\u0169"], [361, 2], [362, 1, "\u016B"], [363, 2], [364, 1, "\u016D"], [365, 2], [366, 1, "\u016F"], [367, 2], [368, 1, "\u0171"], [369, 2], [370, 1, "\u0173"], [371, 2], [372, 1, "\u0175"], [373, 2], [374, 1, "\u0177"], [375, 2], [376, 1, "\xFF"], [377, 1, "\u017A"], [378, 2], [379, 1, "\u017C"], [380, 2], [381, 1, "\u017E"], [382, 2], [383, 1, "s"], [384, 2], [385, 1, "\u0253"], [386, 1, "\u0183"], [387, 2], [388, 1, "\u0185"], [389, 2], [390, 1, "\u0254"], [391, 1, "\u0188"], [392, 2], [393, 1, "\u0256"], [394, 1, "\u0257"], [395, 1, "\u018C"], [[396, 397], 2], [398, 1, "\u01DD"], [399, 1, "\u0259"], [400, 1, "\u025B"], [401, 1, "\u0192"], [402, 2], [403, 1, "\u0260"], [404, 1, "\u0263"], [405, 2], [406, 1, "\u0269"], [407, 1, "\u0268"], [408, 1, "\u0199"], [[409, 411], 2], [412, 1, "\u026F"], [413, 1, "\u0272"], [414, 2], [415, 1, "\u0275"], [416, 1, "\u01A1"], [417, 2], [418, 1, "\u01A3"], [419, 2], [420, 1, "\u01A5"], [421, 2], [422, 1, "\u0280"], [423, 1, "\u01A8"], [424, 2], [425, 1, "\u0283"], [[426, 42
}
});
// ../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/statusMapping.js
var require_statusMapping = __commonJS({
"../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/lib/statusMapping.js"(exports, module2) {
"use strict";
init_define_process();
module2.exports.STATUS_MAPPING = {
mapped: 1,
valid: 2,
disallowed: 3,
disallowed_STD3_valid: 4,
disallowed_STD3_mapped: 5,
deviation: 6,
ignored: 7
};
}
});
// ../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/index.js
var require_tr46 = __commonJS({
"../../node_modules/.pnpm/tr46@3.0.0/node_modules/tr46/index.js"(exports, module2) {
"use strict";
init_define_process();
var punycode = require("punycode");
var regexes = require_regexes();
var mappingTable = require_mappingTable();
var { STATUS_MAPPING } = require_statusMapping();
function containsNonASCII(str) {
return /[^\x00-\x7F]/u.test(str);
}
__name(containsNonASCII, "containsNonASCII");
function findStatus(val, { useSTD3ASCIIRules }) {
let start = 0;
let end = mappingTable.length - 1;
while (start <= end) {
const mid = Math.floor((start + end) / 2);
const target = mappingTable[mid];
const min = Array.isArray(target[0]) ? target[0][0] : target[0];
const max = Array.isArray(target[0]) ? target[0][1] : target[0];
if (min <= val && max >= val) {
if (useSTD3ASCIIRules && (target[1] === STATUS_MAPPING.disallowed_STD3_valid || target[1] === STATUS_MAPPING.disallowed_STD3_mapped)) {
return [STATUS_MAPPING.disallowed, ...target.slice(2)];
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_valid) {
return [STATUS_MAPPING.valid, ...target.slice(2)];
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_mapped) {
return [STATUS_MAPPING.mapped, ...target.slice(2)];
}
return target.slice(1);
} else if (min > val) {
end = mid - 1;
} else {
start = mid + 1;
}
}
return null;
}
__name(findStatus, "findStatus");
function mapChars(domainName, { useSTD3ASCIIRules, processingOption }) {
let hasError = false;
let processed = "";
for (const ch of domainName) {
const [status, mapping] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
switch (status) {
case STATUS_MAPPING.disallowed:
hasError = true;
processed += ch;
break;
case STATUS_MAPPING.ignored:
break;
case STATUS_MAPPING.mapped:
processed += mapping;
break;
case STATUS_MAPPING.deviation:
if (processingOption === "transitional") {
processed += mapping;
} else {
processed += ch;
}
break;
case STATUS_MAPPING.valid:
processed += ch;
break;
}
}
return {
string: processed,
error: hasError
};
}
__name(mapChars, "mapChars");
function validateLabel(label, { checkHyphens, checkBidi, checkJoiners, processingOption, useSTD3ASCIIRules }) {
if (label.normalize("NFC") !== label) {
return false;
}
const codePoints = Array.from(label);
if (checkHyphens) {
if (codePoints[2] === "-" && codePoints[3] === "-" || (label.startsWith("-") || label.endsWith("-"))) {
return false;
}
}
if (label.includes(".") || codePoints.length > 0 && regexes.combiningMarks.test(codePoints[0])) {
return false;
}
for (const ch of codePoints) {
const [status] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
if (processingOption === "transitional" && status !== STATUS_MAPPING.valid || processingOption === "nontransitional" && status !== STATUS_MAPPING.valid && status !== STATUS_MAPPING.deviation) {
return false;
}
}
if (checkJoiners) {
let last = 0;
for (const [i, ch] of codePoints.entries()) {
if (ch === "\u200C" || ch === "\u200D") {
if (i > 0) {
if (regexes.combiningClassVirama.test(codePoints[i - 1])) {
continue;
}
if (ch === "\u200C") {
const next = codePoints.indexOf("\u200C", i + 1);
const test = next < 0 ? codePoints.slice(last) : codePoints.slice(last, next);
if (regexes.validZWNJ.test(test.join(""))) {
last = i + 1;
continue;
}
}
}
return false;
}
}
}
if (checkBidi) {
let rtl;
if (regexes.bidiS1LTR.test(codePoints[0])) {
rtl = false;
} else if (regexes.bidiS1RTL.test(codePoints[0])) {
rtl = true;
} else {
return false;
}
if (rtl) {
if (!regexes.bidiS2.test(label) || !regexes.bidiS3.test(label) || regexes.bidiS4EN.test(label) && regexes.bidiS4AN.test(label)) {
return false;
}
} else if (!regexes.bidiS5.test(label) || !regexes.bidiS6.test(label)) {
return false;
}
}
return true;
}
__name(validateLabel, "validateLabel");
function isBidiDomain(labels) {
const domain = labels.map((label) => {
if (label.startsWith("xn--")) {
try {
return punycode.decode(label.substring(4));
} catch (err) {
return "";
}
}
return label;
}).join(".");
return regexes.bidiDomain.test(domain);
}
__name(isBidiDomain, "isBidiDomain");
function processing(domainName, options) {
const { processingOption } = options;
let { string, error } = mapChars(domainName, options);
string = string.normalize("NFC");
const labels = string.split(".");
const isBidi = isBidiDomain(labels);
for (const [i, origLabel] of labels.entries()) {
let label = origLabel;
let curProcessing = processingOption;
if (label.startsWith("xn--")) {
try {
label = punycode.decode(label.substring(4));
labels[i] = label;
} catch (err) {
error = true;
continue;
}
curProcessing = "nontransitional";
}
if (error) {
continue;
}
const validation = validateLabel(label, {
...options,
processingOption: curProcessing,
checkBidi: options.checkBidi && isBidi
});
if (!validation) {
error = true;
}
}
return {
string: labels.join("."),
error
};
}
__name(processing, "processing");
function toASCII(domainName, {
checkHyphens = false,
checkBidi = false,
checkJoiners = false,
useSTD3ASCIIRules = false,
processingOption = "nontransitional",
verifyDNSLength = false
} = {}) {
if (processingOption !== "transitional" && processingOption !== "nontransitional") {
throw new RangeError("processingOption must be either transitional or nontransitional");
}
const result = processing(domainName, {
processingOption,
checkHyphens,
checkBidi,
checkJoiners,
useSTD3ASCIIRules
});
let labels = result.string.split(".");
labels = labels.map((l) => {
if (containsNonASCII(l)) {
try {
return `xn--${punycode.encode(l)}`;
} catch (e) {
result.error = true;
}
}
return l;
});
if (verifyDNSLength) {
const total = labels.join(".").length;
if (total > 253 || total === 0) {
result.error = true;
}
for (let i = 0; i < labels.length; ++i) {
if (labels[i].length > 63 || labels[i].length === 0) {
result.error = true;
break;
}
}
}
if (result.error) {
return null;
}
return labels.join(".");
}
__name(toASCII, "toASCII");
function toUnicode(domainName, {
checkHyphens = false,
checkBidi = false,
checkJoiners = false,
useSTD3ASCIIRules = false,
processingOption = "nontransitional"
} = {}) {
const result = processing(domainName, {
processingOption,
checkHyphens,
checkBidi,
checkJoiners,
useSTD3ASCIIRules
});
return {
domain: result.string,
error: result.error
};
}
__name(toUnicode, "toUnicode");
module2.exports = {
toASCII,
toUnicode
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/infra.js
var require_infra = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/infra.js"(exports, module2) {
"use strict";
init_define_process();
function isASCIIDigit(c) {
return c >= 48 && c <= 57;
}
__name(isASCIIDigit, "isASCIIDigit");
function isASCIIAlpha(c) {
return c >= 65 && c <= 90 || c >= 97 && c <= 122;
}
__name(isASCIIAlpha, "isASCIIAlpha");
function isASCIIAlphanumeric(c) {
return isASCIIAlpha(c) || isASCIIDigit(c);
}
__name(isASCIIAlphanumeric, "isASCIIAlphanumeric");
function isASCIIHex(c) {
return isASCIIDigit(c) || c >= 65 && c <= 70 || c >= 97 && c <= 102;
}
__name(isASCIIHex, "isASCIIHex");
module2.exports = {
isASCIIDigit,
isASCIIAlpha,
isASCIIAlphanumeric,
isASCIIHex
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/encoding.js
var require_encoding = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/encoding.js"(exports, module2) {
"use strict";
init_define_process();
var utf8Encoder = new TextEncoder();
var utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
function utf8Encode(string) {
return utf8Encoder.encode(string);
}
__name(utf8Encode, "utf8Encode");
function utf8DecodeWithoutBOM(bytes) {
return utf8Decoder.decode(bytes);
}
__name(utf8DecodeWithoutBOM, "utf8DecodeWithoutBOM");
module2.exports = {
utf8Encode,
utf8DecodeWithoutBOM
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/percent-encoding.js
var require_percent_encoding = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/percent-encoding.js"(exports, module2) {
"use strict";
init_define_process();
var { isASCIIHex } = require_infra();
var { utf8Encode } = require_encoding();
function p(char) {
return char.codePointAt(0);
}
__name(p, "p");
function percentEncode(c) {
let hex = c.toString(16).toUpperCase();
if (hex.length === 1) {
hex = `0${hex}`;
}
return `%${hex}`;
}
__name(percentEncode, "percentEncode");
function percentDecodeBytes(input) {
const output = new Uint8Array(input.byteLength);
let outputIndex = 0;
for (let i = 0; i < input.byteLength; ++i) {
const byte = input[i];
if (byte !== 37) {
output[outputIndex++] = byte;
} else if (byte === 37 && (!isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2]))) {
output[outputIndex++] = byte;
} else {
const bytePoint = parseInt(String.fromCodePoint(input[i + 1], input[i + 2]), 16);
output[outputIndex++] = bytePoint;
i += 2;
}
}
return output.slice(0, outputIndex);
}
__name(percentDecodeBytes, "percentDecodeBytes");
function percentDecodeString(input) {
const bytes = utf8Encode(input);
return percentDecodeBytes(bytes);
}
__name(percentDecodeString, "percentDecodeString");
function isC0ControlPercentEncode(c) {
return c <= 31 || c > 126;
}
__name(isC0ControlPercentEncode, "isC0ControlPercentEncode");
var extraFragmentPercentEncodeSet = /* @__PURE__ */ new Set([p(" "), p('"'), p("<"), p(">"), p("`")]);
function isFragmentPercentEncode(c) {
return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);
}
__name(isFragmentPercentEncode, "isFragmentPercentEncode");
var extraQueryPercentEncodeSet = /* @__PURE__ */ new Set([p(" "), p('"'), p("#"), p("<"), p(">")]);
function isQueryPercentEncode(c) {
return isC0ControlPercentEncode(c) || extraQueryPercentEncodeSet.has(c);
}
__name(isQueryPercentEncode, "isQueryPercentEncode");
function isSpecialQueryPercentEncode(c) {
return isQueryPercentEncode(c) || c === p("'");
}
__name(isSpecialQueryPercentEncode, "isSpecialQueryPercentEncode");
var extraPathPercentEncodeSet = /* @__PURE__ */ new Set([p("?"), p("`"), p("{"), p("}")]);
function isPathPercentEncode(c) {
return isQueryPercentEncode(c) || extraPathPercentEncodeSet.has(c);
}
__name(isPathPercentEncode, "isPathPercentEncode");
var extraUserinfoPercentEncodeSet = /* @__PURE__ */ new Set([p("/"), p(":"), p(";"), p("="), p("@"), p("["), p("\\"), p("]"), p("^"), p("|")]);
function isUserinfoPercentEncode(c) {
return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);
}
__name(isUserinfoPercentEncode, "isUserinfoPercentEncode");
var extraComponentPercentEncodeSet = /* @__PURE__ */ new Set([p("$"), p("%"), p("&"), p("+"), p(",")]);
function isComponentPercentEncode(c) {
return isUserinfoPercentEncode(c) || extraComponentPercentEncodeSet.has(c);
}
__name(isComponentPercentEncode, "isComponentPercentEncode");
var extraURLEncodedPercentEncodeSet = /* @__PURE__ */ new Set([p("!"), p("'"), p("("), p(")"), p("~")]);
function isURLEncodedPercentEncode(c) {
return isComponentPercentEncode(c) || extraURLEncodedPercentEncodeSet.has(c);
}
__name(isURLEncodedPercentEncode, "isURLEncodedPercentEncode");
function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {
const bytes = utf8Encode(codePoint);
let output = "";
for (const byte of bytes) {
if (!percentEncodePredicate(byte)) {
output += String.fromCharCode(byte);
} else {
output += percentEncode(byte);
}
}
return output;
}
__name(utf8PercentEncodeCodePointInternal, "utf8PercentEncodeCodePointInternal");
function utf8PercentEncodeCodePoint(codePoint, percentEncodePredicate) {
return utf8PercentEncodeCodePointInternal(String.fromCodePoint(codePoint), percentEncodePredicate);
}
__name(utf8PercentEncodeCodePoint, "utf8PercentEncodeCodePoint");
function utf8PercentEncodeString(input, percentEncodePredicate, spaceAsPlus = false) {
let output = "";
for (const codePoint of input) {
if (spaceAsPlus && codePoint === " ") {
output += "+";
} else {
output += utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate);
}
}
return output;
}
__name(utf8PercentEncodeString, "utf8PercentEncodeString");
module2.exports = {
isC0ControlPercentEncode,
isFragmentPercentEncode,
isQueryPercentEncode,
isSpecialQueryPercentEncode,
isPathPercentEncode,
isUserinfoPercentEncode,
isURLEncodedPercentEncode,
percentDecodeString,
percentDecodeBytes,
utf8PercentEncodeString,
utf8PercentEncodeCodePoint
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/url-state-machine.js
var require_url_state_machine = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/url-state-machine.js"(exports, module2) {
"use strict";
init_define_process();
var tr46 = require_tr46();
var infra = require_infra();
var { utf8DecodeWithoutBOM } = require_encoding();
var {
percentDecodeString,
utf8PercentEncodeCodePoint,
utf8PercentEncodeString,
isC0ControlPercentEncode,
isFragmentPercentEncode,
isQueryPercentEncode,
isSpecialQueryPercentEncode,
isPathPercentEncode,
isUserinfoPercentEncode
} = require_percent_encoding();
function p(char) {
return char.codePointAt(0);
}
__name(p, "p");
var specialSchemes = {
ftp: 21,
file: null,
http: 80,
https: 443,
ws: 80,
wss: 443
};
var failure = Symbol("failure");
function countSymbols(str) {
return [...str].length;
}
__name(countSymbols, "countSymbols");
function at(input, idx) {
const c = input[idx];
return isNaN(c) ? void 0 : String.fromCodePoint(c);
}
__name(at, "at");
function isSingleDot(buffer) {
return buffer === "." || buffer.toLowerCase() === "%2e";
}
__name(isSingleDot, "isSingleDot");
function isDoubleDot(buffer) {
buffer = buffer.toLowerCase();
return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e";
}
__name(isDoubleDot, "isDoubleDot");
function isWindowsDriveLetterCodePoints(cp1, cp2) {
return infra.isASCIIAlpha(cp1) && (cp2 === p(":") || cp2 === p("|"));
}
__name(isWindowsDriveLetterCodePoints, "isWindowsDriveLetterCodePoints");
function isWindowsDriveLetterString(string) {
return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|");
}
__name(isWindowsDriveLetterString, "isWindowsDriveLetterString");
function isNormalizedWindowsDriveLetterString(string) {
return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && string[1] === ":";
}
__name(isNormalizedWindowsDriveLetterString, "isNormalizedWindowsDriveLetterString");
function containsForbiddenHostCodePoint(string) {
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1;
}
__name(containsForbiddenHostCodePoint, "containsForbiddenHostCodePoint");
function containsForbiddenHostCodePointExcludingPercent(string) {
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1;
}
__name(containsForbiddenHostCodePointExcludingPercent, "containsForbiddenHostCodePointExcludingPercent");
function isSpecialScheme2(scheme) {
return specialSchemes[scheme] !== void 0;
}
__name(isSpecialScheme2, "isSpecialScheme");
function isSpecial(url) {
return isSpecialScheme2(url.scheme);
}
__name(isSpecial, "isSpecial");
function isNotSpecial(url) {
return !isSpecialScheme2(url.scheme);
}
__name(isNotSpecial, "isNotSpecial");
function defaultPort(scheme) {
return specialSchemes[scheme];
}
__name(defaultPort, "defaultPort");
function parseIPv4Number(input) {
if (input === "") {
return failure;
}
let R = 10;
if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") {
input = input.substring(2);
R = 16;
} else if (input.length >= 2 && input.charAt(0) === "0") {
input = input.substring(1);
R = 8;
}
if (input === "") {
return 0;
}
let regex = /[^0-7]/u;
if (R === 10) {
regex = /[^0-9]/u;
}
if (R === 16) {
regex = /[^0-9A-Fa-f]/u;
}
if (regex.test(input)) {
return failure;
}
return parseInt(input, R);
}
__name(parseIPv4Number, "parseIPv4Number");
function parseIPv4(input) {
const parts = input.split(".");
if (parts[parts.length - 1] === "") {
if (parts.length > 1) {
parts.pop();
}
}
if (parts.length > 4) {
return failure;
}
const numbers = [];
for (const part of parts) {
const n = parseIPv4Number(part);
if (n === failure) {
return failure;
}
numbers.push(n);
}
for (let i = 0; i < numbers.length - 1; ++i) {
if (numbers[i] > 255) {
return failure;
}
}
if (numbers[numbers.length - 1] >= 256 ** (5 - numbers.length)) {
return failure;
}
let ipv4 = numbers.pop();
let counter = 0;
for (const n of numbers) {
ipv4 += n * 256 ** (3 - counter);
++counter;
}
return ipv4;
}
__name(parseIPv4, "parseIPv4");
function serializeIPv4(address) {
let output = "";
let n = address;
for (let i = 1; i <= 4; ++i) {
output = String(n % 256) + output;
if (i !== 4) {
output = `.${output}`;
}
n = Math.floor(n / 256);
}
return output;
}
__name(serializeIPv4, "serializeIPv4");
function parseIPv6(input) {
const address = [0, 0, 0, 0, 0, 0, 0, 0];
let pieceIndex = 0;
let compress = null;
let pointer = 0;
input = Array.from(input, (c) => c.codePointAt(0));
if (input[pointer] === p(":")) {
if (input[pointer + 1] !== p(":")) {
return failure;
}
pointer += 2;
++pieceIndex;
compress = pieceIndex;
}
while (pointer < input.length) {
if (pieceIndex === 8) {
return failure;
}
if (input[pointer] === p(":")) {
if (compress !== null) {
return failure;
}
++pointer;
++pieceIndex;
compress = pieceIndex;
continue;
}
let value = 0;
let length = 0;
while (length < 4 && infra.isASCIIHex(input[pointer])) {
value = value * 16 + parseInt(at(input, pointer), 16);
++pointer;
++length;
}
if (input[pointer] === p(".")) {
if (length === 0) {
return failure;
}
pointer -= length;
if (pieceIndex > 6) {
return failure;
}
let numbersSeen = 0;
while (input[pointer] !== void 0) {
let ipv4Piece = null;
if (numbersSeen > 0) {
if (input[pointer] === p(".") && numbersSeen < 4) {
++pointer;
} else {
return failure;
}
}
if (!infra.isASCIIDigit(input[pointer])) {
return failure;
}
while (infra.isASCIIDigit(input[pointer])) {
const number = parseInt(at(input, pointer));
if (ipv4Piece === null) {
ipv4Piece = number;
} else if (ipv4Piece === 0) {
return failure;
} else {
ipv4Piece = ipv4Piece * 10 + number;
}
if (ipv4Piece > 255) {
return failure;
}
++pointer;
}
address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
++numbersSeen;
if (numbersSeen === 2 || numbersSeen === 4) {
++pieceIndex;
}
}
if (numbersSeen !== 4) {
return failure;
}
break;
} else if (input[pointer] === p(":")) {
++pointer;
if (input[pointer] === void 0) {
return failure;
}
} else if (input[pointer] !== void 0) {
return failure;
}
address[pieceIndex] = value;
++pieceIndex;
}
if (compress !== null) {
let swaps = pieceIndex - compress;
pieceIndex = 7;
while (pieceIndex !== 0 && swaps > 0) {
const temp = address[compress + swaps - 1];
address[compress + swaps - 1] = address[pieceIndex];
address[pieceIndex] = temp;
--pieceIndex;
--swaps;
}
} else if (compress === null && pieceIndex !== 8) {
return failure;
}
return address;
}
__name(parseIPv6, "parseIPv6");
function serializeIPv6(address) {
let output = "";
const compress = findLongestZeroSequence(address);
let ignore0 = false;
for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {
if (ignore0 && address[pieceIndex] === 0) {
continue;
} else if (ignore0) {
ignore0 = false;
}
if (compress === pieceIndex) {
const separator = pieceIndex === 0 ? "::" : ":";
output += separator;
ignore0 = true;
continue;
}
output += address[pieceIndex].toString(16);
if (pieceIndex !== 7) {
output += ":";
}
}
return output;
}
__name(serializeIPv6, "serializeIPv6");
function parseHost(input, isNotSpecialArg = false) {
if (input[0] === "[") {
if (input[input.length - 1] !== "]") {
return failure;
}
return parseIPv6(input.substring(1, input.length - 1));
}
if (isNotSpecialArg) {
return parseOpaqueHost(input);
}
const domain = utf8DecodeWithoutBOM(percentDecodeString(input));
const asciiDomain = domainToASCII(domain);
if (asciiDomain === failure) {
return failure;
}
if (containsForbiddenHostCodePoint(asciiDomain)) {
return failure;
}
if (endsInANumber(asciiDomain)) {
return parseIPv4(asciiDomain);
}
return asciiDomain;
}
__name(parseHost, "parseHost");
function endsInANumber(input) {
const parts = input.split(".");
if (parts[parts.length - 1] === "") {
if (parts.length === 1) {
return false;
}
parts.pop();
}
const last = parts[parts.length - 1];
if (parseIPv4Number(last) !== failure) {
return true;
}
if (/^[0-9]+$/u.test(last)) {
return true;
}
return false;
}
__name(endsInANumber, "endsInANumber");
function parseOpaqueHost(input) {
if (containsForbiddenHostCodePointExcludingPercent(input)) {
return failure;
}
return utf8PercentEncodeString(input, isC0ControlPercentEncode);
}
__name(parseOpaqueHost, "parseOpaqueHost");
function findLongestZeroSequence(arr) {
let maxIdx = null;
let maxLen = 1;
let currStart = null;
let currLen = 0;
for (let i = 0; i < arr.length; ++i) {
if (arr[i] !== 0) {
if (currLen > maxLen) {
maxIdx = currStart;
maxLen = currLen;
}
currStart = null;
currLen = 0;
} else {
if (currStart === null) {
currStart = i;
}
++currLen;
}
}
if (currLen > maxLen) {
return currStart;
}
return maxIdx;
}
__name(findLongestZeroSequence, "findLongestZeroSequence");
function serializeHost(host) {
if (typeof host === "number") {
return serializeIPv4(host);
}
if (host instanceof Array) {
return `[${serializeIPv6(host)}]`;
}
return host;
}
__name(serializeHost, "serializeHost");
function domainToASCII(domain, beStrict = false) {
const result = tr46.toASCII(domain, {
checkBidi: true,
checkHyphens: false,
checkJoiners: true,
useSTD3ASCIIRules: beStrict,
verifyDNSLength: beStrict
});
if (result === null || result === "") {
return failure;
}
return result;
}
__name(domainToASCII, "domainToASCII");
function trimControlChars(url) {
return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/ug, "");
}
__name(trimControlChars, "trimControlChars");
function trimTabAndNewline(url) {
return url.replace(/\u0009|\u000A|\u000D/ug, "");
}
__name(trimTabAndNewline, "trimTabAndNewline");
function shortenPath(url) {
const { path } = url;
if (path.length === 0) {
return;
}
if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) {
return;
}
path.pop();
}
__name(shortenPath, "shortenPath");
function includesCredentials(url) {
return url.username !== "" || url.password !== "";
}
__name(includesCredentials, "includesCredentials");
function cannotHaveAUsernamePasswordPort(url) {
return url.host === null || url.host === "" || hasAnOpaquePath(url) || url.scheme === "file";
}
__name(cannotHaveAUsernamePasswordPort, "cannotHaveAUsernamePasswordPort");
function hasAnOpaquePath(url) {
return typeof url.path === "string";
}
__name(hasAnOpaquePath, "hasAnOpaquePath");
function isNormalizedWindowsDriveLetter(string) {
return /^[A-Za-z]:$/u.test(string);
}
__name(isNormalizedWindowsDriveLetter, "isNormalizedWindowsDriveLetter");
function URLStateMachine(input, base, encodingOverride, url, stateOverride) {
this.pointer = 0;
this.input = input;
this.base = base || null;
this.encodingOverride = encodingOverride || "utf-8";
this.stateOverride = stateOverride;
this.url = url;
this.failure = false;
this.parseError = false;
if (!this.url) {
this.url = {
scheme: "",
username: "",
password: "",
host: null,
port: null,
path: [],
query: null,
fragment: null
};
const res2 = trimControlChars(this.input);
if (res2 !== this.input) {
this.parseError = true;
}
this.input = res2;
}
const res = trimTabAndNewline(this.input);
if (res !== this.input) {
this.parseError = true;
}
this.input = res;
this.state = stateOverride || "scheme start";
this.buffer = "";
this.atFlag = false;
this.arrFlag = false;
this.passwordTokenSeenFlag = false;
this.input = Array.from(this.input, (c) => c.codePointAt(0));
for (; this.pointer <= this.input.length; ++this.pointer) {
const c = this.input[this.pointer];
const cStr = isNaN(c) ? void 0 : String.fromCodePoint(c);
const ret = this[`parse ${this.state}`](c, cStr);
if (!ret) {
break;
} else if (ret === failure) {
this.failure = true;
break;
}
}
}
__name(URLStateMachine, "URLStateMachine");
URLStateMachine.prototype["parse scheme start"] = /* @__PURE__ */ __name(function parseSchemeStart(c, cStr) {
if (infra.isASCIIAlpha(c)) {
this.buffer += cStr.toLowerCase();
this.state = "scheme";
} else if (!this.stateOverride) {
this.state = "no scheme";
--this.pointer;
} else {
this.parseError = true;
return failure;
}
return true;
}, "parseSchemeStart");
URLStateMachine.prototype["parse scheme"] = /* @__PURE__ */ __name(function parseScheme(c, cStr) {
if (infra.isASCIIAlphanumeric(c) || c === p("+") || c === p("-") || c === p(".")) {
this.buffer += cStr.toLowerCase();
} else if (c === p(":")) {
if (this.stateOverride) {
if (isSpecial(this.url) && !isSpecialScheme2(this.buffer)) {
return false;
}
if (!isSpecial(this.url) && isSpecialScheme2(this.buffer)) {
return false;
}
if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") {
return false;
}
if (this.url.scheme === "file" && this.url.host === "") {
return false;
}
}
this.url.scheme = this.buffer;
if (this.stateOverride) {
if (this.url.port === defaultPort(this.url.scheme)) {
this.url.port = null;
}
return false;
}
this.buffer = "";
if (this.url.scheme === "file") {
if (this.input[this.pointer + 1] !== p("/") || this.input[this.pointer + 2] !== p("/")) {
this.parseError = true;
}
this.state = "file";
} else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) {
this.state = "special relative or authority";
} else if (isSpecial(this.url)) {
this.state = "special authority slashes";
} else if (this.input[this.pointer + 1] === p("/")) {
this.state = "path or authority";
++this.pointer;
} else {
this.url.path = "";
this.state = "opaque path";
}
} else if (!this.stateOverride) {
this.buffer = "";
this.state = "no scheme";
this.pointer = -1;
} else {
this.parseError = true;
return failure;
}
return true;
}, "parseScheme");
URLStateMachine.prototype["parse no scheme"] = /* @__PURE__ */ __name(function parseNoScheme(c) {
if (this.base === null || hasAnOpaquePath(this.base) && c !== p("#")) {
return failure;
} else if (hasAnOpaquePath(this.base) && c === p("#")) {
this.url.scheme = this.base.scheme;
this.url.path = this.base.path;
this.url.query = this.base.query;
this.url.fragment = "";
this.state = "fragment";
} else if (this.base.scheme === "file") {
this.state = "file";
--this.pointer;
} else {
this.state = "relative";
--this.pointer;
}
return true;
}, "parseNoScheme");
URLStateMachine.prototype["parse special relative or authority"] = /* @__PURE__ */ __name(function parseSpecialRelativeOrAuthority(c) {
if (c === p("/") && this.input[this.pointer + 1] === p("/")) {
this.state = "special authority ignore slashes";
++this.pointer;
} else {
this.parseError = true;
this.state = "relative";
--this.pointer;
}
return true;
}, "parseSpecialRelativeOrAuthority");
URLStateMachine.prototype["parse path or authority"] = /* @__PURE__ */ __name(function parsePathOrAuthority(c) {
if (c === p("/")) {
this.state = "authority";
} else {
this.state = "path";
--this.pointer;
}
return true;
}, "parsePathOrAuthority");
URLStateMachine.prototype["parse relative"] = /* @__PURE__ */ __name(function parseRelative(c) {
this.url.scheme = this.base.scheme;
if (c === p("/")) {
this.state = "relative slash";
} else if (isSpecial(this.url) && c === p("\\")) {
this.parseError = true;
this.state = "relative slash";
} else {
this.url.username = this.base.username;
this.url.password = this.base.password;
this.url.host = this.base.host;
this.url.port = this.base.port;
this.url.path = this.base.path.slice();
this.url.query = this.base.query;
if (c === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (!isNaN(c)) {
this.url.query = null;
this.url.path.pop();
this.state = "path";
--this.pointer;
}
}
return true;
}, "parseRelative");
URLStateMachine.prototype["parse relative slash"] = /* @__PURE__ */ __name(function parseRelativeSlash(c) {
if (isSpecial(this.url) && (c === p("/") || c === p("\\"))) {
if (c === p("\\")) {
this.parseError = true;
}
this.state = "special authority ignore slashes";
} else if (c === p("/")) {
this.state = "authority";
} else {
this.url.username = this.base.username;
this.url.password = this.base.password;
this.url.host = this.base.host;
this.url.port = this.base.port;
this.state = "path";
--this.pointer;
}
return true;
}, "parseRelativeSlash");
URLStateMachine.prototype["parse special authority slashes"] = /* @__PURE__ */ __name(function parseSpecialAuthoritySlashes(c) {
if (c === p("/") && this.input[this.pointer + 1] === p("/")) {
this.state = "special authority ignore slashes";
++this.pointer;
} else {
this.parseError = true;
this.state = "special authority ignore slashes";
--this.pointer;
}
return true;
}, "parseSpecialAuthoritySlashes");
URLStateMachine.prototype["parse special authority ignore slashes"] = /* @__PURE__ */ __name(function parseSpecialAuthorityIgnoreSlashes(c) {
if (c !== p("/") && c !== p("\\")) {
this.state = "authority";
--this.pointer;
} else {
this.parseError = true;
}
return true;
}, "parseSpecialAuthorityIgnoreSlashes");
URLStateMachine.prototype["parse authority"] = /* @__PURE__ */ __name(function parseAuthority(c, cStr) {
if (c === p("@")) {
this.parseError = true;
if (this.atFlag) {
this.buffer = `%40${this.buffer}`;
}
this.atFlag = true;
const len = countSymbols(this.buffer);
for (let pointer = 0; pointer < len; ++pointer) {
const codePoint = this.buffer.codePointAt(pointer);
if (codePoint === p(":") && !this.passwordTokenSeenFlag) {
this.passwordTokenSeenFlag = true;
continue;
}
const encodedCodePoints = utf8PercentEncodeCodePoint(codePoint, isUserinfoPercentEncode);
if (this.passwordTokenSeenFlag) {
this.url.password += encodedCodePoints;
} else {
this.url.username += encodedCodePoints;
}
}
this.buffer = "";
} else if (isNaN(c) || c === p("/") || c === p("?") || c === p("#") || isSpecial(this.url) && c === p("\\")) {
if (this.atFlag && this.buffer === "") {
this.parseError = true;
return failure;
}
this.pointer -= countSymbols(this.buffer) + 1;
this.buffer = "";
this.state = "host";
} else {
this.buffer += cStr;
}
return true;
}, "parseAuthority");
URLStateMachine.prototype["parse hostname"] = URLStateMachine.prototype["parse host"] = /* @__PURE__ */ __name(function parseHostName(c, cStr) {
if (this.stateOverride && this.url.scheme === "file") {
--this.pointer;
this.state = "file host";
} else if (c === p(":") && !this.arrFlag) {
if (this.buffer === "") {
this.parseError = true;
return failure;
}
if (this.stateOverride === "hostname") {
return false;
}
const host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
this.url.host = host;
this.buffer = "";
this.state = "port";
} else if (isNaN(c) || c === p("/") || c === p("?") || c === p("#") || isSpecial(this.url) && c === p("\\")) {
--this.pointer;
if (isSpecial(this.url) && this.buffer === "") {
this.parseError = true;
return failure;
} else if (this.stateOverride && this.buffer === "" && (includesCredentials(this.url) || this.url.port !== null)) {
this.parseError = true;
return false;
}
const host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
this.url.host = host;
this.buffer = "";
this.state = "path start";
if (this.stateOverride) {
return false;
}
} else {
if (c === p("[")) {
this.arrFlag = true;
} else if (c === p("]")) {
this.arrFlag = false;
}
this.buffer += cStr;
}
return true;
}, "parseHostName");
URLStateMachine.prototype["parse port"] = /* @__PURE__ */ __name(function parsePort(c, cStr) {
if (infra.isASCIIDigit(c)) {
this.buffer += cStr;
} else if (isNaN(c) || c === p("/") || c === p("?") || c === p("#") || isSpecial(this.url) && c === p("\\") || this.stateOverride) {
if (this.buffer !== "") {
const port = parseInt(this.buffer);
if (port > 2 ** 16 - 1) {
this.parseError = true;
return failure;
}
this.url.port = port === defaultPort(this.url.scheme) ? null : port;
this.buffer = "";
}
if (this.stateOverride) {
return false;
}
this.state = "path start";
--this.pointer;
} else {
this.parseError = true;
return failure;
}
return true;
}, "parsePort");
var fileOtherwiseCodePoints = /* @__PURE__ */ new Set([p("/"), p("\\"), p("?"), p("#")]);
function startsWithWindowsDriveLetter(input, pointer) {
const length = input.length - pointer;
return length >= 2 && isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) && (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2]));
}
__name(startsWithWindowsDriveLetter, "startsWithWindowsDriveLetter");
URLStateMachine.prototype["parse file"] = /* @__PURE__ */ __name(function parseFile(c) {
this.url.scheme = "file";
this.url.host = "";
if (c === p("/") || c === p("\\")) {
if (c === p("\\")) {
this.parseError = true;
}
this.state = "file slash";
} else if (this.base !== null && this.base.scheme === "file") {
this.url.host = this.base.host;
this.url.path = this.base.path.slice();
this.url.query = this.base.query;
if (c === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (!isNaN(c)) {
this.url.query = null;
if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {
shortenPath(this.url);
} else {
this.parseError = true;
this.url.path = [];
}
this.state = "path";
--this.pointer;
}
} else {
this.state = "path";
--this.pointer;
}
return true;
}, "parseFile");
URLStateMachine.prototype["parse file slash"] = /* @__PURE__ */ __name(function parseFileSlash(c) {
if (c === p("/") || c === p("\\")) {
if (c === p("\\")) {
this.parseError = true;
}
this.state = "file host";
} else {
if (this.base !== null && this.base.scheme === "file") {
if (!startsWithWindowsDriveLetter(this.input, this.pointer) && isNormalizedWindowsDriveLetterString(this.base.path[0])) {
this.url.path.push(this.base.path[0]);
}
this.url.host = this.base.host;
}
this.state = "path";
--this.pointer;
}
return true;
}, "parseFileSlash");
URLStateMachine.prototype["parse file host"] = /* @__PURE__ */ __name(function parseFileHost(c, cStr) {
if (isNaN(c) || c === p("/") || c === p("\\") || c === p("?") || c === p("#")) {
--this.pointer;
if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) {
this.parseError = true;
this.state = "path";
} else if (this.buffer === "") {
this.url.host = "";
if (this.stateOverride) {
return false;
}
this.state = "path start";
} else {
let host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
if (host === "localhost") {
host = "";
}
this.url.host = host;
if (this.stateOverride) {
return false;
}
this.buffer = "";
this.state = "path start";
}
} else {
this.buffer += cStr;
}
return true;
}, "parseFileHost");
URLStateMachine.prototype["parse path start"] = /* @__PURE__ */ __name(function parsePathStart(c) {
if (isSpecial(this.url)) {
if (c === p("\\")) {
this.parseError = true;
}
this.state = "path";
if (c !== p("/") && c !== p("\\")) {
--this.pointer;
}
} else if (!this.stateOverride && c === p("?")) {
this.url.query = "";
this.state = "query";
} else if (!this.stateOverride && c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (c !== void 0) {
this.state = "path";
if (c !== p("/")) {
--this.pointer;
}
} else if (this.stateOverride && this.url.host === null) {
this.url.path.push("");
}
return true;
}, "parsePathStart");
URLStateMachine.prototype["parse path"] = /* @__PURE__ */ __name(function parsePath(c) {
if (isNaN(c) || c === p("/") || isSpecial(this.url) && c === p("\\") || !this.stateOverride && (c === p("?") || c === p("#"))) {
if (isSpecial(this.url) && c === p("\\")) {
this.parseError = true;
}
if (isDoubleDot(this.buffer)) {
shortenPath(this.url);
if (c !== p("/") && !(isSpecial(this.url) && c === p("\\"))) {
this.url.path.push("");
}
} else if (isSingleDot(this.buffer) && c !== p("/") && !(isSpecial(this.url) && c === p("\\"))) {
this.url.path.push("");
} else if (!isSingleDot(this.buffer)) {
if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) {
this.buffer = `${this.buffer[0]}:`;
}
this.url.path.push(this.buffer);
}
this.buffer = "";
if (c === p("?")) {
this.url.query = "";
this.state = "query";
}
if (c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
}
} else {
if (c === p("%") && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.buffer += utf8PercentEncodeCodePoint(c, isPathPercentEncode);
}
return true;
}, "parsePath");
URLStateMachine.prototype["parse opaque path"] = /* @__PURE__ */ __name(function parseOpaquePath(c) {
if (c === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else {
if (!isNaN(c) && c !== p("%")) {
this.parseError = true;
}
if (c === p("%") && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
if (!isNaN(c)) {
this.url.path += utf8PercentEncodeCodePoint(c, isC0ControlPercentEncode);
}
}
return true;
}, "parseOpaquePath");
URLStateMachine.prototype["parse query"] = /* @__PURE__ */ __name(function parseQuery(c, cStr) {
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") {
this.encodingOverride = "utf-8";
}
if (!this.stateOverride && c === p("#") || isNaN(c)) {
const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode;
this.url.query += utf8PercentEncodeString(this.buffer, queryPercentEncodePredicate);
this.buffer = "";
if (c === p("#")) {
this.url.fragment = "";
this.state = "fragment";
}
} else if (!isNaN(c)) {
if (c === p("%") && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.buffer += cStr;
}
return true;
}, "parseQuery");
URLStateMachine.prototype["parse fragment"] = /* @__PURE__ */ __name(function parseFragment(c) {
if (!isNaN(c)) {
if (c === p("%") && (!infra.isASCIIHex(this.input[this.pointer + 1]) || !infra.isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.url.fragment += utf8PercentEncodeCodePoint(c, isFragmentPercentEncode);
}
return true;
}, "parseFragment");
function serializeURL(url, excludeFragment) {
let output = `${url.scheme}:`;
if (url.host !== null) {
output += "//";
if (url.username !== "" || url.password !== "") {
output += url.username;
if (url.password !== "") {
output += `:${url.password}`;
}
output += "@";
}
output += serializeHost(url.host);
if (url.port !== null) {
output += `:${url.port}`;
}
}
if (url.host === null && !hasAnOpaquePath(url) && url.path.length > 1 && url.path[0] === "") {
output += "/.";
}
output += serializePath(url);
if (url.query !== null) {
output += `?${url.query}`;
}
if (!excludeFragment && url.fragment !== null) {
output += `#${url.fragment}`;
}
return output;
}
__name(serializeURL, "serializeURL");
function serializeOrigin(tuple) {
let result = `${tuple.scheme}://`;
result += serializeHost(tuple.host);
if (tuple.port !== null) {
result += `:${tuple.port}`;
}
return result;
}
__name(serializeOrigin, "serializeOrigin");
function serializePath(url) {
if (hasAnOpaquePath(url)) {
return url.path;
}
let output = "";
for (const segment of url.path) {
output += `/${segment}`;
}
return output;
}
__name(serializePath, "serializePath");
module2.exports.serializeURL = serializeURL;
module2.exports.serializePath = serializePath;
module2.exports.serializeURLOrigin = function(url) {
switch (url.scheme) {
case "blob":
try {
return module2.exports.serializeURLOrigin(module2.exports.parseURL(serializePath(url)));
} catch (e) {
return "null";
}
case "ftp":
case "http":
case "https":
case "ws":
case "wss":
return serializeOrigin({
scheme: url.scheme,
host: url.host,
port: url.port
});
case "file":
return "null";
default:
return "null";
}
};
module2.exports.basicURLParse = function(input, options) {
if (options === void 0) {
options = {};
}
const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride);
if (usm.failure) {
return null;
}
return usm.url;
};
module2.exports.setTheUsername = function(url, username) {
url.username = utf8PercentEncodeString(username, isUserinfoPercentEncode);
};
module2.exports.setThePassword = function(url, password) {
url.password = utf8PercentEncodeString(password, isUserinfoPercentEncode);
};
module2.exports.serializeHost = serializeHost;
module2.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort;
module2.exports.hasAnOpaquePath = hasAnOpaquePath;
module2.exports.serializeInteger = function(integer) {
return String(integer);
};
module2.exports.parseURL = function(input, options) {
if (options === void 0) {
options = {};
}
return module2.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/urlencoded.js
var require_urlencoded = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/urlencoded.js"(exports, module2) {
"use strict";
init_define_process();
var { utf8Encode, utf8DecodeWithoutBOM } = require_encoding();
var { percentDecodeBytes, utf8PercentEncodeString, isURLEncodedPercentEncode } = require_percent_encoding();
function p(char) {
return char.codePointAt(0);
}
__name(p, "p");
function parseUrlencoded(input) {
const sequences = strictlySplitByteSequence(input, p("&"));
const output = [];
for (const bytes of sequences) {
if (bytes.length === 0) {
continue;
}
let name, value;
const indexOfEqual = bytes.indexOf(p("="));
if (indexOfEqual >= 0) {
name = bytes.slice(0, indexOfEqual);
value = bytes.slice(indexOfEqual + 1);
} else {
name = bytes;
value = new Uint8Array(0);
}
name = replaceByteInByteSequence(name, 43, 32);
value = replaceByteInByteSequence(value, 43, 32);
const nameString = utf8DecodeWithoutBOM(percentDecodeBytes(name));
const valueString = utf8DecodeWithoutBOM(percentDecodeBytes(value));
output.push([nameString, valueString]);
}
return output;
}
__name(parseUrlencoded, "parseUrlencoded");
function parseUrlencodedString(input) {
return parseUrlencoded(utf8Encode(input));
}
__name(parseUrlencodedString, "parseUrlencodedString");
function serializeUrlencoded(tuples, encodingOverride = void 0) {
let encoding = "utf-8";
if (encodingOverride !== void 0) {
encoding = encodingOverride;
}
let output = "";
for (const [i, tuple] of tuples.entries()) {
const name = utf8PercentEncodeString(tuple[0], isURLEncodedPercentEncode, true);
let value = tuple[1];
if (tuple.length > 2 && tuple[2] !== void 0) {
if (tuple[2] === "hidden" && name === "_charset_") {
value = encoding;
} else if (tuple[2] === "file") {
value = value.name;
}
}
value = utf8PercentEncodeString(value, isURLEncodedPercentEncode, true);
if (i !== 0) {
output += "&";
}
output += `${name}=${value}`;
}
return output;
}
__name(serializeUrlencoded, "serializeUrlencoded");
function strictlySplitByteSequence(buf, cp) {
const list = [];
let last = 0;
let i = buf.indexOf(cp);
while (i >= 0) {
list.push(buf.slice(last, i));
last = i + 1;
i = buf.indexOf(cp, last);
}
if (last !== buf.length) {
list.push(buf.slice(last));
}
return list;
}
__name(strictlySplitByteSequence, "strictlySplitByteSequence");
function replaceByteInByteSequence(buf, from, to) {
let i = buf.indexOf(from);
while (i >= 0) {
buf[i] = to;
i = buf.indexOf(from, i + 1);
}
return buf;
}
__name(replaceByteInByteSequence, "replaceByteInByteSequence");
module2.exports = {
parseUrlencodedString,
serializeUrlencoded
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/Function.js
var require_Function = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/Function.js"(exports) {
"use strict";
init_define_process();
var conversions = require_lib();
var utils = require_utils();
exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
if (typeof value !== "function") {
throw new globalObject.TypeError(context + " is not a function");
}
function invokeTheCallbackFunction(...args) {
const thisArg = utils.tryWrapperForImpl(this);
let callResult;
for (let i = 0; i < args.length; i++) {
args[i] = utils.tryWrapperForImpl(args[i]);
}
callResult = Reflect.apply(value, thisArg, args);
callResult = conversions["any"](callResult, { context, globals: globalObject });
return callResult;
}
__name(invokeTheCallbackFunction, "invokeTheCallbackFunction");
invokeTheCallbackFunction.construct = (...args) => {
for (let i = 0; i < args.length; i++) {
args[i] = utils.tryWrapperForImpl(args[i]);
}
let callResult = Reflect.construct(value, args);
callResult = conversions["any"](callResult, { context, globals: globalObject });
return callResult;
};
invokeTheCallbackFunction[utils.wrapperSymbol] = value;
invokeTheCallbackFunction.objectReference = value;
return invokeTheCallbackFunction;
};
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URLSearchParams-impl.js
var require_URLSearchParams_impl = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URLSearchParams-impl.js"(exports) {
"use strict";
init_define_process();
var urlencoded = require_urlencoded();
exports.implementation = /* @__PURE__ */ __name(class URLSearchParamsImpl {
constructor(globalObject, constructorArgs, { doNotStripQMark = false }) {
let init = constructorArgs[0];
this._list = [];
this._url = null;
if (!doNotStripQMark && typeof init === "string" && init[0] === "?") {
init = init.slice(1);
}
if (Array.isArray(init)) {
for (const pair of init) {
if (pair.length !== 2) {
throw new TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");
}
this._list.push([pair[0], pair[1]]);
}
} else if (typeof init === "object" && Object.getPrototypeOf(init) === null) {
for (const name of Object.keys(init)) {
const value = init[name];
this._list.push([name, value]);
}
} else {
this._list = urlencoded.parseUrlencodedString(init);
}
}
_updateSteps() {
if (this._url !== null) {
let query = urlencoded.serializeUrlencoded(this._list);
if (query === "") {
query = null;
}
this._url._url.query = query;
}
}
append(name, value) {
this._list.push([name, value]);
this._updateSteps();
}
delete(name) {
let i = 0;
while (i < this._list.length) {
if (this._list[i][0] === name) {
this._list.splice(i, 1);
} else {
i++;
}
}
this._updateSteps();
}
get(name) {
for (const tuple of this._list) {
if (tuple[0] === name) {
return tuple[1];
}
}
return null;
}
getAll(name) {
const output = [];
for (const tuple of this._list) {
if (tuple[0] === name) {
output.push(tuple[1]);
}
}
return output;
}
has(name) {
for (const tuple of this._list) {
if (tuple[0] === name) {
return true;
}
}
return false;
}
set(name, value) {
let found = false;
let i = 0;
while (i < this._list.length) {
if (this._list[i][0] === name) {
if (found) {
this._list.splice(i, 1);
} else {
found = true;
this._list[i][1] = value;
i++;
}
} else {
i++;
}
}
if (!found) {
this._list.push([name, value]);
}
this._updateSteps();
}
sort() {
this._list.sort((a, b) => {
if (a[0] < b[0]) {
return -1;
}
if (a[0] > b[0]) {
return 1;
}
return 0;
});
this._updateSteps();
}
[Symbol.iterator]() {
return this._list[Symbol.iterator]();
}
toString() {
return urlencoded.serializeUrlencoded(this._list);
}
}, "URLSearchParamsImpl");
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URLSearchParams.js
var require_URLSearchParams = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URLSearchParams.js"(exports) {
"use strict";
init_define_process();
var conversions = require_lib();
var utils = require_utils();
var Function2 = require_Function();
var newObjectInRealm = utils.newObjectInRealm;
var implSymbol = utils.implSymbol;
var ctorRegistrySymbol = utils.ctorRegistrySymbol;
var interfaceName = "URLSearchParams";
exports.is = (value) => {
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
};
exports.isImpl = (value) => {
return utils.isObject(value) && value instanceof Impl.implementation;
};
exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
if (exports.is(value)) {
return utils.implForWrapper(value);
}
throw new globalObject.TypeError(`${context} is not of type 'URLSearchParams'.`);
};
exports.createDefaultIterator = (globalObject, target, kind) => {
const ctorRegistry = globalObject[ctorRegistrySymbol];
const iteratorPrototype = ctorRegistry["URLSearchParams Iterator"];
const iterator = Object.create(iteratorPrototype);
Object.defineProperty(iterator, utils.iterInternalSymbol, {
value: { target, kind, index: 0 },
configurable: true
});
return iterator;
};
function makeWrapper(globalObject, newTarget) {
let proto;
if (newTarget !== void 0) {
proto = newTarget.prototype;
}
if (!utils.isObject(proto)) {
proto = globalObject[ctorRegistrySymbol]["URLSearchParams"].prototype;
}
return Object.create(proto);
}
__name(makeWrapper, "makeWrapper");
exports.create = (globalObject, constructorArgs, privateData) => {
const wrapper = makeWrapper(globalObject);
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
};
exports.createImpl = (globalObject, constructorArgs, privateData) => {
const wrapper = exports.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(wrapper);
};
exports._internalSetup = (wrapper, globalObject) => {
};
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
privateData.wrapper = wrapper;
exports._internalSetup(wrapper, globalObject);
Object.defineProperty(wrapper, implSymbol, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
if (Impl.init) {
Impl.init(wrapper[implSymbol]);
}
return wrapper;
};
exports.new = (globalObject, newTarget) => {
const wrapper = makeWrapper(globalObject, newTarget);
exports._internalSetup(wrapper, globalObject);
Object.defineProperty(wrapper, implSymbol, {
value: Object.create(Impl.implementation.prototype),
configurable: true
});
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
if (Impl.init) {
Impl.init(wrapper[implSymbol]);
}
return wrapper[implSymbol];
};
var exposed = /* @__PURE__ */ new Set(["Window", "Worker"]);
exports.install = (globalObject, globalNames) => {
if (!globalNames.some((globalName) => exposed.has(globalName))) {
return;
}
const ctorRegistry = utils.initCtorRegistry(globalObject);
class URLSearchParams2 {
constructor() {
const args = [];
{
let curArg = arguments[0];
if (curArg !== void 0) {
if (utils.isObject(curArg)) {
if (curArg[Symbol.iterator] !== void 0) {
if (!utils.isObject(curArg)) {
throw new globalObject.TypeError(
"Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object."
);
} else {
const V = [];
const tmp = curArg;
for (let nextItem of tmp) {
if (!utils.isObject(nextItem)) {
throw new globalObject.TypeError(
"Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object."
);
} else {
const V2 = [];
const tmp2 = nextItem;
for (let nextItem2 of tmp2) {
nextItem2 = conversions["USVString"](nextItem2, {
context: "Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",
globals: globalObject
});
V2.push(nextItem2);
}
nextItem = V2;
}
V.push(nextItem);
}
curArg = V;
}
} else {
if (!utils.isObject(curArg)) {
throw new globalObject.TypeError(
"Failed to construct 'URLSearchParams': parameter 1 record is not an object."
);
} else {
const result = /* @__PURE__ */ Object.create(null);
for (const key of Reflect.ownKeys(curArg)) {
const desc = Object.getOwnPropertyDescriptor(curArg, key);
if (desc && desc.enumerable) {
let typedKey = key;
typedKey = conversions["USVString"](typedKey, {
context: "Failed to construct 'URLSearchParams': parameter 1 record's key",
globals: globalObject
});
let typedValue = curArg[key];
typedValue = conversions["USVString"](typedValue, {
context: "Failed to construct 'URLSearchParams': parameter 1 record's value",
globals: globalObject
});
result[typedKey] = typedValue;
}
}
curArg = result;
}
}
} else {
curArg = conversions["USVString"](curArg, {
context: "Failed to construct 'URLSearchParams': parameter 1",
globals: globalObject
});
}
} else {
curArg = "";
}
args.push(curArg);
}
return exports.setup(Object.create(new.target.prototype), globalObject, args);
}
append(name, value) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError(
"'append' called on an object that is not a valid instance of URLSearchParams."
);
}
if (arguments.length < 2) {
throw new globalObject.TypeError(
`Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'append' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
{
let curArg = arguments[1];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'append' on 'URLSearchParams': parameter 2",
globals: globalObject
});
args.push(curArg);
}
return utils.tryWrapperForImpl(esValue[implSymbol].append(...args));
}
delete(name) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError(
"'delete' called on an object that is not a valid instance of URLSearchParams."
);
}
if (arguments.length < 1) {
throw new globalObject.TypeError(
`Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'delete' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
return utils.tryWrapperForImpl(esValue[implSymbol].delete(...args));
}
get(name) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");
}
if (arguments.length < 1) {
throw new globalObject.TypeError(
`Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'get' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
return esValue[implSymbol].get(...args);
}
getAll(name) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError(
"'getAll' called on an object that is not a valid instance of URLSearchParams."
);
}
if (arguments.length < 1) {
throw new globalObject.TypeError(
`Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'getAll' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args));
}
has(name) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");
}
if (arguments.length < 1) {
throw new globalObject.TypeError(
`Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'has' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
return esValue[implSymbol].has(...args);
}
set(name, value) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");
}
if (arguments.length < 2) {
throw new globalObject.TypeError(
`Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'set' on 'URLSearchParams': parameter 1",
globals: globalObject
});
args.push(curArg);
}
{
let curArg = arguments[1];
curArg = conversions["USVString"](curArg, {
context: "Failed to execute 'set' on 'URLSearchParams': parameter 2",
globals: globalObject
});
args.push(curArg);
}
return utils.tryWrapperForImpl(esValue[implSymbol].set(...args));
}
sort() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");
}
return utils.tryWrapperForImpl(esValue[implSymbol].sort());
}
toString() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError(
"'toString' called on an object that is not a valid instance of URLSearchParams."
);
}
return esValue[implSymbol].toString();
}
keys() {
if (!exports.is(this)) {
throw new globalObject.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");
}
return exports.createDefaultIterator(globalObject, this, "key");
}
values() {
if (!exports.is(this)) {
throw new globalObject.TypeError(
"'values' called on an object that is not a valid instance of URLSearchParams."
);
}
return exports.createDefaultIterator(globalObject, this, "value");
}
entries() {
if (!exports.is(this)) {
throw new globalObject.TypeError(
"'entries' called on an object that is not a valid instance of URLSearchParams."
);
}
return exports.createDefaultIterator(globalObject, this, "key+value");
}
forEach(callback) {
if (!exports.is(this)) {
throw new globalObject.TypeError(
"'forEach' called on an object that is not a valid instance of URLSearchParams."
);
}
if (arguments.length < 1) {
throw new globalObject.TypeError(
"Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present."
);
}
callback = Function2.convert(globalObject, callback, {
context: "Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"
});
const thisArg = arguments[1];
let pairs = Array.from(this[implSymbol]);
let i = 0;
while (i < pairs.length) {
const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
callback.call(thisArg, value, key, this);
pairs = Array.from(this[implSymbol]);
i++;
}
}
}
__name(URLSearchParams2, "URLSearchParams");
Object.defineProperties(URLSearchParams2.prototype, {
append: { enumerable: true },
delete: { enumerable: true },
get: { enumerable: true },
getAll: { enumerable: true },
has: { enumerable: true },
set: { enumerable: true },
sort: { enumerable: true },
toString: { enumerable: true },
keys: { enumerable: true },
values: { enumerable: true },
entries: { enumerable: true },
forEach: { enumerable: true },
[Symbol.toStringTag]: { value: "URLSearchParams", configurable: true },
[Symbol.iterator]: { value: URLSearchParams2.prototype.entries, configurable: true, writable: true }
});
ctorRegistry[interfaceName] = URLSearchParams2;
ctorRegistry["URLSearchParams Iterator"] = Object.create(ctorRegistry["%IteratorPrototype%"], {
[Symbol.toStringTag]: {
configurable: true,
value: "URLSearchParams Iterator"
}
});
utils.define(ctorRegistry["URLSearchParams Iterator"], {
next() {
const internal = this && this[utils.iterInternalSymbol];
if (!internal) {
throw new globalObject.TypeError("next() called on a value that is not a URLSearchParams iterator object");
}
const { target, kind, index } = internal;
const values = Array.from(target[implSymbol]);
const len = values.length;
if (index >= len) {
return newObjectInRealm(globalObject, { value: void 0, done: true });
}
const pair = values[index];
internal.index = index + 1;
return newObjectInRealm(globalObject, utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind));
}
});
Object.defineProperty(globalObject, interfaceName, {
configurable: true,
writable: true,
value: URLSearchParams2
});
};
var Impl = require_URLSearchParams_impl();
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URL-impl.js
var require_URL_impl = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URL-impl.js"(exports) {
"use strict";
init_define_process();
var usm = require_url_state_machine();
var urlencoded = require_urlencoded();
var URLSearchParams2 = require_URLSearchParams();
exports.implementation = /* @__PURE__ */ __name(class URLImpl {
constructor(globalObject, constructorArgs) {
const url = constructorArgs[0];
const base = constructorArgs[1];
let parsedBase = null;
if (base !== void 0) {
parsedBase = usm.basicURLParse(base);
if (parsedBase === null) {
throw new TypeError(`Invalid base URL: ${base}`);
}
}
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
if (parsedURL === null) {
throw new TypeError(`Invalid URL: ${url}`);
}
const query = parsedURL.query !== null ? parsedURL.query : "";
this._url = parsedURL;
this._query = URLSearchParams2.createImpl(globalObject, [query], { doNotStripQMark: true });
this._query._url = this;
}
get href() {
return usm.serializeURL(this._url);
}
set href(v) {
const parsedURL = usm.basicURLParse(v);
if (parsedURL === null) {
throw new TypeError(`Invalid URL: ${v}`);
}
this._url = parsedURL;
this._query._list.splice(0);
const { query } = parsedURL;
if (query !== null) {
this._query._list = urlencoded.parseUrlencodedString(query);
}
}
get origin() {
return usm.serializeURLOrigin(this._url);
}
get protocol() {
return `${this._url.scheme}:`;
}
set protocol(v) {
usm.basicURLParse(`${v}:`, { url: this._url, stateOverride: "scheme start" });
}
get username() {
return this._url.username;
}
set username(v) {
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
usm.setTheUsername(this._url, v);
}
get password() {
return this._url.password;
}
set password(v) {
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
usm.setThePassword(this._url, v);
}
get host() {
const url = this._url;
if (url.host === null) {
return "";
}
if (url.port === null) {
return usm.serializeHost(url.host);
}
return `${usm.serializeHost(url.host)}:${usm.serializeInteger(url.port)}`;
}
set host(v) {
if (usm.hasAnOpaquePath(this._url)) {
return;
}
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
}
get hostname() {
if (this._url.host === null) {
return "";
}
return usm.serializeHost(this._url.host);
}
set hostname(v) {
if (usm.hasAnOpaquePath(this._url)) {
return;
}
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
}
get port() {
if (this._url.port === null) {
return "";
}
return usm.serializeInteger(this._url.port);
}
set port(v) {
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
if (v === "") {
this._url.port = null;
} else {
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
}
}
get pathname() {
return usm.serializePath(this._url);
}
set pathname(v) {
if (usm.hasAnOpaquePath(this._url)) {
return;
}
this._url.path = [];
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
}
get search() {
if (this._url.query === null || this._url.query === "") {
return "";
}
return `?${this._url.query}`;
}
set search(v) {
const url = this._url;
if (v === "") {
url.query = null;
this._query._list = [];
return;
}
const input = v[0] === "?" ? v.substring(1) : v;
url.query = "";
usm.basicURLParse(input, { url, stateOverride: "query" });
this._query._list = urlencoded.parseUrlencodedString(input);
}
get searchParams() {
return this._query;
}
get hash() {
if (this._url.fragment === null || this._url.fragment === "") {
return "";
}
return `#${this._url.fragment}`;
}
set hash(v) {
if (v === "") {
this._url.fragment = null;
return;
}
const input = v[0] === "#" ? v.substring(1) : v;
this._url.fragment = "";
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
}
toJSON() {
return this.href;
}
}, "URLImpl");
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URL.js
var require_URL = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/lib/URL.js"(exports) {
"use strict";
init_define_process();
var conversions = require_lib();
var utils = require_utils();
var implSymbol = utils.implSymbol;
var ctorRegistrySymbol = utils.ctorRegistrySymbol;
var interfaceName = "URL";
exports.is = (value) => {
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
};
exports.isImpl = (value) => {
return utils.isObject(value) && value instanceof Impl.implementation;
};
exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
if (exports.is(value)) {
return utils.implForWrapper(value);
}
throw new globalObject.TypeError(`${context} is not of type 'URL'.`);
};
function makeWrapper(globalObject, newTarget) {
let proto;
if (newTarget !== void 0) {
proto = newTarget.prototype;
}
if (!utils.isObject(proto)) {
proto = globalObject[ctorRegistrySymbol]["URL"].prototype;
}
return Object.create(proto);
}
__name(makeWrapper, "makeWrapper");
exports.create = (globalObject, constructorArgs, privateData) => {
const wrapper = makeWrapper(globalObject);
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
};
exports.createImpl = (globalObject, constructorArgs, privateData) => {
const wrapper = exports.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(wrapper);
};
exports._internalSetup = (wrapper, globalObject) => {
};
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
privateData.wrapper = wrapper;
exports._internalSetup(wrapper, globalObject);
Object.defineProperty(wrapper, implSymbol, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
if (Impl.init) {
Impl.init(wrapper[implSymbol]);
}
return wrapper;
};
exports.new = (globalObject, newTarget) => {
const wrapper = makeWrapper(globalObject, newTarget);
exports._internalSetup(wrapper, globalObject);
Object.defineProperty(wrapper, implSymbol, {
value: Object.create(Impl.implementation.prototype),
configurable: true
});
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
if (Impl.init) {
Impl.init(wrapper[implSymbol]);
}
return wrapper[implSymbol];
};
var exposed = /* @__PURE__ */ new Set(["Window", "Worker"]);
exports.install = (globalObject, globalNames) => {
if (!globalNames.some((globalName) => exposed.has(globalName))) {
return;
}
const ctorRegistry = utils.initCtorRegistry(globalObject);
class URL3 {
constructor(url) {
if (arguments.length < 1) {
throw new globalObject.TypeError(
`Failed to construct 'URL': 1 argument required, but only ${arguments.length} present.`
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, {
context: "Failed to construct 'URL': parameter 1",
globals: globalObject
});
args.push(curArg);
}
{
let curArg = arguments[1];
if (curArg !== void 0) {
curArg = conversions["USVString"](curArg, {
context: "Failed to construct 'URL': parameter 2",
globals: globalObject
});
}
args.push(curArg);
}
return exports.setup(Object.create(new.target.prototype), globalObject, args);
}
toJSON() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'toJSON' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol].toJSON();
}
get href() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get href' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["href"];
}
set href(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set href' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'href' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["href"] = V;
}
toString() {
const esValue = this;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["href"];
}
get origin() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get origin' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["origin"];
}
get protocol() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get protocol' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["protocol"];
}
set protocol(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set protocol' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'protocol' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["protocol"] = V;
}
get username() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get username' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["username"];
}
set username(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set username' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'username' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["username"] = V;
}
get password() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get password' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["password"];
}
set password(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set password' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'password' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["password"] = V;
}
get host() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get host' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["host"];
}
set host(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set host' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'host' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["host"] = V;
}
get hostname() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get hostname' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["hostname"];
}
set hostname(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set hostname' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'hostname' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["hostname"] = V;
}
get port() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get port' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["port"];
}
set port(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set port' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'port' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["port"] = V;
}
get pathname() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get pathname' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["pathname"];
}
set pathname(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set pathname' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'pathname' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["pathname"] = V;
}
get search() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get search' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["search"];
}
set search(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set search' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'search' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["search"] = V;
}
get searchParams() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");
}
return utils.getSameObject(this, "searchParams", () => {
return utils.tryWrapperForImpl(esValue[implSymbol]["searchParams"]);
});
}
get hash() {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'get hash' called on an object that is not a valid instance of URL.");
}
return esValue[implSymbol]["hash"];
}
set hash(V) {
const esValue = this !== null && this !== void 0 ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError("'set hash' called on an object that is not a valid instance of URL.");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'hash' property on 'URL': The provided value",
globals: globalObject
});
esValue[implSymbol]["hash"] = V;
}
}
__name(URL3, "URL");
Object.defineProperties(URL3.prototype, {
toJSON: { enumerable: true },
href: { enumerable: true },
toString: { enumerable: true },
origin: { enumerable: true },
protocol: { enumerable: true },
username: { enumerable: true },
password: { enumerable: true },
host: { enumerable: true },
hostname: { enumerable: true },
port: { enumerable: true },
pathname: { enumerable: true },
search: { enumerable: true },
searchParams: { enumerable: true },
hash: { enumerable: true },
[Symbol.toStringTag]: { value: "URL", configurable: true }
});
ctorRegistry[interfaceName] = URL3;
Object.defineProperty(globalObject, interfaceName, {
configurable: true,
writable: true,
value: URL3
});
if (globalNames.includes("Window")) {
Object.defineProperty(globalObject, "webkitURL", {
configurable: true,
writable: true,
value: URL3
});
}
};
var Impl = require_URL_impl();
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/webidl2js-wrapper.js
var require_webidl2js_wrapper = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/webidl2js-wrapper.js"(exports) {
"use strict";
init_define_process();
var URL3 = require_URL();
var URLSearchParams2 = require_URLSearchParams();
exports.URL = URL3;
exports.URLSearchParams = URLSearchParams2;
}
});
// ../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/index.js
var require_whatwg_url = __commonJS({
"../../node_modules/.pnpm/whatwg-url@11.0.0/node_modules/whatwg-url/index.js"(exports) {
"use strict";
init_define_process();
var { URL: URL3, URLSearchParams: URLSearchParams2 } = require_webidl2js_wrapper();
var urlStateMachine = require_url_state_machine();
var percentEncoding = require_percent_encoding();
var sharedGlobalObject = { Array, Object, Promise, String, TypeError };
URL3.install(sharedGlobalObject, ["Window"]);
URLSearchParams2.install(sharedGlobalObject, ["Window"]);
exports.URL = sharedGlobalObject.URL;
exports.URLSearchParams = sharedGlobalObject.URLSearchParams;
exports.parseURL = urlStateMachine.parseURL;
exports.basicURLParse = urlStateMachine.basicURLParse;
exports.serializeURL = urlStateMachine.serializeURL;
exports.serializePath = urlStateMachine.serializePath;
exports.serializeHost = urlStateMachine.serializeHost;
exports.serializeInteger = urlStateMachine.serializeInteger;
exports.serializeURLOrigin = urlStateMachine.serializeURLOrigin;
exports.setTheUsername = urlStateMachine.setTheUsername;
exports.setThePassword = urlStateMachine.setThePassword;
exports.cannotHaveAUsernamePasswordPort = urlStateMachine.cannotHaveAUsernamePasswordPort;
exports.hasAnOpaquePath = urlStateMachine.hasAnOpaquePath;
exports.percentDecodeString = percentEncoding.percentDecodeString;
exports.percentDecodeBytes = percentEncoding.percentDecodeBytes;
}
});
// src/primitives/url.js
var url_exports = {};
__export(url_exports, {
URL: () => import_whatwg_url.URL,
URLPattern: () => URLPattern,
URLSearchParams: () => import_whatwg_url.URLSearchParams
});
module.exports = __toCommonJS(url_exports);
init_define_process();
var import_whatwg_url = __toESM(require_whatwg_url());
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/index.js
init_define_process();
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/dist/urlpattern.js
init_define_process();
var regexIdentifierStart = /[$_\p{ID_Start}]/u;
var regexIdentifierPart = /[$_\u200C\u200D\p{ID_Continue}]/u;
function isASCII(str, extended) {
return (extended ? /^[\x00-\xFF]*$/ : /^[\x00-\x7F]*$/).test(str);
}
__name(isASCII, "isASCII");
function lexer(str, lenient = false) {
const tokens = [];
let i = 0;
while (i < str.length) {
const char = str[i];
const ErrorOrInvalid = /* @__PURE__ */ __name(function(msg) {
if (!lenient)
throw new TypeError(msg);
tokens.push({ type: "INVALID_CHAR", index: i, value: str[i++] });
}, "ErrorOrInvalid");
if (char === "*") {
tokens.push({ type: "ASTERISK", index: i, value: str[i++] });
continue;
}
if (char === "+" || char === "?") {
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
continue;
}
if (char === "\\") {
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
continue;
}
if (char === "{") {
tokens.push({ type: "OPEN", index: i, value: str[i++] });
continue;
}
if (char === "}") {
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
continue;
}
if (char === ":") {
let name = "";
let j = i + 1;
while (j < str.length) {
const code = str.substr(j, 1);
if (j === i + 1 && regexIdentifierStart.test(code) || j !== i + 1 && regexIdentifierPart.test(code)) {
name += str[j++];
continue;
}
break;
}
if (!name) {
ErrorOrInvalid(`Missing parameter name at ${i}`);
continue;
}
tokens.push({ type: "NAME", index: i, value: name });
i = j;
continue;
}
if (char === "(") {
let count = 1;
let pattern = "";
let j = i + 1;
let error = false;
if (str[j] === "?") {
ErrorOrInvalid(`Pattern cannot start with "?" at ${j}`);
continue;
}
while (j < str.length) {
if (!isASCII(str[j], false)) {
ErrorOrInvalid(`Invalid character '${str[j]}' at ${j}.`);
error = true;
break;
}
if (str[j] === "\\") {
pattern += str[j++] + str[j++];
continue;
}
if (str[j] === ")") {
count--;
if (count === 0) {
j++;
break;
}
} else if (str[j] === "(") {
count++;
if (str[j + 1] !== "?") {
ErrorOrInvalid(`Capturing groups are not allowed at ${j}`);
error = true;
break;
}
}
pattern += str[j++];
}
if (error) {
continue;
}
if (count) {
ErrorOrInvalid(`Unbalanced pattern at ${i}`);
continue;
}
if (!pattern) {
ErrorOrInvalid(`Missing pattern at ${i}`);
continue;
}
tokens.push({ type: "PATTERN", index: i, value: pattern });
i = j;
continue;
}
tokens.push({ type: "CHAR", index: i, value: str[i++] });
}
tokens.push({ type: "END", index: i, value: "" });
return tokens;
}
__name(lexer, "lexer");
function parse(str, options = {}) {
const tokens = lexer(str);
const { prefixes = "./" } = options;
const defaultPattern = `[^${escapeString(options.delimiter === void 0 ? "/#?" : options.delimiter)}]+?`;
const result = [];
let key = 0;
let i = 0;
let path = "";
let nameSet = /* @__PURE__ */ new Set();
const tryConsume = /* @__PURE__ */ __name((type) => {
if (i < tokens.length && tokens[i].type === type)
return tokens[i++].value;
}, "tryConsume");
const tryConsumeModifier = /* @__PURE__ */ __name(() => {
const r = tryConsume("MODIFIER");
if (r) {
return r;
}
return tryConsume("ASTERISK");
}, "tryConsumeModifier");
const mustConsume = /* @__PURE__ */ __name((type) => {
const value = tryConsume(type);
if (value !== void 0)
return value;
const { type: nextType, index } = tokens[i];
throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}`);
}, "mustConsume");
const consumeText = /* @__PURE__ */ __name(() => {
let result2 = "";
let value;
while (value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
result2 += value;
}
return result2;
}, "consumeText");
const DefaultEncodePart = /* @__PURE__ */ __name((value) => {
return value;
}, "DefaultEncodePart");
const encodePart = options.encodePart || DefaultEncodePart;
while (i < tokens.length) {
const char = tryConsume("CHAR");
const name = tryConsume("NAME");
let pattern = tryConsume("PATTERN");
if (!name && !pattern && tryConsume("ASTERISK")) {
pattern = ".*";
}
if (name || pattern) {
let prefix = char || "";
if (prefixes.indexOf(prefix) === -1) {
path += prefix;
prefix = "";
}
if (path) {
result.push(encodePart(path));
path = "";
}
const finalName = name || key++;
if (nameSet.has(finalName)) {
throw new TypeError(`Duplicate name '${finalName}'.`);
}
nameSet.add(finalName);
result.push({
name: finalName,
prefix: encodePart(prefix),
suffix: "",
pattern: pattern || defaultPattern,
modifier: tryConsumeModifier() || ""
});
continue;
}
const value = char || tryConsume("ESCAPED_CHAR");
if (value) {
path += value;
continue;
}
const open = tryConsume("OPEN");
if (open) {
const prefix = consumeText();
const name2 = tryConsume("NAME") || "";
let pattern2 = tryConsume("PATTERN") || "";
if (!name2 && !pattern2 && tryConsume("ASTERISK")) {
pattern2 = ".*";
}
const suffix = consumeText();
mustConsume("CLOSE");
const modifier = tryConsumeModifier() || "";
if (!name2 && !pattern2 && !modifier) {
path += prefix;
continue;
}
if (!name2 && !pattern2 && !prefix) {
continue;
}
if (path) {
result.push(encodePart(path));
path = "";
}
result.push({
name: name2 || (pattern2 ? key++ : ""),
pattern: name2 && !pattern2 ? defaultPattern : pattern2,
prefix: encodePart(prefix),
suffix: encodePart(suffix),
modifier
});
continue;
}
if (path) {
result.push(encodePart(path));
path = "";
}
mustConsume("END");
}
return result;
}
__name(parse, "parse");
function escapeString(str) {
return str.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
}
__name(escapeString, "escapeString");
function flags(options) {
return options && options.ignoreCase ? "ui" : "u";
}
__name(flags, "flags");
function regexpToRegexp(path, keys) {
if (!keys)
return path;
const groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
let index = 0;
let execResult = groupsRegex.exec(path.source);
while (execResult) {
keys.push({
name: execResult[1] || index++,
prefix: "",
suffix: "",
modifier: "",
pattern: ""
});
execResult = groupsRegex.exec(path.source);
}
return path;
}
__name(regexpToRegexp, "regexpToRegexp");
function arrayToRegexp(paths, keys, options) {
const parts = paths.map((path) => pathToRegexp(path, keys, options).source);
return new RegExp(`(?:${parts.join("|")})`, flags(options));
}
__name(arrayToRegexp, "arrayToRegexp");
function stringToRegexp(path, keys, options) {
return tokensToRegexp(parse(path, options), keys, options);
}
__name(stringToRegexp, "stringToRegexp");
function tokensToRegexp(tokens, keys, options = {}) {
const {
strict = false,
start = true,
end = true,
encode = /* @__PURE__ */ __name((x) => x, "encode")
} = options;
const endsWith = `[${escapeString(options.endsWith === void 0 ? "" : options.endsWith)}]|$`;
const delimiter = `[${escapeString(options.delimiter === void 0 ? "/#?" : options.delimiter)}]`;
let route = start ? "^" : "";
for (const token of tokens) {
if (typeof token === "string") {
route += escapeString(encode(token));
} else {
const prefix = escapeString(encode(token.prefix));
const suffix = escapeString(encode(token.suffix));
if (token.pattern) {
if (keys)
keys.push(token);
if (prefix || suffix) {
if (token.modifier === "+" || token.modifier === "*") {
const mod = token.modifier === "*" ? "?" : "";
route += `(?:${prefix}((?:${token.pattern})(?:${suffix}${prefix}(?:${token.pattern}))*)${suffix})${mod}`;
} else {
route += `(?:${prefix}(${token.pattern})${suffix})${token.modifier}`;
}
} else {
if (token.modifier === "+" || token.modifier === "*") {
route += `((?:${token.pattern})${token.modifier})`;
} else {
route += `(${token.pattern})${token.modifier}`;
}
}
} else {
route += `(?:${prefix}${suffix})${token.modifier}`;
}
}
}
if (end) {
if (!strict)
route += `${delimiter}?`;
route += !options.endsWith ? "$" : `(?=${endsWith})`;
} else {
const endToken = tokens[tokens.length - 1];
const isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
if (!strict) {
route += `(?:${delimiter}(?=${endsWith}))?`;
}
if (!isEndDelimited) {
route += `(?=${delimiter}|${endsWith})`;
}
}
return new RegExp(route, flags(options));
}
__name(tokensToRegexp, "tokensToRegexp");
function pathToRegexp(path, keys, options) {
if (path instanceof RegExp)
return regexpToRegexp(path, keys);
if (Array.isArray(path))
return arrayToRegexp(path, keys, options);
return stringToRegexp(path, keys, options);
}
__name(pathToRegexp, "pathToRegexp");
var DEFAULT_OPTIONS = {
delimiter: "",
prefixes: "",
sensitive: true,
strict: true
};
var HOSTNAME_OPTIONS = {
delimiter: ".",
prefixes: "",
sensitive: true,
strict: true
};
var PATHNAME_OPTIONS = {
delimiter: "/",
prefixes: "/",
sensitive: true,
strict: true
};
function isAbsolutePathname(pathname, isPattern) {
if (!pathname.length) {
return false;
}
if (pathname[0] === "/") {
return true;
}
if (!isPattern) {
return false;
}
if (pathname.length < 2) {
return false;
}
if ((pathname[0] == "\\" || pathname[0] == "{") && pathname[1] == "/") {
return true;
}
return false;
}
__name(isAbsolutePathname, "isAbsolutePathname");
function maybeStripPrefix(value, prefix) {
if (value.startsWith(prefix)) {
return value.substring(prefix.length, value.length);
}
return value;
}
__name(maybeStripPrefix, "maybeStripPrefix");
function maybeStripSuffix(value, suffix) {
if (value.endsWith(suffix)) {
return value.substr(0, value.length - suffix.length);
}
return value;
}
__name(maybeStripSuffix, "maybeStripSuffix");
function treatAsIPv6Hostname(value) {
if (!value || value.length < 2) {
return false;
}
if (value[0] === "[") {
return true;
}
if ((value[0] === "\\" || value[0] === "{") && value[1] === "[") {
return true;
}
return false;
}
__name(treatAsIPv6Hostname, "treatAsIPv6Hostname");
var SPECIAL_SCHEMES = [
"ftp",
"file",
"http",
"https",
"ws",
"wss"
];
function isSpecialScheme(protocol_regexp) {
if (!protocol_regexp) {
return true;
}
for (const scheme of SPECIAL_SCHEMES) {
if (protocol_regexp.test(scheme)) {
return true;
}
}
return false;
}
__name(isSpecialScheme, "isSpecialScheme");
function canonicalizeHash(hash, isPattern) {
hash = maybeStripPrefix(hash, "#");
if (isPattern || hash === "") {
return hash;
}
const url = new URL("https://example.com");
url.hash = hash;
return url.hash ? url.hash.substring(1, url.hash.length) : "";
}
__name(canonicalizeHash, "canonicalizeHash");
function canonicalizeSearch(search, isPattern) {
search = maybeStripPrefix(search, "?");
if (isPattern || search === "") {
return search;
}
const url = new URL("https://example.com");
url.search = search;
return url.search ? url.search.substring(1, url.search.length) : "";
}
__name(canonicalizeSearch, "canonicalizeSearch");
function canonicalizeHostname(hostname, isPattern) {
if (isPattern || hostname === "") {
return hostname;
}
if (treatAsIPv6Hostname(hostname)) {
return ipv6HostnameEncodeCallback(hostname);
} else {
return hostnameEncodeCallback(hostname);
}
}
__name(canonicalizeHostname, "canonicalizeHostname");
function canonicalizePassword(password, isPattern) {
if (isPattern || password === "") {
return password;
}
const url = new URL("https://example.com");
url.password = password;
return url.password;
}
__name(canonicalizePassword, "canonicalizePassword");
function canonicalizeUsername(username, isPattern) {
if (isPattern || username === "") {
return username;
}
const url = new URL("https://example.com");
url.username = username;
return url.username;
}
__name(canonicalizeUsername, "canonicalizeUsername");
function canonicalizePathname(pathname, protocol, isPattern) {
if (isPattern || pathname === "") {
return pathname;
}
if (protocol && !SPECIAL_SCHEMES.includes(protocol)) {
const url = new URL(`${protocol}:${pathname}`);
return url.pathname;
}
const leadingSlash = pathname[0] == "/";
pathname = new URL(!leadingSlash ? "/-" + pathname : pathname, "https://example.com").pathname;
if (!leadingSlash) {
pathname = pathname.substring(2, pathname.length);
}
return pathname;
}
__name(canonicalizePathname, "canonicalizePathname");
function canonicalizePort(port, protocol, isPattern) {
if (defaultPortForProtocol(protocol) === port) {
port = "";
}
if (isPattern || port === "") {
return port;
}
return portEncodeCallback(port);
}
__name(canonicalizePort, "canonicalizePort");
function canonicalizeProtocol(protocol, isPattern) {
protocol = maybeStripSuffix(protocol, ":");
if (isPattern || protocol === "") {
return protocol;
}
return protocolEncodeCallback(protocol);
}
__name(canonicalizeProtocol, "canonicalizeProtocol");
function defaultPortForProtocol(protocol) {
switch (protocol) {
case "ws":
case "http":
return "80";
case "wws":
case "https":
return "443";
case "ftp":
return "21";
default:
return "";
}
}
__name(defaultPortForProtocol, "defaultPortForProtocol");
function protocolEncodeCallback(input) {
if (input === "") {
return input;
}
if (/^[-+.A-Za-z0-9]*$/.test(input))
return input.toLowerCase();
throw new TypeError(`Invalid protocol '${input}'.`);
}
__name(protocolEncodeCallback, "protocolEncodeCallback");
function usernameEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL("https://example.com");
url.username = input;
return url.username;
}
__name(usernameEncodeCallback, "usernameEncodeCallback");
function passwordEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL("https://example.com");
url.password = input;
return url.password;
}
__name(passwordEncodeCallback, "passwordEncodeCallback");
function hostnameEncodeCallback(input) {
if (input === "") {
return input;
}
if (/[\t\n\r #%/:<>?@[\]^\\|]/g.test(input)) {
throw new TypeError(`Invalid hostname '${input}'`);
}
const url = new URL("https://example.com");
url.hostname = input;
return url.hostname;
}
__name(hostnameEncodeCallback, "hostnameEncodeCallback");
function ipv6HostnameEncodeCallback(input) {
if (input === "") {
return input;
}
if (/[^0-9a-fA-F[\]:]/g.test(input)) {
throw new TypeError(`Invalid IPv6 hostname '${input}'`);
}
return input.toLowerCase();
}
__name(ipv6HostnameEncodeCallback, "ipv6HostnameEncodeCallback");
function portEncodeCallback(input) {
if (input === "") {
return input;
}
if (/^[0-9]*$/.test(input) && parseInt(input) <= 65535) {
return input;
}
throw new TypeError(`Invalid port '${input}'.`);
}
__name(portEncodeCallback, "portEncodeCallback");
function standardURLPathnameEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL("https://example.com");
url.pathname = input[0] !== "/" ? "/-" + input : input;
if (input[0] !== "/") {
return url.pathname.substring(2, url.pathname.length);
}
return url.pathname;
}
__name(standardURLPathnameEncodeCallback, "standardURLPathnameEncodeCallback");
function pathURLPathnameEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL(`data:${input}`);
return url.pathname;
}
__name(pathURLPathnameEncodeCallback, "pathURLPathnameEncodeCallback");
function searchEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL("https://example.com");
url.search = input;
return url.search.substring(1, url.search.length);
}
__name(searchEncodeCallback, "searchEncodeCallback");
function hashEncodeCallback(input) {
if (input === "") {
return input;
}
const url = new URL("https://example.com");
url.hash = input;
return url.hash.substring(1, url.hash.length);
}
__name(hashEncodeCallback, "hashEncodeCallback");
var Parser = /* @__PURE__ */ __name(class {
constructor(input) {
this.tokenList = [];
this.internalResult = {};
this.tokenIndex = 0;
this.tokenIncrement = 1;
this.componentStart = 0;
this.state = 0;
this.groupDepth = 0;
this.hostnameIPv6BracketDepth = 0;
this.shouldTreatAsStandardURL = false;
this.input = input;
}
get result() {
return this.internalResult;
}
parse() {
this.tokenList = lexer(this.input, true);
for (; this.tokenIndex < this.tokenList.length; this.tokenIndex += this.tokenIncrement) {
this.tokenIncrement = 1;
if (this.tokenList[this.tokenIndex].type === "END") {
if (this.state === 0) {
this.rewind();
if (this.isHashPrefix()) {
this.changeState(9, 1);
} else if (this.isSearchPrefix()) {
this.changeState(8, 1);
this.internalResult.hash = "";
} else {
this.changeState(7, 0);
this.internalResult.search = "";
this.internalResult.hash = "";
}
continue;
} else if (this.state === 2) {
this.rewindAndSetState(5);
continue;
}
this.changeState(10, 0);
break;
}
if (this.groupDepth > 0) {
if (this.isGroupClose()) {
this.groupDepth -= 1;
} else {
continue;
}
}
if (this.isGroupOpen()) {
this.groupDepth += 1;
continue;
}
switch (this.state) {
case 0:
if (this.isProtocolSuffix()) {
this.internalResult.username = "";
this.internalResult.password = "";
this.internalResult.hostname = "";
this.internalResult.port = "";
this.internalResult.pathname = "";
this.internalResult.search = "";
this.internalResult.hash = "";
this.rewindAndSetState(1);
}
break;
case 1:
if (this.isProtocolSuffix()) {
this.computeShouldTreatAsStandardURL();
let nextState = 7;
let skip = 1;
if (this.shouldTreatAsStandardURL) {
this.internalResult.pathname = "/";
}
if (this.nextIsAuthoritySlashes()) {
nextState = 2;
skip = 3;
} else if (this.shouldTreatAsStandardURL) {
nextState = 2;
}
this.changeState(nextState, skip);
}
break;
case 2:
if (this.isIdentityTerminator()) {
this.rewindAndSetState(3);
} else if (this.isPathnameStart() || this.isSearchPrefix() || this.isHashPrefix()) {
this.rewindAndSetState(5);
}
break;
case 3:
if (this.isPasswordPrefix()) {
this.changeState(4, 1);
} else if (this.isIdentityTerminator()) {
this.changeState(5, 1);
}
break;
case 4:
if (this.isIdentityTerminator()) {
this.changeState(5, 1);
}
break;
case 5:
if (this.isIPv6Open()) {
this.hostnameIPv6BracketDepth += 1;
} else if (this.isIPv6Close()) {
this.hostnameIPv6BracketDepth -= 1;
}
if (this.isPortPrefix() && !this.hostnameIPv6BracketDepth) {
this.changeState(6, 1);
} else if (this.isPathnameStart()) {
this.changeState(7, 0);
} else if (this.isSearchPrefix()) {
this.changeState(8, 1);
} else if (this.isHashPrefix()) {
this.changeState(9, 1);
}
break;
case 6:
if (this.isPathnameStart()) {
this.changeState(7, 0);
} else if (this.isSearchPrefix()) {
this.changeState(8, 1);
} else if (this.isHashPrefix()) {
this.changeState(9, 1);
}
break;
case 7:
if (this.isSearchPrefix()) {
this.changeState(8, 1);
} else if (this.isHashPrefix()) {
this.changeState(9, 1);
}
break;
case 8:
if (this.isHashPrefix()) {
this.changeState(9, 1);
}
break;
case 9:
break;
case 10:
break;
}
}
}
changeState(newState, skip) {
switch (this.state) {
case 0:
break;
case 1:
this.internalResult.protocol = this.makeComponentString();
break;
case 2:
break;
case 3:
this.internalResult.username = this.makeComponentString();
break;
case 4:
this.internalResult.password = this.makeComponentString();
break;
case 5:
this.internalResult.hostname = this.makeComponentString();
break;
case 6:
this.internalResult.port = this.makeComponentString();
break;
case 7:
this.internalResult.pathname = this.makeComponentString();
break;
case 8:
this.internalResult.search = this.makeComponentString();
break;
case 9:
this.internalResult.hash = this.makeComponentString();
break;
case 10:
break;
}
this.changeStateWithoutSettingComponent(newState, skip);
}
changeStateWithoutSettingComponent(newState, skip) {
this.state = newState;
this.componentStart = this.tokenIndex + skip;
this.tokenIndex += skip;
this.tokenIncrement = 0;
}
rewind() {
this.tokenIndex = this.componentStart;
this.tokenIncrement = 0;
}
rewindAndSetState(newState) {
this.rewind();
this.state = newState;
}
safeToken(index) {
if (index < 0) {
index = this.tokenList.length - index;
}
if (index < this.tokenList.length) {
return this.tokenList[index];
}
return this.tokenList[this.tokenList.length - 1];
}
isNonSpecialPatternChar(index, value) {
const token = this.safeToken(index);
return token.value === value && (token.type === "CHAR" || token.type === "ESCAPED_CHAR" || token.type === "INVALID_CHAR");
}
isProtocolSuffix() {
return this.isNonSpecialPatternChar(this.tokenIndex, ":");
}
nextIsAuthoritySlashes() {
return this.isNonSpecialPatternChar(this.tokenIndex + 1, "/") && this.isNonSpecialPatternChar(this.tokenIndex + 2, "/");
}
isIdentityTerminator() {
return this.isNonSpecialPatternChar(this.tokenIndex, "@");
}
isPasswordPrefix() {
return this.isNonSpecialPatternChar(this.tokenIndex, ":");
}
isPortPrefix() {
return this.isNonSpecialPatternChar(this.tokenIndex, ":");
}
isPathnameStart() {
return this.isNonSpecialPatternChar(this.tokenIndex, "/");
}
isSearchPrefix() {
if (this.isNonSpecialPatternChar(this.tokenIndex, "?")) {
return true;
}
if (this.tokenList[this.tokenIndex].value !== "?") {
return false;
}
const previousToken = this.safeToken(this.tokenIndex - 1);
return previousToken.type !== "NAME" && previousToken.type !== "PATTERN" && previousToken.type !== "CLOSE" && previousToken.type !== "ASTERISK";
}
isHashPrefix() {
return this.isNonSpecialPatternChar(this.tokenIndex, "#");
}
isGroupOpen() {
return this.tokenList[this.tokenIndex].type == "OPEN";
}
isGroupClose() {
return this.tokenList[this.tokenIndex].type == "CLOSE";
}
isIPv6Open() {
return this.isNonSpecialPatternChar(this.tokenIndex, "[");
}
isIPv6Close() {
return this.isNonSpecialPatternChar(this.tokenIndex, "]");
}
makeComponentString() {
const token = this.tokenList[this.tokenIndex];
const componentCharStart = this.safeToken(this.componentStart).index;
return this.input.substring(componentCharStart, token.index);
}
computeShouldTreatAsStandardURL() {
const options = {};
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = protocolEncodeCallback;
const regexp = pathToRegexp(this.makeComponentString(), void 0, options);
this.shouldTreatAsStandardURL = isSpecialScheme(regexp);
}
}, "Parser");
var COMPONENTS = [
"protocol",
"username",
"password",
"hostname",
"port",
"pathname",
"search",
"hash"
];
var DEFAULT_PATTERN = "*";
function extractValues(url, baseURL) {
if (typeof url !== "string") {
throw new TypeError(`parameter 1 is not of type 'string'.`);
}
const o = new URL(url, baseURL);
return {
protocol: o.protocol.substring(0, o.protocol.length - 1),
username: o.username,
password: o.password,
hostname: o.hostname,
port: o.port,
pathname: o.pathname,
search: o.search != "" ? o.search.substring(1, o.search.length) : void 0,
hash: o.hash != "" ? o.hash.substring(1, o.hash.length) : void 0
};
}
__name(extractValues, "extractValues");
function applyInit(o, init, isPattern) {
let baseURL;
if (typeof init.baseURL === "string") {
try {
baseURL = new URL(init.baseURL);
o.protocol = baseURL.protocol ? baseURL.protocol.substring(0, baseURL.protocol.length - 1) : "";
o.username = baseURL.username;
o.password = baseURL.password;
o.hostname = baseURL.hostname;
o.port = baseURL.port;
o.pathname = baseURL.pathname;
o.search = baseURL.search ? baseURL.search.substring(1, baseURL.search.length) : "";
o.hash = baseURL.hash ? baseURL.hash.substring(1, baseURL.hash.length) : "";
} catch {
throw new TypeError(`invalid baseURL '${init.baseURL}'.`);
}
}
if (typeof init.protocol === "string") {
o.protocol = canonicalizeProtocol(init.protocol, isPattern);
}
if (typeof init.username === "string") {
o.username = canonicalizeUsername(init.username, isPattern);
}
if (typeof init.password === "string") {
o.password = canonicalizePassword(init.password, isPattern);
}
if (typeof init.hostname === "string") {
o.hostname = canonicalizeHostname(init.hostname, isPattern);
}
if (typeof init.port === "string") {
o.port = canonicalizePort(init.port, o.protocol, isPattern);
}
if (typeof init.pathname === "string") {
o.pathname = init.pathname;
if (baseURL && !isAbsolutePathname(o.pathname, isPattern)) {
const slashIndex = baseURL.pathname.lastIndexOf("/");
if (slashIndex >= 0) {
o.pathname = baseURL.pathname.substring(0, slashIndex + 1) + o.pathname;
}
}
o.pathname = canonicalizePathname(o.pathname, o.protocol, isPattern);
}
if (typeof init.search === "string") {
o.search = canonicalizeSearch(init.search, isPattern);
}
if (typeof init.hash === "string") {
o.hash = canonicalizeHash(init.hash, isPattern);
}
return o;
}
__name(applyInit, "applyInit");
function escapePatternString(value) {
return value.replace(/([+*?:{}()\\])/g, "\\$1");
}
__name(escapePatternString, "escapePatternString");
function escapeRegexpString(value) {
return value.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
}
__name(escapeRegexpString, "escapeRegexpString");
function tokensToPattern(tokens, options) {
const wildcardPattern = ".*";
const segmentWildcardPattern = `[^${escapeRegexpString(options.delimiter === void 0 ? "/#?" : options.delimiter)}]+?`;
const regexIdentifierPart2 = /[$_\u200C\u200D\p{ID_Continue}]/u;
let result = "";
for (let i = 0; i < tokens.length; ++i) {
const token = tokens[i];
const lastToken = i > 0 ? tokens[i - 1] : null;
const nextToken = i < tokens.length - 1 ? tokens[i + 1] : null;
if (typeof token === "string") {
result += escapePatternString(token);
continue;
}
if (token.pattern === "") {
if (token.modifier === "") {
result += escapePatternString(token.prefix);
continue;
}
result += `{${escapePatternString(token.prefix)}}${token.modifier}`;
continue;
}
const customName = typeof token.name !== "number";
const optionsPrefixes = options.prefixes !== void 0 ? options.prefixes : "./";
let needsGrouping = token.suffix !== "" || token.prefix !== "" && (token.prefix.length !== 1 || !optionsPrefixes.includes(token.prefix));
if (!needsGrouping && customName && token.pattern === segmentWildcardPattern && token.modifier === "" && nextToken && !nextToken.prefix && !nextToken.suffix) {
if (typeof nextToken === "string") {
const code = nextToken.length > 0 ? nextToken[0] : "";
needsGrouping = regexIdentifierPart2.test(code);
} else {
needsGrouping = typeof nextToken.name === "number";
}
}
if (!needsGrouping && token.prefix === "" && lastToken && typeof lastToken === "string" && lastToken.length > 0) {
const code = lastToken[lastToken.length - 1];
needsGrouping = optionsPrefixes.includes(code);
}
if (needsGrouping) {
result += "{";
}
result += escapePatternString(token.prefix);
if (customName) {
result += `:${token.name}`;
}
if (token.pattern === wildcardPattern) {
if (!customName && (!lastToken || typeof lastToken === "string" || lastToken.modifier || needsGrouping || token.prefix !== "")) {
result += "*";
} else {
result += `(${wildcardPattern})`;
}
} else if (token.pattern === segmentWildcardPattern) {
if (!customName) {
result += `(${segmentWildcardPattern})`;
}
} else {
result += `(${token.pattern})`;
}
if (token.pattern === segmentWildcardPattern && customName && token.suffix !== "") {
if (regexIdentifierPart2.test(token.suffix[0])) {
result += "\\";
}
}
result += escapePatternString(token.suffix);
if (needsGrouping) {
result += "}";
}
result += token.modifier;
}
return result;
}
__name(tokensToPattern, "tokensToPattern");
var URLPattern = /* @__PURE__ */ __name(class {
constructor(init = {}, baseURLOrOptions, options) {
this.regexp = {};
this.keys = {};
this.component_pattern = {};
try {
let baseURL = void 0;
if (typeof baseURLOrOptions === "string") {
baseURL = baseURLOrOptions;
} else {
options = baseURLOrOptions;
}
if (typeof init === "string") {
const parser = new Parser(init);
parser.parse();
init = parser.result;
if (baseURL === void 0 && typeof init.protocol !== "string") {
throw new TypeError(`A base URL must be provided for a relative constructor string.`);
}
init.baseURL = baseURL;
} else {
if (!init || typeof init !== "object") {
throw new TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);
}
if (baseURL) {
throw new TypeError(`parameter 1 is not of type 'string'.`);
}
}
if (typeof options === "undefined") {
options = { ignoreCase: false };
}
const ignoreCaseOptions = { ignoreCase: options.ignoreCase === true };
const defaults = {
pathname: DEFAULT_PATTERN,
protocol: DEFAULT_PATTERN,
username: DEFAULT_PATTERN,
password: DEFAULT_PATTERN,
hostname: DEFAULT_PATTERN,
port: DEFAULT_PATTERN,
search: DEFAULT_PATTERN,
hash: DEFAULT_PATTERN
};
this.pattern = applyInit(defaults, init, true);
if (defaultPortForProtocol(this.pattern.protocol) === this.pattern.port) {
this.pattern.port = "";
}
let component;
for (component of COMPONENTS) {
if (!(component in this.pattern))
continue;
const options2 = {};
const pattern = this.pattern[component];
this.keys[component] = [];
switch (component) {
case "protocol":
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = protocolEncodeCallback;
break;
case "username":
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = usernameEncodeCallback;
break;
case "password":
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = passwordEncodeCallback;
break;
case "hostname":
Object.assign(options2, HOSTNAME_OPTIONS);
if (treatAsIPv6Hostname(pattern)) {
options2.encodePart = ipv6HostnameEncodeCallback;
} else {
options2.encodePart = hostnameEncodeCallback;
}
break;
case "port":
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = portEncodeCallback;
break;
case "pathname":
if (isSpecialScheme(this.regexp.protocol)) {
Object.assign(options2, PATHNAME_OPTIONS, ignoreCaseOptions);
options2.encodePart = standardURLPathnameEncodeCallback;
} else {
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = pathURLPathnameEncodeCallback;
}
break;
case "search":
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = searchEncodeCallback;
break;
case "hash":
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = hashEncodeCallback;
break;
}
try {
const tokens = parse(pattern, options2);
this.regexp[component] = tokensToRegexp(tokens, this.keys[component], options2);
this.component_pattern[component] = tokensToPattern(tokens, options2);
} catch {
throw new TypeError(`invalid ${component} pattern '${this.pattern[component]}'.`);
}
}
} catch (err) {
throw new TypeError(`Failed to construct 'URLPattern': ${err.message}`);
}
}
test(input = {}, baseURL) {
let values = {
pathname: "",
protocol: "",
username: "",
password: "",
hostname: "",
port: "",
search: "",
hash: ""
};
if (typeof input !== "string" && baseURL) {
throw new TypeError(`parameter 1 is not of type 'string'.`);
}
if (typeof input === "undefined") {
return false;
}
try {
if (typeof input === "object") {
values = applyInit(values, input, false);
} else {
values = applyInit(values, extractValues(input, baseURL), false);
}
} catch (err) {
return false;
}
let component;
for (component of COMPONENTS) {
if (!this.regexp[component].exec(values[component])) {
return false;
}
}
return true;
}
exec(input = {}, baseURL) {
let values = {
pathname: "",
protocol: "",
username: "",
password: "",
hostname: "",
port: "",
search: "",
hash: ""
};
if (typeof input !== "string" && baseURL) {
throw new TypeError(`parameter 1 is not of type 'string'.`);
}
if (typeof input === "undefined") {
return;
}
try {
if (typeof input === "object") {
values = applyInit(values, input, false);
} else {
values = applyInit(values, extractValues(input, baseURL), false);
}
} catch (err) {
return null;
}
let result = {};
if (baseURL) {
result.inputs = [input, baseURL];
} else {
result.inputs = [input];
}
let component;
for (component of COMPONENTS) {
let match = this.regexp[component].exec(values[component]);
if (!match) {
return null;
}
let groups = {};
for (let [i, key] of this.keys[component].entries()) {
if (typeof key.name === "string" || typeof key.name === "number") {
let value = match[i + 1];
groups[key.name] = value;
}
}
result[component] = {
input: values[component] || "",
groups
};
}
return result;
}
get protocol() {
return this.component_pattern.protocol;
}
get username() {
return this.component_pattern.username;
}
get password() {
return this.component_pattern.password;
}
get hostname() {
return this.component_pattern.hostname;
}
get port() {
return this.component_pattern.port;
}
get pathname() {
return this.component_pattern.pathname;
}
get search() {
return this.component_pattern.search;
}
get hash() {
return this.component_pattern.hash;
}
}, "URLPattern");
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/index.js
if (!globalThis.URLPattern) {
globalThis.URLPattern = URLPattern;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
URL,
URLPattern,
URLSearchParams
});