@internetarchive/bookreader 5.0.0-70-a3 → 5.0.0-71

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"plugins/plugin.url.js","mappings":"krCAAO,ICkCgCA,EDlC1BC,EAAS,WACpB,SAAAA,IAA0B,IAAdC,EAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,G,4FAACG,CAAA,KAAAL,GACtBM,KAAKC,kBAAoBN,EAGzBK,KAAKE,UAAY,CACf,CAAEC,KAAM,OAAQC,SAAU,OAAQC,QAAS,MAC3C,CAAEF,KAAM,OAAQC,SAAU,OAAQC,QAAS,OAC3C,CAAEF,KAAM,SAAUC,SAAU,OAAQE,eAAgB,KACpD,CAAEH,KAAM,IAAKC,SAAU,eACvB,CAAED,KAAM,OAAQC,SAAU,eAC1B,CAAED,KAAM,OAAQC,SAAU,eAC1B,CAAED,KAAM,QAASC,SAAU,gBAG7BJ,KAAKO,SAAW,CAAC,EACjBP,KAAKQ,QAAUR,KAAKC,kBAAkBO,SAAW,OACjDR,KAAKS,mBAAqBT,KAAKC,kBAAkBQ,oBAAuB,IACxET,KAAKU,kBAAoB,KACzBV,KAAKW,gBAAkB,KACvBX,KAAKY,YAAc,IACrB,C,QA0KC,O,EAxKDlB,E,EAAA,EAAAmB,IAAA,sBAAAC,MAMA,SAAoBP,GAAU,IAAAQ,EAAA,KACtBC,EAAe,IAAIC,gBACnBC,EAAa,CAAC,EAEpBC,OAAOC,KAAKb,GAAUc,SAAQ,SAAAR,GAAO,IAAAS,EAAAC,EAKHC,EAEzBC,EANHC,EAASX,EAAKb,UAAUyB,MAAK,SAAAD,GAAM,OAAIA,EAAOvB,OAASU,CAAG,IACpD,QAAVS,EAAII,SAAM,IAAAJ,GAANA,EAAQhB,iBACVoB,EAASX,EAAKb,UAAUyB,MAAK,SAAAC,GAAS,OAAIA,EAAUzB,OAASuB,EAAOpB,cAAc,KAE5D,SAAd,QAANiB,EAAAG,SAAM,IA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IAGpGkK,IAAuBrL,EAAcqJ,GAAgB,kBAAmB5R,EAAK4T,GAAuBlK,GAC1G,CAEAT,EAAe2I,GAAgB,OAE/BvK,EAAE,CAAEiB,QAAQ,EAAMwL,aAAa,EAAM7L,QAASI,EAAgB0L,MAAO3L,GAAe,CAClFtL,IAAK8U,I,sBC/gCP,EAAQ,K","sources":["webpack://@internetarchive/bookreader/./src/plugins/url/UrlPlugin.js","webpack://@internetarchive/bookreader/./src/plugins/url/plugin.url.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/define-built-in-accessor.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-punycode-to-ascii.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.object.entries.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.object.from-entries.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/web.url.constructor.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/web.url.js"],"sourcesContent":["export class UrlPlugin {\n constructor(options = {}) {\n this.bookReaderOptions = options;\n\n // the canonical order of elements is important in the path and query string\n this.urlSchema = [\n { name: 'page', position: 'path', default: 'n0' },\n { name: 'mode', position: 'path', default: '2up' },\n { name: 'search', position: 'path', deprecated_for: 'q' },\n { name: 'q', position: 'query_param' },\n { name: 'sort', position: 'query_param' },\n { name: 'view', position: 'query_param' },\n { name: 'admin', position: 'query_param' },\n ];\n\n this.urlState = {};\n this.urlMode = this.bookReaderOptions.urlMode || 'hash';\n this.urlHistoryBasePath = this.bookReaderOptions.urlHistoryBasePath || '/';\n this.urlLocationPollId = null;\n this.oldLocationHash = null;\n this.oldUserHash = null;\n }\n\n /**\n * Parse JSON object URL state to string format\n * Arrange path names in an order that it is positioned on the urlSchema\n * @param {Object} urlState\n * @returns {string}\n */\n urlStateToUrlString(urlState) {\n const searchParams = new URLSearchParams();\n const pathParams = {};\n\n Object.keys(urlState).forEach(key => {\n let schema = this.urlSchema.find(schema => schema.name === key);\n if (schema?.deprecated_for) {\n schema = this.urlSchema.find(schemaKey => schemaKey.name === schema.deprecated_for);\n }\n if (schema?.position == 'path') {\n pathParams[schema?.name] = urlState[key];\n } else {\n searchParams.append(schema?.name || key, urlState[key]);\n }\n });\n\n const strPathParams = this.urlSchema\n .filter(s => s.position == 'path')\n .map(schema => pathParams[schema.name] ? `${schema.name}/${pathParams[schema.name]}` : '')\n .join('/');\n\n // replace consecutive slashes with a single slash + remove trailing slashes\n const strStrippedTrailingSlash = `${strPathParams.replace(/\\/+/g, '/').replace(/\\/+$/, '')}`;\n const concatenatedPath = `${strStrippedTrailingSlash}?${searchParams.toString()}`;\n return searchParams.toString() ? concatenatedPath : `${strStrippedTrailingSlash}`;\n }\n\n /**\n * Parse string URL and add it in the current urlState\n * Example:\n * /page/n7/mode/2up => {page: 'n7', mode: '2up'}\n * /page/n7/mode/2up/search/hello => {page: 'n7', mode: '2up', q: 'hello'}\n * @param {string} urlString\n * @returns {object}\n */\n urlStringToUrlState(urlString) {\n const urlState = {};\n\n // Fetch searchParams from given {str}\n // Note: whole URL path is needed for URL parsing\n const urlPath = new URL(urlString, 'http://example.com');\n const urlSearchParamsObj = Object.fromEntries(urlPath.searchParams.entries());\n const splitUrlMatches = urlPath.pathname.match(/[^\\\\/]+\\/[^\\\\/]+/g);\n const urlStrSplitSlashObj = splitUrlMatches ? Object.fromEntries(splitUrlMatches.map(x => x.split('/'))) : {};\n\n const doesKeyExists = (_object, _key) => {\n return Object.keys(_object).some(value => value == _key);\n };\n\n // Add path objects to urlState\n this.urlSchema\n .filter(schema => schema.position == 'path')\n .forEach(schema => {\n const hasPropertyKey = doesKeyExists(urlStrSplitSlashObj, schema.name);\n const hasDeprecatedKey = doesKeyExists(schema, 'deprecated_for') && hasPropertyKey;\n\n if (hasDeprecatedKey) {\n urlState[schema.deprecated_for] = urlStrSplitSlashObj[schema.name];\n return;\n }\n\n if (hasPropertyKey) {\n urlState[schema.name] = urlStrSplitSlashObj[schema.name];\n return;\n }\n });\n\n // Add searchParams to urlState\n Object.entries(urlSearchParamsObj).forEach(([key, value]) => {\n urlState[key] = value;\n });\n\n return urlState;\n }\n\n /**\n * Add or update key-value to the urlState\n * @param {string} key\n * @param {string} val\n */\n setUrlParam(key, value) {\n this.urlState[key] = value;\n\n this.pushToAddressBar();\n }\n\n /**\n * Delete key-value to the urlState\n * @param {string} key\n */\n removeUrlParam(key) {\n delete this.urlState[key];\n\n this.pushToAddressBar();\n }\n\n /**\n * Get key-value from the urlState\n * @param {string} key\n * @return {string}\n */\n getUrlParam(key) {\n return this.urlState[key];\n }\n\n /**\n * Push URL params to addressbar\n */\n pushToAddressBar() {\n const urlStrPath = this.urlStateToUrlString(this.urlState);\n const concatenatedPath = urlStrPath !== '/' ? urlStrPath : '';\n if (this.urlMode == 'history') {\n if (!window.history || !window.history.replaceState) {\n this.options.urlMode = 'hash';\n } else {\n const newUrlPath = `${this.urlHistoryBasePath}${concatenatedPath}`.trim().replace(/(\\/+)/g, '/');\n try {\n window.history.replaceState({}, null, newUrlPath);\n } catch (e) {\n // DOMException on Chrome when in sandboxed iframe\n this.urlMode = 'hash';\n }\n }\n }\n\n if (this.urlMode == 'hash') {\n window.location.replace('#' + concatenatedPath);\n }\n this.oldLocationHash = urlStrPath;\n }\n\n /**\n * Get the url and check if it has changed\n * If it was changeed, update the urlState\n */\n listenForHashChanges() {\n this.oldLocationHash = window.location.hash.substr(1);\n if (this.urlLocationPollId) {\n clearInterval(this.urlLocationPollId);\n this.urlLocationPollId = null;\n }\n\n // check if the URL changes\n const updateHash = () => {\n const newFragment = window.location.hash.substr(1);\n const hasFragmentChange = newFragment != this.oldLocationHash;\n\n if (!hasFragmentChange) { return; }\n\n this.urlState = this.urlStringToUrlState(newFragment);\n };\n this.urlLocationPollId = setInterval(updateHash, 500);\n }\n\n /**\n * Will read either the hash or URL and return the bookreader fragment\n */\n pullFromAddressBar (location = window.location) {\n const path = this.urlMode === 'history'\n ? (location.pathname.substr(this.urlHistoryBasePath.length) + location.search)\n : location.hash.substr(1);\n this.urlState = this.urlStringToUrlState(path);\n }\n}\n","/* global BookReader */\n\nimport { UrlPlugin } from \"./UrlPlugin\";\n\n/**\n * Plugin for URL management in BookReader\n * Note read more about the url \"fragment\" here:\n * https://openlibrary.org/dev/docs/bookurls\n */\n\njQuery.extend(BookReader.defaultOptions, {\n enableUrlPlugin: true,\n bookId: '',\n /** @type {string} Defaults can be a urlFragment string */\n defaults: null,\n updateWindowTitle: false,\n\n /** @type {'history' | 'hash'} */\n urlMode: 'hash',\n\n /**\n * When using 'history' mode, this part of the URL is kept constant\n * @example /details/plato/\n */\n urlHistoryBasePath: '/',\n\n /** Only these params will be reflected onto the URL */\n urlTrackedParams: ['page', 'search', 'mode', 'region', 'highlight', 'view'],\n\n /** If true, don't update the URL when `page == n0 (eg \"/page/n0\")` */\n urlTrackIndex0: false,\n});\n\n/** @override */\nBookReader.prototype.setup = (function(super_) {\n return function(options) {\n super_.call(this, options);\n\n this.bookId = options.bookId;\n this.defaults = options.defaults;\n\n this.locationPollId = null;\n this.oldLocationHash = null;\n this.oldUserHash = null;\n };\n})(BookReader.prototype.setup);\n\n/** @override */\nBookReader.prototype.init = (function(super_) {\n return function() {\n\n if (this.options.enableUrlPlugin) {\n this.bind(BookReader.eventNames.PostInit, () => {\n const { updateWindowTitle, urlMode } = this.options;\n if (updateWindowTitle) {\n document.title = this.shortTitle(this.bookTitle, 50);\n }\n if (urlMode === 'hash') {\n this.urlStartLocationPolling();\n }\n });\n\n this.bind(BookReader.eventNames.fragmentChange,\n this.urlUpdateFragment.bind(this)\n );\n }\n super_.call(this);\n };\n})(BookReader.prototype.init);\n\n/**\n * Returns a shortened version of the title with the maximum number of characters\n * @param {number} maximumCharacters\n * @return {string}\n */\nBookReader.prototype.shortTitle = function(maximumCharacters) {\n if (this.bookTitle.length < maximumCharacters) {\n return this.bookTitle;\n }\n\n const title = `${this.bookTitle.substr(0, maximumCharacters - 3)}...`;\n return title;\n};\n\n/**\n * Starts polling of window.location to see hash fragment changes\n */\nBookReader.prototype.urlStartLocationPolling = function() {\n this.oldLocationHash = this.urlReadFragment();\n\n if (this.locationPollId) {\n clearInterval(this.locationPollId);\n this.locationPollId = null;\n }\n\n const updateHash = () => {\n const newFragment = this.urlReadFragment();\n const hasFragmentChange = (newFragment != this.oldLocationHash) && (newFragment != this.oldUserHash);\n\n if (!hasFragmentChange) { return; }\n\n const params = this.paramsFromFragment(newFragment);\n\n const updateParams = () => this.updateFromParams(params);\n\n this.trigger(BookReader.eventNames.stop);\n if (this.animating) {\n // Queue change if animating\n if (this.autoStop) this.autoStop();\n this.animationFinishedCallback = updateParams;\n } else {\n // update immediately\n updateParams();\n }\n this.oldUserHash = newFragment;\n };\n\n this.locationPollId = setInterval(updateHash, 500);\n};\n\n/**\n * Update URL from the current parameters.\n * Call this instead of manually using window.location.replace\n */\nBookReader.prototype.urlUpdateFragment = function() {\n const allParams = this.paramsFromCurrent();\n const { urlTrackIndex0, urlTrackedParams } = this.options;\n\n if (!urlTrackIndex0\n && (typeof(allParams.index) !== 'undefined')\n && allParams.index === 0) {\n delete allParams.index;\n delete allParams.page;\n }\n\n const params = urlTrackedParams.reduce((validParams, paramName) => {\n if (paramName in allParams) {\n validParams[paramName] = allParams[paramName];\n }\n return validParams;\n }, {});\n\n const newFragment = this.fragmentFromParams(params, this.options.urlMode);\n const currFragment = this.urlReadFragment();\n const currQueryString = this.getLocationSearch();\n const newQueryString = this.queryStringFromParams(params, currQueryString, this.options.urlMode);\n if (currFragment === newFragment && currQueryString === newQueryString) {\n return;\n }\n\n if (this.options.urlMode === 'history') {\n if (!window.history || !window.history.replaceState) {\n this.options.urlMode = 'hash';\n } else {\n const baseWithoutSlash = this.options.urlHistoryBasePath.replace(/\\/+$/, '');\n const newFragmentWithSlash = newFragment === '' ? '' : `/${newFragment}`;\n\n const newUrlPath = `${baseWithoutSlash}${newFragmentWithSlash}${newQueryString}`;\n try {\n window.history.replaceState({}, null, newUrlPath);\n this.oldLocationHash = newFragment + newQueryString;\n } catch (e) {\n // DOMException on Chrome when in sandboxed iframe\n this.options.urlMode = 'hash';\n }\n }\n }\n\n if (this.options.urlMode === 'hash') {\n const newQueryStringSearch = this.urlParamsFiltersOnlySearch(this.readQueryString());\n window.location.replace('#' + newFragment + newQueryStringSearch);\n this.oldLocationHash = newFragment + newQueryStringSearch;\n }\n};\n\n/**\n * @private\n * Filtering query parameters to select only book search param (?q=foo)\n This needs to be updated/URL system modified if future query params are to be added\n * @param {string} url\n * @return {string}\n * */\nBookReader.prototype.urlParamsFiltersOnlySearch = function(url) {\n const params = new URLSearchParams(url);\n return params.has('q') ? `?${new URLSearchParams({ q: params.get('q') })}` : '';\n};\n\n\n/**\n * Will read either the hash or URL and return the bookreader fragment\n * @return {string}\n */\nBookReader.prototype.urlReadFragment = function() {\n const { urlMode, urlHistoryBasePath } = this.options;\n if (urlMode === 'history') {\n return window.location.pathname.substr(urlHistoryBasePath.length);\n } else {\n return window.location.hash.substr(1);\n }\n};\n\n/**\n * Will read the hash return the bookreader fragment\n * @return {string}\n */\nBookReader.prototype.urlReadHashFragment = function() {\n return window.location.hash.substr(1);\n};\nexport class BookreaderUrlPlugin extends BookReader {\n init() {\n if (this.options.enableUrlPlugin) {\n this.urlPlugin = new UrlPlugin(this.options);\n this.bind(BookReader.eventNames.PostInit, () => {\n const { urlMode } = this.options;\n\n if (urlMode === 'hash') {\n this.urlPlugin.listenForHashChanges();\n }\n });\n }\n\n super.init();\n }\n}\n\nwindow.BookReader = BookreaderUrlPlugin;\nexport default BookreaderUrlPlugin;\n","var makeBuiltIn = require('../internals/make-built-in');\nvar defineProperty = require('../internals/object-define-property');\n\nmodule.exports = function (target, name, descriptor) {\n if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });\n if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });\n return defineProperty.f(target, name, descriptor);\n};\n","'use strict';\n// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\nvar regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\nvar regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\nvar OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\nvar baseMinusTMin = base - tMin;\n\nvar $RangeError = RangeError;\nvar exec = uncurryThis(regexSeparators.exec);\nvar floor = Math.floor;\nvar fromCharCode = String.fromCharCode;\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar join = uncurryThis([].join);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar split = uncurryThis(''.split);\nvar toLowerCase = uncurryThis(''.toLowerCase);\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\nvar ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = charCodeAt(string, counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = charCodeAt(string, counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n push(output, value);\n counter--;\n }\n } else {\n push(output, value);\n }\n }\n return output;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n */\nvar digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\nvar adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n while (delta > baseMinusTMin * tMax >> 1) {\n delta = floor(delta / baseMinusTMin);\n k += base;\n }\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\nvar encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n push(output, fromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n push(output, delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n throw $RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw $RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n var k = base;\n while (true) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor(qMinusT / baseMinusT);\n k += base;\n }\n\n push(output, fromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n handledCPCount++;\n }\n }\n\n delta++;\n n++;\n }\n return join(output, '');\n};\n\nmodule.exports = function (input) {\n var encoded = [];\n var labels = split(replace(toLowerCase(input), regexSeparators, '\\u002E'), '.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label);\n }\n return join(encoded, '.');\n};\n","var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;\nvar fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]()\n || non[METHOD_NAME]() !== non\n || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);\n });\n};\n","var $ = require('../internals/export');\nvar $entries = require('../internals/object-to-array').entries;\n\n// `Object.entries` method\n// https://tc39.es/ecma262/#sec-object.entries\n$({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n});\n","var $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar createProperty = require('../internals/create-property');\n\n// `Object.fromEntries` method\n// https://github.com/tc39/proposal-object-from-entries\n$({ target: 'Object', stat: true }, {\n fromEntries: function fromEntries(iterable) {\n var obj = {};\n iterate(iterable, function (k, v) {\n createProperty(obj, k, v);\n }, { AS_ENTRIES: true });\n return obj;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.es/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.string.iterator');\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar USE_NATIVE_URL = require('../internals/url-constructor-detection');\nvar global = require('../internals/global');\nvar bind = require('../internals/function-bind-context');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar anInstance = require('../internals/an-instance');\nvar hasOwn = require('../internals/has-own-property');\nvar assign = require('../internals/object-assign');\nvar arrayFrom = require('../internals/array-from');\nvar arraySlice = require('../internals/array-slice-simple');\nvar codeAt = require('../internals/string-multibyte').codeAt;\nvar toASCII = require('../internals/string-punycode-to-ascii');\nvar $toString = require('../internals/to-string');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\nvar URLSearchParamsModule = require('../modules/web.url-search-params.constructor');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar getInternalURLState = InternalStateModule.getterFor('URL');\nvar URLSearchParams = URLSearchParamsModule.URLSearchParams;\nvar getInternalSearchParamsState = URLSearchParamsModule.getState;\n\nvar NativeURL = global.URL;\nvar TypeError = global.TypeError;\nvar parseInt = global.parseInt;\nvar floor = Math.floor;\nvar pow = Math.pow;\nvar charAt = uncurryThis(''.charAt);\nvar exec = uncurryThis(/./.exec);\nvar join = uncurryThis([].join);\nvar numberToString = uncurryThis(1.0.toString);\nvar pop = uncurryThis([].pop);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar shift = uncurryThis([].shift);\nvar split = uncurryThis(''.split);\nvar stringSlice = uncurryThis(''.slice);\nvar toLowerCase = uncurryThis(''.toLowerCase);\nvar unshift = uncurryThis([].unshift);\n\nvar INVALID_AUTHORITY = 'Invalid authority';\nvar INVALID_SCHEME = 'Invalid scheme';\nvar INVALID_HOST = 'Invalid host';\nvar INVALID_PORT = 'Invalid port';\n\nvar ALPHA = /[a-z]/i;\n// eslint-disable-next-line regexp/no-obscure-range -- safe\nvar ALPHANUMERIC = /[\\d+-.a-z]/i;\nvar DIGIT = /\\d/;\nvar HEX_START = /^0x/i;\nvar OCT = /^[0-7]+$/;\nvar DEC = /^\\d+$/;\nvar HEX = /^[\\da-f]+$/i;\n/* eslint-disable regexp/no-control-character -- safe */\nvar FORBIDDEN_HOST_CODE_POINT = /[\\0\\t\\n\\r #%/:<>?@[\\\\\\]^|]/;\nvar FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\0\\t\\n\\r #/:<>?@[\\\\\\]^|]/;\nvar LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u0020]+|[\\u0000-\\u0020]+$/g;\nvar TAB_AND_NEW_LINE = /[\\t\\n\\r]/g;\n/* eslint-enable regexp/no-control-character -- safe */\nvar EOF;\n\n// https://url.spec.whatwg.org/#ipv4-number-parser\nvar parseIPv4 = function (input) {\n var parts = split(input, '.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.length--;\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && charAt(part, 0) == '0') {\n radix = exec(HEX_START, part) ? 16 : 8;\n part = stringSlice(part, radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!exec(radix == 10 ? DEC : radix == 8 ? OCT : HEX, part)) return input;\n number = parseInt(part, radix);\n }\n push(numbers, number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = pop(numbers);\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n};\n\n// https://url.spec.whatwg.org/#concept-ipv6-parser\n// eslint-disable-next-line max-statements -- TODO\nvar parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var chr = function () {\n return charAt(input, pointer);\n };\n\n if (chr() == ':') {\n if (charAt(input, 1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (chr()) {\n if (pieceIndex == 8) return;\n if (chr() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && exec(HEX, chr())) {\n value = value * 16 + parseInt(chr(), 16);\n pointer++;\n length++;\n }\n if (chr() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (chr()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (chr() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!exec(DIGIT, chr())) return;\n while (exec(DIGIT, chr())) {\n number = parseInt(chr(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (chr() == ':') {\n pointer++;\n if (!chr()) return;\n } else if (chr()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n};\n\nvar findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n};\n\n// https://url.spec.whatwg.org/#host-serializing\nvar serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n unshift(result, host % 256);\n host = floor(host / 256);\n } return join(result, '.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += numberToString(host[index], 16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n};\n\nvar C0ControlPercentEncodeSet = {};\nvar fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n});\nvar pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n});\nvar userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n});\n\nvar percentEncode = function (chr, set) {\n var code = codeAt(chr, 0);\n return code > 0x20 && code < 0x7F && !hasOwn(set, chr) ? chr : encodeURIComponent(chr);\n};\n\n// https://url.spec.whatwg.org/#special-scheme\nvar specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\n// https://url.spec.whatwg.org/#windows-drive-letter\nvar isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && exec(ALPHA, charAt(string, 0))\n && ((second = charAt(string, 1)) == ':' || (!normalized && second == '|'));\n};\n\n// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter\nvar startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && (\n string.length == 2 ||\n ((third = charAt(string, 2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n};\n\n// https://url.spec.whatwg.org/#single-dot-path-segment\nvar isSingleDot = function (segment) {\n return segment === '.' || toLowerCase(segment) === '%2e';\n};\n\n// https://url.spec.whatwg.org/#double-dot-path-segment\nvar isDoubleDot = function (segment) {\n segment = toLowerCase(segment);\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n};\n\n// States:\nvar SCHEME_START = {};\nvar SCHEME = {};\nvar NO_SCHEME = {};\nvar SPECIAL_RELATIVE_OR_AUTHORITY = {};\nvar PATH_OR_AUTHORITY = {};\nvar RELATIVE = {};\nvar RELATIVE_SLASH = {};\nvar SPECIAL_AUTHORITY_SLASHES = {};\nvar SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\nvar AUTHORITY = {};\nvar HOST = {};\nvar HOSTNAME = {};\nvar PORT = {};\nvar FILE = {};\nvar FILE_SLASH = {};\nvar FILE_HOST = {};\nvar PATH_START = {};\nvar PATH = {};\nvar CANNOT_BE_A_BASE_URL_PATH = {};\nvar QUERY = {};\nvar FRAGMENT = {};\n\nvar URLState = function (url, isBase, base) {\n var urlString = $toString(url);\n var baseState, failure, searchParams;\n if (isBase) {\n failure = this.parse(urlString);\n if (failure) throw TypeError(failure);\n this.searchParams = null;\n } else {\n if (base !== undefined) baseState = new URLState(base, true);\n failure = this.parse(urlString, null, baseState);\n if (failure) throw TypeError(failure);\n searchParams = getInternalSearchParamsState(new URLSearchParams());\n searchParams.bindURL(this);\n this.searchParams = searchParams;\n }\n};\n\nURLState.prototype = {\n type: 'URL',\n // https://url.spec.whatwg.org/#url-parsing\n // eslint-disable-next-line max-statements -- TODO\n parse: function (input, stateOverride, base) {\n var url = this;\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, chr, bufferCodePoints, failure;\n\n input = $toString(input);\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = replace(input, TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n chr = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (chr && exec(ALPHA, chr)) {\n buffer += toLowerCase(chr);\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) {\n buffer += toLowerCase(chr);\n } else if (chr == ':') {\n if (stateOverride && (\n (url.isSpecial() != hasOwn(specialSchemes, buffer)) ||\n (buffer == 'file' && (url.includesCredentials() || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (url.isSpecial() && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (url.isSpecial() && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (url.isSpecial()) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n push(url.path, '');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && chr != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && chr == '#') {\n url.scheme = base.scheme;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (chr == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (chr == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (chr == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = base.query;\n } else if (chr == '/' || (chr == '\\\\' && url.isSpecial())) {\n state = RELATIVE_SLASH;\n } else if (chr == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.path.length--;\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (url.isSpecial() && (chr == '/' || chr == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (chr == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (chr != '/' || charAt(buffer, pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (chr != '/' && chr != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (chr == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial())\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += chr;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (chr == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = url.parseHost(buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial())\n ) {\n if (url.isSpecial() && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) return;\n failure = url.parseHost(buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (chr == '[') seenBracket = true;\n else if (chr == ']') seenBracket = false;\n buffer += chr;\n } break;\n\n case PORT:\n if (exec(DIGIT, chr)) {\n buffer += chr;\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial()) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (chr == '/' || chr == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (chr == EOF) {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = base.query;\n } else if (chr == '?') {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.shortenPath();\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (chr == '/' || chr == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {\n if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (chr == EOF || chr == '/' || chr == '\\\\' || chr == '?' || chr == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = url.parseHost(buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += chr;\n break;\n\n case PATH_START:\n if (url.isSpecial()) {\n state = PATH;\n if (chr != '/' && chr != '\\\\') continue;\n } else if (!stateOverride && chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n state = PATH;\n if (chr != '/') continue;\n } break;\n\n case PATH:\n if (\n chr == EOF || chr == '/' ||\n (chr == '\\\\' && url.isSpecial()) ||\n (!stateOverride && (chr == '?' || chr == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n url.shortenPath();\n if (chr != '/' && !(chr == '\\\\' && url.isSpecial())) {\n push(url.path, '');\n }\n } else if (isSingleDot(buffer)) {\n if (chr != '/' && !(chr == '\\\\' && url.isSpecial())) {\n push(url.path, '');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter\n }\n push(url.path, buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n shift(url.path);\n }\n }\n if (chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(chr, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n if (chr == \"'\" && url.isSpecial()) url.query += '%27';\n else if (chr == '#') url.query += '%23';\n else url.query += percentEncode(chr, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (chr != EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n },\n // https://url.spec.whatwg.org/#host-parsing\n parseHost: function (input) {\n var result, codePoints, index;\n if (charAt(input, 0) == '[') {\n if (charAt(input, input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(stringSlice(input, 1, -1));\n if (!result) return INVALID_HOST;\n this.host = result;\n // opaque host\n } else if (!this.isSpecial()) {\n if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n this.host = result;\n } else {\n input = toASCII(input);\n if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n this.host = result;\n }\n },\n // https://url.spec.whatwg.org/#cannot-have-a-username-password-port\n cannotHaveUsernamePasswordPort: function () {\n return !this.host || this.cannotBeABaseURL || this.scheme == 'file';\n },\n // https://url.spec.whatwg.org/#include-credentials\n includesCredentials: function () {\n return this.username != '' || this.password != '';\n },\n // https://url.spec.whatwg.org/#is-special\n isSpecial: function () {\n return hasOwn(specialSchemes, this.scheme);\n },\n // https://url.spec.whatwg.org/#shorten-a-urls-path\n shortenPath: function () {\n var path = this.path;\n var pathSize = path.length;\n if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.length--;\n }\n },\n // https://url.spec.whatwg.org/#concept-url-serializer\n serialize: function () {\n var url = this;\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (url.includesCredentials()) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n },\n // https://url.spec.whatwg.org/#dom-url-href\n setHref: function (href) {\n var failure = this.parse(href);\n if (failure) throw TypeError(failure);\n this.searchParams.update();\n },\n // https://url.spec.whatwg.org/#dom-url-origin\n getOrigin: function () {\n var scheme = this.scheme;\n var port = this.port;\n if (scheme == 'blob') try {\n return new URLConstructor(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !this.isSpecial()) return 'null';\n return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : '');\n },\n // https://url.spec.whatwg.org/#dom-url-protocol\n getProtocol: function () {\n return this.scheme + ':';\n },\n setProtocol: function (protocol) {\n this.parse($toString(protocol) + ':', SCHEME_START);\n },\n // https://url.spec.whatwg.org/#dom-url-username\n getUsername: function () {\n return this.username;\n },\n setUsername: function (username) {\n var codePoints = arrayFrom($toString(username));\n if (this.cannotHaveUsernamePasswordPort()) return;\n this.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n },\n // https://url.spec.whatwg.org/#dom-url-password\n getPassword: function () {\n return this.password;\n },\n setPassword: function (password) {\n var codePoints = arrayFrom($toString(password));\n if (this.cannotHaveUsernamePasswordPort()) return;\n this.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n },\n // https://url.spec.whatwg.org/#dom-url-host\n getHost: function () {\n var host = this.host;\n var port = this.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n },\n setHost: function (host) {\n if (this.cannotBeABaseURL) return;\n this.parse(host, HOST);\n },\n // https://url.spec.whatwg.org/#dom-url-hostname\n getHostname: function () {\n var host = this.host;\n return host === null ? '' : serializeHost(host);\n },\n setHostname: function (hostname) {\n if (this.cannotBeABaseURL) return;\n this.parse(hostname, HOSTNAME);\n },\n // https://url.spec.whatwg.org/#dom-url-port\n getPort: function () {\n var port = this.port;\n return port === null ? '' : $toString(port);\n },\n setPort: function (port) {\n if (this.cannotHaveUsernamePasswordPort()) return;\n port = $toString(port);\n if (port == '') this.port = null;\n else this.parse(port, PORT);\n },\n // https://url.spec.whatwg.org/#dom-url-pathname\n getPathname: function () {\n var path = this.path;\n return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';\n },\n setPathname: function (pathname) {\n if (this.cannotBeABaseURL) return;\n this.path = [];\n this.parse(pathname, PATH_START);\n },\n // https://url.spec.whatwg.org/#dom-url-search\n getSearch: function () {\n var query = this.query;\n return query ? '?' + query : '';\n },\n setSearch: function (search) {\n search = $toString(search);\n if (search == '') {\n this.query = null;\n } else {\n if ('?' == charAt(search, 0)) search = stringSlice(search, 1);\n this.query = '';\n this.parse(search, QUERY);\n }\n this.searchParams.update();\n },\n // https://url.spec.whatwg.org/#dom-url-searchparams\n getSearchParams: function () {\n return this.searchParams.facade;\n },\n // https://url.spec.whatwg.org/#dom-url-hash\n getHash: function () {\n var fragment = this.fragment;\n return fragment ? '#' + fragment : '';\n },\n setHash: function (hash) {\n hash = $toString(hash);\n if (hash == '') {\n this.fragment = null;\n return;\n }\n if ('#' == charAt(hash, 0)) hash = stringSlice(hash, 1);\n this.fragment = '';\n this.parse(hash, FRAGMENT);\n },\n update: function () {\n this.query = this.searchParams.serialize() || null;\n }\n};\n\n// `URL` constructor\n// https://url.spec.whatwg.org/#url-class\nvar URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLPrototype);\n var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined;\n var state = setInternalState(that, new URLState(url, false, base));\n if (!DESCRIPTORS) {\n that.href = state.serialize();\n that.origin = state.getOrigin();\n that.protocol = state.getProtocol();\n that.username = state.getUsername();\n that.password = state.getPassword();\n that.host = state.getHost();\n that.hostname = state.getHostname();\n that.port = state.getPort();\n that.pathname = state.getPathname();\n that.search = state.getSearch();\n that.searchParams = state.getSearchParams();\n that.hash = state.getHash();\n }\n};\n\nvar URLPrototype = URLConstructor.prototype;\n\nvar accessorDescriptor = function (getter, setter) {\n return {\n get: function () {\n return getInternalURLState(this)[getter]();\n },\n set: setter && function (value) {\n return getInternalURLState(this)[setter](value);\n },\n configurable: true,\n enumerable: true\n };\n};\n\nif (DESCRIPTORS) {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref'));\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin'));\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol'));\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername'));\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword'));\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost'));\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname'));\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort'));\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname'));\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch'));\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams'));\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash'));\n}\n\n// `URL.prototype.toJSON` method\n// https://url.spec.whatwg.org/#dom-url-tojson\ndefineBuiltIn(URLPrototype, 'toJSON', function toJSON() {\n return getInternalURLState(this).serialize();\n}, { enumerable: true });\n\n// `URL.prototype.toString` method\n// https://url.spec.whatwg.org/#URL-stringification-behavior\ndefineBuiltIn(URLPrototype, 'toString', function toString() {\n return getInternalURLState(this).serialize();\n}, { enumerable: true });\n\nif (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n if (nativeCreateObjectURL) defineBuiltIn(URLConstructor, 'createObjectURL', bind(nativeCreateObjectURL, NativeURL));\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n if (nativeRevokeObjectURL) defineBuiltIn(URLConstructor, 'revokeObjectURL', bind(nativeRevokeObjectURL, NativeURL));\n}\n\nsetToStringTag(URLConstructor, 'URL');\n\n$({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {\n URL: URLConstructor\n});\n","// TODO: Remove this module from `core-js@4` since it's replaced to module below\nrequire('../modules/web.url.constructor');\n"],"names":["super_","UrlPlugin","options","arguments","length","undefined","_classCallCheck","this","bookReaderOptions","urlSchema","name","position","default","deprecated_for","urlState","urlMode","urlHistoryBasePath","urlLocationPollId","oldLocationHash","oldUserHash","key","value","_this","searchParams","URLSearchParams","pathParams","Object","keys","forEach","_schema","_schema2","_schema3","_schema4","schema","find","schemaKey","append","strPathParams","filter","s","map","concat","join","strStrippedTrailingSlash","replace","concatenatedPath","toString","urlString","urlPath","URL","urlSearchParamsObj","fromEntries","entries","splitUrlMatches","pathname","match","urlStrSplitSlashObj","x","split","doesKeyExists","_object","_key","some","hasPropertyKey","_ref","_ref2","pushToAddressBar","urlStrPath","urlStateToUrlString","window","history","replaceState","newUrlPath","trim","e","location","_this2","hash","substr","clearInterval","setInterval","newFragment","urlStringToUrlState","path","search","extend","BookReader","defaultOptions","enableUrlPlugin","bookId","defaults","updateWindowTitle","urlTrackedParams","urlTrackIndex0","prototype","setup","call","locationPollId","init","bind","eventNames","PostInit","_this$options","document","title","shortTitle","bookTitle","urlStartLocationPolling","fragmentChange","urlUpdateFragment","maximumCharacters","urlReadFragment","params","paramsFromFragment","updateParams","updateFromParams","trigger","stop","animating","autoStop","animationFinishedCallback","allParams","paramsFromCurrent","_this$options2","index","page","reduce","validParams","paramName","fragmentFromParams","currFragment","currQueryString","getLocationSearch","newQueryString","queryStringFromParams","baseWithoutSlash","newFragmentWithSlash","newQueryStringSearch","urlParamsFiltersOnlySearch","readQueryString","url","has","q","get","_this$options3","urlReadHashFragment","BookreaderUrlPlugin","_BookReader","_inherits","_super","apply","_this3","urlPlugin","listenForHashChanges","_get","_getPrototypeOf","makeBuiltIn","defineProperty","module","exports","target","descriptor","getter","set","setter","f","uncurryThis","maxInt","regexNonASCII","regexSeparators","OVERFLOW_ERROR","$RangeError","RangeError","exec","floor","Math","fromCharCode","String","charCodeAt","push","toLowerCase","digitToBasic","digit","adapt","delta","numPoints","firstTime","k","baseMinusTMin","base","encode","input","output","string","counter","extra","ucs2decode","i","currentValue","inputLength","n","bias","basicLength","handledCPCount","m","handledCPCountPlusOne","t","qMinusT","baseMinusT","label","encoded","labels","PROPER_FUNCTION_NAME","fails","whitespaces","METHOD_NAME","$","$entries","stat","O","iterate","createProperty","iterable","obj","v","AS_ENTRIES","$trim","proto","forced","forcedStringTrimMethod","EOF","DESCRIPTORS","USE_NATIVE_URL","global","defineBuiltIn","defineBuiltInAccessor","anInstance","hasOwn","assign","arrayFrom","arraySlice","codeAt","toASCII","$toString","setToStringTag","validateArgumentsLength","URLSearchParamsModule","InternalStateModule","setInternalState","getInternalURLState","getterFor","getInternalSearchParamsState","getState","NativeURL","TypeError","parseInt","pow","charAt","numberToString","pop","shift","stringSlice","slice","unshift","INVALID_SCHEME","INVALID_HOST","INVALID_PORT","ALPHA","ALPHANUMERIC","DIGIT","HEX_START","OCT","DEC","HEX","FORBIDDEN_HOST_CODE_POINT","FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT","LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE","TAB_AND_NEW_LINE","serializeHost","host","result","compress","ignore0","ipv6","maxIndex","maxLength","currStart","currLength","findLongestZeroSequence","C0ControlPercentEncodeSet","fragmentPercentEncodeSet","pathPercentEncodeSet","userinfoPercentEncodeSet","percentEncode","chr","code","encodeURIComponent","specialSchemes","ftp","file","http","https","ws","wss","isWindowsDriveLetter","normalized","second","startsWithWindowsDriveLetter","third","isSingleDot","segment","SCHEME_START","SCHEME","NO_SCHEME","SPECIAL_RELATIVE_OR_AUTHORITY","PATH_OR_AUTHORITY","RELATIVE","RELATIVE_SLASH","SPECIAL_AUTHORITY_SLASHES","SPECIAL_AUTHORITY_IGNORE_SLASHES","AUTHORITY","HOST","HOSTNAME","PORT","FILE","FILE_SLASH","FILE_HOST","PATH_START","PATH","CANNOT_BE_A_BASE_URL_PATH","QUERY","FRAGMENT","URLState","isBase","baseState","failure","parse","bindURL","type","stateOverride","codePoints","bufferCodePoints","state","pointer","buffer","seenAt","seenBracket","seenPasswordToken","scheme","username","password","port","query","fragment","cannotBeABaseURL","isSpecial","includesCredentials","codePoint","encodedCodePoints","parseHost","shortenPath","numbersSeen","ipv4Piece","number","swaps","swap","address","pieceIndex","parseIPv6","partsLength","numbers","part","radix","ipv4","parts","parseIPv4","cannotHaveUsernamePasswordPort","pathSize","serialize","setHref","href","update","getOrigin","URLConstructor","origin","error","getProtocol","setProtocol","protocol","getUsername","setUsername","getPassword","setPassword","getHost","setHost","getHostname","setHostname","hostname","getPort","setPort","getPathname","setPathname","getSearch","setSearch","getSearchParams","facade","getHash","setHash","that","URLPrototype","accessorDescriptor","configurable","enumerable","nativeCreateObjectURL","createObjectURL","nativeRevokeObjectURL","revokeObjectURL","constructor","sham"],"sourceRoot":""}
1
+ {"version":3,"file":"plugins/plugin.url.js","mappings":"krCAAO,ICkCgCA,EDlC1BC,EAAS,WACpB,SAAAA,IAA0B,IAAdC,EAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,G,4FAACG,CAAA,KAAAL,GACtBM,KAAKC,kBAAoBN,EAGzBK,KAAKE,UAAY,CACf,CAAEC,KAAM,OAAQC,SAAU,OAAQC,QAAS,MAC3C,CAAEF,KAAM,OAAQC,SAAU,OAAQC,QAAS,OAC3C,CAAEF,KAAM,SAAUC,SAAU,OAAQE,eAAgB,KACpD,CAAEH,KAAM,IAAKC,SAAU,eACvB,CAAED,KAAM,OAAQC,SAAU,eAC1B,CAAED,KAAM,OAAQC,SAAU,eAC1B,CAAED,KAAM,QAASC,SAAU,gBAG7BJ,KAAKO,SAAW,CAAC,EACjBP,KAAKQ,QAAUR,KAAKC,kBAAkBO,SAAW,OACjDR,KAAKS,mBAAqBT,KAAKC,kBAAkBQ,oBAAuB,IACxET,KAAKU,kBA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,GAAc,WAAYC,GAAmB,cAAe,gBAGlF9K,EAAsB6K,GAAc,OAAQC,GAAmB,UAAW,YAG1E9K,EAAsB6K,GAAc,WAAYC,GAAmB,cAAe,gBAGlF9K,EAAsB6K,GAAc,SAAUC,GAAmB,YAAa,cAG9E9K,EAAsB6K,GAAc,eAAgBC,GAAmB,oBAGvE9K,EAAsB6K,GAAc,OAAQC,GAAmB,UAAW,aAK5E/K,EAAc8K,GAAc,UAAU,WACpC,OAAO/J,EAAoBtP,MAAMsX,WACnC,GAAG,CAAEkC,YAAY,IAIjBjL,EAAc8K,GAAc,YAAY,WACtC,OAAO/J,EAAoBtP,MAAMsX,WACnC,GAAG,CAAEkC,YAAY,IAEb9J,EAAW,CACb,IAAI+J,GAAwB/J,EAAUgK,gBAClCC,GAAwBjK,EAAUkK,gBAGlCH,IAAuBlL,EAAcoJ,GAAgB,kBAAmB3R,EAAKyT,GAAuB/J,IAGpGiK,IAAuBpL,EAAcoJ,GAAgB,kBAAmB3R,EAAK2T,GAAuBjK,GAC1G,CAEAT,EAAe0I,GAAgB,OAE/BtK,EAAE,CAAEiB,QAAQ,EAAMuL,aAAa,EAAM5L,QAASI,EAAgByL,MAAO1L,GAAe,CAClFzL,IAAKgV,I,sBC/gCP,EAAQ,K","sources":["webpack://@internetarchive/bookreader/./src/plugins/url/UrlPlugin.js","webpack://@internetarchive/bookreader/./src/plugins/url/plugin.url.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/define-built-in-accessor.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-punycode-to-ascii.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.object.entries.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.object.from-entries.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/web.url.constructor.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/web.url.js"],"sourcesContent":["export class UrlPlugin {\n constructor(options = {}) {\n this.bookReaderOptions = options;\n\n // the canonical order of elements is important in the path and query string\n this.urlSchema = [\n { name: 'page', position: 'path', default: 'n0' },\n { name: 'mode', position: 'path', default: '2up' },\n { name: 'search', position: 'path', deprecated_for: 'q' },\n { name: 'q', position: 'query_param' },\n { name: 'sort', position: 'query_param' },\n { name: 'view', position: 'query_param' },\n { name: 'admin', position: 'query_param' },\n ];\n\n this.urlState = {};\n this.urlMode = this.bookReaderOptions.urlMode || 'hash';\n this.urlHistoryBasePath = this.bookReaderOptions.urlHistoryBasePath || '/';\n this.urlLocationPollId = null;\n this.oldLocationHash = null;\n this.oldUserHash = null;\n }\n\n /**\n * Parse JSON object URL state to string format\n * Arrange path names in an order that it is positioned on the urlSchema\n * @param {Object} urlState\n * @returns {string}\n */\n urlStateToUrlString(urlState) {\n const searchParams = new URLSearchParams();\n const pathParams = {};\n\n Object.keys(urlState).forEach(key => {\n let schema = this.urlSchema.find(schema => schema.name === key);\n if (schema?.deprecated_for) {\n schema = this.urlSchema.find(schemaKey => schemaKey.name === schema.deprecated_for);\n }\n if (schema?.position == 'path') {\n pathParams[schema?.name] = urlState[key];\n } else {\n searchParams.append(schema?.name || key, urlState[key]);\n }\n });\n\n const strPathParams = this.urlSchema\n .filter(s => s.position == 'path')\n .map(schema => pathParams[schema.name] ? `${schema.name}/${encodeURIComponent(pathParams[schema.name])}` : '')\n .join('/');\n\n // replace consecutive slashes with a single slash + remove trailing slashes\n const strStrippedTrailingSlash = `${strPathParams.replace(/\\/+/g, '/').replace(/\\/+$/, '')}`;\n const concatenatedPath = `${strStrippedTrailingSlash}?${searchParams.toString()}`;\n return searchParams.toString() ? concatenatedPath : `${strStrippedTrailingSlash}`;\n }\n\n /**\n * Parse string URL and add it in the current urlState\n * Example:\n * /page/n7/mode/2up => {page: 'n7', mode: '2up'}\n * /page/n7/mode/2up/search/hello => {page: 'n7', mode: '2up', q: 'hello'}\n * @param {string} urlString\n * @returns {object}\n */\n urlStringToUrlState(urlString) {\n const urlState = {};\n\n // Fetch searchParams from given {str}\n // Note: whole URL path is needed for URL parsing\n const urlPath = new URL(urlString, 'http://example.com');\n const urlSearchParamsObj = Object.fromEntries(urlPath.searchParams.entries());\n const splitUrlMatches = urlPath.pathname.match(/[^\\\\/]+\\/[^\\\\/]+/g);\n const urlStrSplitSlashObj = splitUrlMatches ? Object.fromEntries(splitUrlMatches.map(x => x.split('/'))) : {};\n\n const doesKeyExists = (_object, _key) => {\n return Object.keys(_object).some(value => value == _key);\n };\n\n // Add path objects to urlState\n this.urlSchema\n .filter(schema => schema.position == 'path')\n .forEach(schema => {\n const hasPropertyKey = doesKeyExists(urlStrSplitSlashObj, schema.name);\n const hasDeprecatedKey = doesKeyExists(schema, 'deprecated_for') && hasPropertyKey;\n\n // Not in the URL\n if (!hasPropertyKey && !hasDeprecatedKey) {\n return;\n }\n\n const urlStateParam = hasDeprecatedKey ? schema.deprecated_for : schema.name;\n urlState[urlStateParam] = decodeURIComponent(urlStrSplitSlashObj[schema.name]);\n });\n\n // Add searchParams to urlState\n Object.entries(urlSearchParamsObj).forEach(([key, value]) => {\n urlState[key] = value;\n });\n\n return urlState;\n }\n\n /**\n * Add or update key-value to the urlState\n * @param {string} key\n * @param {string} val\n */\n setUrlParam(key, value) {\n this.urlState[key] = value;\n\n this.pushToAddressBar();\n }\n\n /**\n * Delete key-value to the urlState\n * @param {string} key\n */\n removeUrlParam(key) {\n delete this.urlState[key];\n\n this.pushToAddressBar();\n }\n\n /**\n * Get key-value from the urlState\n * @param {string} key\n * @return {string}\n */\n getUrlParam(key) {\n return this.urlState[key];\n }\n\n /**\n * Push URL params to addressbar\n */\n pushToAddressBar() {\n const urlStrPath = this.urlStateToUrlString(this.urlState);\n const concatenatedPath = urlStrPath !== '/' ? urlStrPath : '';\n if (this.urlMode == 'history') {\n if (!window.history || !window.history.replaceState) {\n this.options.urlMode = 'hash';\n } else {\n const newUrlPath = `${this.urlHistoryBasePath}${concatenatedPath}`.trim().replace(/(\\/+)/g, '/');\n try {\n window.history.replaceState({}, null, newUrlPath);\n } catch (e) {\n // DOMException on Chrome when in sandboxed iframe\n this.urlMode = 'hash';\n }\n }\n }\n\n if (this.urlMode == 'hash') {\n window.location.replace('#' + concatenatedPath);\n }\n this.oldLocationHash = urlStrPath;\n }\n\n /**\n * Get the url and check if it has changed\n * If it was changeed, update the urlState\n */\n listenForHashChanges() {\n this.oldLocationHash = window.location.hash.substr(1);\n if (this.urlLocationPollId) {\n clearInterval(this.urlLocationPollId);\n this.urlLocationPollId = null;\n }\n\n // check if the URL changes\n const updateHash = () => {\n const newFragment = window.location.hash.substr(1);\n const hasFragmentChange = newFragment != this.oldLocationHash;\n\n if (!hasFragmentChange) { return; }\n\n this.urlState = this.urlStringToUrlState(newFragment);\n };\n this.urlLocationPollId = setInterval(updateHash, 500);\n }\n\n /**\n * Will read either the hash or URL and return the bookreader fragment\n */\n pullFromAddressBar (location = window.location) {\n const path = this.urlMode === 'history'\n ? (location.pathname.substr(this.urlHistoryBasePath.length) + location.search)\n : location.hash.substr(1);\n this.urlState = this.urlStringToUrlState(path);\n }\n}\n","/* global BookReader */\n\nimport { UrlPlugin } from \"./UrlPlugin\";\n\n/**\n * Plugin for URL management in BookReader\n * Note read more about the url \"fragment\" here:\n * https://openlibrary.org/dev/docs/bookurls\n */\n\njQuery.extend(BookReader.defaultOptions, {\n enableUrlPlugin: true,\n bookId: '',\n /** @type {string} Defaults can be a urlFragment string */\n defaults: null,\n updateWindowTitle: false,\n\n /** @type {'history' | 'hash'} */\n urlMode: 'hash',\n\n /**\n * When using 'history' mode, this part of the URL is kept constant\n * @example /details/plato/\n */\n urlHistoryBasePath: '/',\n\n /** Only these params will be reflected onto the URL */\n urlTrackedParams: ['page', 'search', 'mode', 'region', 'highlight', 'view'],\n\n /** If true, don't update the URL when `page == n0 (eg \"/page/n0\")` */\n urlTrackIndex0: false,\n});\n\n/** @override */\nBookReader.prototype.setup = (function(super_) {\n return function(options) {\n super_.call(this, options);\n\n this.bookId = options.bookId;\n this.defaults = options.defaults;\n\n this.locationPollId = null;\n this.oldLocationHash = null;\n this.oldUserHash = null;\n };\n})(BookReader.prototype.setup);\n\n/** @override */\nBookReader.prototype.init = (function(super_) {\n return function() {\n\n if (this.options.enableUrlPlugin) {\n this.bind(BookReader.eventNames.PostInit, () => {\n const { updateWindowTitle, urlMode } = this.options;\n if (updateWindowTitle) {\n document.title = this.shortTitle(this.bookTitle, 50);\n }\n if (urlMode === 'hash') {\n this.urlStartLocationPolling();\n }\n });\n\n this.bind(BookReader.eventNames.fragmentChange,\n this.urlUpdateFragment.bind(this)\n );\n }\n super_.call(this);\n };\n})(BookReader.prototype.init);\n\n/**\n * Returns a shortened version of the title with the maximum number of characters\n * @param {number} maximumCharacters\n * @return {string}\n */\nBookReader.prototype.shortTitle = function(maximumCharacters) {\n if (this.bookTitle.length < maximumCharacters) {\n return this.bookTitle;\n }\n\n const title = `${this.bookTitle.substr(0, maximumCharacters - 3)}...`;\n return title;\n};\n\n/**\n * Starts polling of window.location to see hash fragment changes\n */\nBookReader.prototype.urlStartLocationPolling = function() {\n this.oldLocationHash = this.urlReadFragment();\n\n if (this.locationPollId) {\n clearInterval(this.locationPollId);\n this.locationPollId = null;\n }\n\n const updateHash = () => {\n const newFragment = this.urlReadFragment();\n const hasFragmentChange = (newFragment != this.oldLocationHash) && (newFragment != this.oldUserHash);\n\n if (!hasFragmentChange) { return; }\n\n const params = this.paramsFromFragment(newFragment);\n\n const updateParams = () => this.updateFromParams(params);\n\n this.trigger(BookReader.eventNames.stop);\n if (this.animating) {\n // Queue change if animating\n if (this.autoStop) this.autoStop();\n this.animationFinishedCallback = updateParams;\n } else {\n // update immediately\n updateParams();\n }\n this.oldUserHash = newFragment;\n };\n\n this.locationPollId = setInterval(updateHash, 500);\n};\n\n/**\n * Update URL from the current parameters.\n * Call this instead of manually using window.location.replace\n */\nBookReader.prototype.urlUpdateFragment = function() {\n const allParams = this.paramsFromCurrent();\n const { urlTrackIndex0, urlTrackedParams } = this.options;\n\n if (!urlTrackIndex0\n && (typeof(allParams.index) !== 'undefined')\n && allParams.index === 0) {\n delete allParams.index;\n delete allParams.page;\n }\n\n const params = urlTrackedParams.reduce((validParams, paramName) => {\n if (paramName in allParams) {\n validParams[paramName] = allParams[paramName];\n }\n return validParams;\n }, {});\n\n const newFragment = this.fragmentFromParams(params, this.options.urlMode);\n const currFragment = this.urlReadFragment();\n const currQueryString = this.getLocationSearch();\n const newQueryString = this.queryStringFromParams(params, currQueryString, this.options.urlMode);\n if (currFragment === newFragment && currQueryString === newQueryString) {\n return;\n }\n\n if (this.options.urlMode === 'history') {\n if (!window.history || !window.history.replaceState) {\n this.options.urlMode = 'hash';\n } else {\n const baseWithoutSlash = this.options.urlHistoryBasePath.replace(/\\/+$/, '');\n const newFragmentWithSlash = newFragment === '' ? '' : `/${newFragment}`;\n\n const newUrlPath = `${baseWithoutSlash}${newFragmentWithSlash}${newQueryString}`;\n try {\n window.history.replaceState({}, null, newUrlPath);\n this.oldLocationHash = newFragment + newQueryString;\n } catch (e) {\n // DOMException on Chrome when in sandboxed iframe\n this.options.urlMode = 'hash';\n }\n }\n }\n\n if (this.options.urlMode === 'hash') {\n const newQueryStringSearch = this.urlParamsFiltersOnlySearch(this.readQueryString());\n window.location.replace('#' + newFragment + newQueryStringSearch);\n this.oldLocationHash = newFragment + newQueryStringSearch;\n }\n};\n\n/**\n * @private\n * Filtering query parameters to select only book search param (?q=foo)\n This needs to be updated/URL system modified if future query params are to be added\n * @param {string} url\n * @return {string}\n * */\nBookReader.prototype.urlParamsFiltersOnlySearch = function(url) {\n const params = new URLSearchParams(url);\n return params.has('q') ? `?${new URLSearchParams({ q: params.get('q') })}` : '';\n};\n\n\n/**\n * Will read either the hash or URL and return the bookreader fragment\n * @return {string}\n */\nBookReader.prototype.urlReadFragment = function() {\n const { urlMode, urlHistoryBasePath } = this.options;\n if (urlMode === 'history') {\n return window.location.pathname.substr(urlHistoryBasePath.length);\n } else {\n return window.location.hash.substr(1);\n }\n};\n\n/**\n * Will read the hash return the bookreader fragment\n * @return {string}\n */\nBookReader.prototype.urlReadHashFragment = function() {\n return window.location.hash.substr(1);\n};\nexport class BookreaderUrlPlugin extends BookReader {\n init() {\n if (this.options.enableUrlPlugin) {\n this.urlPlugin = new UrlPlugin(this.options);\n this.bind(BookReader.eventNames.PostInit, () => {\n const { urlMode } = this.options;\n\n if (urlMode === 'hash') {\n this.urlPlugin.listenForHashChanges();\n }\n });\n }\n\n super.init();\n }\n}\n\nwindow.BookReader = BookreaderUrlPlugin;\nexport default BookreaderUrlPlugin;\n","var makeBuiltIn = require('../internals/make-built-in');\nvar defineProperty = require('../internals/object-define-property');\n\nmodule.exports = function (target, name, descriptor) {\n if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });\n if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });\n return defineProperty.f(target, name, descriptor);\n};\n","'use strict';\n// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\nvar regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\nvar regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\nvar OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\nvar baseMinusTMin = base - tMin;\n\nvar $RangeError = RangeError;\nvar exec = uncurryThis(regexSeparators.exec);\nvar floor = Math.floor;\nvar fromCharCode = String.fromCharCode;\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar join = uncurryThis([].join);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar split = uncurryThis(''.split);\nvar toLowerCase = uncurryThis(''.toLowerCase);\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\nvar ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = charCodeAt(string, counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = charCodeAt(string, counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n push(output, value);\n counter--;\n }\n } else {\n push(output, value);\n }\n }\n return output;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n */\nvar digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\nvar adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n while (delta > baseMinusTMin * tMax >> 1) {\n delta = floor(delta / baseMinusTMin);\n k += base;\n }\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\nvar encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n push(output, fromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n push(output, delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n throw $RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw $RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n var k = base;\n while (true) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor(qMinusT / baseMinusT);\n k += base;\n }\n\n push(output, fromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n handledCPCount++;\n }\n }\n\n delta++;\n n++;\n }\n return join(output, '');\n};\n\nmodule.exports = function (input) {\n var encoded = [];\n var labels = split(replace(toLowerCase(input), regexSeparators, '\\u002E'), '.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label);\n }\n return join(encoded, '.');\n};\n","var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;\nvar fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]()\n || non[METHOD_NAME]() !== non\n || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);\n });\n};\n","var $ = require('../internals/export');\nvar $entries = require('../internals/object-to-array').entries;\n\n// `Object.entries` method\n// https://tc39.es/ecma262/#sec-object.entries\n$({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n});\n","var $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar createProperty = require('../internals/create-property');\n\n// `Object.fromEntries` method\n// https://github.com/tc39/proposal-object-from-entries\n$({ target: 'Object', stat: true }, {\n fromEntries: function fromEntries(iterable) {\n var obj = {};\n iterate(iterable, function (k, v) {\n createProperty(obj, k, v);\n }, { AS_ENTRIES: true });\n return obj;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.es/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.string.iterator');\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar USE_NATIVE_URL = require('../internals/url-constructor-detection');\nvar global = require('../internals/global');\nvar bind = require('../internals/function-bind-context');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar anInstance = require('../internals/an-instance');\nvar hasOwn = require('../internals/has-own-property');\nvar assign = require('../internals/object-assign');\nvar arrayFrom = require('../internals/array-from');\nvar arraySlice = require('../internals/array-slice-simple');\nvar codeAt = require('../internals/string-multibyte').codeAt;\nvar toASCII = require('../internals/string-punycode-to-ascii');\nvar $toString = require('../internals/to-string');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\nvar URLSearchParamsModule = require('../modules/web.url-search-params.constructor');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar getInternalURLState = InternalStateModule.getterFor('URL');\nvar URLSearchParams = URLSearchParamsModule.URLSearchParams;\nvar getInternalSearchParamsState = URLSearchParamsModule.getState;\n\nvar NativeURL = global.URL;\nvar TypeError = global.TypeError;\nvar parseInt = global.parseInt;\nvar floor = Math.floor;\nvar pow = Math.pow;\nvar charAt = uncurryThis(''.charAt);\nvar exec = uncurryThis(/./.exec);\nvar join = uncurryThis([].join);\nvar numberToString = uncurryThis(1.0.toString);\nvar pop = uncurryThis([].pop);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar shift = uncurryThis([].shift);\nvar split = uncurryThis(''.split);\nvar stringSlice = uncurryThis(''.slice);\nvar toLowerCase = uncurryThis(''.toLowerCase);\nvar unshift = uncurryThis([].unshift);\n\nvar INVALID_AUTHORITY = 'Invalid authority';\nvar INVALID_SCHEME = 'Invalid scheme';\nvar INVALID_HOST = 'Invalid host';\nvar INVALID_PORT = 'Invalid port';\n\nvar ALPHA = /[a-z]/i;\n// eslint-disable-next-line regexp/no-obscure-range -- safe\nvar ALPHANUMERIC = /[\\d+-.a-z]/i;\nvar DIGIT = /\\d/;\nvar HEX_START = /^0x/i;\nvar OCT = /^[0-7]+$/;\nvar DEC = /^\\d+$/;\nvar HEX = /^[\\da-f]+$/i;\n/* eslint-disable regexp/no-control-character -- safe */\nvar FORBIDDEN_HOST_CODE_POINT = /[\\0\\t\\n\\r #%/:<>?@[\\\\\\]^|]/;\nvar FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\0\\t\\n\\r #/:<>?@[\\\\\\]^|]/;\nvar LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u0020]+|[\\u0000-\\u0020]+$/g;\nvar TAB_AND_NEW_LINE = /[\\t\\n\\r]/g;\n/* eslint-enable regexp/no-control-character -- safe */\nvar EOF;\n\n// https://url.spec.whatwg.org/#ipv4-number-parser\nvar parseIPv4 = function (input) {\n var parts = split(input, '.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.length--;\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && charAt(part, 0) == '0') {\n radix = exec(HEX_START, part) ? 16 : 8;\n part = stringSlice(part, radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!exec(radix == 10 ? DEC : radix == 8 ? OCT : HEX, part)) return input;\n number = parseInt(part, radix);\n }\n push(numbers, number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = pop(numbers);\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n};\n\n// https://url.spec.whatwg.org/#concept-ipv6-parser\n// eslint-disable-next-line max-statements -- TODO\nvar parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var chr = function () {\n return charAt(input, pointer);\n };\n\n if (chr() == ':') {\n if (charAt(input, 1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (chr()) {\n if (pieceIndex == 8) return;\n if (chr() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && exec(HEX, chr())) {\n value = value * 16 + parseInt(chr(), 16);\n pointer++;\n length++;\n }\n if (chr() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (chr()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (chr() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!exec(DIGIT, chr())) return;\n while (exec(DIGIT, chr())) {\n number = parseInt(chr(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (chr() == ':') {\n pointer++;\n if (!chr()) return;\n } else if (chr()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n};\n\nvar findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n};\n\n// https://url.spec.whatwg.org/#host-serializing\nvar serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n unshift(result, host % 256);\n host = floor(host / 256);\n } return join(result, '.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += numberToString(host[index], 16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n};\n\nvar C0ControlPercentEncodeSet = {};\nvar fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n});\nvar pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n});\nvar userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n});\n\nvar percentEncode = function (chr, set) {\n var code = codeAt(chr, 0);\n return code > 0x20 && code < 0x7F && !hasOwn(set, chr) ? chr : encodeURIComponent(chr);\n};\n\n// https://url.spec.whatwg.org/#special-scheme\nvar specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\n// https://url.spec.whatwg.org/#windows-drive-letter\nvar isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && exec(ALPHA, charAt(string, 0))\n && ((second = charAt(string, 1)) == ':' || (!normalized && second == '|'));\n};\n\n// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter\nvar startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && (\n string.length == 2 ||\n ((third = charAt(string, 2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n};\n\n// https://url.spec.whatwg.org/#single-dot-path-segment\nvar isSingleDot = function (segment) {\n return segment === '.' || toLowerCase(segment) === '%2e';\n};\n\n// https://url.spec.whatwg.org/#double-dot-path-segment\nvar isDoubleDot = function (segment) {\n segment = toLowerCase(segment);\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n};\n\n// States:\nvar SCHEME_START = {};\nvar SCHEME = {};\nvar NO_SCHEME = {};\nvar SPECIAL_RELATIVE_OR_AUTHORITY = {};\nvar PATH_OR_AUTHORITY = {};\nvar RELATIVE = {};\nvar RELATIVE_SLASH = {};\nvar SPECIAL_AUTHORITY_SLASHES = {};\nvar SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\nvar AUTHORITY = {};\nvar HOST = {};\nvar HOSTNAME = {};\nvar PORT = {};\nvar FILE = {};\nvar FILE_SLASH = {};\nvar FILE_HOST = {};\nvar PATH_START = {};\nvar PATH = {};\nvar CANNOT_BE_A_BASE_URL_PATH = {};\nvar QUERY = {};\nvar FRAGMENT = {};\n\nvar URLState = function (url, isBase, base) {\n var urlString = $toString(url);\n var baseState, failure, searchParams;\n if (isBase) {\n failure = this.parse(urlString);\n if (failure) throw TypeError(failure);\n this.searchParams = null;\n } else {\n if (base !== undefined) baseState = new URLState(base, true);\n failure = this.parse(urlString, null, baseState);\n if (failure) throw TypeError(failure);\n searchParams = getInternalSearchParamsState(new URLSearchParams());\n searchParams.bindURL(this);\n this.searchParams = searchParams;\n }\n};\n\nURLState.prototype = {\n type: 'URL',\n // https://url.spec.whatwg.org/#url-parsing\n // eslint-disable-next-line max-statements -- TODO\n parse: function (input, stateOverride, base) {\n var url = this;\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, chr, bufferCodePoints, failure;\n\n input = $toString(input);\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = replace(input, TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n chr = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (chr && exec(ALPHA, chr)) {\n buffer += toLowerCase(chr);\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) {\n buffer += toLowerCase(chr);\n } else if (chr == ':') {\n if (stateOverride && (\n (url.isSpecial() != hasOwn(specialSchemes, buffer)) ||\n (buffer == 'file' && (url.includesCredentials() || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (url.isSpecial() && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (url.isSpecial() && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (url.isSpecial()) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n push(url.path, '');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && chr != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && chr == '#') {\n url.scheme = base.scheme;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (chr == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (chr == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (chr == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = base.query;\n } else if (chr == '/' || (chr == '\\\\' && url.isSpecial())) {\n state = RELATIVE_SLASH;\n } else if (chr == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = arraySlice(base.path);\n url.path.length--;\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (url.isSpecial() && (chr == '/' || chr == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (chr == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (chr != '/' || charAt(buffer, pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (chr != '/' && chr != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (chr == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial())\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += chr;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (chr == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = url.parseHost(buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial())\n ) {\n if (url.isSpecial() && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) return;\n failure = url.parseHost(buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (chr == '[') seenBracket = true;\n else if (chr == ']') seenBracket = false;\n buffer += chr;\n } break;\n\n case PORT:\n if (exec(DIGIT, chr)) {\n buffer += chr;\n } else if (\n chr == EOF || chr == '/' || chr == '?' || chr == '#' ||\n (chr == '\\\\' && url.isSpecial()) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (chr == '/' || chr == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (chr == EOF) {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = base.query;\n } else if (chr == '?') {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {\n url.host = base.host;\n url.path = arraySlice(base.path);\n url.shortenPath();\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (chr == '/' || chr == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {\n if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (chr == EOF || chr == '/' || chr == '\\\\' || chr == '?' || chr == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = url.parseHost(buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += chr;\n break;\n\n case PATH_START:\n if (url.isSpecial()) {\n state = PATH;\n if (chr != '/' && chr != '\\\\') continue;\n } else if (!stateOverride && chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n state = PATH;\n if (chr != '/') continue;\n } break;\n\n case PATH:\n if (\n chr == EOF || chr == '/' ||\n (chr == '\\\\' && url.isSpecial()) ||\n (!stateOverride && (chr == '?' || chr == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n url.shortenPath();\n if (chr != '/' && !(chr == '\\\\' && url.isSpecial())) {\n push(url.path, '');\n }\n } else if (isSingleDot(buffer)) {\n if (chr != '/' && !(chr == '\\\\' && url.isSpecial())) {\n push(url.path, '');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter\n }\n push(url.path, buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n shift(url.path);\n }\n }\n if (chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(chr, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (chr == '?') {\n url.query = '';\n state = QUERY;\n } else if (chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && chr == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (chr != EOF) {\n if (chr == \"'\" && url.isSpecial()) url.query += '%27';\n else if (chr == '#') url.query += '%23';\n else url.query += percentEncode(chr, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (chr != EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n },\n // https://url.spec.whatwg.org/#host-parsing\n parseHost: function (input) {\n var result, codePoints, index;\n if (charAt(input, 0) == '[') {\n if (charAt(input, input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(stringSlice(input, 1, -1));\n if (!result) return INVALID_HOST;\n this.host = result;\n // opaque host\n } else if (!this.isSpecial()) {\n if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n this.host = result;\n } else {\n input = toASCII(input);\n if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n this.host = result;\n }\n },\n // https://url.spec.whatwg.org/#cannot-have-a-username-password-port\n cannotHaveUsernamePasswordPort: function () {\n return !this.host || this.cannotBeABaseURL || this.scheme == 'file';\n },\n // https://url.spec.whatwg.org/#include-credentials\n includesCredentials: function () {\n return this.username != '' || this.password != '';\n },\n // https://url.spec.whatwg.org/#is-special\n isSpecial: function () {\n return hasOwn(specialSchemes, this.scheme);\n },\n // https://url.spec.whatwg.org/#shorten-a-urls-path\n shortenPath: function () {\n var path = this.path;\n var pathSize = path.length;\n if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.length--;\n }\n },\n // https://url.spec.whatwg.org/#concept-url-serializer\n serialize: function () {\n var url = this;\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (url.includesCredentials()) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n },\n // https://url.spec.whatwg.org/#dom-url-href\n setHref: function (href) {\n var failure = this.parse(href);\n if (failure) throw TypeError(failure);\n this.searchParams.update();\n },\n // https://url.spec.whatwg.org/#dom-url-origin\n getOrigin: function () {\n var scheme = this.scheme;\n var port = this.port;\n if (scheme == 'blob') try {\n return new URLConstructor(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !this.isSpecial()) return 'null';\n return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : '');\n },\n // https://url.spec.whatwg.org/#dom-url-protocol\n getProtocol: function () {\n return this.scheme + ':';\n },\n setProtocol: function (protocol) {\n this.parse($toString(protocol) + ':', SCHEME_START);\n },\n // https://url.spec.whatwg.org/#dom-url-username\n getUsername: function () {\n return this.username;\n },\n setUsername: function (username) {\n var codePoints = arrayFrom($toString(username));\n if (this.cannotHaveUsernamePasswordPort()) return;\n this.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n },\n // https://url.spec.whatwg.org/#dom-url-password\n getPassword: function () {\n return this.password;\n },\n setPassword: function (password) {\n var codePoints = arrayFrom($toString(password));\n if (this.cannotHaveUsernamePasswordPort()) return;\n this.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n },\n // https://url.spec.whatwg.org/#dom-url-host\n getHost: function () {\n var host = this.host;\n var port = this.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n },\n setHost: function (host) {\n if (this.cannotBeABaseURL) return;\n this.parse(host, HOST);\n },\n // https://url.spec.whatwg.org/#dom-url-hostname\n getHostname: function () {\n var host = this.host;\n return host === null ? '' : serializeHost(host);\n },\n setHostname: function (hostname) {\n if (this.cannotBeABaseURL) return;\n this.parse(hostname, HOSTNAME);\n },\n // https://url.spec.whatwg.org/#dom-url-port\n getPort: function () {\n var port = this.port;\n return port === null ? '' : $toString(port);\n },\n setPort: function (port) {\n if (this.cannotHaveUsernamePasswordPort()) return;\n port = $toString(port);\n if (port == '') this.port = null;\n else this.parse(port, PORT);\n },\n // https://url.spec.whatwg.org/#dom-url-pathname\n getPathname: function () {\n var path = this.path;\n return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';\n },\n setPathname: function (pathname) {\n if (this.cannotBeABaseURL) return;\n this.path = [];\n this.parse(pathname, PATH_START);\n },\n // https://url.spec.whatwg.org/#dom-url-search\n getSearch: function () {\n var query = this.query;\n return query ? '?' + query : '';\n },\n setSearch: function (search) {\n search = $toString(search);\n if (search == '') {\n this.query = null;\n } else {\n if ('?' == charAt(search, 0)) search = stringSlice(search, 1);\n this.query = '';\n this.parse(search, QUERY);\n }\n this.searchParams.update();\n },\n // https://url.spec.whatwg.org/#dom-url-searchparams\n getSearchParams: function () {\n return this.searchParams.facade;\n },\n // https://url.spec.whatwg.org/#dom-url-hash\n getHash: function () {\n var fragment = this.fragment;\n return fragment ? '#' + fragment : '';\n },\n setHash: function (hash) {\n hash = $toString(hash);\n if (hash == '') {\n this.fragment = null;\n return;\n }\n if ('#' == charAt(hash, 0)) hash = stringSlice(hash, 1);\n this.fragment = '';\n this.parse(hash, FRAGMENT);\n },\n update: function () {\n this.query = this.searchParams.serialize() || null;\n }\n};\n\n// `URL` constructor\n// https://url.spec.whatwg.org/#url-class\nvar URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLPrototype);\n var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined;\n var state = setInternalState(that, new URLState(url, false, base));\n if (!DESCRIPTORS) {\n that.href = state.serialize();\n that.origin = state.getOrigin();\n that.protocol = state.getProtocol();\n that.username = state.getUsername();\n that.password = state.getPassword();\n that.host = state.getHost();\n that.hostname = state.getHostname();\n that.port = state.getPort();\n that.pathname = state.getPathname();\n that.search = state.getSearch();\n that.searchParams = state.getSearchParams();\n that.hash = state.getHash();\n }\n};\n\nvar URLPrototype = URLConstructor.prototype;\n\nvar accessorDescriptor = function (getter, setter) {\n return {\n get: function () {\n return getInternalURLState(this)[getter]();\n },\n set: setter && function (value) {\n return getInternalURLState(this)[setter](value);\n },\n configurable: true,\n enumerable: true\n };\n};\n\nif (DESCRIPTORS) {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref'));\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin'));\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol'));\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername'));\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword'));\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost'));\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname'));\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort'));\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname'));\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch'));\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams'));\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash'));\n}\n\n// `URL.prototype.toJSON` method\n// https://url.spec.whatwg.org/#dom-url-tojson\ndefineBuiltIn(URLPrototype, 'toJSON', function toJSON() {\n return getInternalURLState(this).serialize();\n}, { enumerable: true });\n\n// `URL.prototype.toString` method\n// https://url.spec.whatwg.org/#URL-stringification-behavior\ndefineBuiltIn(URLPrototype, 'toString', function toString() {\n return getInternalURLState(this).serialize();\n}, { enumerable: true });\n\nif (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n if (nativeCreateObjectURL) defineBuiltIn(URLConstructor, 'createObjectURL', bind(nativeCreateObjectURL, NativeURL));\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n if (nativeRevokeObjectURL) defineBuiltIn(URLConstructor, 'revokeObjectURL', bind(nativeRevokeObjectURL, NativeURL));\n}\n\nsetToStringTag(URLConstructor, 'URL');\n\n$({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {\n URL: URLConstructor\n});\n","// TODO: Remove this module from `core-js@4` since it's replaced to module below\nrequire('../modules/web.url.constructor');\n"],"names":["super_","UrlPlugin","options","arguments","length","undefined","_classCallCheck","this","bookReaderOptions","urlSchema","name","position","default","deprecated_for","urlState","urlMode","urlHistoryBasePath","urlLocationPollId","oldLocationHash","oldUserHash","key","value","_this","searchParams","URLSearchParams","pathParams","Object","keys","forEach","_schema","_schema2","_schema3","_schema4","schema","find","schemaKey","append","strPathParams","filter","s","map","concat","encodeURIComponent","join","strStrippedTrailingSlash","replace","concatenatedPath","toString","urlString","urlPath","URL","urlSearchParamsObj","fromEntries","entries","splitUrlMatches","pathname","match","urlStrSplitSlashObj","x","split","doesKeyExists","_object","_key","some","hasPropertyKey","hasDeprecatedKey","urlStateParam","decodeURIComponent","_ref","_ref2","pushToAddressBar","urlStrPath","urlStateToUrlString","window","history","replaceState","newUrlPath","trim","e","location","_this2","hash","substr","clearInterval","setInterval","newFragment","urlStringToUrlState","path","search","extend","BookReader","defaultOptions","enableUrlPlugin","bookId","defaults","updateWindowTitle","urlTrackedParams","urlTrackIndex0","prototype","setup","call","locationPollId","init","bind","eventNames","PostInit","_this$options","document","title","shortTitle","bookTitle","urlStartLocationPolling","fragmentChange","urlUpdateFragment","maximumCharacters","urlReadFragment","params","paramsFromFragment","updateParams","updateFromParams","trigger","stop","animating","autoStop","animationFinishedCallback","allParams","paramsFromCurrent","_this$options2","index","page","reduce","validParams","paramName","fragmentFromParams","currFragment","currQueryString","getLocationSearch","newQueryString","queryStringFromParams","baseWithoutSlash","newFragmentWithSlash","newQueryStringSearch","urlParamsFiltersOnlySearch","readQueryString","url","has","q","get","_this$options3","urlReadHashFragment","BookreaderUrlPlugin","_BookReader","_inherits","_super","apply","_this3","urlPlugin","listenForHashChanges","_get","_getPrototypeOf","makeBuiltIn","defineProperty","module","exports","target","descriptor","getter","set","setter","f","uncurryThis","maxInt","regexNonASCII","regexSeparators","OVERFLOW_ERROR","$RangeError","RangeError","exec","floor","Math","fromCharCode","String","charCodeAt","push","toLowerCase","digitToBasic","digit","adapt","delta","numPoints","firstTime","k","baseMinusTMin","base","encode","input","output","string","counter","extra","ucs2decode","i","currentValue","inputLength","n","bias","basicLength","handledCPCount","m","handledCPCountPlusOne","t","qMinusT","baseMinusT","label","encoded","labels","PROPER_FUNCTION_NAME","fails","whitespaces","METHOD_NAME","$","$entries","stat","O","iterate","createProperty","iterable","obj","v","AS_ENTRIES","$trim","proto","forced","forcedStringTrimMethod","EOF","DESCRIPTORS","USE_NATIVE_URL","global","defineBuiltIn","defineBuiltInAccessor","anInstance","hasOwn","assign","arrayFrom","arraySlice","codeAt","toASCII","$toString","setToStringTag","validateArgumentsLength","URLSearchParamsModule","InternalStateModule","setInternalState","getInternalURLState","getterFor","getInternalSearchParamsState","getState","NativeURL","TypeError","parseInt","pow","charAt","numberToString","pop","shift","stringSlice","slice","unshift","INVALID_SCHEME","INVALID_HOST","INVALID_PORT","ALPHA","ALPHANUMERIC","DIGIT","HEX_START","OCT","DEC","HEX","FORBIDDEN_HOST_CODE_POINT","FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT","LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE","TAB_AND_NEW_LINE","serializeHost","host","result","compress","ignore0","ipv6","maxIndex","maxLength","currStart","currLength","findLongestZeroSequence","C0ControlPercentEncodeSet","fragmentPercentEncodeSet","pathPercentEncodeSet","userinfoPercentEncodeSet","percentEncode","chr","code","specialSchemes","ftp","file","http","https","ws","wss","isWindowsDriveLetter","normalized","second","startsWithWindowsDriveLetter","third","isSingleDot","segment","SCHEME_START","SCHEME","NO_SCHEME","SPECIAL_RELATIVE_OR_AUTHORITY","PATH_OR_AUTHORITY","RELATIVE","RELATIVE_SLASH","SPECIAL_AUTHORITY_SLASHES","SPECIAL_AUTHORITY_IGNORE_SLASHES","AUTHORITY","HOST","HOSTNAME","PORT","FILE","FILE_SLASH","FILE_HOST","PATH_START","PATH","CANNOT_BE_A_BASE_URL_PATH","QUERY","FRAGMENT","URLState","isBase","baseState","failure","parse","bindURL","type","stateOverride","codePoints","bufferCodePoints","state","pointer","buffer","seenAt","seenBracket","seenPasswordToken","scheme","username","password","port","query","fragment","cannotBeABaseURL","isSpecial","includesCredentials","codePoint","encodedCodePoints","parseHost","shortenPath","numbersSeen","ipv4Piece","number","swaps","swap","address","pieceIndex","parseIPv6","partsLength","numbers","part","radix","ipv4","parts","parseIPv4","cannotHaveUsernamePasswordPort","pathSize","serialize","setHref","href","update","getOrigin","URLConstructor","origin","error","getProtocol","setProtocol","protocol","getUsername","setUsername","getPassword","setPassword","getHost","setHost","getHostname","setHostname","hostname","getPort","setPort","getPathname","setPathname","getSearch","setSearch","getSearchParams","facade","getHash","setHash","that","URLPrototype","accessorDescriptor","configurable","enumerable","nativeCreateObjectURL","createObjectURL","nativeRevokeObjectURL","revokeObjectURL","constructor","sham"],"sourceRoot":""}
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 5.0.0-71
2
+ - Dev: update jest monorepo @renovate
3
+ - Fix: Share & Mutliple View menu panel refactor @iisa
4
+
5
+ # 5.0.0-70
6
+ - Feature: Remember ReadAloud voice selection @sbwhitt
7
+ - Fix: Support page numbers that require url encoding @cdrini
8
+
1
9
  # 5.0.0-69
