woocommerce/7752.8a2c2903.iframe.bundle...

2962 lines
98 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
(self["webpackChunk_woocommerce_storybook"] = self["webpackChunk_woocommerce_storybook"] || []).push([[7752],{
/***/ "../../node_modules/.pnpm/@wordpress+url@3.7.1/node_modules/@wordpress/url/build-module/add-query-args.js":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
F: () => (/* binding */ addQueryArgs)
});
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+url@3.7.1/node_modules/@wordpress/url/build-module/get-query-string.js
/**
* Returns the query string part of the URL.
*
* @param {string} url The full URL.
*
* @example
* ```js
* const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'
* ```
*
* @return {string|void} The query string part of the URL.
*/
function getQueryString(url) {
let query;
try {
query = new URL(url, 'http://example.com').search.substring(1);
} catch (error) {}
if (query) {
return query;
}
}
//# sourceMappingURL=get-query-string.js.map
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+url@3.7.1/node_modules/@wordpress/url/build-module/get-query-args.js
/**
* Internal dependencies
*/
/** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */
/**
* @typedef {Record<string,QueryArgParsed>} QueryArgs
*/
/**
* Sets a value in object deeply by a given array of path segments. Mutates the
* object reference.
*
* @param {Record<string,*>} object Object in which to assign.
* @param {string[]} path Path segment at which to set value.
* @param {*} value Value to set.
*/
function setPath(object, path, value) {
const length = path.length;
const lastIndex = length - 1;
for (let i = 0; i < length; i++) {
let key = path[i];
if (!key && Array.isArray(object)) {
// If key is empty string and next value is array, derive key from
// the current length of the array.
key = object.length.toString();
}
key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key; // If the next key in the path is numeric (or empty string), it will be
// created as an array. Otherwise, it will be created as an object.
const isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
object[key] = i === lastIndex ? // If at end of path, assign the intended value.
value : // Otherwise, advance to the next object in the path, creating
// it if it does not yet exist.
object[key] || (isNextKeyArrayIndex ? [] : {});
if (Array.isArray(object[key]) && !isNextKeyArrayIndex) {
// If we current key is non-numeric, but the next value is an
// array, coerce the value to an object.
object[key] = { ...object[key]
};
} // Update working reference object to the next in the path.
object = object[key];
}
}
/**
* Returns an object of query arguments of the given URL. If the given URL is
* invalid or has no querystring, an empty object is returned.
*
* @param {string} url URL.
*
* @example
* ```js
* const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );
* // { "foo": "bar", "bar": "baz" }
* ```
*
* @return {QueryArgs} Query args object.
*/
function getQueryArgs(url) {
return (getQueryString(url) || '' // Normalize space encoding, accounting for PHP URL encoding
// corresponding to `application/x-www-form-urlencoded`.
//
// See: https://tools.ietf.org/html/rfc1866#section-8.2.1
).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => {
const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where
// default is restored in destructuring assignment.
.filter(Boolean).map(decodeURIComponent);
if (key) {
const segments = key.replace(/\]/g, '').split('[');
setPath(accumulator, segments, value);
}
return accumulator;
}, Object.create(null));
}
//# sourceMappingURL=get-query-args.js.map
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+url@3.7.1/node_modules/@wordpress/url/build-module/build-query-string.js
/**
* Generates URL-encoded query string using input query data.
*
* It is intended to behave equivalent as PHP's `http_build_query`, configured
* with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).
*
* @example
* ```js
* const queryString = buildQueryString( {
* simple: 'is ok',
* arrays: [ 'are', 'fine', 'too' ],
* objects: {
* evenNested: {
* ok: 'yes',
* },
* },
* } );
* // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes"
* ```
*
* @param {Record<string,*>} data Data to encode.
*
* @return {string} Query string.
*/
function buildQueryString(data) {
let string = '';
const stack = Object.entries(data);
let pair;
while (pair = stack.shift()) {
let [key, value] = pair; // Support building deeply nested data, from array or object values.
const hasNestedData = Array.isArray(value) || value && value.constructor === Object;
if (hasNestedData) {
// Push array or object values onto the stack as composed of their
// original key and nested index or key, retaining order by a
// combination of Array#reverse and Array#unshift onto the stack.
const valuePairs = Object.entries(value).reverse();
for (const [member, memberValue] of valuePairs) {
stack.unshift([`${key}[${member}]`, memberValue]);
}
} else if (value !== undefined) {
// Null is treated as special case, equivalent to empty string.
if (value === null) {
value = '';
}
string += '&' + [key, value].map(encodeURIComponent).join('=');
}
} // Loop will concatenate with leading `&`, but it's only expected for all
// but the first query parameter. This strips the leading `&`, while still
// accounting for the case that the string may in-fact be empty.
return string.substr(1);
}
//# sourceMappingURL=build-query-string.js.map
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+url@3.7.1/node_modules/@wordpress/url/build-module/add-query-args.js
/**
* Internal dependencies
*/
/**
* Appends arguments as querystring to the provided URL. If the URL already
* includes query arguments, the arguments are merged with (and take precedent
* over) the existing set.
*
* @param {string} [url=''] URL to which arguments should be appended. If omitted,
* only the resulting querystring is returned.
* @param {Object} [args] Query arguments to apply to URL.
*
* @example
* ```js
* const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
* ```
*
* @return {string} URL with arguments applied.
*/
function addQueryArgs() {
let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
let args = arguments.length > 1 ? arguments[1] : undefined;
// If no arguments are to be appended, return original URL.
if (!args || !Object.keys(args).length) {
return url;
}
let baseUrl = url; // Determine whether URL already had query arguments.
const queryStringIndex = url.indexOf('?');
if (queryStringIndex !== -1) {
// Merge into existing query arguments.
args = Object.assign(getQueryArgs(url), args); // Change working base URL to omit previous query arguments.
baseUrl = baseUrl.substr(0, queryStringIndex);
}
return baseUrl + '?' + buildQueryString(args);
}
//# sourceMappingURL=add-query-args.js.map
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-sort.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var arraySlice = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-slice-simple.js");
var floor = Math.floor;
var mergeSort = function (array, comparefn) {
var length = array.length;
var middle = floor(length / 2);
return length < 8 ? insertionSort(array, comparefn) : merge(
array,
mergeSort(arraySlice(array, 0, middle), comparefn),
mergeSort(arraySlice(array, middle), comparefn),
comparefn
);
};
var insertionSort = function (array, comparefn) {
var length = array.length;
var i = 1;
var element, j;
while (i < length) {
j = i;
element = array[i];
while (j && comparefn(array[j - 1], element) > 0) {
array[j] = array[--j];
}
if (j !== i++) array[j] = element;
} return array;
};
var merge = function (array, left, right, comparefn) {
var llength = left.length;
var rlength = right.length;
var lindex = 0;
var rindex = 0;
while (lindex < llength || rindex < rlength) {
array[lindex + rindex] = (lindex < llength && rindex < rlength)
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
: lindex < llength ? left[lindex++] : right[rindex++];
} return array;
};
module.exports = mergeSort;
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-parse-int.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js");
var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js");
var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js");
var toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js");
var trim = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-trim.js").trim);
var whitespaces = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/whitespaces.js");
var $parseInt = global.parseInt;
var Symbol = global.Symbol;
var ITERATOR = Symbol && Symbol.iterator;
var hex = /^[+-]?0x/i;
var exec = uncurryThis(hex.exec);
var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
// MS Edge 18- broken with boxed symbols
|| (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));
// `parseInt` method
// https://tc39.es/ecma262/#sec-parseint-string-radix
module.exports = FORCED ? function parseInt(string, radix) {
var S = trim(toString(string));
return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
} : $parseInt;
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-punycode-to-ascii.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js");
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
var base = 36;
var tMin = 1;
var tMax = 26;
var skew = 38;
var damp = 700;
var initialBias = 72;
var initialN = 128; // 0x80
var delimiter = '-'; // '\x2D'
var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
var baseMinusTMin = base - tMin;
var $RangeError = RangeError;
var exec = uncurryThis(regexSeparators.exec);
var floor = Math.floor;
var fromCharCode = String.fromCharCode;
var charCodeAt = uncurryThis(''.charCodeAt);
var join = uncurryThis([].join);
var push = uncurryThis([].push);
var replace = uncurryThis(''.replace);
var split = uncurryThis(''.split);
var toLowerCase = uncurryThis(''.toLowerCase);
/**
* Creates an array containing the numeric code points of each Unicode
* character in the string. While JavaScript uses UCS-2 internally,
* this function will convert a pair of surrogate halves (each of which
* UCS-2 exposes as separate characters) into a single code point,
* matching UTF-16.
*/
var ucs2decode = function (string) {
var output = [];
var counter = 0;
var length = string.length;
while (counter < length) {
var value = charCodeAt(string, counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// It's a high surrogate, and there is a next character.
var extra = charCodeAt(string, counter++);
if ((extra & 0xFC00) === 0xDC00) { // Low surrogate.
push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
} else {
// It's an unmatched surrogate; only append this code unit, in case the
// next code unit is the high surrogate of a surrogate pair.
push(output, value);
counter--;
}
} else {
push(output, value);
}
}
return output;
};
/**
* Converts a digit/integer into a basic code point.
*/
var digitToBasic = function (digit) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26);
};
/**
* Bias adaptation function as per section 3.4 of RFC 3492.
* https://tools.ietf.org/html/rfc3492#section-3.4
*/
var adapt = function (delta, numPoints, firstTime) {
var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
while (delta > baseMinusTMin * tMax >> 1) {
delta = floor(delta / baseMinusTMin);
k += base;
}
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};
/**
* Converts a string of Unicode symbols (e.g. a domain name label) to a
* Punycode string of ASCII-only symbols.
*/
var encode = function (input) {
var output = [];
// Convert the input in UCS-2 to an array of Unicode code points.
input = ucs2decode(input);
// Cache the length.
var inputLength = input.length;
// Initialize the state.
var n = initialN;
var delta = 0;
var bias = initialBias;
var i, currentValue;
// Handle the basic code points.
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue < 0x80) {
push(output, fromCharCode(currentValue));
}
}
var basicLength = output.length; // number of basic code points.
var handledCPCount = basicLength; // number of code points that have been handled;
// Finish the basic string with a delimiter unless it's empty.
if (basicLength) {
push(output, delimiter);
}
// Main encoding loop:
while (handledCPCount < inputLength) {
// All non-basic code points < n have been handled already. Find the next larger one:
var m = maxInt;
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue >= n && currentValue < m) {
m = currentValue;
}
}
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
var handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
throw new $RangeError(OVERFLOW_ERROR);
}
delta += (m - n) * handledCPCountPlusOne;
n = m;
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue < n && ++delta > maxInt) {
throw new $RangeError(OVERFLOW_ERROR);
}
if (currentValue === n) {
// Represent delta as a generalized variable-length integer.
var q = delta;
var k = base;
while (true) {
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
if (q < t) break;
var qMinusT = q - t;
var baseMinusT = base - t;
push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
q = floor(qMinusT / baseMinusT);
k += base;
}
push(output, fromCharCode(digitToBasic(q)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
delta = 0;
handledCPCount++;
}
}
delta++;
n++;
}
return join(output, '');
};
module.exports = function (input) {
var encoded = [];
var labels = split(replace(toLowerCase(input), regexSeparators, '\u002E'), '.');
var i, label;
for (i = 0; i < labels.length; i++) {
label = labels[i];
push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label);
}
return join(encoded, '.');
};
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/url-constructor-detection.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js");
var wellKnownSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/well-known-symbol.js");
var DESCRIPTORS = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/descriptors.js");
var IS_PURE = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-pure.js");
var ITERATOR = wellKnownSymbol('iterator');
module.exports = !fails(function () {
// eslint-disable-next-line unicorn/relative-url-style -- required for testing
var url = new URL('b?a=1&b=2&c=3', 'http://a');
var params = url.searchParams;
var params2 = new URLSearchParams('a=1&a=2&b=3');
var result = '';
url.pathname = 'c%20d';
params.forEach(function (value, key) {
params['delete']('b');
result += key + value;
});
params2['delete']('a', 2);
// `undefined` case is a Chromium 117 bug
// https://bugs.chromium.org/p/v8/issues/detail?id=14222
params2['delete']('b', undefined);
return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b')))
|| (!params.size && (IS_PURE || !DESCRIPTORS))
|| !params.sort
|| url.href !== 'http://a/c%20d?a=1&c=3'
|| params.get('c') !== '3'
|| String(new URLSearchParams('?a=1')) !== 'a=1'
|| !params[ITERATOR]
// throws in Edge
|| new URL('https://a@b').username !== 'a'
|| new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
// not punycoded in Edge
|| new URL('http://тест').host !== 'xn--e1aybc'
// not escaped in Chrome 62-
|| new URL('http://a#б').hash !== '#%D0%B1'
// fails in Chrome 66-
|| result !== 'a1c3'
// throws in Safari
|| new URL('http://x', undefined).host !== 'x';
});
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.is-array.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
var isArray = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-array.js");
// `Array.isArray` method
// https://tc39.es/ecma262/#sec-array.isarray
$({ target: 'Array', stat: true }, {
isArray: isArray
});
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
var $parseInt = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-parse-int.js");
// `parseInt` method
// https://tc39.es/ecma262/#sec-parseint-string-radix
$({ global: true, forced: parseInt !== $parseInt }, {
parseInt: $parseInt
});
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.set.constructor.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
var collection = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/collection.js");
var collectionStrong = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/collection-strong.js");
// `Set` constructor
// https://tc39.es/ecma262/#sec-set-objects
collection('Set', function (init) {
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.set.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
// TODO: Remove this module from `core-js@4` since it's replaced to module below
__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.set.constructor.js");
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.string.starts-with.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this-clause.js");
var getOwnPropertyDescriptor = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-get-own-property-descriptor.js").f);
var toLength = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-length.js");
var toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js");
var notARegExp = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/not-a-regexp.js");
var requireObjectCoercible = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/require-object-coercible.js");
var correctIsRegExpLogic = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/correct-is-regexp-logic.js");
var IS_PURE = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-pure.js");
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
var nativeStartsWith = uncurryThis(''.startsWith);
var stringSlice = uncurryThis(''.slice);
var min = Math.min;
var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
return descriptor && !descriptor.writable;
}();
// `String.prototype.startsWith` method
// https://tc39.es/ecma262/#sec-string.prototype.startswith
$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
startsWith: function startsWith(searchString /* , position = 0 */) {
var that = toString(requireObjectCoercible(this));
notARegExp(searchString);
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
var search = toString(searchString);
return nativeStartsWith
? nativeStartsWith(that, search, index)
: stringSlice(that, index, index + search.length) === search;
}
});
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url-search-params.constructor.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.iterator.js");
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js");
var call = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-call.js");
var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js");
var DESCRIPTORS = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/descriptors.js");
var USE_NATIVE_URL = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/url-constructor-detection.js");
var defineBuiltIn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in.js");
var defineBuiltInAccessor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in-accessor.js");
var defineBuiltIns = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-ins.js");
var setToStringTag = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/set-to-string-tag.js");
var createIteratorConstructor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/iterator-create-constructor.js");
var InternalStateModule = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/internal-state.js");
var anInstance = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-instance.js");
var isCallable = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-callable.js");
var hasOwn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js");
var bind = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind-context.js");
var classof = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/classof.js");
var anObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-object.js");
var isObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js");
var $toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js");
var create = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-create.js");
var createPropertyDescriptor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/create-property-descriptor.js");
var getIterator = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/get-iterator.js");
var getIteratorMethod = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/get-iterator-method.js");
var createIterResultObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/create-iter-result-object.js");
var validateArgumentsLength = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/validate-arguments-length.js");
var wellKnownSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/well-known-symbol.js");
var arraySort = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-sort.js");
var ITERATOR = wellKnownSymbol('iterator');
var URL_SEARCH_PARAMS = 'URLSearchParams';
var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
var setInternalState = InternalStateModule.set;
var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Avoid NodeJS experimental warning
var safeGetBuiltIn = function (name) {
if (!DESCRIPTORS) return global[name];
var descriptor = getOwnPropertyDescriptor(global, name);
return descriptor && descriptor.value;
};
var nativeFetch = safeGetBuiltIn('fetch');
var NativeRequest = safeGetBuiltIn('Request');
var Headers = safeGetBuiltIn('Headers');
var RequestPrototype = NativeRequest && NativeRequest.prototype;
var HeadersPrototype = Headers && Headers.prototype;
var RegExp = global.RegExp;
var TypeError = global.TypeError;
var decodeURIComponent = global.decodeURIComponent;
var encodeURIComponent = global.encodeURIComponent;
var charAt = uncurryThis(''.charAt);
var join = uncurryThis([].join);
var push = uncurryThis([].push);
var replace = uncurryThis(''.replace);
var shift = uncurryThis([].shift);
var splice = uncurryThis([].splice);
var split = uncurryThis(''.split);
var stringSlice = uncurryThis(''.slice);
var plus = /\+/g;
var sequences = Array(4);
var percentSequence = function (bytes) {
return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
};
var percentDecode = function (sequence) {
try {
return decodeURIComponent(sequence);
} catch (error) {
return sequence;
}
};
var deserialize = function (it) {
var result = replace(it, plus, ' ');
var bytes = 4;
try {
return decodeURIComponent(result);
} catch (error) {
while (bytes) {
result = replace(result, percentSequence(bytes--), percentDecode);
}
return result;
}
};
var find = /[!'()~]|%20/g;
var replacements = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+'
};
var replacer = function (match) {
return replacements[match];
};
var serialize = function (it) {
return replace(encodeURIComponent(it), find, replacer);
};
var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
setInternalState(this, {
type: URL_SEARCH_PARAMS_ITERATOR,
target: getInternalParamsState(params).entries,
index: 0,
kind: kind
});
}, URL_SEARCH_PARAMS, function next() {
var state = getInternalIteratorState(this);
var target = state.target;
var index = state.index++;
if (!target || index >= target.length) {
state.target = undefined;
return createIterResultObject(undefined, true);
}
var entry = target[index];
switch (state.kind) {
case 'keys': return createIterResultObject(entry.key, false);
case 'values': return createIterResultObject(entry.value, false);
} return createIterResultObject([entry.key, entry.value], false);
}, true);
var URLSearchParamsState = function (init) {
this.entries = [];
this.url = null;
if (init !== undefined) {
if (isObject(init)) this.parseObject(init);
else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init));
}
};
URLSearchParamsState.prototype = {
type: URL_SEARCH_PARAMS,
bindURL: function (url) {
this.url = url;
this.update();
},
parseObject: function (object) {
var entries = this.entries;
var iteratorMethod = getIteratorMethod(object);
var iterator, next, step, entryIterator, entryNext, first, second;
if (iteratorMethod) {
iterator = getIterator(object, iteratorMethod);
next = iterator.next;
while (!(step = call(next, iterator)).done) {
entryIterator = getIterator(anObject(step.value));
entryNext = entryIterator.next;
if (
(first = call(entryNext, entryIterator)).done ||
(second = call(entryNext, entryIterator)).done ||
!call(entryNext, entryIterator).done
) throw new TypeError('Expected sequence with length 2');
push(entries, { key: $toString(first.value), value: $toString(second.value) });
}
} else for (var key in object) if (hasOwn(object, key)) {
push(entries, { key: key, value: $toString(object[key]) });
}
},
parseQuery: function (query) {
if (query) {
var entries = this.entries;
var attributes = split(query, '&');
var index = 0;
var attribute, entry;
while (index < attributes.length) {
attribute = attributes[index++];
if (attribute.length) {
entry = split(attribute, '=');
push(entries, {
key: deserialize(shift(entry)),
value: deserialize(join(entry, '='))
});
}
}
}
},
serialize: function () {
var entries = this.entries;
var result = [];
var index = 0;
var entry;
while (index < entries.length) {
entry = entries[index++];
push(result, serialize(entry.key) + '=' + serialize(entry.value));
} return join(result, '&');
},
update: function () {
this.entries.length = 0;
this.parseQuery(this.url.query);
},
updateURL: function () {
if (this.url) this.url.update();
}
};
// `URLSearchParams` constructor
// https://url.spec.whatwg.org/#interface-urlsearchparams
var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
anInstance(this, URLSearchParamsPrototype);
var init = arguments.length > 0 ? arguments[0] : undefined;
var state = setInternalState(this, new URLSearchParamsState(init));
if (!DESCRIPTORS) this.size = state.entries.length;
};
var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
defineBuiltIns(URLSearchParamsPrototype, {
// `URLSearchParams.prototype.append` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
append: function append(name, value) {
var state = getInternalParamsState(this);
validateArgumentsLength(arguments.length, 2);
push(state.entries, { key: $toString(name), value: $toString(value) });
if (!DESCRIPTORS) this.length++;
state.updateURL();
},
// `URLSearchParams.prototype.delete` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-delete
'delete': function (name /* , value */) {
var state = getInternalParamsState(this);
var length = validateArgumentsLength(arguments.length, 1);
var entries = state.entries;
var key = $toString(name);
var $value = length < 2 ? undefined : arguments[1];
var value = $value === undefined ? $value : $toString($value);
var index = 0;
while (index < entries.length) {
var entry = entries[index];
if (entry.key === key && (value === undefined || entry.value === value)) {
splice(entries, index, 1);
if (value !== undefined) break;
} else index++;
}
if (!DESCRIPTORS) this.size = entries.length;
state.updateURL();
},
// `URLSearchParams.prototype.get` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
get: function get(name) {
var entries = getInternalParamsState(this).entries;
validateArgumentsLength(arguments.length, 1);
var key = $toString(name);
var index = 0;
for (; index < entries.length; index++) {
if (entries[index].key === key) return entries[index].value;
}
return null;
},
// `URLSearchParams.prototype.getAll` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
getAll: function getAll(name) {
var entries = getInternalParamsState(this).entries;
validateArgumentsLength(arguments.length, 1);
var key = $toString(name);
var result = [];
var index = 0;
for (; index < entries.length; index++) {
if (entries[index].key === key) push(result, entries[index].value);
}
return result;
},
// `URLSearchParams.prototype.has` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-has
has: function has(name /* , value */) {
var entries = getInternalParamsState(this).entries;
var length = validateArgumentsLength(arguments.length, 1);
var key = $toString(name);
var $value = length < 2 ? undefined : arguments[1];
var value = $value === undefined ? $value : $toString($value);
var index = 0;
while (index < entries.length) {
var entry = entries[index++];
if (entry.key === key && (value === undefined || entry.value === value)) return true;
}
return false;
},
// `URLSearchParams.prototype.set` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
set: function set(name, value) {
var state = getInternalParamsState(this);
validateArgumentsLength(arguments.length, 1);
var entries = state.entries;
var found = false;
var key = $toString(name);
var val = $toString(value);
var index = 0;
var entry;
for (; index < entries.length; index++) {
entry = entries[index];
if (entry.key === key) {
if (found) splice(entries, index--, 1);
else {
found = true;
entry.value = val;
}
}
}
if (!found) push(entries, { key: key, value: val });
if (!DESCRIPTORS) this.size = entries.length;
state.updateURL();
},
// `URLSearchParams.prototype.sort` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-sort
sort: function sort() {
var state = getInternalParamsState(this);
arraySort(state.entries, function (a, b) {
return a.key > b.key ? 1 : -1;
});
state.updateURL();
},
// `URLSearchParams.prototype.forEach` method
forEach: function forEach(callback /* , thisArg */) {
var entries = getInternalParamsState(this).entries;
var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined);
var index = 0;
var entry;
while (index < entries.length) {
entry = entries[index++];
boundFunction(entry.value, entry.key, this);
}
},
// `URLSearchParams.prototype.keys` method
keys: function keys() {
return new URLSearchParamsIterator(this, 'keys');
},
// `URLSearchParams.prototype.values` method
values: function values() {
return new URLSearchParamsIterator(this, 'values');
},
// `URLSearchParams.prototype.entries` method
entries: function entries() {
return new URLSearchParamsIterator(this, 'entries');
}
}, { enumerable: true });
// `URLSearchParams.prototype[@@iterator]` method
defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' });
// `URLSearchParams.prototype.toString` method
// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {
return getInternalParamsState(this).serialize();
}, { enumerable: true });
// `URLSearchParams.prototype.size` getter
// https://github.com/whatwg/url/pull/734
if (DESCRIPTORS) defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
get: function size() {
return getInternalParamsState(this).entries.length;
},
configurable: true,
enumerable: true
});
setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
$({ global: true, constructor: true, forced: !USE_NATIVE_URL }, {
URLSearchParams: URLSearchParamsConstructor
});
// Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`
if (!USE_NATIVE_URL && isCallable(Headers)) {
var headersHas = uncurryThis(HeadersPrototype.has);
var headersSet = uncurryThis(HeadersPrototype.set);
var wrapRequestOptions = function (init) {
if (isObject(init)) {
var body = init.body;
var headers;
if (classof(body) === URL_SEARCH_PARAMS) {
headers = init.headers ? new Headers(init.headers) : new Headers();
if (!headersHas(headers, 'content-type')) {
headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
}
return create(init, {
body: createPropertyDescriptor(0, $toString(body)),
headers: createPropertyDescriptor(0, headers)
});
}
} return init;
};
if (isCallable(nativeFetch)) {
$({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
fetch: function fetch(input /* , init */) {
return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
}
});
}
if (isCallable(NativeRequest)) {
var RequestConstructor = function Request(input /* , init */) {
anInstance(this, RequestPrototype);
return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
};
RequestPrototype.constructor = RequestConstructor;
RequestConstructor.prototype = RequestPrototype;
$({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
Request: RequestConstructor
});
}
}
module.exports = {
URLSearchParams: URLSearchParamsConstructor,
getState: getInternalParamsState
};
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url-search-params.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
// TODO: Remove this module from `core-js@4` since it's replaced to module below
__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url-search-params.constructor.js");
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url.constructor.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.string.iterator.js");
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
var DESCRIPTORS = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/descriptors.js");
var USE_NATIVE_URL = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/url-constructor-detection.js");
var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js");
var bind = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind-context.js");
var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js");
var defineBuiltIn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in.js");
var defineBuiltInAccessor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in-accessor.js");
var anInstance = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-instance.js");
var hasOwn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js");
var assign = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-assign.js");
var arrayFrom = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-from.js");
var arraySlice = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-slice-simple.js");
var codeAt = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-multibyte.js").codeAt);
var toASCII = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-punycode-to-ascii.js");
var $toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js");
var setToStringTag = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/set-to-string-tag.js");
var validateArgumentsLength = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/validate-arguments-length.js");
var URLSearchParamsModule = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url-search-params.constructor.js");
var InternalStateModule = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/internal-state.js");
var setInternalState = InternalStateModule.set;
var getInternalURLState = InternalStateModule.getterFor('URL');
var URLSearchParams = URLSearchParamsModule.URLSearchParams;
var getInternalSearchParamsState = URLSearchParamsModule.getState;
var NativeURL = global.URL;
var TypeError = global.TypeError;
var parseInt = global.parseInt;
var floor = Math.floor;
var pow = Math.pow;
var charAt = uncurryThis(''.charAt);
var exec = uncurryThis(/./.exec);
var join = uncurryThis([].join);
var numberToString = uncurryThis(1.0.toString);
var pop = uncurryThis([].pop);
var push = uncurryThis([].push);
var replace = uncurryThis(''.replace);
var shift = uncurryThis([].shift);
var split = uncurryThis(''.split);
var stringSlice = uncurryThis(''.slice);
var toLowerCase = uncurryThis(''.toLowerCase);
var unshift = uncurryThis([].unshift);
var INVALID_AUTHORITY = 'Invalid authority';
var INVALID_SCHEME = 'Invalid scheme';
var INVALID_HOST = 'Invalid host';
var INVALID_PORT = 'Invalid port';
var ALPHA = /[a-z]/i;
// eslint-disable-next-line regexp/no-obscure-range -- safe
var ALPHANUMERIC = /[\d+-.a-z]/i;
var DIGIT = /\d/;
var HEX_START = /^0x/i;
var OCT = /^[0-7]+$/;
var DEC = /^\d+$/;
var HEX = /^[\da-f]+$/i;
/* eslint-disable regexp/no-control-character -- safe */
var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/;
var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/;
var LEADING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+/;
var TRAILING_C0_CONTROL_OR_SPACE = /(^|[^\u0000-\u0020])[\u0000-\u0020]+$/;
var TAB_AND_NEW_LINE = /[\t\n\r]/g;
/* eslint-enable regexp/no-control-character -- safe */
var EOF;
// https://url.spec.whatwg.org/#ipv4-number-parser
var parseIPv4 = function (input) {
var parts = split(input, '.');
var partsLength, numbers, index, part, radix, number, ipv4;
if (parts.length && parts[parts.length - 1] === '') {
parts.length--;
}
partsLength = parts.length;
if (partsLength > 4) return input;
numbers = [];
for (index = 0; index < partsLength; index++) {
part = parts[index];
if (part === '') return input;
radix = 10;
if (part.length > 1 && charAt(part, 0) === '0') {
radix = exec(HEX_START, part) ? 16 : 8;
part = stringSlice(part, radix === 8 ? 1 : 2);
}
if (part === '') {
number = 0;
} else {
if (!exec(radix === 10 ? DEC : radix === 8 ? OCT : HEX, part)) return input;
number = parseInt(part, radix);
}
push(numbers, number);
}
for (index = 0; index < partsLength; index++) {
number = numbers[index];
if (index === partsLength - 1) {
if (number >= pow(256, 5 - partsLength)) return null;
} else if (number > 255) return null;
}
ipv4 = pop(numbers);
for (index = 0; index < numbers.length; index++) {
ipv4 += numbers[index] * pow(256, 3 - index);
}
return ipv4;
};
// https://url.spec.whatwg.org/#concept-ipv6-parser
// eslint-disable-next-line max-statements -- TODO
var parseIPv6 = function (input) {
var address = [0, 0, 0, 0, 0, 0, 0, 0];
var pieceIndex = 0;
var compress = null;
var pointer = 0;
var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
var chr = function () {
return charAt(input, pointer);
};
if (chr() === ':') {
if (charAt(input, 1) !== ':') return;
pointer += 2;
pieceIndex++;
compress = pieceIndex;
}
while (chr()) {
if (pieceIndex === 8) return;
if (chr() === ':') {
if (compress !== null) return;
pointer++;
pieceIndex++;
compress = pieceIndex;
continue;
}
value = length = 0;
while (length < 4 && exec(HEX, chr())) {
value = value * 16 + parseInt(chr(), 16);
pointer++;
length++;
}
if (chr() === '.') {
if (length === 0) return;
pointer -= length;
if (pieceIndex > 6) return;
numbersSeen = 0;
while (chr()) {
ipv4Piece = null;
if (numbersSeen > 0) {
if (chr() === '.' && numbersSeen < 4) pointer++;
else return;
}
if (!exec(DIGIT, chr())) return;
while (exec(DIGIT, chr())) {
number = parseInt(chr(), 10);
if (ipv4Piece === null) ipv4Piece = number;
else if (ipv4Piece === 0) return;
else ipv4Piece = ipv4Piece * 10 + number;
if (ipv4Piece > 255) return;
pointer++;
}
address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
numbersSeen++;
if (numbersSeen === 2 || numbersSeen === 4) pieceIndex++;
}
if (numbersSeen !== 4) return;
break;
} else if (chr() === ':') {
pointer++;
if (!chr()) return;
} else if (chr()) return;
address[pieceIndex++] = value;
}
if (compress !== null) {
swaps = pieceIndex - compress;
pieceIndex = 7;
while (pieceIndex !== 0 && swaps > 0) {
swap = address[pieceIndex];
address[pieceIndex--] = address[compress + swaps - 1];
address[compress + --swaps] = swap;
}
} else if (pieceIndex !== 8) return;
return address;
};
var findLongestZeroSequence = function (ipv6) {
var maxIndex = null;
var maxLength = 1;
var currStart = null;
var currLength = 0;
var index = 0;
for (; index < 8; index++) {
if (ipv6[index] !== 0) {
if (currLength > maxLength) {
maxIndex = currStart;
maxLength = currLength;
}
currStart = null;
currLength = 0;
} else {
if (currStart === null) currStart = index;
++currLength;
}
}
if (currLength > maxLength) {
maxIndex = currStart;
maxLength = currLength;
}
return maxIndex;
};
// https://url.spec.whatwg.org/#host-serializing
var serializeHost = function (host) {
var result, index, compress, ignore0;
// ipv4
if (typeof host == 'number') {
result = [];
for (index = 0; index < 4; index++) {
unshift(result, host % 256);
host = floor(host / 256);
} return join(result, '.');
// ipv6
} else if (typeof host == 'object') {
result = '';
compress = findLongestZeroSequence(host);
for (index = 0; index < 8; index++) {
if (ignore0 && host[index] === 0) continue;
if (ignore0) ignore0 = false;
if (compress === index) {
result += index ? ':' : '::';
ignore0 = true;
} else {
result += numberToString(host[index], 16);
if (index < 7) result += ':';
}
}
return '[' + result + ']';
} return host;
};
var C0ControlPercentEncodeSet = {};
var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
});
var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
'#': 1, '?': 1, '{': 1, '}': 1
});
var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
'/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
});
var percentEncode = function (chr, set) {
var code = codeAt(chr, 0);
return code > 0x20 && code < 0x7F && !hasOwn(set, chr) ? chr : encodeURIComponent(chr);
};
// https://url.spec.whatwg.org/#special-scheme
var specialSchemes = {
ftp: 21,
file: null,
http: 80,
https: 443,
ws: 80,
wss: 443
};
// https://url.spec.whatwg.org/#windows-drive-letter
var isWindowsDriveLetter = function (string, normalized) {
var second;
return string.length === 2 && exec(ALPHA, charAt(string, 0))
&& ((second = charAt(string, 1)) === ':' || (!normalized && second === '|'));
};
// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
var startsWithWindowsDriveLetter = function (string) {
var third;
return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && (
string.length === 2 ||
((third = charAt(string, 2)) === '/' || third === '\\' || third === '?' || third === '#')
);
};
// https://url.spec.whatwg.org/#single-dot-path-segment
var isSingleDot = function (segment) {
return segment === '.' || toLowerCase(segment) === '%2e';
};
// https://url.spec.whatwg.org/#double-dot-path-segment
var isDoubleDot = function (segment) {
segment = toLowerCase(segment);
return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
};
// States:
var SCHEME_START = {};
var SCHEME = {};
var NO_SCHEME = {};
var SPECIAL_RELATIVE_OR_AUTHORITY = {};
var PATH_OR_AUTHORITY = {};
var RELATIVE = {};
var RELATIVE_SLASH = {};
var SPECIAL_AUTHORITY_SLASHES = {};
var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
var AUTHORITY = {};
var HOST = {};
var HOSTNAME = {};
var PORT = {};
var FILE = {};
var FILE_SLASH = {};
var FILE_HOST = {};
var PATH_START = {};
var PATH = {};
var CANNOT_BE_A_BASE_URL_PATH = {};
var QUERY = {};
var FRAGMENT = {};
var URLState = function (url, isBase, base) {
var urlString = $toString(url);
var baseState, failure, searchParams;
if (isBase) {
failure = this.parse(urlString);
if (failure) throw new TypeError(failure);
this.searchParams = null;
} else {
if (base !== undefined) baseState = new URLState(base, true);
failure = this.parse(urlString, null, baseState);
if (failure) throw new TypeError(failure);
searchParams = getInternalSearchParamsState(new URLSearchParams());
searchParams.bindURL(this);
this.searchParams = searchParams;
}
};
URLState.prototype = {
type: 'URL',
// https://url.spec.whatwg.org/#url-parsing
// eslint-disable-next-line max-statements -- TODO
parse: function (input, stateOverride, base) {
var url = this;
var state = stateOverride || SCHEME_START;
var pointer = 0;
var buffer = '';
var seenAt = false;
var seenBracket = false;
var seenPasswordToken = false;
var codePoints, chr, bufferCodePoints, failure;
input = $toString(input);
if (!stateOverride) {
url.scheme = '';
url.username = '';
url.password = '';
url.host = null;
url.port = null;
url.path = [];
url.query = null;
url.fragment = null;
url.cannotBeABaseURL = false;
input = replace(input, LEADING_C0_CONTROL_OR_SPACE, '');
input = replace(input, TRAILING_C0_CONTROL_OR_SPACE, '$1');
}
input = replace(input, TAB_AND_NEW_LINE, '');
codePoints = arrayFrom(input);
while (pointer <= codePoints.length) {
chr = codePoints[pointer];
switch (state) {
case SCHEME_START:
if (chr && exec(ALPHA, chr)) {
buffer += toLowerCase(chr);
state = SCHEME;
} else if (!stateOverride) {
state = NO_SCHEME;
continue;
} else return INVALID_SCHEME;
break;
case SCHEME:
if (chr && (exec(ALPHANUMERIC, chr) || chr === '+' || chr === '-' || chr === '.')) {
buffer += toLowerCase(chr);
} else if (chr === ':') {
if (stateOverride && (
(url.isSpecial() !== hasOwn(specialSchemes, buffer)) ||
(buffer === 'file' && (url.includesCredentials() || url.port !== null)) ||
(url.scheme === 'file' && !url.host)
)) return;
url.scheme = buffer;
if (stateOverride) {
if (url.isSpecial() && specialSchemes[url.scheme] === url.port) url.port = null;
return;
}
buffer = '';
if (url.scheme === 'file') {
state = FILE;
} else if (url.isSpecial() && base && base.scheme === url.scheme) {
state = SPECIAL_RELATIVE_OR_AUTHORITY;
} else if (url.isSpecial()) {
state = SPECIAL_AUTHORITY_SLASHES;
} else if (codePoints[pointer + 1] === '/') {
state = PATH_OR_AUTHORITY;
pointer++;
} else {
url.cannotBeABaseURL = true;
push(url.path, '');
state = CANNOT_BE_A_BASE_URL_PATH;
}
} else if (!stateOverride) {
buffer = '';
state = NO_SCHEME;
pointer = 0;
continue;
} else return INVALID_SCHEME;
break;
case NO_SCHEME:
if (!base || (base.cannotBeABaseURL && chr !== '#')) return INVALID_SCHEME;
if (base.cannotBeABaseURL && chr === '#') {
url.scheme = base.scheme;
url.path = arraySlice(base.path);
url.query = base.query;
url.fragment = '';
url.cannotBeABaseURL = true;
state = FRAGMENT;
break;
}
state = base.scheme === 'file' ? FILE : RELATIVE;
continue;
case SPECIAL_RELATIVE_OR_AUTHORITY:
if (chr === '/' && codePoints[pointer + 1] === '/') {
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
pointer++;
} else {
state = RELATIVE;
continue;
} break;
case PATH_OR_AUTHORITY:
if (chr === '/') {
state = AUTHORITY;
break;
} else {
state = PATH;
continue;
}
case RELATIVE:
url.scheme = base.scheme;
if (chr === EOF) {
url.username = base.username;
url.password = base.password;
url.host = base.host;
url.port = base.port;
url.path = arraySlice(base.path);
url.query = base.query;
} else if (chr === '/' || (chr === '\\' && url.isSpecial())) {
state = RELATIVE_SLASH;
} else if (chr === '?') {
url.username = base.username;
url.password = base.password;
url.host = base.host;
url.port = base.port;
url.path = arraySlice(base.path);
url.query = '';
state = QUERY;
} else if (chr === '#') {
url.username = base.username;
url.password = base.password;
url.host = base.host;
url.port = base.port;
url.path = arraySlice(base.path);
url.query = base.query;
url.fragment = '';
state = FRAGMENT;
} else {
url.username = base.username;
url.password = base.password;
url.host = base.host;
url.port = base.port;
url.path = arraySlice(base.path);
url.path.length--;
state = PATH;
continue;
} break;
case RELATIVE_SLASH:
if (url.isSpecial() && (chr === '/' || chr === '\\')) {
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
} else if (chr === '/') {
state = AUTHORITY;
} else {
url.username = base.username;
url.password = base.password;
url.host = base.host;
url.port = base.port;
state = PATH;
continue;
} break;
case SPECIAL_AUTHORITY_SLASHES:
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
if (chr !== '/' || charAt(buffer, pointer + 1) !== '/') continue;
pointer++;
break;
case SPECIAL_AUTHORITY_IGNORE_SLASHES:
if (chr !== '/' && chr !== '\\') {
state = AUTHORITY;
continue;
} break;
case AUTHORITY:
if (chr === '@') {
if (seenAt) buffer = '%40' + buffer;
seenAt = true;
bufferCodePoints = arrayFrom(buffer);
for (var i = 0; i < bufferCodePoints.length; i++) {
var codePoint = bufferCodePoints[i];
if (codePoint === ':' && !seenPasswordToken) {
seenPasswordToken = true;
continue;
}
var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
if (seenPasswordToken) url.password += encodedCodePoints;
else url.username += encodedCodePoints;
}
buffer = '';
} else if (
chr === EOF || chr === '/' || chr === '?' || chr === '#' ||
(chr === '\\' && url.isSpecial())
) {
if (seenAt && buffer === '') return INVALID_AUTHORITY;
pointer -= arrayFrom(buffer).length + 1;
buffer = '';
state = HOST;
} else buffer += chr;
break;
case HOST:
case HOSTNAME:
if (stateOverride && url.scheme === 'file') {
state = FILE_HOST;
continue;
} else if (chr === ':' && !seenBracket) {
if (buffer === '') return INVALID_HOST;
failure = url.parseHost(buffer);
if (failure) return failure;
buffer = '';
state = PORT;
if (stateOverride === HOSTNAME) return;
} else if (
chr === EOF || chr === '/' || chr === '?' || chr === '#' ||
(chr === '\\' && url.isSpecial())
) {
if (url.isSpecial() && buffer === '') return INVALID_HOST;
if (stateOverride && buffer === '' && (url.includesCredentials() || url.port !== null)) return;
failure = url.parseHost(buffer);
if (failure) return failure;
buffer = '';
state = PATH_START;
if (stateOverride) return;
continue;
} else {
if (chr === '[') seenBracket = true;
else if (chr === ']') seenBracket = false;
buffer += chr;
} break;
case PORT:
if (exec(DIGIT, chr)) {
buffer += chr;
} else if (
chr === EOF || chr === '/' || chr === '?' || chr === '#' ||
(chr === '\\' && url.isSpecial()) ||
stateOverride
) {
if (buffer !== '') {
var port = parseInt(buffer, 10);
if (port > 0xFFFF) return INVALID_PORT;
url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port;
buffer = '';
}
if (stateOverride) return;
state = PATH_START;
continue;
} else return INVALID_PORT;
break;
case FILE:
url.scheme = 'file';
if (chr === '/' || chr === '\\') state = FILE_SLASH;
else if (base && base.scheme === 'file') {
switch (chr) {
case EOF:
url.host = base.host;
url.path = arraySlice(base.path);
url.query = base.query;
break;
case '?':
url.host = base.host;
url.path = arraySlice(base.path);
url.query = '';
state = QUERY;
break;
case '#':
url.host = base.host;
url.path = arraySlice(base.path);
url.query = base.query;
url.fragment = '';
state = FRAGMENT;
break;
default:
if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {
url.host = base.host;
url.path = arraySlice(base.path);
url.shortenPath();
}
state = PATH;
continue;
}
} else {
state = PATH;
continue;
} break;
case FILE_SLASH:
if (chr === '/' || chr === '\\') {
state = FILE_HOST;
break;
}
if (base && base.scheme === 'file' && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {
if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]);
else url.host = base.host;
}
state = PATH;
continue;
case FILE_HOST:
if (chr === EOF || chr === '/' || chr === '\\' || chr === '?' || chr === '#') {
if (!stateOverride && isWindowsDriveLetter(buffer)) {
state = PATH;
} else if (buffer === '') {
url.host = '';
if (stateOverride) return;
state = PATH_START;
} else {
failure = url.parseHost(buffer);
if (failure) return failure;
if (url.host === 'localhost') url.host = '';
if (stateOverride) return;
buffer = '';
state = PATH_START;
} continue;
} else buffer += chr;
break;
case PATH_START:
if (url.isSpecial()) {
state = PATH;
if (chr !== '/' && chr !== '\\') continue;
} else if (!stateOverride && chr === '?') {
url.query = '';
state = QUERY;
} else if (!stateOverride && chr === '#') {
url.fragment = '';
state = FRAGMENT;
} else if (chr !== EOF) {
state = PATH;
if (chr !== '/') continue;
} break;
case PATH:
if (
chr === EOF || chr === '/' ||
(chr === '\\' && url.isSpecial()) ||
(!stateOverride && (chr === '?' || chr === '#'))
) {
if (isDoubleDot(buffer)) {
url.shortenPath();
if (chr !== '/' && !(chr === '\\' && url.isSpecial())) {
push(url.path, '');
}
} else if (isSingleDot(buffer)) {
if (chr !== '/' && !(chr === '\\' && url.isSpecial())) {
push(url.path, '');
}
} else {
if (url.scheme === 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
if (url.host) url.host = '';
buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter
}
push(url.path, buffer);
}
buffer = '';
if (url.scheme === 'file' && (chr === EOF || chr === '?' || chr === '#')) {
while (url.path.length > 1 && url.path[0] === '') {
shift(url.path);
}
}
if (chr === '?') {
url.query = '';
state = QUERY;
} else if (chr === '#') {
url.fragment = '';
state = FRAGMENT;
}
} else {
buffer += percentEncode(chr, pathPercentEncodeSet);
} break;
case CANNOT_BE_A_BASE_URL_PATH:
if (chr === '?') {
url.query = '';
state = QUERY;
} else if (chr === '#') {
url.fragment = '';
state = FRAGMENT;
} else if (chr !== EOF) {
url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet);
} break;
case QUERY:
if (!stateOverride && chr === '#') {
url.fragment = '';
state = FRAGMENT;
} else if (chr !== EOF) {
if (chr === "'" && url.isSpecial()) url.query += '%27';
else if (chr === '#') url.query += '%23';
else url.query += percentEncode(chr, C0ControlPercentEncodeSet);
} break;
case FRAGMENT:
if (chr !== EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet);
break;
}
pointer++;
}
},
// https://url.spec.whatwg.org/#host-parsing
parseHost: function (input) {
var result, codePoints, index;
if (charAt(input, 0) === '[') {
if (charAt(input, input.length - 1) !== ']') return INVALID_HOST;
result = parseIPv6(stringSlice(input, 1, -1));
if (!result) return INVALID_HOST;
this.host = result;
// opaque host
} else if (!this.isSpecial()) {
if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST;
result = '';
codePoints = arrayFrom(input);
for (index = 0; index < codePoints.length; index++) {
result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
}
this.host = result;
} else {
input = toASCII(input);
if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST;
result = parseIPv4(input);
if (result === null) return INVALID_HOST;
this.host = result;
}
},
// https://url.spec.whatwg.org/#cannot-have-a-username-password-port
cannotHaveUsernamePasswordPort: function () {
return !this.host || this.cannotBeABaseURL || this.scheme === 'file';
},
// https://url.spec.whatwg.org/#include-credentials
includesCredentials: function () {
return this.username !== '' || this.password !== '';
},
// https://url.spec.whatwg.org/#is-special
isSpecial: function () {
return hasOwn(specialSchemes, this.scheme);
},
// https://url.spec.whatwg.org/#shorten-a-urls-path
shortenPath: function () {
var path = this.path;
var pathSize = path.length;
if (pathSize && (this.scheme !== 'file' || pathSize !== 1 || !isWindowsDriveLetter(path[0], true))) {
path.length--;
}
},
// https://url.spec.whatwg.org/#concept-url-serializer
serialize: function () {
var url = this;
var scheme = url.scheme;
var username = url.username;
var password = url.password;
var host = url.host;
var port = url.port;
var path = url.path;
var query = url.query;
var fragment = url.fragment;
var output = scheme + ':';
if (host !== null) {
output += '//';
if (url.includesCredentials()) {
output += username + (password ? ':' + password : '') + '@';
}
output += serializeHost(host);
if (port !== null) output += ':' + port;
} else if (scheme === 'file') output += '//';
output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';
if (query !== null) output += '?' + query;
if (fragment !== null) output += '#' + fragment;
return output;
},
// https://url.spec.whatwg.org/#dom-url-href
setHref: function (href) {
var failure = this.parse(href);
if (failure) throw new TypeError(failure);
this.searchParams.update();
},
// https://url.spec.whatwg.org/#dom-url-origin
getOrigin: function () {
var scheme = this.scheme;
var port = this.port;
if (scheme === 'blob') try {
return new URLConstructor(scheme.path[0]).origin;
} catch (error) {
return 'null';
}
if (scheme === 'file' || !this.isSpecial()) return 'null';
return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : '');
},
// https://url.spec.whatwg.org/#dom-url-protocol
getProtocol: function () {
return this.scheme + ':';
},
setProtocol: function (protocol) {
this.parse($toString(protocol) + ':', SCHEME_START);
},
// https://url.spec.whatwg.org/#dom-url-username
getUsername: function () {
return this.username;
},
setUsername: function (username) {
var codePoints = arrayFrom($toString(username));
if (this.cannotHaveUsernamePasswordPort()) return;
this.username = '';
for (var i = 0; i < codePoints.length; i++) {
this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
}
},
// https://url.spec.whatwg.org/#dom-url-password
getPassword: function () {
return this.password;
},
setPassword: function (password) {
var codePoints = arrayFrom($toString(password));
if (this.cannotHaveUsernamePasswordPort()) return;
this.password = '';
for (var i = 0; i < codePoints.length; i++) {
this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
}
},
// https://url.spec.whatwg.org/#dom-url-host
getHost: function () {
var host = this.host;
var port = this.port;
return host === null ? ''
: port === null ? serializeHost(host)
: serializeHost(host) + ':' + port;
},
setHost: function (host) {
if (this.cannotBeABaseURL) return;
this.parse(host, HOST);
},
// https://url.spec.whatwg.org/#dom-url-hostname
getHostname: function () {
var host = this.host;
return host === null ? '' : serializeHost(host);
},
setHostname: function (hostname) {
if (this.cannotBeABaseURL) return;
this.parse(hostname, HOSTNAME);
},
// https://url.spec.whatwg.org/#dom-url-port
getPort: function () {
var port = this.port;
return port === null ? '' : $toString(port);
},
setPort: function (port) {
if (this.cannotHaveUsernamePasswordPort()) return;
port = $toString(port);
if (port === '') this.port = null;
else this.parse(port, PORT);
},
// https://url.spec.whatwg.org/#dom-url-pathname
getPathname: function () {
var path = this.path;
return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';
},
setPathname: function (pathname) {
if (this.cannotBeABaseURL) return;
this.path = [];
this.parse(pathname, PATH_START);
},
// https://url.spec.whatwg.org/#dom-url-search
getSearch: function () {
var query = this.query;
return query ? '?' + query : '';
},
setSearch: function (search) {
search = $toString(search);
if (search === '') {
this.query = null;
} else {
if (charAt(search, 0) === '?') search = stringSlice(search, 1);
this.query = '';
this.parse(search, QUERY);
}
this.searchParams.update();
},
// https://url.spec.whatwg.org/#dom-url-searchparams
getSearchParams: function () {
return this.searchParams.facade;
},
// https://url.spec.whatwg.org/#dom-url-hash
getHash: function () {
var fragment = this.fragment;
return fragment ? '#' + fragment : '';
},
setHash: function (hash) {
hash = $toString(hash);
if (hash === '') {
this.fragment = null;
return;
}
if (charAt(hash, 0) === '#') hash = stringSlice(hash, 1);
this.fragment = '';
this.parse(hash, FRAGMENT);
},
update: function () {
this.query = this.searchParams.serialize() || null;
}
};
// `URL` constructor
// https://url.spec.whatwg.org/#url-class
var URLConstructor = function URL(url /* , base */) {
var that = anInstance(this, URLPrototype);
var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined;
var state = setInternalState(that, new URLState(url, false, base));
if (!DESCRIPTORS) {
that.href = state.serialize();
that.origin = state.getOrigin();
that.protocol = state.getProtocol();
that.username = state.getUsername();
that.password = state.getPassword();
that.host = state.getHost();
that.hostname = state.getHostname();
that.port = state.getPort();
that.pathname = state.getPathname();
that.search = state.getSearch();
that.searchParams = state.getSearchParams();
that.hash = state.getHash();
}
};
var URLPrototype = URLConstructor.prototype;
var accessorDescriptor = function (getter, setter) {
return {
get: function () {
return getInternalURLState(this)[getter]();
},
set: setter && function (value) {
return getInternalURLState(this)[setter](value);
},
configurable: true,
enumerable: true
};
};
if (DESCRIPTORS) {
// `URL.prototype.href` accessors pair
// https://url.spec.whatwg.org/#dom-url-href
defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref'));
// `URL.prototype.origin` getter
// https://url.spec.whatwg.org/#dom-url-origin
defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin'));
// `URL.prototype.protocol` accessors pair
// https://url.spec.whatwg.org/#dom-url-protocol
defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol'));
// `URL.prototype.username` accessors pair
// https://url.spec.whatwg.org/#dom-url-username
defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername'));
// `URL.prototype.password` accessors pair
// https://url.spec.whatwg.org/#dom-url-password
defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword'));
// `URL.prototype.host` accessors pair
// https://url.spec.whatwg.org/#dom-url-host
defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost'));
// `URL.prototype.hostname` accessors pair
// https://url.spec.whatwg.org/#dom-url-hostname
defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname'));
// `URL.prototype.port` accessors pair
// https://url.spec.whatwg.org/#dom-url-port
defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort'));
// `URL.prototype.pathname` accessors pair
// https://url.spec.whatwg.org/#dom-url-pathname
defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname'));
// `URL.prototype.search` accessors pair
// https://url.spec.whatwg.org/#dom-url-search
defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch'));
// `URL.prototype.searchParams` getter
// https://url.spec.whatwg.org/#dom-url-searchparams
defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams'));
// `URL.prototype.hash` accessors pair
// https://url.spec.whatwg.org/#dom-url-hash
defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash'));
}
// `URL.prototype.toJSON` method
// https://url.spec.whatwg.org/#dom-url-tojson
defineBuiltIn(URLPrototype, 'toJSON', function toJSON() {
return getInternalURLState(this).serialize();
}, { enumerable: true });
// `URL.prototype.toString` method
// https://url.spec.whatwg.org/#URL-stringification-behavior
defineBuiltIn(URLPrototype, 'toString', function toString() {
return getInternalURLState(this).serialize();
}, { enumerable: true });
if (NativeURL) {
var nativeCreateObjectURL = NativeURL.createObjectURL;
var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
// `URL.createObjectURL` method
// https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
if (nativeCreateObjectURL) defineBuiltIn(URLConstructor, 'createObjectURL', bind(nativeCreateObjectURL, NativeURL));
// `URL.revokeObjectURL` method
// https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
if (nativeRevokeObjectURL) defineBuiltIn(URLConstructor, 'revokeObjectURL', bind(nativeRevokeObjectURL, NativeURL));
}
setToStringTag(URLConstructor, 'URL');
$({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {
URL: URLConstructor
});
/***/ }),
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url.js":
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
// TODO: Remove this module from `core-js@4` since it's replaced to module below
__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.url.constructor.js");
/***/ }),
/***/ "../../node_modules/.pnpm/history@5.3.0/node_modules/history/index.js":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ zR: () => (/* binding */ createBrowserHistory)
/* harmony export */ });
/* unused harmony exports Action, createHashHistory, createMemoryHistory, createPath, parsePath */
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js");
/**
* Actions represent the type of change to a location value.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
*/
var Action;
(function (Action) {
/**
* A POP indicates a change to an arbitrary index in the history stack, such
* as a back or forward navigation. It does not describe the direction of the
* navigation, only that the current index changed.
*
* Note: This is the default action for newly created history objects.
*/
Action["Pop"] = "POP";
/**
* A PUSH indicates a new entry being added to the history stack, such as when
* a link is clicked and a new page loads. When this happens, all subsequent
* entries in the stack are lost.
*/
Action["Push"] = "PUSH";
/**
* A REPLACE indicates the entry at the current index in the history stack
* being replaced by a new one.
*/
Action["Replace"] = "REPLACE";
})(Action || (Action = {}));
var readOnly = false ? 0 : function (obj) {
return obj;
};
function warning(cond, message) {
if (!cond) {
// eslint-disable-next-line no-console
if (typeof console !== 'undefined') console.warn(message);
try {
// Welcome to debugging history!
//
// This error is thrown as a convenience so you can more easily
// find the source for a warning that appears in the console by
// enabling "pause on exceptions" in your JavaScript debugger.
throw new Error(message); // eslint-disable-next-line no-empty
} catch (e) {}
}
}
var BeforeUnloadEventType = 'beforeunload';
var HashChangeEventType = 'hashchange';
var PopStateEventType = 'popstate';
/**
* Browser history stores the location in regular URLs. This is the standard for
* most web apps, but it requires some configuration on the server to ensure you
* serve the same app at multiple URLs.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
*/
function createBrowserHistory(options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$window = _options.window,
window = _options$window === void 0 ? document.defaultView : _options$window;
var globalHistory = window.history;
function getIndexAndLocation() {
var _window$location = window.location,
pathname = _window$location.pathname,
search = _window$location.search,
hash = _window$location.hash;
var state = globalHistory.state || {};
return [state.idx, readOnly({
pathname: pathname,
search: search,
hash: hash,
state: state.usr || null,
key: state.key || 'default'
})];
}
var blockedPopTx = null;
function handlePop() {
if (blockedPopTx) {
blockers.call(blockedPopTx);
blockedPopTx = null;
} else {
var nextAction = Action.Pop;
var _getIndexAndLocation = getIndexAndLocation(),
nextIndex = _getIndexAndLocation[0],
nextLocation = _getIndexAndLocation[1];
if (blockers.length) {
if (nextIndex != null) {
var delta = index - nextIndex;
if (delta) {
// Revert the POP
blockedPopTx = {
action: nextAction,
location: nextLocation,
retry: function retry() {
go(delta * -1);
}
};
go(delta);
}
} else {
// Trying to POP to a location with no index. We did not create
// this location, so we can't effectively block the navigation.
false ? 0 : void 0;
}
} else {
applyTx(nextAction);
}
}
}
window.addEventListener(PopStateEventType, handlePop);
var action = Action.Pop;
var _getIndexAndLocation2 = getIndexAndLocation(),
index = _getIndexAndLocation2[0],
location = _getIndexAndLocation2[1];
var listeners = createEvents();
var blockers = createEvents();
if (index == null) {
index = 0;
globalHistory.replaceState((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, globalHistory.state, {
idx: index
}), '');
}
function createHref(to) {
return typeof to === 'string' ? to : createPath(to);
} // state defaults to `null` because `window.history.state` does
function getNextLocation(to, state) {
if (state === void 0) {
state = null;
}
return readOnly((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({
pathname: location.pathname,
hash: '',
search: ''
}, typeof to === 'string' ? parsePath(to) : to, {
state: state,
key: createKey()
}));
}
function getHistoryStateAndUrl(nextLocation, index) {
return [{
usr: nextLocation.state,
key: nextLocation.key,
idx: index
}, createHref(nextLocation)];
}
function allowTx(action, location, retry) {
return !blockers.length || (blockers.call({
action: action,
location: location,
retry: retry
}), false);
}
function applyTx(nextAction) {
action = nextAction;
var _getIndexAndLocation3 = getIndexAndLocation();
index = _getIndexAndLocation3[0];
location = _getIndexAndLocation3[1];
listeners.call({
action: action,
location: location
});
}
function push(to, state) {
var nextAction = Action.Push;
var nextLocation = getNextLocation(to, state);
function retry() {
push(to, state);
}
if (allowTx(nextAction, nextLocation, retry)) {
var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
historyState = _getHistoryStateAndUr[0],
url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
// try...catch because iOS limits us to 100 pushState calls :/
try {
globalHistory.pushState(historyState, '', url);
} catch (error) {
// They are going to lose state here, but there is no real
// way to warn them about it since the page will refresh...
window.location.assign(url);
}
applyTx(nextAction);
}
}
function replace(to, state) {
var nextAction = Action.Replace;
var nextLocation = getNextLocation(to, state);
function retry() {
replace(to, state);
}
if (allowTx(nextAction, nextLocation, retry)) {
var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
historyState = _getHistoryStateAndUr2[0],
url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
globalHistory.replaceState(historyState, '', url);
applyTx(nextAction);
}
}
function go(delta) {
globalHistory.go(delta);
}
var history = {
get action() {
return action;
},
get location() {
return location;
},
createHref: createHref,
push: push,
replace: replace,
go: go,
back: function back() {
go(-1);
},
forward: function forward() {
go(1);
},
listen: function listen(listener) {
return listeners.push(listener);
},
block: function block(blocker) {
var unblock = blockers.push(blocker);
if (blockers.length === 1) {
window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
}
return function () {
unblock(); // Remove the beforeunload listener so the document may
// still be salvageable in the pagehide event.
// See https://html.spec.whatwg.org/#unloading-documents
if (!blockers.length) {
window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
}
};
}
};
return history;
}
/**
* Hash history stores the location in window.location.hash. This makes it ideal
* for situations where you don't want to send the location to the server for
* some reason, either because you do cannot configure it or the URL space is
* reserved for something else.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
*/
function createHashHistory(options) {
if (options === void 0) {
options = {};
}
var _options2 = options,
_options2$window = _options2.window,
window = _options2$window === void 0 ? document.defaultView : _options2$window;
var globalHistory = window.history;
function getIndexAndLocation() {
var _parsePath = parsePath(window.location.hash.substr(1)),
_parsePath$pathname = _parsePath.pathname,
pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
_parsePath$search = _parsePath.search,
search = _parsePath$search === void 0 ? '' : _parsePath$search,
_parsePath$hash = _parsePath.hash,
hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
var state = globalHistory.state || {};
return [state.idx, readOnly({
pathname: pathname,
search: search,
hash: hash,
state: state.usr || null,
key: state.key || 'default'
})];
}
var blockedPopTx = null;
function handlePop() {
if (blockedPopTx) {
blockers.call(blockedPopTx);
blockedPopTx = null;
} else {
var nextAction = Action.Pop;
var _getIndexAndLocation4 = getIndexAndLocation(),
nextIndex = _getIndexAndLocation4[0],
nextLocation = _getIndexAndLocation4[1];
if (blockers.length) {
if (nextIndex != null) {
var delta = index - nextIndex;
if (delta) {
// Revert the POP
blockedPopTx = {
action: nextAction,
location: nextLocation,
retry: function retry() {
go(delta * -1);
}
};
go(delta);
}
} else {
// Trying to POP to a location with no index. We did not create
// this location, so we can't effectively block the navigation.
false ? 0 : void 0;
}
} else {
applyTx(nextAction);
}
}
}
window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
// https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
window.addEventListener(HashChangeEventType, function () {
var _getIndexAndLocation5 = getIndexAndLocation(),
nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
if (createPath(nextLocation) !== createPath(location)) {
handlePop();
}
});
var action = Action.Pop;
var _getIndexAndLocation6 = getIndexAndLocation(),
index = _getIndexAndLocation6[0],
location = _getIndexAndLocation6[1];
var listeners = createEvents();
var blockers = createEvents();
if (index == null) {
index = 0;
globalHistory.replaceState(_extends({}, globalHistory.state, {
idx: index
}), '');
}
function getBaseHref() {
var base = document.querySelector('base');
var href = '';
if (base && base.getAttribute('href')) {
var url = window.location.href;
var hashIndex = url.indexOf('#');
href = hashIndex === -1 ? url : url.slice(0, hashIndex);
}
return href;
}
function createHref(to) {
return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
}
function getNextLocation(to, state) {
if (state === void 0) {
state = null;
}
return readOnly(_extends({
pathname: location.pathname,
hash: '',
search: ''
}, typeof to === 'string' ? parsePath(to) : to, {
state: state,
key: createKey()
}));
}
function getHistoryStateAndUrl(nextLocation, index) {
return [{
usr: nextLocation.state,
key: nextLocation.key,
idx: index
}, createHref(nextLocation)];
}
function allowTx(action, location, retry) {
return !blockers.length || (blockers.call({
action: action,
location: location,
retry: retry
}), false);
}
function applyTx(nextAction) {
action = nextAction;
var _getIndexAndLocation7 = getIndexAndLocation();
index = _getIndexAndLocation7[0];
location = _getIndexAndLocation7[1];
listeners.call({
action: action,
location: location
});
}
function push(to, state) {
var nextAction = Action.Push;
var nextLocation = getNextLocation(to, state);
function retry() {
push(to, state);
}
false ? 0 : void 0;
if (allowTx(nextAction, nextLocation, retry)) {
var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
historyState = _getHistoryStateAndUr3[0],
url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
// try...catch because iOS limits us to 100 pushState calls :/
try {
globalHistory.pushState(historyState, '', url);
} catch (error) {
// They are going to lose state here, but there is no real
// way to warn them about it since the page will refresh...
window.location.assign(url);
}
applyTx(nextAction);
}
}
function replace(to, state) {
var nextAction = Action.Replace;
var nextLocation = getNextLocation(to, state);
function retry() {
replace(to, state);
}
false ? 0 : void 0;
if (allowTx(nextAction, nextLocation, retry)) {
var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
historyState = _getHistoryStateAndUr4[0],
url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
globalHistory.replaceState(historyState, '', url);
applyTx(nextAction);
}
}
function go(delta) {
globalHistory.go(delta);
}
var history = {
get action() {
return action;
},
get location() {
return location;
},
createHref: createHref,
push: push,
replace: replace,
go: go,
back: function back() {
go(-1);
},
forward: function forward() {
go(1);
},
listen: function listen(listener) {
return listeners.push(listener);
},
block: function block(blocker) {
var unblock = blockers.push(blocker);
if (blockers.length === 1) {
window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
}
return function () {
unblock(); // Remove the beforeunload listener so the document may
// still be salvageable in the pagehide event.
// See https://html.spec.whatwg.org/#unloading-documents
if (!blockers.length) {
window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
}
};
}
};
return history;
}
/**
* Memory history stores the current location in memory. It is designed for use
* in stateful non-browser environments like tests and React Native.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
*/
function createMemoryHistory(options) {
if (options === void 0) {
options = {};
}
var _options3 = options,
_options3$initialEntr = _options3.initialEntries,
initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
initialIndex = _options3.initialIndex;
var entries = initialEntries.map(function (entry) {
var location = readOnly(_extends({
pathname: '/',
search: '',
hash: '',
state: null,
key: createKey()
}, typeof entry === 'string' ? parsePath(entry) : entry));
false ? 0 : void 0;
return location;
});
var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
var action = Action.Pop;
var location = entries[index];
var listeners = createEvents();
var blockers = createEvents();
function createHref(to) {
return typeof to === 'string' ? to : createPath(to);
}
function getNextLocation(to, state) {
if (state === void 0) {
state = null;
}
return readOnly(_extends({
pathname: location.pathname,
search: '',
hash: ''
}, typeof to === 'string' ? parsePath(to) : to, {
state: state,
key: createKey()
}));
}
function allowTx(action, location, retry) {
return !blockers.length || (blockers.call({
action: action,
location: location,
retry: retry
}), false);
}
function applyTx(nextAction, nextLocation) {
action = nextAction;
location = nextLocation;
listeners.call({
action: action,
location: location
});
}
function push(to, state) {
var nextAction = Action.Push;
var nextLocation = getNextLocation(to, state);
function retry() {
push(to, state);
}
false ? 0 : void 0;
if (allowTx(nextAction, nextLocation, retry)) {
index += 1;
entries.splice(index, entries.length, nextLocation);
applyTx(nextAction, nextLocation);
}
}
function replace(to, state) {
var nextAction = Action.Replace;
var nextLocation = getNextLocation(to, state);
function retry() {
replace(to, state);
}
false ? 0 : void 0;
if (allowTx(nextAction, nextLocation, retry)) {
entries[index] = nextLocation;
applyTx(nextAction, nextLocation);
}
}
function go(delta) {
var nextIndex = clamp(index + delta, 0, entries.length - 1);
var nextAction = Action.Pop;
var nextLocation = entries[nextIndex];
function retry() {
go(delta);
}
if (allowTx(nextAction, nextLocation, retry)) {
index = nextIndex;
applyTx(nextAction, nextLocation);
}
}
var history = {
get index() {
return index;
},
get action() {
return action;
},
get location() {
return location;
},
createHref: createHref,
push: push,
replace: replace,
go: go,
back: function back() {
go(-1);
},
forward: function forward() {
go(1);
},
listen: function listen(listener) {
return listeners.push(listener);
},
block: function block(blocker) {
return blockers.push(blocker);
}
};
return history;
} ////////////////////////////////////////////////////////////////////////////////
// UTILS
////////////////////////////////////////////////////////////////////////////////
function clamp(n, lowerBound, upperBound) {
return Math.min(Math.max(n, lowerBound), upperBound);
}
function promptBeforeUnload(event) {
// Cancel the event.
event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
event.returnValue = '';
}
function createEvents() {
var handlers = [];
return {
get length() {
return handlers.length;
},
push: function push(fn) {
handlers.push(fn);
return function () {
handlers = handlers.filter(function (handler) {
return handler !== fn;
});
};
},
call: function call(arg) {
handlers.forEach(function (fn) {
return fn && fn(arg);
});
}
};
}
function createKey() {
return Math.random().toString(36).substr(2, 8);
}
/**
* Creates a string URL path from the given pathname, search, and hash components.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
*/
function createPath(_ref) {
var _ref$pathname = _ref.pathname,
pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
_ref$search = _ref.search,
search = _ref$search === void 0 ? '' : _ref$search,
_ref$hash = _ref.hash,
hash = _ref$hash === void 0 ? '' : _ref$hash;
if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
return pathname;
}
/**
* Parses a string URL path into its separate pathname, search, and hash components.
*
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
*/
function parsePath(path) {
var parsedPath = {};
if (path) {
var hashIndex = path.indexOf('#');
if (hashIndex >= 0) {
parsedPath.hash = path.substr(hashIndex);
path = path.substr(0, hashIndex);
}
var searchIndex = path.indexOf('?');
if (searchIndex >= 0) {
parsedPath.search = path.substr(searchIndex);
path = path.substr(0, searchIndex);
}
if (path) {
parsedPath.pathname = path;
}
}
return parsedPath;
}
//# sourceMappingURL=index.js.map
/***/ })
}]);