2
10
  - Fix: Handle ppi incorrectly set to one @cdrini
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-70-a3",
3
+ "version": "5.0.0-71",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "@babel/plugin-proposal-decorators": "7.22.7",
47
47
  "@babel/preset-env": "7.22.9",
48
48
  "@open-wc/testing-helpers": "^2.3.0",
49
- "@types/jest": "29.5.4",
49
+ "@types/jest": "29.5.5",
50
50
  "@webcomponents/webcomponentsjs": "^2.6.0",
51
51
  "babel-loader": "9.1.3",
52
52
  "codecov": "^3.8.3",
@@ -59,8 +59,8 @@
59
59
  "http-server": "14.1.1",
60
60
  "interactjs": "^1.10.18",
61
61
  "iso-language-codes": "1.1.0",
62
- "jest": "29.6.4",
63
- "jest-environment-jsdom": "^29.6.4",
62
+ "jest": "29.7.0",
63
+ "jest-environment-jsdom": "^29.7.0",
64
64
  "jquery": "3.6.1",
65
65
  "jquery-colorbox": "1.6.4",
66
66
  "jquery-ui": "1.12.1",
package/src/BookReader.js CHANGED
@@ -1788,7 +1788,7 @@ BookReader.prototype.paramsFromFragment = function(fragment) {
1788
1788
  // Index and page
1789
1789
  if ('undefined' != typeof(urlHash['page'])) {
1790
1790
  // page was set -- may not be int
1791
- params.page = urlHash['page'];
1791
+ params.page = decodeURIComponent(urlHash['page']);
1792
1792
  }
1793
1793
 
1794
1794
  // $$$ process /region
@@ -1820,11 +1820,10 @@ BookReader.prototype.paramsFromFragment = function(fragment) {
1820
1820
  * @return {string}
1821
1821
  */
1822
1822
  BookReader.prototype.fragmentFromParams = function(params, urlMode = 'hash') {
1823
- const separator = '/';
1824
1823
  const fragments = [];
1825
1824
 
1826
1825
  if ('undefined' != typeof(params.page)) {
1827
- fragments.push('page', params.page);
1826
+ fragments.push('page', encodeURIComponent(params.page));
1828
1827
  } else {
1829
1828
  if ('undefined' != typeof(params.index)) {
1830
1829
  // Don't have page numbering but we do have the index
@@ -1850,10 +1849,10 @@ BookReader.prototype.fragmentFromParams = function(params, urlMode = 'hash') {
1850
1849
 
1851
1850
  // search
1852
1851
  if (params.search && urlMode === 'hash') {
1853
- fragments.push('search', params.search);
1852
+ fragments.push('search', utils.encodeURIComponentPlus(params.search));
1854
1853
  }
1855
1854
 
1856
- return utils.encodeURIComponentPlus(fragments.join(separator)).replace(/%2F/g, '/');
1855
+ return fragments.join('/');
1857
1856
  };
1858
1857
 
1859
1858
  /**